blob: afe457e484b532a6c4be7154d39b8f4861e0a633 [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 {
153 return FALSE;
154 }
155 for(i =0; i < pMac->lim.maxBssId; i++)
156 {
157
158 if(pMac->lim.gpSession[i].valid == TRUE)
159 {
160 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
161 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
162 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
163
164 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
165 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
166 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
167 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700168 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
169 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
170 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
171 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700172 ))
173 {
174 validState = FALSE;
175 break;
176 }
177
178 }
179 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530180 limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700181
182 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
183 return TRUE;
184
185 return FALSE;
186}
187
Jeff Johnson295189b2012-06-20 16:38:30 -0700188
189
190/**
191 * __limIsSmeAssocCnfValid()
192 *
193 *FUNCTION:
194 * This function is called by limProcessLmmMessages() upon
195 * receiving SME_ASSOC_CNF.
196 *
197 *LOGIC:
198 * Message validity checks are performed in this function
199 *
200 *ASSUMPTIONS:
201 *
202 *NOTE:
203 *
204 * @param pMeasReq Pointer to Received ASSOC_CNF message
205 * @return true When received SME_ASSOC_CNF is formatted
206 * correctly
207 * false otherwise
208 */
209
210inline static tANI_U8
211__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
212{
213 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
214 return false;
215 else
216 return true;
217} /*** end __limIsSmeAssocCnfValid() ***/
218
219
220/**
221 * __limGetSmeJoinReqSizeForAlloc()
222 *
223 *FUNCTION:
224 * This function is called in various places to get IE length
225 * from tSirBssDescription structure
226 * number being scanned.
227 *
228 *PARAMS:
229 *
230 *LOGIC:
231 *
232 *ASSUMPTIONS:
233 * NA
234 *
235 *NOTE:
236 * NA
237 *
238 * @param pBssDescr
239 * @return Total IE length
240 */
241
242static tANI_U16
243__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
244{
245 tANI_U16 len = 0;
246
247 if (!pBuf)
248 return len;
249
250 pBuf += sizeof(tANI_U16);
251 len = limGetU16( pBuf );
252 return (len + sizeof( tANI_U16 ));
253} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
254
255
256/**----------------------------------------------------------------
257\fn __limIsDeferedMsgForLearn
258
259\brief Has role only if 11h is enabled. Not used on STA side.
260 Defers the message if SME is in learn state and brings
261 the LIM back to normal mode.
262
263\param pMac
264\param pMsg - Pointer to message posted from SME to LIM.
265\return TRUE - If defered
266 FALSE - Otherwise
267------------------------------------------------------------------*/
268static tANI_BOOLEAN
269__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
270{
271 if (limIsSystemInScanState(pMac))
272 {
273 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
274 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700275 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700276 return eANI_BOOLEAN_FALSE;
277 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700278 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700279 pMsg->type);)
280
281 /** Send finish scan req to HAL only if LIM is not waiting for any response
282 * from HAL like init scan rsp, start scan rsp etc.
283 */
284 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
285 {
286 //Set the resume channel to Any valid channel (invalid).
287 //This will instruct HAL to set it to any previous valid channel.
288 peSetResumeChannel(pMac, 0, 0);
289 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
290 }
291
292 return eANI_BOOLEAN_TRUE;
293 }
294 return eANI_BOOLEAN_FALSE;
295}
296
297/**----------------------------------------------------------------
298\fn __limIsDeferedMsgForRadar
299
300\brief Has role only if 11h is enabled. Not used on STA side.
301 Defers the message if radar is detected.
302
303\param pMac
304\param pMsg - Pointer to message posted from SME to LIM.
305\return TRUE - If defered
306 FALSE - Otherwise
307------------------------------------------------------------------*/
308static tANI_BOOLEAN
309__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
310{
311 /** fRadarDetCurOperChan will be set only if we detect radar in current
312 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700313 //TODO: Need to take care radar detection.
314 //if (LIM_IS_RADAR_DETECTED(pMac))
315 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700316 {
317 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
318 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700319 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700320 return eANI_BOOLEAN_FALSE;
321 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700322 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 pMsg->type);)
324 return eANI_BOOLEAN_TRUE;
325 }
326 return eANI_BOOLEAN_FALSE;
327}
328
329
330/**
331 * __limProcessSmeStartReq()
332 *
333 *FUNCTION:
334 * This function is called to process SME_START_REQ message
335 * from HDD or upper layer application.
336 *
337 *LOGIC:
338 *
339 *ASSUMPTIONS:
340 *
341 *NOTE:
342 *
343 * @param pMac Pointer to Global MAC structure
344 * @param *pMsgBuf A pointer to the SME message buffer
345 * @return None
346 */
347
348static void
349__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
350{
351 tSirResultCodes retCode = eSIR_SME_SUCCESS;
352 tANI_U8 smesessionId;
353 tANI_U16 smetransactionId;
354
355
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530356 limLog(pMac, LOG1, FL("Received SME_START_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700357
358 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
359
360 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
361 {
362 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
363
Jeff Johnsone7245742012-09-05 17:12:55 -0700364 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700365
366 /// By default do not return after first scan match
367 pMac->lim.gLimReturnAfterFirstMatch = 0;
368
369 /// Initialize MLM state machine
370 limInitMlm(pMac);
371
372 /// By default return unique scan results
373 pMac->lim.gLimReturnUniqueResults = true;
374 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700375#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
376 pMac->lim.gLimSmeLfrScanResultLength = 0;
377#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700378
Jeff Johnson295189b2012-06-20 16:38:30 -0700379 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
380 {
381 /*
382 * Need to indicate new BSSs found during background scanning to
383 * host. Update this parameter at CFG
384 */
385 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
386 != eSIR_SUCCESS)
387 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700388 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700389 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
390 }
391 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700392 }
393 else
394 {
395 /**
396 * Should not have received eWNI_SME_START_REQ in states
397 * other than OFFLINE. Return response to host and
398 * log error
399 */
Sushant Kaushik1b645382014-10-13 16:39:36 +0530400 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %d"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
402 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
403 }
404 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
405} /*** end __limProcessSmeStartReq() ***/
406
407
408/** -------------------------------------------------------------
409\fn __limProcessSmeSysReadyInd
410\brief handles the notification from HDD. PE just forwards this message to HAL.
411\param tpAniSirGlobal pMac
412\param tANI_U32* pMsgBuf
413\return TRUE-Posting to HAL failed, so PE will consume the buffer.
414\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
415 -------------------------------------------------------------*/
416static tANI_BOOLEAN
417__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
418{
419 tSirMsgQ msg;
420
421 msg.type = WDA_SYS_READY_IND;
422 msg.reserved = 0;
423 msg.bodyptr = pMsgBuf;
424 msg.bodyval = 0;
425
Jeff Johnson92751692013-03-06 16:00:33 -0800426 if (pMac->gDriverType != eDRIVER_TYPE_MFG)
Jeff Johnson295189b2012-06-20 16:38:30 -0700427 {
Jeff Johnson92751692013-03-06 16:00:33 -0800428 peRegisterTLHandle(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700429 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700430 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700431 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700432
Jeff Johnson92751692013-03-06 16:00:33 -0800433 if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700435 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 return eANI_BOOLEAN_TRUE;
437 }
438 return eANI_BOOLEAN_FALSE;
439}
440
Jeff Johnsone7245742012-09-05 17:12:55 -0700441#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700442
Jeff Johnsone7245742012-09-05 17:12:55 -0700443tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
444{
445 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
446 {
447 switch(secondaryChanOffset)
448 {
449 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
450 return primarychanNum;
451 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
452 return primarychanNum + 2;
453 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
454 return primarychanNum - 2;
455 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
456 return primarychanNum + 6;
457 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
458 return primarychanNum + 2;
459 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
460 return primarychanNum - 2;
461 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
462 return primarychanNum - 6;
463 default :
464 return eSIR_CFG_INVALID_ID;
465 }
466 }
467 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
468 {
469 switch(secondaryChanOffset)
470 {
471 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
472 return primarychanNum + 2;
473 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
474 return primarychanNum - 2;
475 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
476 return primarychanNum;
477 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
478 return primarychanNum + 2;
479 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
480 return primarychanNum - 2;
481 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
482 return primarychanNum + 2;
483 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
484 return primarychanNum - 2;
485 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
486 return primarychanNum + 2;
487 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
488 return primarychanNum - 2;
489 default :
490 return eSIR_CFG_INVALID_ID;
491 }
492 }
493 return primarychanNum;
494}
495
496#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700497/**
498 * __limHandleSmeStartBssRequest()
499 *
500 *FUNCTION:
501 * This function is called to process SME_START_BSS_REQ message
502 * from HDD or upper layer application.
503 *
504 *LOGIC:
505 *
506 *ASSUMPTIONS:
507 *
508 *NOTE:
509 *
510 * @param pMac Pointer to Global MAC structure
511 * @param *pMsgBuf A pointer to the SME message buffer
512 * @return None
513 */
514
515static void
516__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
517{
518 tANI_U16 size;
519 tANI_U32 val = 0;
520 tSirRetStatus retStatus;
521 tSirMacChanNum channelNumber;
Jeff Johnsonace91102013-04-05 08:03:18 -0700522 tLimMlmStartReq *pMlmStartReq = NULL;
523 tpSirSmeStartBssReq pSmeStartBssReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 tSirResultCodes retCode = eSIR_SME_SUCCESS;
525 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700526 tANI_U8 sessionId;
527 tpPESession psessionEntry = NULL;
528 tANI_U8 smesessionId;
529 tANI_U16 smetransactionId;
530
531#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
532 //Since the session is not created yet, sending NULL. The response should have the correct state.
533 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
534#endif //FEATURE_WLAN_DIAG_SUPPORT
535
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530536 limLog(pMac, LOG1, FL("Received SME_START_BSS_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700537
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530538 /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */
Jeff Johnson295189b2012-06-20 16:38:30 -0700539 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
540 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
541 {
542 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
543
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530544 pSmeStartBssReq = vos_mem_malloc(size);
545 if ( NULL == pSmeStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530547 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pMac->lim.gpLimStartBssReq"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 /// Send failure response to host
549 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
550 goto end;
551 }
552
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530553 vos_mem_set((void *)pSmeStartBssReq, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700554
555 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
556 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
557 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700558 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 retCode = eSIR_SME_INVALID_PARAMETERS;
560 goto free;
561 }
562#if 0
563 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700564 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700565 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
566#endif
567
568 /* This is the place where PE is going to create a session.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530569 * If session is not existed, then create a new session */
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
571 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700572 limLog(pMac, LOGW, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700573 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
574 psessionEntry = NULL;
575 goto free;
576 }
577 else
578 {
579 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
580 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700581 limLog(pMac, LOGW, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
583 goto free;
584 }
585
586 }
587
588 /* Store the session related parameters in newly created session */
589 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
590
591 /* Store PE sessionId in session Table */
592 psessionEntry->peSessionId = sessionId;
593
594 /* Store SME session Id in sessionTable */
595 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
596
597 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
598
599 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
600
601 /* Copy SSID to session table */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530602 vos_mem_copy( (tANI_U8 *)&psessionEntry->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700603 (tANI_U8 *)&pSmeStartBssReq->ssId,
604 (pSmeStartBssReq->ssId.length + 1));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530605
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 psessionEntry->bssType = pSmeStartBssReq->bssType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530607
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 psessionEntry->nwType = pSmeStartBssReq->nwType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530609
Jeff Johnson295189b2012-06-20 16:38:30 -0700610 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
611
612 /* Store the channel number in session Table */
613 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
614
615 /*Store Persona */
616 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700617 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 psessionEntry->pePersona);
619
620 /*Update the phymode*/
621 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
622
623 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
624 psessionEntry->currentOperChannel );
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530625
626#ifdef WLAN_FEATURE_AP_HT40_24G
627 /*Store Overlapping BSS Scan Parameters IEs to session table */
628 if (pSmeStartBssReq->apHT40_24GEnabled)
629 {
630 limInitOBSSScanParams(pMac, psessionEntry);
631 }
632#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 /* Store the dot 11 mode in to the session Table*/
634
635 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700636 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
637#ifdef WLAN_FEATURE_11AC
638 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700639 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
640 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700641#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800642
643 psessionEntry->txLdpcIniFeatureEnabled =
644 pSmeStartBssReq->txLdpcIniFeatureEnabled;
645
Chet Lanctot8cecea22014-02-11 19:09:36 -0800646#ifdef WLAN_FEATURE_11W
647 psessionEntry->limRmfEnabled = pSmeStartBssReq->pmfCapable ? 1 : 0;
648 limLog(pMac, LOG1, FL("Session RMF enabled: %d"), psessionEntry->limRmfEnabled);
649#endif
650
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530651 vos_mem_copy((void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 (void*)&pSmeStartBssReq->operationalRateSet,
653 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530654 vos_mem_copy((void*)&psessionEntry->extRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700655 (void*)&pSmeStartBssReq->extendedRateSet,
656 sizeof(tSirMacRateSet));
657
658 switch(pSmeStartBssReq->bssType)
659 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 case eSIR_INFRA_AP_MODE:
661 psessionEntry->limSystemRole = eLIM_AP_ROLE;
662 psessionEntry->privacy = pSmeStartBssReq->privacy;
663 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
664 psessionEntry->authType = pSmeStartBssReq->authType;
665 /* Store the DTIM period */
666 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
667 /*Enable/disable UAPSD*/
668 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
669 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
670 {
671 psessionEntry->proxyProbeRspEn = 0;
672 }
673 else
674 {
675 /* To detect PBC overlap in SAP WPS mode, Host handles
676 * Probe Requests.
677 */
678 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
679 {
680 psessionEntry->proxyProbeRspEn = 1;
681 }
682 else
683 {
684 psessionEntry->proxyProbeRspEn = 0;
685 }
686 }
687 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
688 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
krunal soni45b9eb62014-03-26 12:54:25 -0700689 limGetShortSlotFromPhyMode(pMac, psessionEntry,
690 psessionEntry->gLimPhyMode,
691 &psessionEntry->shortSlotTimeSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700693 case eSIR_IBSS_MODE:
694 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
krunal soni45b9eb62014-03-26 12:54:25 -0700695 limGetShortSlotFromPhyMode(pMac, psessionEntry,
696 psessionEntry->gLimPhyMode,
697 &psessionEntry->shortSlotTimeSupported);
Abhishek Singhd5c31272014-03-07 14:46:50 +0530698 /* In WPA-NONE case we wont get the privacy bit in ibss config
699 * from supplicant, but we are updating WNI_CFG_PRIVACY_ENABLED
700 * on basis of Encryption type in csrRoamSetBssConfigCfg. So
701 * get the privacy info from WNI_CFG_PRIVACY_ENABLED
702 */
703 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &val)
704 != eSIR_SUCCESS)
705 limLog(pMac, LOGE, FL("cfg get WNI_CFG_PRIVACY_ENABLED"
706 " failed"));
707 psessionEntry->privacy =(tANI_U8) val;
krunal sonie9002db2013-11-25 14:24:17 -0800708 psessionEntry->isCoalesingInIBSSAllowed =
709 pSmeStartBssReq->isCoalesingInIBSSAllowed;
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 break;
711
712 case eSIR_BTAMP_AP_MODE:
713 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
714 break;
715
716 case eSIR_BTAMP_STA_MODE:
717 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
718 break;
719
720 /* There is one more mode called auto mode. which is used no where */
721
722 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
723
724
725 default:
726 //not used anywhere...used in scan function
727 break;
728 }
729
730 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
731 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700733 )
734 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530735 psessionEntry->parsedAssocReq = vos_mem_malloc(
736 psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq));
737 if ( NULL == psessionEntry->parsedAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530739 limLog(pMac, LOGW, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
741 goto free;
742 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530743 vos_mem_set(psessionEntry->parsedAssocReq,
744 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)),
745 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 }
747
748 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
749 if (pSmeStartBssReq->channelId)
750 {
751 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700752 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
753 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
754 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700755 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700756 FL("cbMode %u"), pSmeStartBssReq->cbMode);
757#ifdef WLAN_FEATURE_11AC
758 if(psessionEntry->vhtCapability)
759 {
760 tANI_U32 centerChan;
761 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700762
Jeff Johnsone7245742012-09-05 17:12:55 -0700763 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
764 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700765 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700766 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700767 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700768 }
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530769
Abhishek Singh921926b2014-02-13 17:21:01 +0530770 if(channelNumber <= RF_CHAN_14 &&
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530771 chanWidth != eHT_CHANNEL_WIDTH_20MHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -0700772 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530773 chanWidth = eHT_CHANNEL_WIDTH_20MHZ;
Abhishek Singh921926b2014-02-13 17:21:01 +0530774 limLog(pMac, LOG1, FL("Setting chanWidth to 20Mhz for"
775 " channel %d"),channelNumber);
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700777
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530778 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ ||
779 chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
Abhishek Singh921926b2014-02-13 17:21:01 +0530780 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530781 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
782 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
783 != eSIR_SUCCESS)
784 {
785 limLog(pMac, LOGP, FL("could not set "
786 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
787 retCode = eSIR_LOGP_EXCEPTION;
788 goto free;
789 }
790 }
791 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
792 {
793 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
794 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
795 != eSIR_SUCCESS)
796 {
797 limLog(pMac, LOGP, FL("could not set "
798 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
799 retCode = eSIR_LOGP_EXCEPTION;
800 goto free;
801 }
802
803 centerChan = limGetCenterChannel( pMac, channelNumber,
804 pSmeStartBssReq->cbMode,
805 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
Jeff Johnsone7245742012-09-05 17:12:55 -0700806 if(centerChan != eSIR_CFG_INVALID_ID)
807 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530808 limLog(pMac, LOGW, FL("***Center Channel for "
809 "80MHZ channel width = %d"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700810 psessionEntry->apCenterChan = centerChan;
Abhishek Singh921926b2014-02-13 17:21:01 +0530811 if (cfgSetInt(pMac,
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530812 WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
813 centerChan) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -0700814 {
Abhishek Singh921926b2014-02-13 17:21:01 +0530815 limLog(pMac, LOGP, FL("could not set "
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530816 "WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700817 retCode = eSIR_LOGP_EXCEPTION;
818 goto free;
819 }
820 }
821 }
822
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530823 /* All the translation is done by now for gVhtChannelWidth
824 * from .ini file to the actual values as defined in spec.
825 * So, grabing the spec value which is
826 * updated in .dat file by the above logic */
827 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
828 &chanWidth) != eSIR_SUCCESS)
829 {
830 limLog(pMac, LOGP,
831 FL("Unable to retrieve Channel Width from CFG"));
832 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700833 /*For Sta+p2p-Go concurrency
834 vhtTxChannelWidthSet is used for storing p2p-GO channel width
835 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
836 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
837 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700838 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700839 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700840 }
841 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
842#endif
843 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700844 else
845 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700846 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 retCode = eSIR_SME_INVALID_PARAMETERS;
848 goto free;
849 }
850
851 // Delete pre-auth list if any
852 limDeletePreAuthList(pMac);
853
854 // Delete IBSS peer BSSdescription list if any
855 //limIbssDelete(pMac); sep 26 review
856
857
858
859#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
860 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700861 limInitMlm(pMac);
862#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700863
Jeff Johnsone7245742012-09-05 17:12:55 -0700864 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700865
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 /* keep the RSN/WPA IE information in PE Session Entry
867 * later will be using this to check when received (Re)Assoc req
868 * */
869 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
870
Jeff Johnson295189b2012-06-20 16:38:30 -0700871
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 //Taken care for only softAP case rest need to be done
873 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
874 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
875 /*each byte will have the following info
876 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
877 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530878 vos_mem_copy( (void *) &psessionEntry->cfgProtection,
Jeff Johnson295189b2012-06-20 16:38:30 -0700879 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700880 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700881 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
882 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700883
884 // Prepare and Issue LIM_MLM_START_REQ to MLM
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530885 pMlmStartReq = vos_mem_malloc(sizeof(tLimMlmStartReq));
886 if ( NULL == pMlmStartReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530888 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
890 goto free;
891 }
892
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530893 vos_mem_set((void *) pMlmStartReq, sizeof(tLimMlmStartReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700894
895 /* Copy SSID to the MLM start structure */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530896 vos_mem_copy( (tANI_U8 *) &pMlmStartReq->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 (tANI_U8 *) &pSmeStartBssReq->ssId,
898 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
900 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700901
902
903 pMlmStartReq->bssType = psessionEntry->bssType;
904
905 /* Fill PE session Id from the session Table */
906 pMlmStartReq->sessionId = psessionEntry->peSessionId;
907
908 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700909 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700910 )
911 {
912 //len = sizeof(tSirMacAddr);
913 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
914 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700915 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700916
917 /* Copy the BSSId from sessionTable to mlmStartReq struct */
918 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
919 }
920
921 else // ibss mode
922 {
923 pMac->lim.gLimIbssCoalescingHappened = false;
924
925 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
926 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700927 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700928 retCode = eSIR_LOGP_EXCEPTION;
929 goto free;
930 }
931
932 if(!autoGenBssId)
933 {
934 // We're not auto generating BSSID. Instead, get it from session entry
935 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
936
937 if(pMlmStartReq->bssId[0] & 0x01)
938 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700939 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700940 autoGenBssId = TRUE;
941 }
942 }
943
944 if( autoGenBssId )
945 { //if BSSID is not any uc id. then use locally generated BSSID.
946 //Autogenerate the BSSID
947 limGetRandomBssid( pMac, pMlmStartReq->bssId);
948 pMlmStartReq->bssId[0]= 0x02;
949
950 /* Copy randomly generated BSSID to the session Table */
951 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
952 }
953 }
954 /* store the channel num in mlmstart req structure */
955 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
956 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
957 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
958
Jeff Johnson295189b2012-06-20 16:38:30 -0700959 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
960 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
961 pMlmStartReq->wps_state = psessionEntry->wps_state;
962
963 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700964 {
965 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700966 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700967 pMlmStartReq->dtimPeriod = (tANI_U8)val;
968 }
969
970 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700971 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700972 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
973
974 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700975 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
977
978 //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 +0530979 vos_mem_copy((void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700980 sizeof(tSirMacRateSet));
981
Jeff Johnson295189b2012-06-20 16:38:30 -0700982 // Now populate the 11n related parameters
983 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700984 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700985 //
986 // FIXME_GEN4 - Determine the appropriate defaults...
987 //
988 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
989 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700990 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700991
992 /* sep26 review */
993 psessionEntry->limRFBand = limGetRFBand(channelNumber);
994
995 // Initialize 11h Enable Flag
996 psessionEntry->lim11hEnable = 0;
997 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
998 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
999 {
1000 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001001 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001002 psessionEntry->lim11hEnable = val;
1003 }
1004
1005 if (!psessionEntry->lim11hEnable)
1006 {
1007 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != 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 }
1010
Jeff Johnson295189b2012-06-20 16:38:30 -07001011 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
1012 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001013 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001014
1015 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
1016 return;
1017 }
1018 else
1019 {
1020
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001021 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001022 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
1023 goto end;
1024 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
1025
1026free:
Jeff Johnsonace91102013-04-05 08:03:18 -07001027 if ((psessionEntry != NULL) &&
1028 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
1029 {
1030 psessionEntry->pLimStartBssReq = NULL;
1031 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301032 vos_mem_free( pSmeStartBssReq);
1033 vos_mem_free( pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001034
1035end:
1036
1037 /* This routine should return the sme sessionId and SME transaction Id */
1038 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1039
1040 if(NULL != psessionEntry)
1041 {
1042 peDeleteSession(pMac,psessionEntry);
1043 psessionEntry = NULL;
1044 }
1045 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
1046} /*** end __limHandleSmeStartBssRequest() ***/
1047
1048
1049/**--------------------------------------------------------------
1050\fn __limProcessSmeStartBssReq
1051
1052\brief Wrapper for the function __limHandleSmeStartBssRequest
1053 This message will be defered until softmac come out of
1054 scan mode or if we have detected radar on the current
1055 operating channel.
1056\param pMac
1057\param pMsg
1058
1059\return TRUE - If we consumed the buffer
1060 FALSE - If have defered the message.
1061 ---------------------------------------------------------------*/
1062static tANI_BOOLEAN
1063__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1064{
1065 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1066 __limIsDeferedMsgForRadar(pMac, pMsg))
1067 {
1068 /**
1069 * If message defered, buffer is not consumed yet.
1070 * So return false
1071 */
1072 return eANI_BOOLEAN_FALSE;
1073 }
1074
1075 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1076 return eANI_BOOLEAN_TRUE;
1077}
1078
1079
1080/**
1081 * limGetRandomBssid()
1082 *
1083 * FUNCTION:This function is called to process generate the random number for bssid
1084 * This function is called to process SME_SCAN_REQ message
1085 * from HDD or upper layer application.
1086 *
1087 * LOGIC:
1088 *
1089 * ASSUMPTIONS:
1090 *
1091 * NOTE:
1092 * 1. geneartes the unique random number for bssid in ibss
1093 *
1094 * @param pMac Pointer to Global MAC structure
1095 * @param *data Pointer to bssid buffer
1096 * @return None
1097 */
1098void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1099{
1100 tANI_U32 random[2] ;
1101 random[0] = tx_time_get();
1102 random[0] |= (random[0] << 15) ;
1103 random[1] = random[0] >> 1;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301104 vos_mem_copy( data, (tANI_U8*)random, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001105}
1106
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301107static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
1108 tpSirSmeScanReq pScanReq)
1109{
1110 tSirScanOffloadReq *pScanOffloadReq;
1111 tANI_U8 *p;
1112 tSirMsgQ msg;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301113 tANI_U16 i, len;
1114 tSirRetStatus rc = eSIR_SUCCESS;
1115
1116 /* The tSirScanOffloadReq will reserve the space for first channel,
1117 so allocate the memory for (numChannels - 1) and uIEFieldLen */
1118 len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
1119 pScanReq->uIEFieldLen;
1120
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301121 pScanOffloadReq = vos_mem_malloc(len);
1122 if ( NULL == pScanOffloadReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301123 {
1124 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301125 FL("AllocateMemory failed for pScanOffloadReq"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301126 return eHAL_STATUS_FAILURE;
1127 }
1128
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301129 vos_mem_set( (tANI_U8 *) pScanOffloadReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301130
1131 msg.type = WDA_START_SCAN_OFFLOAD_REQ;
1132 msg.bodyptr = pScanOffloadReq;
1133 msg.bodyval = 0;
1134
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301135 vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301136 (tANI_U8*) pScanReq->bssId,
1137 sizeof(tSirMacAddr));
1138
1139 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
1140 {
1141 limLog(pMac, LOGE,
1142 FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
Kiet Lamb1233192013-11-28 13:38:20 +05301143 vos_mem_free (pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301144 return eHAL_STATUS_FAILURE;
1145 }
1146
1147 pScanOffloadReq->numSsid = pScanReq->numSsid;
1148 for (i = 0; i < pScanOffloadReq->numSsid; i++)
1149 {
1150 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301151 vos_mem_copy((tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301152 (tANI_U8 *) pScanReq->ssId[i].ssId,
1153 pScanOffloadReq->ssId[i].length);
1154 }
1155
1156 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301157 vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301158 (tANI_U8 *) pScanReq->selfMacAddr,
1159 sizeof(tSirMacAddr));
1160 pScanOffloadReq->bssType = pScanReq->bssType;
1161 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1162 pScanOffloadReq->scanType = pScanReq->scanType;
1163 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1164 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1165 pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
1166 pScanOffloadReq->sessionId = pScanReq->sessionId;
1167 pScanOffloadReq->channelList.numChannels =
1168 pScanReq->channelList.numChannels;
1169 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1170 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1171 p[i] = pScanReq->channelList.channelNumber[i];
1172
1173 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1174 pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301175 vos_mem_copy((tANI_U8 *) p + i,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301176 (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
1177 pScanOffloadReq->uIEFieldLen);
1178
1179 rc = wdaPostCtrlMsg(pMac, &msg);
1180 if (rc != eSIR_SUCCESS)
1181 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001182 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301183 vos_mem_free(pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301184 return eHAL_STATUS_FAILURE;
1185 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301186 limLog(pMac, LOG1, FL("Processed Offload Scan Request Successfully"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301187
1188 return eHAL_STATUS_SUCCESS;
1189}
Jeff Johnson295189b2012-06-20 16:38:30 -07001190
1191/**
1192 * __limProcessSmeScanReq()
1193 *
1194 *FUNCTION:
1195 * This function is called to process SME_SCAN_REQ message
1196 * from HDD or upper layer application.
1197 *
1198 *LOGIC:
1199 *
1200 *ASSUMPTIONS:
1201 *
1202 *NOTE:
1203 * 1. Periodic scanning should be requesting to return unique
1204 * scan results.
1205 *
1206 * @param pMac Pointer to Global MAC structure
1207 * @param *pMsgBuf A pointer to the SME message buffer
1208 * @return None
1209 */
1210
Viral Modid440e682013-03-06 02:25:31 -08001211static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001212__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1213{
1214 tANI_U32 len;
1215 tLimMlmScanReq *pMlmScanReq;
1216 tpSirSmeScanReq pScanReq;
1217 tANI_U8 i = 0;
1218
1219#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1220 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1221#endif //FEATURE_WLAN_DIAG_SUPPORT
1222
1223 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301224 limLog(pMac, LOG1,FL("SME SCAN REQ numChan %d min %d max %d IELen %d"
1225 "first %d fresh %d unique %d type %s (%d)"
1226 " mode %s (%d)rsp %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001227 pScanReq->channelList.numChannels,
1228 pScanReq->minChannelTime,
1229 pScanReq->maxChannelTime,
1230 pScanReq->uIEFieldLen,
1231 pScanReq->returnAfterFirstMatch,
1232 pScanReq->returnFreshResults,
1233 pScanReq->returnUniqueResults,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301234 lim_ScanTypetoString(pScanReq->scanType),
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001235 pScanReq->scanType,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301236 lim_BackgroundScanModetoString(pScanReq->backgroundScanMode),
1237 pScanReq->backgroundScanMode, pMac->lim.gLimRspReqd ? 1 : 0);
Viral Modid86bde22012-12-10 13:09:21 -08001238
1239 /* Since scan req always requires a response, we will overwrite response required here.
1240 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1241 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1242 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1243 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1244 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1245 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1246 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1247 * the global flag gLimRspReqd to TRUE here.
1248 */
1249 pMac->lim.gLimRspReqd = TRUE;
1250
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301251 /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001252 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1253
1254 /* This routine should return the sme sessionId and SME transaction Id */
1255
1256 if (!limIsSmeScanReqValid(pMac, pScanReq))
1257 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301258 limLog(pMac, LOGE, FL("Received SME_SCAN_REQ with invalid parameters"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001259
1260 if (pMac->lim.gLimRspReqd)
1261 {
1262 pMac->lim.gLimRspReqd = false;
1263
1264 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1265
1266 } // if (pMac->lim.gLimRspReqd)
1267
1268 return;
1269 }
1270
1271 //if scan is disabled then return as invalid scan request.
1272 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1273 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1274 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301275 limLog(pMac, LOGE, FL("SCAN is disabled or SCAN in power save"
1276 " is disabled and system is in power save."));
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001277 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001278 return;
1279 }
1280
1281
1282 /**
1283 * If scan request is received in idle, joinFailed
1284 * states or in link established state (in STA role)
1285 * or in normal state (in STA-in-IBSS/AP role) with
1286 * 'return fresh scan results' request from HDD or
1287 * it is periodic background scanning request,
1288 * trigger fresh scan request to MLM
1289 */
1290 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1291 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301292 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1293 {
1294 // Discard previously cached scan results
1295 limReInitScanResults(pMac);
1296 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001297
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301298 pMac->lim.gLim24Band11dScanDone = 0;
1299 pMac->lim.gLim50Band11dScanDone = 0;
1300 pMac->lim.gLimReturnAfterFirstMatch =
1301 pScanReq->returnAfterFirstMatch;
1302 pMac->lim.gLimBackgroundScanMode =
1303 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001304
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301305 pMac->lim.gLimReturnUniqueResults =
1306 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1307 /* De-activate Heartbeat timers for connected sessions while
1308 * scan is in progress if the system is in Active mode *
1309 * AND it is not a ROAMING ("background") scan */
1310 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1311 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1312 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1313 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1314 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001315 for(i=0;i<pMac->lim.maxBssId;i++)
1316 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301317 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1318 (pMac->lim.gpSession[i].valid == TRUE) &&
1319 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1320 {
1321 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1322 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301324 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001325
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301326 if (pMac->fScanOffload)
1327 {
1328 if (eHAL_STATUS_SUCCESS !=
1329 limSendHalStartScanOffloadReq(pMac, pScanReq))
1330 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301331 limLog(pMac, LOGE, FL("Couldn't send Offload scan request"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301332 limSendSmeScanRsp(pMac,
1333 offsetof(tSirSmeScanRsp, bssDescription[0]),
1334 eSIR_SME_INVALID_PARAMETERS,
1335 pScanReq->sessionId,
1336 pScanReq->transactionId);
1337 return;
1338 }
1339 }
1340 else
1341 {
1342
1343 /*Change Global SME state */
1344 /* Store the previous SME state */
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301345 limLog(pMac, LOG1, FL("Non Offload SCAN request "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301346 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1347 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1348 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1349
1350 if (pScanReq->channelList.numChannels == 0)
1351 {
1352 tANI_U32 cfg_len;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301353
1354 limLog(pMac, LOG1,
1355 FL("Scan all channels as Number of channels is 0"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301356 // Scan all channels
1357 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001358 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1359 pScanReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301360 pMlmScanReq = vos_mem_malloc(len);
1361 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301362 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301363 // Log error
1364 limLog(pMac, LOGP,
1365 FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001366
Padma, Santhosh Kumar8fa85212015-02-18 12:24:56 +05301367 if (pMac->lim.gLimRspReqd)
1368 {
1369 pMac->lim.gLimRspReqd = false;
1370
1371 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1372 eSIR_SME_RESOURCES_UNAVAILABLE,
1373 pScanReq->sessionId,
1374 pScanReq->transactionId);
1375 }
1376
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301377 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301378 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001379
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301380 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301381 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001382
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301383 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1384 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001385 pMlmScanReq->channelList.channelNumber,
1386 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301387 {
1388 /**
1389 * Could not get Valid channel list from CFG.
1390 * Log error.
1391 */
1392 limLog(pMac, LOGP,
1393 FL("could not retrieve Valid channel list"));
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301394
1395 if (pMac->lim.gLimRspReqd)
1396 {
1397 pMac->lim.gLimRspReqd = false;
1398
1399 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1400 eSIR_SME_INVALID_PARAMETERS,
1401 pScanReq->sessionId,
1402 pScanReq->transactionId);
1403 }
1404 return;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301405 }
1406 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
Padma, Santhosh Kumar778d8382015-03-04 17:41:22 +05301407
1408 //Ignore DFS channels if DFS scan is disabled
1409 if(pMac->scan.fEnableDFSChnlScan == DFS_CHNL_SCAN_DISABLED)
1410 {
1411 tANI_U8 numChan = 0;
1412 tANI_U8 channel_state;
1413 tANI_U8 *chan_ptr = pMlmScanReq->channelList.channelNumber;
1414
1415 limLog(pMac, LOG1,
1416 FL("Ignore DFS channels from valid channel list"));
1417
1418 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1419 pMlmScanReq->channelList.channelNumber,
1420 pMlmScanReq->channelList.numChannels);
1421
1422 //Filter DFS channels
1423 for (i = 0; i < cfg_len; i++)
1424 {
1425 channel_state =
1426 vos_nv_getChannelEnabledState(*(chan_ptr + i));
1427
1428 //Allow channel if not DFS
1429 if(channel_state != NV_CHANNEL_DFS)
1430 {
1431 *(chan_ptr + numChan) = *(chan_ptr + i);
1432 numChan++;
1433 }
1434 }
1435 pMlmScanReq->channelList.numChannels = (tANI_U8) numChan;
1436
1437 limLog(pMac, LOG1, FL("No of valid channels %d, No of"
1438 "channels after filtering %d"), cfg_len, numChan);
1439
1440 limLog(pMac, LOG1, FL("Channel list after filtering: "));
1441
1442 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1443 pMlmScanReq->channelList.channelNumber,
1444 pMlmScanReq->channelList.numChannels);
1445 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301446 }
1447 else
1448 {
1449 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1450 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1451 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001452
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301453 pMlmScanReq = vos_mem_malloc(len);
1454 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301455 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301456 // Log error
1457 limLog(pMac, LOGP,
1458 FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001459
Padma, Santhosh Kumar8fa85212015-02-18 12:24:56 +05301460 if (pMac->lim.gLimRspReqd)
1461 {
1462 pMac->lim.gLimRspReqd = false;
1463
1464 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp),
1465 eSIR_SME_RESOURCES_UNAVAILABLE,
1466 pScanReq->sessionId,
1467 pScanReq->transactionId);
1468 }
1469
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301470 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301471 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001472
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301473 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301474 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301475 pMlmScanReq->channelList.numChannels =
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301476 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001477
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301478 vos_mem_copy( pMlmScanReq->channelList.channelNumber,
1479 pScanReq->channelList.channelNumber,
1480 pScanReq->channelList.numChannels);
1481 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001482
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301483 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1484 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1485 if(pScanReq->uIEFieldLen)
1486 {
1487 vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1488 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1489 pScanReq->uIEFieldLen);
1490 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001491
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301492 pMlmScanReq->bssType = pScanReq->bssType;
1493 vos_mem_copy( pMlmScanReq->bssId,
1494 pScanReq->bssId,
1495 sizeof(tSirMacAddr));
1496 pMlmScanReq->numSsid = pScanReq->numSsid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001497
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301498 i = 0;
1499 while (i < pMlmScanReq->numSsid)
1500 {
1501 vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001502 (tANI_U8 *) &pScanReq->ssId[i],
1503 pScanReq->ssId[i].length + 1);
1504
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301505 i++;
1506 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001507
Jeff Johnson295189b2012-06-20 16:38:30 -07001508
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301509 pMlmScanReq->scanType = pScanReq->scanType;
1510 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05301511 if (pMac->miracast_mode)
1512 {
1513 pMlmScanReq->minChannelTime = DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST;
1514 pMlmScanReq->maxChannelTime = DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
1515 }
1516 else
1517 {
1518 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1519 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1520 }
1521
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301522 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1523 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
1524 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1525 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001526
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301527 //Store the smeSessionID and transaction ID for later use.
1528 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1529 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001530
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301531 // Issue LIM_MLM_SCAN_REQ to MLM
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301532 limLog(pMac, LOG1, FL("Issue Scan request command to MLM "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301533 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1534 }
1535 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001536
1537 else
1538 {
1539 /// In all other cases return 'cached' scan results
1540 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1541 {
1542 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1543
1544 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001545#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1546 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001547 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001548 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1549 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1550 {
1551 limSendSmeLfrScanRsp(pMac, scanRspLen,
1552 eSIR_SME_SUCCESS,
1553 pScanReq->sessionId,
1554 pScanReq->transactionId);
1555 }
1556 else
1557 {
1558 scanRspLen = sizeof(tSirSmeScanRsp) +
1559 pMac->lim.gLimSmeLfrScanResultLength -
1560 sizeof(tSirBssDescription);
1561 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1562 pScanReq->sessionId, pScanReq->transactionId);
1563 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001564 }
1565 else
1566 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001567#endif
1568 if (pMac->lim.gLimSmeScanResultLength == 0)
1569 {
1570 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1571 pScanReq->sessionId, pScanReq->transactionId);
1572 }
1573 else
1574 {
1575 scanRspLen = sizeof(tSirSmeScanRsp) +
1576 pMac->lim.gLimSmeScanResultLength -
1577 sizeof(tSirBssDescription);
1578 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1579 pScanReq->sessionId, pScanReq->transactionId);
1580 }
1581#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001582 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001583#endif
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301584 limLog(pMac, LOG1, FL("Cached scan results are returned "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001585
1586 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1587 {
1588 // Discard previously cached scan results
1589 limReInitScanResults(pMac);
1590 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001591#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1592 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1593 {
1594 // Discard previously cached scan results
1595 limReInitLfrScanResults(pMac);
1596 }
1597#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001598
1599 } // if (pMac->lim.gLimRspReqd)
1600 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1601
Jeff Johnson295189b2012-06-20 16:38:30 -07001602#ifdef BACKGROUND_SCAN_ENABLED
1603 // start background scans if needed
1604 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1605 __limBackgroundScanInitiate(pMac);
1606#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001607
1608} /*** end __limProcessSmeScanReq() ***/
1609
Jeff Johnsone7245742012-09-05 17:12:55 -07001610#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001611
Jeff Johnsone7245742012-09-05 17:12:55 -07001612static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1613{
1614 tpSirOemDataReq pOemDataReq;
1615 tLimMlmOemDataReq* pMlmOemDataReq;
1616
1617 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1618
1619 //post the lim mlm message now
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301620 pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq));
1621 if ( NULL == pMlmOemDataReq )
Jeff Johnsone7245742012-09-05 17:12:55 -07001622 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301623 limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001624 return;
1625 }
1626
1627 //Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301628 vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001629
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301630 vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr,
1631 sizeof(tSirMacAddr));
1632 vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq,
1633 OEM_DATA_REQ_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001634
1635 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1636 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1637
1638 return;
1639
1640} /*** end __limProcessSmeOemDataReq() ***/
1641
1642#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001643
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301644/**
1645 * __limProcessClearDfsChannelList()
1646 *
1647 *FUNCTION:
1648 *Clear DFS channel list when country is changed/aquired.
1649.*This message is sent from SME.
1650 *
1651 *LOGIC:
1652 *
1653 *ASSUMPTIONS:
1654 *
1655 *NOTE:
1656 *
1657 * @param pMac Pointer to Global MAC structure
1658 * @param *pMsgBuf A pointer to the SME message buffer
1659 * @return None
1660 */
1661static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1662 tpSirMsgQ pMsg)
1663{
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301664 vos_mem_set( &pMac->lim.dfschannelList,
1665 sizeof(tSirDFSChannelList), 0);
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301666}
Jeff Johnson295189b2012-06-20 16:38:30 -07001667
1668/**
1669 * __limProcessSmeJoinReq()
1670 *
1671 *FUNCTION:
1672 * This function is called to process SME_JOIN_REQ message
1673 * from HDD or upper layer application.
1674 *
1675 *LOGIC:
1676 *
1677 *ASSUMPTIONS:
1678 *
1679 *NOTE:
1680 *
1681 * @param pMac Pointer to Global MAC structure
1682 * @param *pMsgBuf A pointer to the SME message buffer
1683 * @return None
1684 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001685static void
1686__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1687{
1688 // tANI_U8 *pBuf;
1689 //tANI_U32 len;
1690// tSirMacAddr currentBssId;
1691 tpSirSmeJoinReq pSmeJoinReq = NULL;
1692 tLimMlmJoinReq *pMlmJoinReq;
1693 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1694 tANI_U32 val = 0;
1695 tANI_U16 nSize;
1696 tANI_U8 sessionId;
1697 tpPESession psessionEntry = NULL;
1698 tANI_U8 smesessionId;
1699 tANI_U16 smetransactionId;
1700 tPowerdBm localPowerConstraint = 0, regMax = 0;
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301701 tANI_U16 ieLen;
1702 v_U8_t *vendorIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001703
1704#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1705 //Not sending any session, since it is not created yet. The response whould have correct state.
1706 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1707#endif //FEATURE_WLAN_DIAG_SUPPORT
1708
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301709 limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001710
1711#ifdef WLAN_FEATURE_VOWIFI
1712 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1713 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1714 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1715 * like not honoring power constraint on 1st association after driver loading. */
1716 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001717 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001718 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1719 val = 0;
1720#endif /* WLAN_FEATURE_VOWIFI */
1721
1722 /**
1723 * Expect Join request in idle state.
1724 * Reassociate request is expected in link established state.
1725 */
1726
1727 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1728 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1729 {
1730 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301731
1732 pSmeJoinReq = vos_mem_malloc(nSize);
1733 if ( NULL == pSmeJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001734 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301735 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1736 "pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1738 goto end;
1739 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301740 (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001741
Jeff Johnson295189b2012-06-20 16:38:30 -07001742 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1743 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1744 {
1745 /// Received invalid eWNI_SME_JOIN_REQ
1746 // Log the event
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301747 limLog(pMac, LOGW, FL("SessionId:%d Received SME_JOIN_REQ with"
1748 "invalid data"),pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001749 retCode = eSIR_SME_INVALID_PARAMETERS;
1750 goto end;
1751 }
1752
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301753 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23
Jeff Johnson295189b2012-06-20 16:38:30 -07001754
1755 /* check for the existence of start BSS session */
1756#ifdef FIXME_GEN6
1757 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1758 {
1759 if(peValidateBtJoinRequest(pMac)!= TRUE)
1760 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301761 limLog(pMac, LOGW, FL("SessionId:%d Start Bss session"
1762 "not present::SME_JOIN_REQ in unexpected state"),
1763 pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001764 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1765 psessionEntry = NULL;
1766 goto end;
1767 }
1768 }
1769
1770#endif
1771
1772
1773 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1774 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301775 limLog(pMac, LOGE, FL("Session(%d) Already exists for BSSID: "
Sushant Kaushik1b645382014-10-13 16:39:36 +05301776 MAC_ADDRESS_STR" in limSmeState = %d"),sessionId,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301777 MAC_ADDR_ARRAY(pSmeJoinReq->bssDescription.bssId),
1778 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001779
1780 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1781 {
1782 // Received eWNI_SME_JOIN_REQ for same
1783 // BSS as currently associated.
1784 // Log the event and send success
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301785 PELOGW(limLog(pMac, LOGW, FL("SessionId:%d Received"
1786 "SME_JOIN_REQ for currently joined BSS"),sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001787 /// Send Join success response to host
Deepthi Gowrif3e27252013-12-11 20:50:01 +05301788 retCode = eSIR_SME_ALREADY_JOINED_A_BSS;
1789 psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001790 goto end;
1791 }
1792 else
1793 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301794 PELOGE(limLog(pMac, LOGE, FL("SME_JOIN_REQ not for"
1795 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001796 retCode = eSIR_SME_REFUSED;
1797 psessionEntry = NULL;
1798 goto end;
1799 }
1800 }
1801 else /* Session Entry does not exist for given BSSId */
1802 {
1803 /* Try to Create a new session */
1804 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1805 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001806 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001807 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1808 goto end;
1809 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301810 else
1811 limLog(pMac,LOG1,FL("SessionId:%d New session created"),
1812 sessionId);
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05301813 }
1814
1815 if(psessionEntry != NULL && pSmeJoinReq->operationalRateSet.numRates > 0 ){
1816 if(!limCheck11BRateBitmap(pSmeJoinReq->rateBitMap)){
1817 psessionEntry->is11Gonly = true;
1818 }
1819 }
1820
Jeff Johnsone7245742012-09-05 17:12:55 -07001821 handleHTCapabilityandHTInfo(pMac, psessionEntry);
krunal soni5afa96c2013-09-06 22:19:02 -07001822 psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
Jeff Johnsone7245742012-09-05 17:12:55 -07001823
Jeff Johnson295189b2012-06-20 16:38:30 -07001824 /* Store Session related parameters */
1825 /* Store PE session Id in session Table */
1826 psessionEntry->peSessionId = sessionId;
1827
1828 /* store the smejoin req handle in session table */
1829 psessionEntry->pLimJoinReq = pSmeJoinReq;
1830
1831 /* Store SME session Id in sessionTable */
1832 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1833
1834 /* Store SME transaction Id in session Table */
1835 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1836
1837 /* Store beaconInterval */
1838 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1839
1840 /* Copying of bssId is already done, while creating session */
1841 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1842 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1843 psessionEntry->bssType = pSmeJoinReq->bsstype;
1844
1845 psessionEntry->statypeForBss = STA_ENTRY_PEER;
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301846 psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled;
1847 psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled;
Sushant Kaushik74df8db2015-03-11 18:09:05 +05301848 psessionEntry->bOSENAssociation = pSmeJoinReq->bOSENAssociation;
Jeff Johnson295189b2012-06-20 16:38:30 -07001849
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301850 /* Store vendor specfic IE for CISCO AP */
1851 ieLen = (pSmeJoinReq->bssDescription.length +
1852 sizeof( pSmeJoinReq->bssDescription.length ) -
1853 GET_FIELD_OFFSET( tSirBssDescription, ieFields ));
1854
1855 vendorIE = limGetVendorIEOuiPtr(pMac, SIR_MAC_CISCO_OUI,
1856 SIR_MAC_CISCO_OUI_SIZE,
1857 ((tANI_U8 *)&pSmeJoinReq->bssDescription.ieFields) , ieLen);
1858
1859 if ( NULL != vendorIE )
1860 {
1861 limLog(pMac, LOGE,
1862 FL("DUT is trying to connect to Cisco AP"));
1863 psessionEntry->isCiscoVendorAP = TRUE;
1864 }
1865 else
1866 {
1867 psessionEntry->isCiscoVendorAP = FALSE;
1868 }
1869
Jeff Johnson295189b2012-06-20 16:38:30 -07001870 /* Copy the dot 11 mode in to the session table */
1871
1872 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1873 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001874#ifdef WLAN_FEATURE_11AC
1875 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001876 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001877 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001878 if (psessionEntry->vhtCapability )
1879 {
1880 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1881
1882 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001883 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001884 psessionEntry->txBFIniFeatureEnabled);
1885
1886 if( psessionEntry->txBFIniFeatureEnabled )
1887 {
1888 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1889 != eSIR_SUCCESS)
1890 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301891 limLog(pMac, LOGP, FL("could not set "
1892 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001893 retCode = eSIR_LOGP_EXCEPTION;
1894 goto end;
1895 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001896 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301897 "***__limProcessSmeJoinReq: txBFCsnValue=%d****",
1898 pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001899
1900 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001901 != eSIR_SUCCESS)
1902 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301903 limLog(pMac, LOGP, FL("could not set "
1904 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001905 retCode = eSIR_LOGP_EXCEPTION;
1906 goto end;
1907 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301908
1909 if ( FALSE == pMac->isMuBfsessionexist )
1910 psessionEntry->txMuBformee = pSmeJoinReq->txMuBformee;
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001911 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301912
1913 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1914 "SmeJoinReq:txMuBformee=%d psessionEntry: txMuBformee = %d",
1915 pSmeJoinReq->txMuBformee, psessionEntry->txMuBformee);
1916
1917 if(cfgSetInt(pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, psessionEntry->txMuBformee)
1918 != eSIR_SUCCESS)
1919 {
1920 limLog(pMac, LOGE, FL("could not set "
1921 "WNI_CFG_VHT_MU_BEAMFORMEE_CAP at CFG"));
1922 retCode = eSIR_LOGP_EXCEPTION;
1923 goto end;
1924 }
1925
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001926 }
1927
Jeff Johnsone7245742012-09-05 17:12:55 -07001928#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001929
1930 /*Phy mode*/
1931 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1932
1933 /* Copy The channel Id to the session Table */
1934 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001935 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1936 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1937 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001938
Chet Lanctot186b5732013-03-18 10:26:30 -07001939 /* Record if management frames need to be protected */
1940#ifdef WLAN_FEATURE_11W
1941 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1942 {
1943 psessionEntry->limRmfEnabled = 1;
1944 }
1945 else
1946 {
1947 psessionEntry->limRmfEnabled = 0;
1948 }
1949#endif
1950
krunal soni8d13b092013-07-19 13:23:29 -07001951#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1952 psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi;
1953#endif
1954
Jeff Johnson295189b2012-06-20 16:38:30 -07001955 /*Store Persona */
1956 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1957 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301958 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona,
1959 pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001960
1961 /* Copy the SSID from smejoinreq to session entry */
1962 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301963 vos_mem_copy( psessionEntry->ssId.ssId,
1964 pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length);
1965
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001966 // Determin 11r or ESE connection based on input from SME
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301967 // which inturn is dependent on the profile the user wants to connect
1968 // to, So input is coming from supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07001969#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301970 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001971#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001972#ifdef FEATURE_WLAN_ESE
1973 psessionEntry->isESEconnection = pSmeJoinReq->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001974#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001975#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301976 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001977#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301978
Jeff Johnson43971f52012-07-17 12:26:56 -07001979#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301980 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
Jeff Johnson43971f52012-07-17 12:26:56 -07001981#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301982 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001983
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301984 if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001985 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301986 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1987 }
1988 else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1989 {
1990 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1991 }
1992 else
1993 {
1994 /* Throw an error and return and make sure to delete the session.*/
Abhishek Singh57aebef2014-02-03 18:47:44 +05301995 limLog(pMac, LOGE, FL("received SME_JOIN_REQ with invalid"
1996 " bss type %d"), psessionEntry->bssType);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301997 retCode = eSIR_SME_INVALID_PARAMETERS;
1998 goto end;
1999 }
2000
2001 if (pSmeJoinReq->addIEScan.length)
2002 {
2003 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan,
Jeff Johnson295189b2012-06-20 16:38:30 -07002004 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
2005 }
2006
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302007 if (pSmeJoinReq->addIEAssoc.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302009 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc,
Jeff Johnson295189b2012-06-20 16:38:30 -07002010 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
2011 }
2012
Jeff Johnson295189b2012-06-20 16:38:30 -07002013 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302014 pMlmJoinReq = vos_mem_malloc(val);
2015 if ( NULL == pMlmJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05302017 limLog(pMac, LOGP, FL("call to AllocateMemory "
2018 "failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 return;
2020 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302021 (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002022
2023 /* PE SessionId is stored as a part of JoinReq*/
2024 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
2025
2026 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
2027 != eSIR_SUCCESS)
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302028 {
2029 limLog(pMac, LOGE, FL("could not retrieve JoinFailureTimer value "
2030 "setting it to default value"));
2031 pMlmJoinReq->joinFailureTimeout = JOIN_FAILURE_TIMEOUT;
2032 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002033
2034 /* copy operational rate from psessionEntry*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302035 vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002036 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302037 vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002038 sizeof(tSirMacRateSet));
2039 //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 +05302040 vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07002041 sizeof(tSirMacRateSet));
2042
2043 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
2044
Jeff Johnson295189b2012-06-20 16:38:30 -07002045 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
2046
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302047 vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
2049 psessionEntry->pLimJoinReq->bssDescription.length + 2);
2050
Jeff Johnson295189b2012-06-20 16:38:30 -07002051 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07002052 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002053
Jeff Johnsone7245742012-09-05 17:12:55 -07002054 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05302055 localPowerConstraint = regMax;
Jeff Johnsone7245742012-09-05 17:12:55 -07002056 limExtractApCapability( pMac,
2057 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
2058 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
2059 &psessionEntry->limCurrentBssQosCaps,
2060 &psessionEntry->limCurrentBssPropCap,
2061 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002062 , &localPowerConstraint,
2063 psessionEntry
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05302064 );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05302065
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002066#ifdef FEATURE_WLAN_ESE
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002067 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07002068#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302069 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002070#endif
Sushant Kaushikece4b562015-04-09 18:27:33 +05302071 if (!psessionEntry->maxTxPower)
2072 {
2073 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("Tx power"
2074 "is zero. Setting it to default value %d"),
2075 TX_POWER_DEFAULT);
2076 psessionEntry->maxTxPower = TX_POWER_DEFAULT;
2077 }
2078
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05302079 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
2080 "Regulatory max = %d, local power constraint = %d,"
Abhishek Singh57aebef2014-02-03 18:47:44 +05302081 " max tx = %d", regMax, localPowerConstraint,
2082 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002083
2084 if (pMac->lim.gLimCurrentBssUapsd)
2085 {
2086 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302087 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2088 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002089
2090 // resetting the dynamic uapsd mask
2091 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
2092 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
2093 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002094
2095 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
2096
2097 // Initialize 11h Enable Flag
2098 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
2099 {
2100 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302101 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002102 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302103 psessionEntry->lim11hEnable = 1;
2104 }
2105 else
2106 psessionEntry->lim11hEnable = val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002107 }
2108 else
2109 psessionEntry->lim11hEnable = 0;
2110
2111 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
2112 pMac->lim.gLimIbssCoalescingHappened = false;
2113
Jeff Johnsone7245742012-09-05 17:12:55 -07002114 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2115 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
2116 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002117
Abhishek Singh57aebef2014-02-03 18:47:44 +05302118 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
2119 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
2120 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
2121 psessionEntry->currentOperChannel,
2122 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002123
2124 /* Indicate whether spectrum management is enabled*/
2125 psessionEntry->spectrumMgtEnabled =
2126 pSmeJoinReq->spectrumMgtIndicator;
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302127
2128 /* Enable the spectrum management if this is a DFS channel */
2129 if (psessionEntry->countryInfoPresent &&
2130 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2131 {
2132 psessionEntry->spectrumMgtEnabled = TRUE;
2133 }
2134
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302135 limLog(pMac,LOG1,FL("SessionId: %d LIM_MLM_JOIN_REQ is posted to MLM "
2136 "SM"), pMlmJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 /* Issue LIM_MLM_JOIN_REQ to MLM */
2138 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
2139 return;
2140
2141 }
2142 else
2143 {
2144 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05302145 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
Sushant Kaushik1b645382014-10-13 16:39:36 +05302146 "in state %d"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002147 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
2148 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2149 psessionEntry = NULL;
2150 goto end;
2151
2152 }
2153
2154end:
2155 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
2156
2157 if(pSmeJoinReq)
2158 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302159 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002160 pSmeJoinReq = NULL;
2161 if (NULL != psessionEntry)
2162 {
2163 psessionEntry->pLimJoinReq = NULL;
2164 }
2165 }
2166
2167 if(retCode != eSIR_SME_SUCCESS)
2168 {
2169 if(NULL != psessionEntry)
2170 {
2171 peDeleteSession(pMac,psessionEntry);
2172 psessionEntry = NULL;
2173 }
2174 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05302175 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
2176 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002177 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
2178} /*** end __limProcessSmeJoinReq() ***/
2179
2180
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002181#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08002182tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07002183{
2184 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302185 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002186 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07002187 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2188 maxTxPower = txPower;
2189 else if (txPower < MIN_TX_PWR_CAP)
2190 maxTxPower = MIN_TX_PWR_CAP;
2191 else
2192 maxTxPower = MAX_TX_PWR_CAP;
2193
2194 return (maxTxPower);
2195}
2196#endif
2197
Jeff Johnson295189b2012-06-20 16:38:30 -07002198/**
2199 * __limProcessSmeReassocReq()
2200 *
2201 *FUNCTION:
2202 * This function is called to process SME_REASSOC_REQ message
2203 * from HDD or upper layer application.
2204 *
2205 *LOGIC:
2206 *
2207 *ASSUMPTIONS:
2208 *
2209 *NOTE:
2210 *
2211 * @param pMac Pointer to Global MAC structure
2212 * @param *pMsgBuf A pointer to the SME message buffer
2213 * @return None
2214 */
2215
2216static void
2217__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2218{
2219 tANI_U16 caps;
2220 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002221 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 tLimMlmReassocReq *pMlmReassocReq;
2223 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2224 tpPESession psessionEntry = NULL;
2225 tANI_U8 sessionId;
2226 tANI_U8 smeSessionId;
2227 tANI_U16 transactionId;
2228 tPowerdBm localPowerConstraint = 0, regMax = 0;
2229 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002230 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002231
2232
Abhishek Singh127a8442014-12-15 17:31:27 +05302233 limLog(pMac, LOG1, FL("Received SME_REASSOC_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002234
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002235 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302236 pReassocReq = vos_mem_malloc(nSize);
2237 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 {
2239 // Log error
2240 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302241 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002242
2243 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2244 goto end;
2245 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302246 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2248 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2249 (!limIsSmeJoinReqValid(pMac,
2250 (tpSirSmeJoinReq) pReassocReq)))
2251 {
2252 /// Received invalid eWNI_SME_REASSOC_REQ
2253 // Log the event
2254 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002255 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002256
2257 retCode = eSIR_SME_INVALID_PARAMETERS;
2258 goto end;
2259 }
2260
2261 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2262 {
2263 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002264 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002265 retCode = eSIR_SME_INVALID_PARAMETERS;
2266 goto end;
2267 }
2268
2269#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2270 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2271#endif //FEATURE_WLAN_DIAG_SUPPORT
2272 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2273
2274 /* Store the reassoc handle in the session Table.. 23rd sep review */
2275 psessionEntry->pLimReAssocReq = pReassocReq;
Padma, Santhosh Kumar0d25d102014-07-17 15:08:48 +05302276 psessionEntry->dot11mode = pReassocReq->dot11mode;
2277 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(pReassocReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002278
2279 /**
2280 * Reassociate request is expected
2281 * in link established state only.
2282 */
2283
2284 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2285 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002286#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2288 {
2289 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002290 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002291 psessionEntry->peSessionId);
2292
2293 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302294 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002295 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2296 {
2297 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2298 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002299 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 retCode = eSIR_SME_INVALID_PARAMETERS;
2301 goto end;
2302 }
2303
2304 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2305 return;
2306 }
2307#endif
2308 /// Should not have received eWNI_SME_REASSOC_REQ
2309 // Log the event
2310 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302311 FL("received unexpected SME_REASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002312 psessionEntry->limSmeState);
2313 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2314
2315 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2316 goto end;
2317 }
2318
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302319 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002320 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2321 sizeof(tSirMacAddr));
2322
2323 psessionEntry->limReassocChannelId =
2324 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2325
Jeff Johnsone7245742012-09-05 17:12:55 -07002326 psessionEntry->reAssocHtSupportedChannelWidthSet =
2327 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2328 psessionEntry->reAssocHtRecommendedTxWidthSet =
2329 psessionEntry->reAssocHtSupportedChannelWidthSet;
2330 psessionEntry->reAssocHtSecondaryChannelOffset =
2331 psessionEntry->pLimReAssocReq->cbMode;
2332
Jeff Johnson295189b2012-06-20 16:38:30 -07002333 psessionEntry->limReassocBssCaps =
2334 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002335 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2336 localPowerConstraint = regMax;
2337 limExtractApCapability( pMac,
2338 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2339 limGetIElenFromBssDescription(
2340 &psessionEntry->pLimReAssocReq->bssDescription),
2341 &psessionEntry->limReassocBssQosCaps,
2342 &psessionEntry->limReassocBssPropCap,
2343 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002344 , &localPowerConstraint,
2345 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002346 );
2347
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302348 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Sushant Kaushikece4b562015-04-09 18:27:33 +05302349 if (!psessionEntry->maxTxPower)
2350 {
2351 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, FL("Tx power "
2352 "is zero. Setting it to default value %d"),
2353 TX_POWER_DEFAULT);
2354 psessionEntry->maxTxPower = TX_POWER_DEFAULT;
2355 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002356#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302357 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2358 "= %d, max tx = %d", regMax, localPowerConstraint,
2359 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002360#endif
2361 {
2362 #if 0
2363 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2364 &cfgLen) != eSIR_SUCCESS)
2365 {
2366 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002367 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002368 }
2369 #endif//TO SUPPORT BT-AMP
2370
2371 /* Copy the SSID from sessio entry to local variable */
2372 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302373 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002374 psessionEntry->ssId.ssId,
2375 psessionEntry->ssId.length);
2376 #endif
2377 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302378 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002379 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2380
2381 }
2382
2383 if (pMac->lim.gLimCurrentBssUapsd)
2384 {
2385 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302386 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2387 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 }
2389
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302390 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2391 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002392 {
2393 // Log error
2394 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302395 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002396
2397 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2398 goto end;
2399 }
2400
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302401 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002402 psessionEntry->limReAssocbssId,
2403 sizeof(tSirMacAddr));
2404
2405 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2406 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2407 != eSIR_SUCCESS)
2408 {
2409 /**
2410 * Could not get ReassocFailureTimeout value
2411 * from CFG. Log error.
2412 */
2413 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002414 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002415 }
2416
2417 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2418 {
2419 /**
2420 * Could not get Capabilities value
2421 * from CFG. Log error.
2422 */
2423 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002424 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002425 }
2426 pMlmReassocReq->capabilityInfo = caps;
2427
2428 /* Update PE sessionId*/
2429 pMlmReassocReq->sessionId = sessionId;
2430
2431 /* If telescopic beaconing is enabled, set listen interval to
2432 WNI_CFG_TELE_BCN_MAX_LI */
2433 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2434 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002435 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002436
2437 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2438
2439 if(teleBcnEn)
2440 {
2441 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2442 eSIR_SUCCESS)
2443 {
2444 /**
2445 * Could not get ListenInterval value
2446 * from CFG. Log error.
2447 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002448 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002449 }
2450 }
2451 else
2452 {
2453 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2454 {
2455 /**
2456 * Could not get ListenInterval value
2457 * from CFG. Log error.
2458 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002459 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002460 }
2461 }
2462
2463 /* Delete all BA sessions before Re-Assoc.
2464 * BA frames are class 3 frames and the session
2465 * is lost upon disassociation and reassociation.
2466 */
2467
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05302468 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS,
2469 eSIR_MAC_UNSPEC_FAILURE_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002470
2471 pMlmReassocReq->listenInterval = (tANI_U16) val;
2472
2473 /* Indicate whether spectrum management is enabled*/
2474 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2475
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302476 /* Enable the spectrum management if this is a DFS channel */
2477 if (psessionEntry->countryInfoPresent &&
2478 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2479 {
2480 psessionEntry->spectrumMgtEnabled = TRUE;
2481 }
2482
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2484 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2485
Jeff Johnsone7245742012-09-05 17:12:55 -07002486 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002487
2488 limPostMlmMessage(pMac,
2489 LIM_MLM_REASSOC_REQ,
2490 (tANI_U32 *) pMlmReassocReq);
2491 return;
2492
2493end:
2494 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302495 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002496
2497 if (psessionEntry)
2498 {
2499 // error occurred after we determined the session so extract
2500 // session and transaction info from there
2501 smeSessionId = psessionEntry->smeSessionId;
2502 transactionId = psessionEntry->transactionId;
2503 }
2504 else
2505 {
2506 // error occurred before or during the time we determined the session
2507 // so extract the session and transaction info from the message
2508 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2509 }
2510
2511 /// Send Reassoc failure response to host
2512 /// (note psessionEntry may be NULL, but that's OK)
2513 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2514 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2515 psessionEntry, smeSessionId, transactionId);
2516
2517} /*** end __limProcessSmeReassocReq() ***/
2518
2519
2520tANI_BOOLEAN sendDisassocFrame = 1;
2521/**
2522 * __limProcessSmeDisassocReq()
2523 *
2524 *FUNCTION:
2525 * This function is called to process SME_DISASSOC_REQ message
2526 * from HDD or upper layer application.
2527 *
2528 *LOGIC:
2529 *
2530 *ASSUMPTIONS:
2531 *
2532 *NOTE:
2533 *
2534 * @param pMac Pointer to Global MAC structure
2535 * @param *pMsgBuf A pointer to the SME message buffer
2536 * @return None
2537 */
2538
2539static void
2540__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2541{
2542 tANI_U16 disassocTrigger, reasonCode;
2543 tLimMlmDisassocReq *pMlmDisassocReq;
2544 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002545 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002546 tSirSmeDisassocReq smeDisassocReq;
2547 tpPESession psessionEntry = NULL;
2548 tANI_U8 sessionId;
2549 tANI_U8 smesessionId;
2550 tANI_U16 smetransactionId;
2551
Jeff Johnson295189b2012-06-20 16:38:30 -07002552
Jeff Johnson43971f52012-07-17 12:26:56 -07002553 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002554 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002555 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002556 return;
2557 }
2558
Jeff Johnson43971f52012-07-17 12:26:56 -07002559 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002560
Jeff Johnson43971f52012-07-17 12:26:56 -07002561 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002562
Jeff Johnson43971f52012-07-17 12:26:56 -07002563 if ( (eSIR_FAILURE == status) ||
2564 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002565 {
2566 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002567 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002568
2569 if (pMac->lim.gLimRspReqd)
2570 {
2571 pMac->lim.gLimRspReqd = false;
2572
2573 retCode = eSIR_SME_INVALID_PARAMETERS;
2574 disassocTrigger = eLIM_HOST_DISASSOC;
2575 goto sendDisassoc;
2576 }
2577
2578 return;
2579 }
2580
Jeff Johnson295189b2012-06-20 16:38:30 -07002581 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2582 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302583 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2584 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002585 retCode = eSIR_SME_INVALID_PARAMETERS;
2586 disassocTrigger = eLIM_HOST_DISASSOC;
2587 goto sendDisassoc;
2588
2589 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302590 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2591 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2592 smesessionId,psessionEntry->limSystemRole,
2593 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2594 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002595
2596#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2597 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2598#endif //FEATURE_WLAN_DIAG_SUPPORT
2599
2600 /* Update SME session Id and SME transaction ID*/
2601
2602 psessionEntry->smeSessionId = smesessionId;
2603 psessionEntry->transactionId = smetransactionId;
2604
2605 switch (psessionEntry->limSystemRole)
2606 {
2607 case eLIM_STA_ROLE:
2608 case eLIM_BT_AMP_STA_ROLE:
2609 switch (psessionEntry->limSmeState)
2610 {
2611 case eLIM_SME_ASSOCIATED_STATE:
2612 case eLIM_SME_LINK_EST_STATE:
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +05302613 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2614 "limSmeState: %d "),psessionEntry->limSmeState);
2615
Jeff Johnson295189b2012-06-20 16:38:30 -07002616 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2617 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002618#ifdef FEATURE_WLAN_TDLS
2619 /* Delete all TDLS peers connected before leaving BSS*/
2620 limDeleteTDLSPeers(pMac, psessionEntry);
2621#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002622 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002623 break;
2624
2625 case eLIM_SME_WT_DEAUTH_STATE:
2626 /* PE shall still process the DISASSOC_REQ and proceed with
2627 * link tear down even if it had already sent a DEAUTH_IND to
2628 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2629 * its been set when PE entered WT_DEAUTH_STATE.
2630 */
2631 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002632 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302633 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2634 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002635 break;
2636
2637 case eLIM_SME_WT_DISASSOC_STATE:
2638 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2639 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2640 * PE can continue processing DISASSOC_REQ and send the response instead
2641 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2642 * for disassoc frame.
2643 *
2644 * It will send a disassoc, which is ok. However, we can use the global flag
2645 * sendDisassoc to not send disassoc frame.
2646 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302647 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2648 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002649 break;
2650
2651 case eLIM_SME_JOIN_FAILURE_STATE: {
2652 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302653 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2654 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002655 if (pMac->lim.gLimRspReqd) {
2656 retCode = eSIR_SME_SUCCESS;
2657 disassocTrigger = eLIM_HOST_DISASSOC;
2658 goto sendDisassoc;
2659 }
2660 }break;
2661 default:
2662 /**
2663 * STA is not currently associated.
2664 * Log error and send response to host
2665 */
2666 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302667 FL("received unexpected SME_DISASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002668 psessionEntry->limSmeState);
2669 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2670
2671 if (pMac->lim.gLimRspReqd)
2672 {
2673 if (psessionEntry->limSmeState !=
2674 eLIM_SME_WT_ASSOC_STATE)
2675 pMac->lim.gLimRspReqd = false;
2676
2677 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2678 disassocTrigger = eLIM_HOST_DISASSOC;
2679 goto sendDisassoc;
2680 }
2681
2682 return;
2683 }
2684
2685 break;
2686
2687 case eLIM_AP_ROLE:
2688 case eLIM_BT_AMP_AP_ROLE:
2689 // Fall through
2690 break;
2691
2692 case eLIM_STA_IN_IBSS_ROLE:
2693 default: // eLIM_UNKNOWN_ROLE
2694 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002695 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002696 psessionEntry->limSystemRole);
2697
2698 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2699 disassocTrigger = eLIM_HOST_DISASSOC;
2700 goto sendDisassoc;
2701 } // end switch (pMac->lim.gLimSystemRole)
2702
2703 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2704 {
2705 /// Disassociation is triggered by Link Monitoring
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302706 limLog(pMac, LOG1, FL("Sending Disasscoc with reason Link Monitoring"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002707 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2708 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2709 }
2710 else
2711 {
2712 disassocTrigger = eLIM_HOST_DISASSOC;
2713 reasonCode = smeDisassocReq.reasonCode;
2714 }
2715
2716 if (smeDisassocReq.doNotSendOverTheAir)
2717 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302718 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002719 sendDisassocFrame = 0;
2720 }
2721 // Trigger Disassociation frame to peer MAC entity
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302722 limLog(pMac, LOG1, FL("Sending Disasscoc with disassoc Trigger"
2723 " : %d, reasonCode : %d"),
2724 disassocTrigger, reasonCode);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302725 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2726 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002727 {
2728 // Log error
2729 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302730 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002731
2732 return;
2733 }
2734
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302735 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002736 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2737 sizeof(tSirMacAddr));
2738
2739 pMlmDisassocReq->reasonCode = reasonCode;
2740 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2741
2742 /* Update PE session ID*/
2743 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002744
2745 limPostMlmMessage(pMac,
2746 LIM_MLM_DISASSOC_REQ,
2747 (tANI_U32 *) pMlmDisassocReq);
2748 return;
2749
2750sendDisassoc:
2751 if (psessionEntry)
2752 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2753 retCode,
2754 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002755 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002756 else
2757 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2758 retCode,
2759 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002760 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002761
2762
2763} /*** end __limProcessSmeDisassocReq() ***/
2764
2765
2766/** -----------------------------------------------------------------
2767 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2768
2769 This function is called to process SME_DISASSOC_CNF message
2770 from HDD or upper layer application.
2771
2772 \param pMac - global mac structure
2773 \param pStaDs - station dph hash node
2774 \return none
2775 \sa
2776 ----------------------------------------------------------------- */
2777static void
2778__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2779{
2780 tSirSmeDisassocCnf smeDisassocCnf;
2781 tANI_U16 aid;
2782 tpDphHashNode pStaDs;
2783 tSirRetStatus status = eSIR_SUCCESS;
2784 tpPESession psessionEntry;
2785 tANI_U8 sessionId;
2786
2787
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302788 limLog(pMac, LOG1, FL("received SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002789
2790 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2791
2792 if (status == eSIR_FAILURE)
2793 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002794 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002795 return;
2796 }
2797
2798 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2799 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002800 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002801 return;
2802 }
2803
2804 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2805 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302806 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002807 return;
2808 }
2809
2810#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2811 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2812 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2813 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2814 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2815#endif //FEATURE_WLAN_DIAG_SUPPORT
2816
2817 switch (psessionEntry->limSystemRole)
2818 {
2819 case eLIM_STA_ROLE:
2820 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2821 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2822 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2823 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2824 {
2825 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302826 FL("received unexp SME_DISASSOC_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002827 psessionEntry->limSmeState);
2828 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2829 return;
2830 }
2831 break;
2832
2833 case eLIM_AP_ROLE:
2834 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002835 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002836
2837 case eLIM_STA_IN_IBSS_ROLE:
2838 default: // eLIM_UNKNOWN_ROLE
2839 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002840 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002841 psessionEntry->limSystemRole);
2842
2843 return;
2844 }
2845
2846
2847 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2848 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002849 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 )
2851 {
2852 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2853 if (pStaDs == NULL)
2854 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302855 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2856 "does not have context, addr= "MAC_ADDRESS_STR),
2857 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002858 return;
2859 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002860 /* Delete FT session if there exists one */
2861 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002862 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002863
2864 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002865 }
2866
2867 return;
2868}
2869
2870
2871/**
2872 * __limProcessSmeDeauthReq()
2873 *
2874 *FUNCTION:
2875 * This function is called to process SME_DEAUTH_REQ message
2876 * from HDD or upper layer application.
2877 *
2878 *LOGIC:
2879 *
2880 *ASSUMPTIONS:
2881 *
2882 *NOTE:
2883 *
2884 * @param pMac Pointer to Global MAC structure
2885 * @param *pMsgBuf A pointer to the SME message buffer
2886 * @return None
2887 */
2888
2889static void
2890__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2891{
2892 tANI_U16 deauthTrigger, reasonCode;
2893 tLimMlmDeauthReq *pMlmDeauthReq;
2894 tSirSmeDeauthReq smeDeauthReq;
2895 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2896 tSirRetStatus status = eSIR_SUCCESS;
2897 tpPESession psessionEntry;
2898 tANI_U8 sessionId; //PE sessionId
2899 tANI_U8 smesessionId;
2900 tANI_U16 smetransactionId;
2901
Jeff Johnson295189b2012-06-20 16:38:30 -07002902
2903 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002904 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2905
2906 //We need to get a session first but we don't even know if the message is correct.
2907 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2908 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002909 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002910 retCode = eSIR_SME_INVALID_PARAMETERS;
2911 deauthTrigger = eLIM_HOST_DEAUTH;
2912 goto sendDeauth;
2913
2914 }
2915
2916 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2917 {
Sachin Ahuja42354142015-01-06 19:48:35 +05302918 PELOGE(limLog(pMac, LOGE,FL
2919 ("received invalid SME_DEAUTH_REQ message"));)
2920 pMac->lim.gLimRspReqd = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002921
Sachin Ahuja42354142015-01-06 19:48:35 +05302922 retCode = eSIR_SME_INVALID_PARAMETERS;
2923 deauthTrigger = eLIM_HOST_DEAUTH;
2924 goto sendDeauth;
Jeff Johnson295189b2012-06-20 16:38:30 -07002925 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302926 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2927 "Systemrole %d with reasoncode %u in limSmestate %d from "
2928 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2929 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2930 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002931#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2932 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2933#endif //FEATURE_WLAN_DIAG_SUPPORT
2934
2935 /* Update SME session ID and Transaction ID */
2936 psessionEntry->smeSessionId = smesessionId;
2937 psessionEntry->transactionId = smetransactionId;
2938
2939
2940 switch (psessionEntry->limSystemRole)
2941 {
2942 case eLIM_STA_ROLE:
2943 case eLIM_BT_AMP_STA_ROLE:
2944
2945 switch (psessionEntry->limSmeState)
2946 {
2947 case eLIM_SME_ASSOCIATED_STATE:
2948 case eLIM_SME_LINK_EST_STATE:
2949 case eLIM_SME_WT_ASSOC_STATE:
2950 case eLIM_SME_JOIN_FAILURE_STATE:
2951 case eLIM_SME_IDLE_STATE:
2952 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2953 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002954 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002955
2956 // Send Deauthentication request to MLM below
2957
2958 break;
Sachin Ahujaa100dcc2014-07-03 14:30:18 +05302959 case eLIM_SME_WT_DEAUTH_STATE:
2960 /*
2961 * PE Recieved a Deauth frame. Normally it gets
2962 * DEAUTH_CNF but it received DEAUTH_REQ. Which
2963 * means host is also trying to disconnect.
2964 * PE can continue processing DEAUTH_REQ and send
2965 * the response instead of failing the request.
2966 * SME will anyway ignore DEAUTH_IND that was sent
2967 * for deauth frame.
2968 */
2969 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
2970 "SME_WT_DEAUTH_STATE. "));
2971 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002972 default:
2973 /**
2974 * STA is not in a state to deauthenticate with
2975 * peer. Log error and send response to host.
2976 */
2977 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302978 FL("received unexp SME_DEAUTH_REQ in state %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05302979 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002980 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2981
2982 if (pMac->lim.gLimRspReqd)
2983 {
2984 pMac->lim.gLimRspReqd = false;
2985
2986 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2987 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08002988 /**
2989 *here we received deauth request from AP so sme state is
2990 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
2991 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
2992 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
2993 so the below condition captures the state where delSta
2994 not done and firmware still in connected state.
2995 */
2996 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
2997 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
2998 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
2999 {
3000 retCode = eSIR_SME_DEAUTH_STATUS;
3001 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003002 goto sendDeauth;
3003 }
3004
3005 return;
3006 }
3007
3008 break;
3009
3010 case eLIM_STA_IN_IBSS_ROLE:
Abhishek Singh92fbac22015-03-24 17:57:36 +05303011 limLog(pMac, LOGE,FL("Deauth not allowed in IBSS"));
3012 if (pMac->lim.gLimRspReqd)
3013 {
3014 pMac->lim.gLimRspReqd = false;
3015 retCode = eSIR_SME_INVALID_PARAMETERS;
3016 deauthTrigger = eLIM_HOST_DEAUTH;
3017 goto sendDeauth;
3018 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003019 return;
3020
3021 case eLIM_AP_ROLE:
3022 // Fall through
3023
3024 break;
3025
3026 default:
3027 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303028 FL("received unexpected SME_DEAUTH_REQ for role %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05303029 psessionEntry->limSystemRole);
Abhishek Singh92fbac22015-03-24 17:57:36 +05303030 if (pMac->lim.gLimRspReqd)
3031 {
3032 pMac->lim.gLimRspReqd = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07003033
Abhishek Singh92fbac22015-03-24 17:57:36 +05303034 retCode = eSIR_SME_INVALID_PARAMETERS;
3035 deauthTrigger = eLIM_HOST_DEAUTH;
3036 goto sendDeauth;
3037 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003038 return;
Abhishek Singh92fbac22015-03-24 17:57:36 +05303039
Jeff Johnson295189b2012-06-20 16:38:30 -07003040 } // end switch (pMac->lim.gLimSystemRole)
3041
3042 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
3043 {
3044 /// Deauthentication is triggered by Link Monitoring
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303045 limLog(pMac, LOG1,
3046 FL("Deauthentication is triggered by Link Monitoring"));
3047 limLog(pMac, LOG1,
3048 FL("Set Trigger to eLIM_LINK_MONITORING_DEAUTH"));
3049 limLog(pMac, LOG1,
3050 FL("and Reason to eSIR_MAC_UNSPEC_FAILURE_REASON"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003051 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
3052 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
3053 }
3054 else
3055 {
3056 deauthTrigger = eLIM_HOST_DEAUTH;
3057 reasonCode = smeDeauthReq.reasonCode;
3058 }
3059
3060 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303061 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
3062 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003063 {
3064 // Log error
Abhishek Singh92fbac22015-03-24 17:57:36 +05303065 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303066 FL("call to AllocateMemory failed for mlmDeauthReq"));
Abhishek Singh92fbac22015-03-24 17:57:36 +05303067 if (pMac->lim.gLimRspReqd)
3068 {
3069 pMac->lim.gLimRspReqd = false;
3070 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3071 deauthTrigger = eLIM_HOST_DEAUTH;
3072 goto sendDeauth;
3073 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003074 return;
3075 }
3076
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303077 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003078 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
3079 sizeof(tSirMacAddr));
3080
3081 pMlmDeauthReq->reasonCode = reasonCode;
3082 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07003083
3084 /* Update PE session Id*/
3085 pMlmDeauthReq->sessionId = sessionId;
3086
3087 limPostMlmMessage(pMac,
3088 LIM_MLM_DEAUTH_REQ,
3089 (tANI_U32 *) pMlmDeauthReq);
3090 return;
3091
3092sendDeauth:
3093 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
3094 retCode,
3095 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07003096 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003097 smesessionId, smetransactionId);
3098} /*** end __limProcessSmeDeauthReq() ***/
3099
3100
3101
3102/**
3103 * __limProcessSmeSetContextReq()
3104 *
3105 *FUNCTION:
3106 * This function is called to process SME_SETCONTEXT_REQ message
3107 * from HDD or upper layer application.
3108 *
3109 *LOGIC:
3110 *
3111 *ASSUMPTIONS:
3112 *
3113 *NOTE:
3114 *
3115 * @param pMac Pointer to Global MAC structure
3116 * @param *pMsgBuf A pointer to the SME message buffer
3117 * @return None
3118 */
3119
3120static void
3121__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3122{
3123 tpSirSmeSetContextReq pSetContextReq;
3124 tLimMlmSetKeysReq *pMlmSetKeysReq;
3125 tpPESession psessionEntry;
3126 tANI_U8 sessionId; //PE sessionID
3127 tANI_U8 smesessionId;
3128 tANI_U16 smetransactionId;
3129
3130
3131 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003132 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07003133
3134
3135 if(pMsgBuf == NULL)
3136 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003137 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003138 return;
3139 }
3140
3141 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303142
3143 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
3144 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003145 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303146 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 return;
3148 }
3149
3150 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3151 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
3152 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003153 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003154 goto end;
3155 }
3156
3157 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3158 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003159 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 -07003160 limSendSmeSetContextRsp(pMac,
3161 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003162 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003163 eSIR_SME_INVALID_PARAMETERS,NULL,
3164 smesessionId,smetransactionId);
3165
3166 goto end;
3167 }
3168
3169
3170 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
3171 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003172 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003173 limSendSmeSetContextRsp(pMac,
3174 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003175 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003176 eSIR_SME_INVALID_PARAMETERS,NULL,
3177 smesessionId,smetransactionId);
3178
3179 goto end;
3180 }
3181
3182#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3183 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
3184#endif //FEATURE_WLAN_DIAG_SUPPORT
3185
3186
3187 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
3188 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3189 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3190 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3191 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3192 {
3193 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303194 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
3195 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003196 {
3197 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303198 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003199 goto end;
3200 }
Abhishek Singhb25e8442015-06-23 14:28:05 +05303201 vos_mem_zero(pMlmSetKeysReq,sizeof(tLimMlmSetKeysReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07003202 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
3203 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
3204 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3205 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003206 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003207 goto end;
3208 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303209 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003210 (tANI_U8 *) &pSetContextReq->peerMacAddr,
3211 sizeof(tSirMacAddr));
3212
Jeff Johnson295189b2012-06-20 16:38:30 -07003213
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303214 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07003215 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
3216 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
3217
3218 pMlmSetKeysReq->sessionId = sessionId;
3219#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3220 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003221 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07003222#endif
3223
Jeff Johnson295189b2012-06-20 16:38:30 -07003224 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
3225 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
3226 {
3227 if(pSetContextReq->keyMaterial.key[0].keyLength)
3228 {
3229 tANI_U8 keyId;
3230 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303231 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07003232 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
3233 }
3234 else {
3235 tANI_U32 i;
3236 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3237 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303238 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003239 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3240 }
3241 }
3242 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003243
3244 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003245 }
3246 else
3247 {
3248 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303249 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003250 psessionEntry->limSystemRole,
3251 psessionEntry->limSmeState);
3252 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3253
3254 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003255 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003256 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3257 smesessionId,
3258 smetransactionId);
3259 }
3260
3261end:
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303262 vos_mem_zero(pSetContextReq,
3263 (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303264 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 return;
3266} /*** end __limProcessSmeSetContextReq() ***/
3267
3268/**
3269 * __limProcessSmeRemoveKeyReq()
3270 *
3271 *FUNCTION:
3272 * This function is called to process SME_REMOVEKEY_REQ message
3273 * from HDD or upper layer application.
3274 *
3275 *LOGIC:
3276 *
3277 *ASSUMPTIONS:
3278 *
3279 *NOTE:
3280 *
3281 * @param pMac Pointer to Global MAC structure
3282 * @param *pMsgBuf A pointer to the SME message buffer
3283 * @return None
3284 */
3285
3286static void
3287__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3288{
3289 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3290 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3291 tpPESession psessionEntry;
3292 tANI_U8 sessionId; //PE sessionID
3293 tANI_U8 smesessionId;
3294 tANI_U16 smetransactionId;
3295
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303296 limLog(pMac, LOG1,
3297 FL("received SME_REMOVEKEY_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003298
3299 if(pMsgBuf == NULL)
3300 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003301 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 return;
3303 }
3304
3305
3306 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3307
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303308 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3309 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 {
3311 //Log error
3312 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303313 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003314
3315 return;
3316 }
3317
3318 if ((limRemoveKeyReqSerDes(pMac,
3319 pRemoveKeyReq,
3320 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3321 {
3322 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003323 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003324
3325 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3326
3327 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3328 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003329 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003330 //goto end;
3331 }
3332
3333 limSendSmeRemoveKeyRsp(pMac,
3334 pRemoveKeyReq->peerMacAddr,
3335 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3336 smesessionId,smetransactionId);
3337
3338 goto end;
3339 }
3340
3341 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3342 {
3343 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003344 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003345 limSendSmeRemoveKeyRsp(pMac,
3346 pRemoveKeyReq->peerMacAddr,
3347 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3348 smesessionId, smetransactionId);
3349 goto end;
3350 }
3351
3352
3353 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3354 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3355 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3356 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3357 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3358 {
3359 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303360 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3361 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003362 {
3363 // Log error
3364 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303365 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003366
3367 goto end;
3368 }
3369
3370 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3371 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3372 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3373 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3374
3375 /* Update PE session Id */
3376 pMlmRemoveKeyReq->sessionId = sessionId;
3377
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303378 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003379 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3380 sizeof(tSirMacAddr));
3381
3382
3383 limPostMlmMessage(pMac,
3384 LIM_MLM_REMOVEKEY_REQ,
3385 (tANI_U32 *) pMlmRemoveKeyReq);
3386 }
3387 else
3388 {
3389 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303390 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003391 psessionEntry->limSystemRole,
3392 psessionEntry->limSmeState);
3393 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3394
3395 limSendSmeRemoveKeyRsp(pMac,
3396 pRemoveKeyReq->peerMacAddr,
3397 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3398 smesessionId,smetransactionId);
3399 }
3400
3401end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303402 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003403} /*** end __limProcessSmeRemoveKeyReq() ***/
3404
Jeff Johnson295189b2012-06-20 16:38:30 -07003405void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3406{
3407 tSirMsgQ mmhMsg;
3408 tpSmeGetScanChnRsp pSirSmeRsp;
3409 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303410 tANI_U8 sessionId;
3411 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003412
3413 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3414 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003415 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003416 pMac->lim.scanChnInfo.numChnInfo);
3417 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3418 }
3419
Abhishek Singh525045c2014-12-15 17:18:45 +05303420 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003421 FL("Sending message %s with number of channels %d"),
Abhishek Singh525045c2014-12-15 17:18:45 +05303422 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07003423
3424 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303425 pSirSmeRsp = vos_mem_malloc(len);
3426 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003427 {
3428 /// Buffer not available. Log error
3429 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303430 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003431
3432 return;
3433 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303434 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003435
Jeff Johnson295189b2012-06-20 16:38:30 -07003436 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3437 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303438
3439 if (pMac->fScanOffload)
3440 {
3441 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3442 pSirSmeRsp->sessionId = sessionId;
3443 }
3444 else
3445 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003446
3447 if(pMac->lim.scanChnInfo.numChnInfo)
3448 {
3449 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303450 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3451 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003452 }
3453 //Clear the list
3454 limRessetScanChannelInfo(pMac);
3455
3456 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3457 mmhMsg.bodyptr = pSirSmeRsp;
3458 mmhMsg.bodyval = 0;
3459
3460 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003461 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003462 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3463}
3464
3465
Jeff Johnson295189b2012-06-20 16:38:30 -07003466void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3467{
3468 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3469 tpDphHashNode pStaDs = NULL;
3470 tpPESession psessionEntry = NULL;
3471 tSap_Event sapEvent;
3472 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3473 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3474 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3475 tANI_U8 assocId = 0;
3476 tANI_U8 staCount = 0;
3477
3478 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3479 {
3480 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003481 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303482 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003483 }
3484
3485 switch (getAssocSTAsReq.modId)
3486 {
3487/**
3488 case VOS_MODULE_ID_HAL:
3489 wdaPostCtrlMsg( pMac, &msgQ );
3490 return;
3491
3492 case VOS_MODULE_ID_TL:
3493 Post msg TL
3494 return;
3495*/
3496 case VOS_MODULE_ID_PE:
3497 default:
3498 break;
3499 }
3500
Jeff Johnson1250df42012-12-10 14:31:52 -08003501 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003502 // Find PE session Entry
3503 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3504 {
3505 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003506 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003507 goto limAssocStaEnd;
3508 }
3509
3510 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3511 {
3512 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303513 FL("Received unexpected message in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303514 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003515 goto limAssocStaEnd;
3516 }
3517
3518 // Retrieve values obtained in the request message
3519 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3520 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3521
3522 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3523 {
3524 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3525
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303526 if ((NULL == pStaDs) || (NULL == pAssocStasTemp))
Jeff Johnson295189b2012-06-20 16:38:30 -07003527 continue;
3528
3529 if (pStaDs->valid)
3530 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303531 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3532 (tANI_U8 *)&pStaDs->staAddr,
3533 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003534 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3535 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3536
Kiet Lamb1233192013-11-28 13:38:20 +05303537 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003538 (tANI_U8 *)&pStaDs->supportedRates,
3539 sizeof(tSirSupportedRates));
3540 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3541 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3542 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3543
Jeff Johnson295189b2012-06-20 16:38:30 -07003544 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003545 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3546 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003547 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3548 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3549
3550 pAssocStasTemp++;
3551 staCount++;
3552 }
3553 }
3554
3555limAssocStaEnd:
3556 // Call hdd callback with sap event to send the list of associated stations from PE
3557 if (pSapEventCallback != NULL)
3558 {
3559 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3560 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3561 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3562 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3563 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3564 }
3565}
3566
3567
3568/**
3569 * limProcessSmeGetWPSPBCSessions
3570 *
3571 *FUNCTION:
3572 * This function is called when query the WPS PBC overlap message is received
3573 *
3574 *LOGIC:
3575 * This function parses get WPS PBC overlap information message and call callback to pass
3576 * WPS PBC overlap information back to hdd.
3577 *ASSUMPTIONS:
3578 *
3579 *
3580 *NOTE:
3581 *
3582 * @param pMac Pointer to Global MAC structure
3583 * @param pMsgBuf A pointer to WPS PBC overlap query message
3584*
3585 * @return None
3586 */
3587void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3588{
3589 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3590 tpPESession psessionEntry = NULL;
3591 tSap_Event sapEvent;
3592 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3593 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3594 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3595
3596 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3597
3598 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3599 {
3600 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003601 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303602 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003603 }
3604
Jeff Johnson1250df42012-12-10 14:31:52 -08003605 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003606 // Find PE session Entry
3607 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3608 {
3609 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003610 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003611 goto limGetWPSPBCSessionsEnd;
3612 }
3613
3614 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3615 {
3616 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303617 FL("Received unexpected message in role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003618 psessionEntry->limSystemRole);
3619 goto limGetWPSPBCSessionsEnd;
3620 }
3621
Jeff Johnson1250df42012-12-10 14:31:52 -08003622 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003623 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3624 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3625
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303626 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003627 { //This is GetWpsSession call
3628
3629 limGetWPSPBCSessions(pMac,
3630 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3631 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3632 }
3633 else
3634 {
3635 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3636 /* don't have to inform the HDD/Host */
3637 return;
3638 }
3639
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003640 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003641 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3642
3643 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3644
3645limGetWPSPBCSessionsEnd:
3646 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303647
3648 if (NULL != pSapEventCallback)
3649 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07003650}
3651
Jeff Johnson295189b2012-06-20 16:38:30 -07003652
3653
3654/**
3655 * __limCounterMeasures()
3656 *
3657 * FUNCTION:
3658 * This function is called to "implement" MIC counter measure
3659 * and is *temporary* only
3660 *
3661 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3662 * we don't do the proper STA disassoc sequence since the
3663 * BSS will be stoped anyway
3664 *
3665 *ASSUMPTIONS:
3666 *
3667 *NOTE:
3668 *
3669 * @param pMac Pointer to Global MAC structure
3670 * @return None
3671 */
3672
3673static void
3674__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3675{
3676 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
Abhishek Singh8944b222014-09-17 16:13:17 +05303677 /* If PMF is enabled then don't send broadcast disassociation */
3678 if ( ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
3679 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
3680 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
3681#ifdef WLAN_FEATURE_11W
3682 && !psessionEntry->limRmfEnabled
3683#endif
3684 )
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003685 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003686
Jeff Johnson295189b2012-06-20 16:38:30 -07003687};
3688
3689
Jeff Johnson295189b2012-06-20 16:38:30 -07003690void
3691limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3692{
3693 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3694 tpPESession psessionEntry;
3695 tANI_U8 sessionId; //PE sessionId
3696
3697 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3698 {
3699 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003700 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003701 return;
3702 }
3703
3704 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3705 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003706 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003707 return;
3708 }
3709
3710 if ( tkipCntrMeasReq.bEnable )
3711 {
3712 __limCounterMeasures( pMac, psessionEntry );
3713 }
3714
3715 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3716}
Jeff Johnson295189b2012-06-20 16:38:30 -07003717
3718
3719static void
3720__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3721{
3722 tSirSmeStopBssReq stopBssReq;
3723 tSirRetStatus status;
3724 tLimSmeStates prevState;
3725 tANI_U8 sessionId; //PE sessionId
3726 tpPESession psessionEntry;
3727 tANI_U8 smesessionId;
3728 tANI_U16 smetransactionId;
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303729 tANI_U8 i = 0;
3730 tpDphHashNode pStaDs = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003731
3732 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3733
3734
3735
3736 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3737 !limIsSmeStopBssReqValid(pMsgBuf))
3738 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003739 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003740 /// Send Stop BSS response to host
3741 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3742 return;
3743 }
3744
3745
3746 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3747 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003748 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003749 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3750 return;
3751 }
3752
3753#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3754 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3755#endif //FEATURE_WLAN_DIAG_SUPPORT
3756
3757
3758 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3759 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3760 {
3761 /**
3762 * Should not have received STOP_BSS_REQ in states
3763 * other than 'normal' state or on STA in Infrastructure
3764 * mode. Log error and return response to host.
3765 */
3766 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303767 FL("received unexpected SME_STOP_BSS_REQ in state %d, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003768 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3769 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3770 /// Send Stop BSS response to host
3771 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3772 return;
3773 }
3774
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3776 {
3777 limWPSPBCClose(pMac, psessionEntry);
3778 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003779 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003780
3781 prevState = psessionEntry->limSmeState;
3782
3783 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003784 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003785
3786 /* Update SME session Id and Transaction Id */
3787 psessionEntry->smeSessionId = smesessionId;
3788 psessionEntry->transactionId = smetransactionId;
3789
Abhishek Singh8944b222014-09-17 16:13:17 +05303790 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame.
3791 * If PMF is enabled then don't send broadcast disassociation */
3792 if ( ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) &&
3793 (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3794#ifdef WLAN_FEATURE_11W
3795 && !psessionEntry->limRmfEnabled
3796#endif
3797 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003798 {
3799 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3800 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3801 // Send disassoc all stations associated thru TKIP
3802 __limCounterMeasures(pMac,psessionEntry);
3803 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303804 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003805 }
3806
3807 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3808 pMac->lim.gLimIbssCoalescingHappened = false;
3809
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303810 for(i = 1 ; i < pMac->lim.gLimAssocStaLimit ; i++)
3811 {
3812 pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable);
3813 if (NULL == pStaDs)
3814 continue;
3815 status = limDelSta(pMac, pStaDs, false, psessionEntry) ;
3816 if(eSIR_SUCCESS == status)
3817 {
3818 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ;
3819 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ;
3820 }
3821 else
3822 {
3823 limLog(pMac, LOGE, FL("limDelSta failed with Status : %d"), status);
3824 VOS_ASSERT(0) ;
3825 }
3826 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003827 /* send a delBss to HAL and wait for a response */
3828 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3829
3830 if (status != eSIR_SUCCESS)
3831 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003832 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003833 psessionEntry->limSmeState= prevState;
3834
Jeff Johnsone7245742012-09-05 17:12:55 -07003835 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003836
3837 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3838 }
3839}
3840
3841
3842/**--------------------------------------------------------------
3843\fn __limProcessSmeStopBssReq
3844
3845\brief Wrapper for the function __limHandleSmeStopBssRequest
3846 This message will be defered until softmac come out of
3847 scan mode. Message should be handled even if we have
3848 detected radar in the current operating channel.
3849\param pMac
3850\param pMsg
3851
3852\return TRUE - If we consumed the buffer
3853 FALSE - If have defered the message.
3854 ---------------------------------------------------------------*/
3855static tANI_BOOLEAN
3856__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3857{
3858 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3859 {
3860 /**
3861 * If message defered, buffer is not consumed yet.
3862 * So return false
3863 */
3864 return eANI_BOOLEAN_FALSE;
3865 }
3866 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3867 return eANI_BOOLEAN_TRUE;
3868} /*** end __limProcessSmeStopBssReq() ***/
3869
3870
3871void limProcessSmeDelBssRsp(
3872 tpAniSirGlobal pMac,
3873 tANI_U32 body,tpPESession psessionEntry)
3874{
3875
3876 (void) body;
3877 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3878 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003879 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003880 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3881 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003882 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3883 return;
3884}
3885
3886
Jeff Johnson295189b2012-06-20 16:38:30 -07003887/**---------------------------------------------------------------
3888\fn __limProcessSmeAssocCnfNew
3889\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3890\ in BTAMP AP.
3891\
3892\param pMac
3893\param msgType - message type
3894\param pMsgBuf - a pointer to the SME message buffer
3895\return None
3896------------------------------------------------------------------*/
3897
3898 void
3899__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3900{
3901 tSirSmeAssocCnf assocCnf;
3902 tpDphHashNode pStaDs = NULL;
3903 tpPESession psessionEntry= NULL;
3904 tANI_U8 sessionId;
3905
3906
3907 if(pMsgBuf == NULL)
3908 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003909 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003910 goto end;
3911 }
3912
3913 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3914 !__limIsSmeAssocCnfValid(&assocCnf))
3915 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003916 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003917 goto end;
3918 }
3919
3920 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3921 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003922 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003923 goto end;
3924 }
3925
3926 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3927 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3928 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05303929 limLog(pMac, LOGE, FL("Received unexpected message %X in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303930 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 goto end;
3932 }
3933
3934 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3935
3936 if (pStaDs == NULL)
3937 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303938 limLog(pMac, LOGE,
3939 FL("Received invalid message %X due to no STA context, "
3940 "for aid %d, peer "),
3941 msgType, assocCnf.aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07003942 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3943
3944 /*
3945 ** send a DISASSOC_IND message to WSM to make sure
3946 ** the state in WSM and LIM is the same
3947 **/
3948 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3949 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3950 goto end;
3951 }
3952 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303953 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003954 (tANI_U8 *) assocCnf.peerMacAddr,
3955 sizeof(tSirMacAddr)) ) ||
3956 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3957 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3958 (msgType != eWNI_SME_ASSOC_CNF)) ||
3959 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003960 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003961 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303962 limLog(pMac, LOGE,
3963 FL("Received invalid message %X due to peerMacAddr mismatched "
3964 "or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "
3965 "StaD mlmState : %d"),
3966 msgType, assocCnf.aid, pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003967 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3968 goto end;
3969 }
3970
3971 /*
3972 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3973 ** has been received
3974 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003975 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003976 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3977
3978 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3979 {
3980 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3981 * when it had received Assoc Request frame. Now, PE just needs to send
3982 * Association Response frame to the requesting BTAMP-STA.
3983 */
3984 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003985 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003986 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3987 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3988 goto end;
3989 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3990 else
3991 {
3992 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3993 /*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*/
3994 if(!pStaDs->mlmStaContext.updateContext)
3995 pStaDs->mlmStaContext.updateContext = 1;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303996 limLog(pMac, LOG1, FL("Receive Assoc Cnf with status Code : %d(assoc id=%d) "),
3997 assocCnf.statusCode, pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003998 limRejectAssociation(pMac, pStaDs->staAddr,
3999 pStaDs->mlmStaContext.subType,
4000 true, pStaDs->mlmStaContext.authType,
4001 pStaDs->assocId, true,
4002 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004003 }
4004
4005end:
4006 if((psessionEntry != NULL) && (pStaDs != NULL))
4007 {
4008 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
4009 {
4010 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
4011 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304012 vos_mem_free(((tpSirAssocReq)
4013 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07004014 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4015 }
4016
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304017 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004018 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4019 }
4020 }
4021
4022} /*** end __limProcessSmeAssocCnfNew() ***/
4023
4024
Jeff Johnson295189b2012-06-20 16:38:30 -07004025
4026
4027static void
4028__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4029{
4030 tpDphHashNode pStaDs;
4031 tSirMacAddr peerMac;
4032 tpSirAddtsReq pSirAddts;
4033 tANI_U32 timeout;
4034 tpPESession psessionEntry;
4035 tANI_U8 sessionId; //PE sessionId
4036 tANI_U8 smesessionId;
4037 tANI_U16 smetransactionId;
4038
4039
4040 if(pMsgBuf == NULL)
4041 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004042 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004043 return;
4044 }
4045
4046 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4047
4048 pSirAddts = (tpSirAddtsReq) pMsgBuf;
4049
4050 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
4051 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004052 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004053 return;
4054 }
4055#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4056 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
4057#endif //FEATURE_WLAN_DIAG_SUPPORT
4058
4059
4060
4061 /* if sta
4062 * - verify assoc state
4063 * - send addts request to ap
4064 * - wait for addts response from ap
4065 * if ap, just ignore with error log
4066 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304067 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004068 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004069 pSirAddts->req.tspec.tsinfo.traffic.tsid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304070 pSirAddts->req.tspec.tsinfo.traffic.userPrio);
Jeff Johnson295189b2012-06-20 16:38:30 -07004071
4072 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
4073 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004074 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004075 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4076 smesessionId,smetransactionId);
4077 return;
4078 }
4079
Jeff Johnson295189b2012-06-20 16:38:30 -07004080 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4081
4082 if(pStaDs == NULL)
4083 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004084 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004085 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4086 smesessionId,smetransactionId);
4087 return;
4088 }
4089
4090 if ((! pStaDs->valid) ||
4091 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
4092 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004093 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004094 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4095 smesessionId,smetransactionId);
4096 return;
4097 }
4098
4099 pSirAddts->req.wsmTspecPresent = 0;
4100 pSirAddts->req.wmeTspecPresent = 0;
4101 pSirAddts->req.lleTspecPresent = 0;
4102
4103 if ((pStaDs->wsmEnabled) &&
4104 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
4105 pSirAddts->req.wsmTspecPresent = 1;
4106 else if (pStaDs->wmeEnabled)
4107 pSirAddts->req.wmeTspecPresent = 1;
4108 else if (pStaDs->lleEnabled)
4109 pSirAddts->req.lleTspecPresent = 1;
4110 else
4111 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004112 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004113 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4114 smesessionId,smetransactionId);
4115 return;
4116 }
4117
4118 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4119 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4120 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004121 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07004122 psessionEntry->limSmeState);
4123 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4124 smesessionId,smetransactionId);
4125 return;
4126 }
4127
4128 if (pMac->lim.gLimAddtsSent)
4129 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004130 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07004131 pMac->lim.gLimAddtsReq.req.dialogToken,
4132 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
4133 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
4134 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4135 smesessionId,smetransactionId);
4136 return;
4137 }
4138
4139 #if 0
4140 val = sizeof(tSirMacAddr);
4141 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
4142 {
4143 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004144 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004145 return;
4146 }
4147 #endif
4148 sirCopyMacAddr(peerMac,psessionEntry->bssId);
4149
4150 // save the addts request
4151 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304152 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07004153
4154 // ship out the message now
4155 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
4156 psessionEntry);
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304157 limLog(pMac, LOG1, FL("Sent ADDTS request"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004158
4159 // start a timer to wait for the response
4160 if (pSirAddts->timeout)
4161 timeout = pSirAddts->timeout;
4162 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
4163 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004164 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004165 WNI_CFG_ADDTS_RSP_TIMEOUT);
4166 return;
4167 }
4168
4169 timeout = SYS_MS_TO_TICKS(timeout);
4170 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
4171 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004172 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004173 return;
4174 }
4175 pMac->lim.gLimAddtsRspTimerCount++;
4176 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
4177 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
4178 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004179 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004180 return;
4181 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004182 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07004183
4184 //add the sessionId to the timer object
4185 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
4186 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
4187 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004188 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004189 return;
4190 }
4191 return;
4192}
4193
4194
4195static void
4196__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4197{
4198 tSirMacAddr peerMacAddr;
4199 tANI_U8 ac;
4200 tSirMacTSInfo *pTsinfo;
4201 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
4202 tpDphHashNode pStaDs = NULL;
4203 tpPESession psessionEntry;
4204 tANI_U8 sessionId;
4205 tANI_U32 status = eSIR_SUCCESS;
4206 tANI_U8 smesessionId;
4207 tANI_U16 smetransactionId;
4208
4209 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4210
4211 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
4212 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004213 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004214 status = eSIR_FAILURE;
4215 goto end;
4216 }
4217#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4218 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
4219#endif //FEATURE_WLAN_DIAG_SUPPORT
4220
4221
4222 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
4223 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004224 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004225 status = eSIR_FAILURE;
4226 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
4227 return;
4228 }
4229
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304230 limLog(pMac, LOG1, FL("Sent DELTS request to station with "
4231 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
4232 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004233
4234 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
4235 psessionEntry);
4236
4237 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
4238
4239 /* We've successfully send DELTS frame to AP. Update the
4240 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
4241 * is no longer trigger enabled or delivery enabled
4242 */
4243 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
4244
4245 /* We're deleting the TSPEC, so this particular AC is no longer
4246 * admitted. PE needs to downgrade the EDCA
4247 * parameters(for the AC for which TS is being deleted) to the
4248 * next best AC for which ACM is not enabled, and send the
4249 * updated values to HAL.
4250 */
4251 ac = upToAc(pTsinfo->traffic.userPrio);
4252
4253 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4254 {
4255 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4256 }
4257 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4258 {
4259 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4260 }
4261 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4262 {
4263 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4264 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4265 }
4266
4267 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4268
4269 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4270 if (pStaDs != NULL)
4271 {
4272 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4273 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4274 else
4275 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4276 status = eSIR_SUCCESS;
4277 }
4278 else
4279 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004280 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004281 status = eSIR_FAILURE;
4282 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004283#ifdef FEATURE_WLAN_ESE
4284#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004285 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4286#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004287 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004288#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004289#endif
4290
4291 // send an sme response back
4292 end:
4293 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4294}
4295
4296
4297void
4298limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4299{
4300 //fetch the sessionEntry based on the sessionId
4301 tpPESession psessionEntry;
4302 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4303 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004304 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004305 return;
4306 }
4307
4308 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4309 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004310 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004311 pMac->lim.gLimAddtsSent = false;
4312 return;
4313 }
4314
4315 if (! pMac->lim.gLimAddtsSent)
4316 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004317 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004318 return;
4319 }
4320
4321 if (param != pMac->lim.gLimAddtsRspTimerCount)
4322 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004323 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004324 param, pMac->lim.gLimAddtsRspTimerCount);
4325 return;
4326 }
4327
4328 // this a real response timeout
4329 pMac->lim.gLimAddtsSent = false;
4330 pMac->lim.gLimAddtsRspTimerCount++;
4331
4332 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4333 psessionEntry->smeSessionId, psessionEntry->transactionId);
4334}
4335
4336
4337/**
4338 * __limProcessSmeStatsRequest()
4339 *
4340 *FUNCTION:
4341 *
4342 *
4343 *NOTE:
4344 *
4345 * @param pMac Pointer to Global MAC structure
4346 * @param *pMsgBuf A pointer to the SME message buffer
4347 * @return None
4348 */
4349static void
4350__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4351{
4352 tpAniGetStatsReq pStatsReq;
4353 tSirMsgQ msgQ;
4354 tpPESession psessionEntry;
4355 tANI_U8 sessionId;
4356
4357
4358 if(pMsgBuf == NULL)
4359 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004360 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004361 return;
4362 }
4363
4364 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4365
4366 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4367 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004368 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304369 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004370 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004371 return;
4372 }
4373
4374
4375
4376 switch(pStatsReq->msgType)
4377 {
4378 //Add Lim stats here. and send reqsponse.
4379
4380 //HAL maintained Stats.
4381 case eWNI_SME_STA_STAT_REQ:
4382 msgQ.type = WDA_STA_STAT_REQ;
4383 break;
4384 case eWNI_SME_AGGR_STAT_REQ:
4385 msgQ.type = WDA_AGGR_STAT_REQ;
4386 break;
4387 case eWNI_SME_GLOBAL_STAT_REQ:
4388 msgQ.type = WDA_GLOBAL_STAT_REQ;
4389 break;
4390 case eWNI_SME_STAT_SUMM_REQ:
4391 msgQ.type = WDA_STAT_SUMM_REQ;
4392 break;
4393 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004394 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304395 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004396 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004397 return;
4398 }
4399
Jeff Johnson295189b2012-06-20 16:38:30 -07004400 msgQ.reserved = 0;
4401 msgQ.bodyptr = pMsgBuf;
4402 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004403 if(NULL == psessionEntry)
4404 {
4405 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4406 }
4407 else
4408 {
4409 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4410 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004411 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004412 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304413 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004414 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004415 return;
4416 }
4417
4418 return;
4419}
4420
4421
4422/**
4423 * __limProcessSmeGetStatisticsRequest()
4424 *
4425 *FUNCTION:
4426 *
4427 *
4428 *NOTE:
4429 *
4430 * @param pMac Pointer to Global MAC structure
4431 * @param *pMsgBuf A pointer to the SME message buffer
4432 * @return None
4433 */
4434static void
4435__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4436{
4437 tpAniGetPEStatsReq pPEStatsReq;
4438 tSirMsgQ msgQ;
4439
4440 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4441
4442 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4443
4444 msgQ.type = WDA_GET_STATISTICS_REQ;
4445
Jeff Johnson295189b2012-06-20 16:38:30 -07004446 msgQ.reserved = 0;
4447 msgQ.bodyptr = pMsgBuf;
4448 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004449 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004450
4451 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304452 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004453 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004454 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004455 return;
4456 }
4457
4458 return;
4459}
4460
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004461#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004462/**
4463 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4464 *
4465 *NOTE:
4466 *
4467 * @param pMac Pointer to Global MAC structure
4468 * @param *pMsgBuf A pointer to the SME message buffer
4469 * @return None
4470 */
4471static void
4472__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4473{
4474 tSirMsgQ msgQ;
4475
4476 msgQ.type = WDA_TSM_STATS_REQ;
4477 msgQ.reserved = 0;
4478 msgQ.bodyptr = pMsgBuf;
4479 msgQ.bodyval = 0;
4480 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4481
4482 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4483 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004484 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004485 limLog(pMac, LOGP, "Unable to forward request");
4486 return;
4487 }
4488}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004489#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004490
4491
Jeff Johnson295189b2012-06-20 16:38:30 -07004492
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004493#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004494/**
4495 * __limProcessSmeGetRoamRssiRequest()
4496 *
4497 *FUNCTION:
4498 *
4499 *
4500 *NOTE:
4501 *
4502 * @param pMac Pointer to Global MAC structure
4503 * @param *pMsgBuf A pointer to the SME message buffer
4504 * @return None
4505 */
4506static void
4507__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4508{
4509 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4510 tSirMsgQ msgQ;
4511
4512 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4513 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4514
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004515 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 ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304521 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004522 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004523 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004524 return;
4525 }
4526
4527 return;
4528}
4529#endif
4530
4531
Jeff Johnson295189b2012-06-20 16:38:30 -07004532static void
4533__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4534{
4535 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4536 tpPESession psessionEntry;
4537 tANI_U8 sessionId; //PE sessionID
4538
4539 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004540 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004541
4542 if(pMsgBuf == NULL)
4543 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004544 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004545 return;
4546 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004547
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304548 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4549 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004550 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304551 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004552 return;
4553 }
4554
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004555 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004556 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004557 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004558 goto end;
4559 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004560
Jeff Johnson295189b2012-06-20 16:38:30 -07004561 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4562 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004563 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004564 goto end;
4565 }
4566
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304567 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004568
Jeff Johnson295189b2012-06-20 16:38:30 -07004569 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004570 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004571
4572end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304573 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004574 return;
4575} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4576
4577static void
4578__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4579{
4580 tpSirUpdateParams pUpdateParams;
4581 tpPESession psessionEntry;
4582
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304583 limLog(pMac, LOG1,
4584 FL("received SME_HIDE_SSID message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004585
4586 if(pMsgBuf == NULL)
4587 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004588 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004589 return;
4590 }
4591
4592 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4593
4594 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4595 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004596 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004597 pUpdateParams->sessionId);
4598 return;
4599 }
4600
4601 /* Update the session entry */
4602 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4603
4604 /* Update beacon */
4605 schSetFixedBeaconFields(pMac, psessionEntry);
4606 limSendBeaconInd(pMac, psessionEntry);
4607
4608 return;
4609} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4610
4611static void
4612__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4613{
4614 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4615 tpPESession psessionEntry;
4616 tANI_U8 sessionId; //PE sessionID
4617
4618 if(pMsgBuf == NULL)
4619 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004620 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004621 return;
4622 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304623
4624 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4625 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004626 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304627 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004628 return;
4629 }
4630
4631 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4632 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004633 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004634 goto end;
4635 }
4636
4637 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4638 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004639 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004640 goto end;
4641 }
4642
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304643 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4644 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004645
4646 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4647
4648 psessionEntry->pLimStartBssReq->privacy = 1;
4649 psessionEntry->privacy = 1;
4650
4651 schSetFixedBeaconFields(pMac, psessionEntry);
4652 limSendBeaconInd(pMac, psessionEntry);
4653
4654end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304655 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004656 return;
4657} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4658
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004659/*
4660Update the beacon Interval dynamically if beaconInterval is different in MCC
4661*/
4662static void
4663__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4664{
4665 tpSirChangeBIParams pChangeBIParams;
4666 tpPESession psessionEntry;
4667 tANI_U8 sessionId = 0;
4668 tUpdateBeaconParams beaconParams;
4669
4670 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004671 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004672
4673 if(pMsgBuf == NULL)
4674 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004675 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004676 return;
4677 }
4678
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304679 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004680 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4681
4682 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4683 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004684 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004685 return;
4686 }
4687
4688 /*Update sessionEntry Beacon Interval*/
4689 if(psessionEntry->beaconParams.beaconInterval !=
4690 pChangeBIParams->beaconInterval )
4691 {
4692 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4693 }
4694
4695 /*Update sch beaconInterval*/
4696 if(pMac->sch.schObject.gSchBeaconInterval !=
4697 pChangeBIParams->beaconInterval )
4698 {
4699 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4700
4701 PELOG1(limLog(pMac, LOG1,
4702 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4703
4704 /* Update beacon */
4705 schSetFixedBeaconFields(pMac, psessionEntry);
4706
Sunil Ravib96f7b52013-05-22 21:40:05 -07004707 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004708 //Set change in beacon Interval
4709 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004710 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004711 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4712 }
4713
4714 return;
4715} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4716
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304717/** -------------------------------------------------------------
4718\fn
4719\brief handles indication message from HDD to update HT mode
4720\param tpAniSirGlobal pMac
4721\param tANI_U32 pMsgBuf
4722\return None
4723-------------------------------------------------------------*/
4724#ifdef WLAN_FEATURE_AP_HT40_24G
4725static void __limProcessSmeSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4726{
4727 tpSirSetHT2040Mode pSetHT2040Mode;
4728 tpPESession psessionEntry;
4729 tANI_U8 sessionId = 0;
4730 tUpdateVHTOpMode *pHtOpMode = NULL;
4731 vos_msg_t msg;
Jeff Johnson295189b2012-06-20 16:38:30 -07004732
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304733 PELOG1(limLog(pMac, LOGRW,
4734 FL("received Set HT 20/40 mode message")););
4735
4736 if(pMsgBuf == NULL)
4737 {
4738 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
4739 return;
4740 }
4741
4742 pSetHT2040Mode = (tpSirSetHT2040Mode)pMsgBuf;
4743
4744 if((psessionEntry = peFindSessionByBssid(pMac, pSetHT2040Mode->bssId,
4745 &sessionId)) == NULL)
4746 {
4747 limLog(pMac, LOGE, FL("Session does not exist for given BSSID "));
4748 limPrintMacAddr(pMac, pSetHT2040Mode->bssId, LOGE);
4749 return;
4750 }
4751
4752 limLog(pMac, LOGW, FL("Update session entry for cbMod=%d"),
4753 pSetHT2040Mode->cbMode);
4754
4755 /*Update sessionEntry HT related fields*/
4756 switch(pSetHT2040Mode->cbMode)
4757 {
4758 case PHY_SINGLE_CHANNEL_CENTERED:
4759 psessionEntry->htSecondaryChannelOffset = PHY_SINGLE_CHANNEL_CENTERED;
4760 psessionEntry->htRecommendedTxWidthSet = 0;
4761 break;
4762 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
4763 psessionEntry->htSecondaryChannelOffset =
4764 PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
4765 psessionEntry->htRecommendedTxWidthSet = 1;
4766 break;
4767 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
4768 psessionEntry->htSecondaryChannelOffset =
4769 PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
4770 psessionEntry->htRecommendedTxWidthSet = 1;
4771 break;
4772 default:
4773 limLog(pMac, LOGE,FL("Invalid cbMode"));
4774 return;
4775 }
4776
4777 limLog(pMac, LOGW, FL("Channel Bonding mode : %d"
4778 " htSecondaryChannelOffset: %d"
4779 " htRecommendedTxWidthSet :%d"),
4780 pSetHT2040Mode->cbMode,
4781 psessionEntry->htSecondaryChannelOffset,
4782 psessionEntry->htRecommendedTxWidthSet);
4783
4784 limLog(pMac, LOGW, FL("Update Beacon IEs"));
4785
4786 /* Update beacon */
4787 schSetFixedBeaconFields(pMac, psessionEntry);
4788 limSendBeaconInd(pMac, psessionEntry);
4789
4790 /* Update OP Mode */
4791 pHtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode));
4792 if ( NULL == pHtOpMode )
4793 {
4794 limLog(pMac, LOGE,
4795 FL("Not able to allocate memory for setting OP mode"));
4796 return;
4797 }
4798
4799 pHtOpMode->opMode = (psessionEntry->htSecondaryChannelOffset ==
4800 PHY_SINGLE_CHANNEL_CENTERED)?
4801 eHT_CHANNEL_WIDTH_20MHZ:eHT_CHANNEL_WIDTH_40MHZ;
4802
4803 /* Pass Self STA ID to FW. Based on Self STA ID FW will update the
4804 * operating mode for all connected STA.
4805 */
4806
4807 pHtOpMode->staId = psessionEntry->staId;
4808
4809 msg.type = WDA_UPDATE_OP_MODE;
4810 msg.reserved = 0;
4811 msg.bodyptr = pHtOpMode;
4812
4813 if (!VOS_IS_STATUS_SUCCESS(
4814 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
4815 {
4816 limLog(pMac, LOGE,
4817 FL("Not able to post WDA_UPDATE_OP_MODE message to WDA"));
4818 vos_mem_free(pHtOpMode);
4819 return;
4820 }
4821
4822 limLog(pMac, LOGW,
4823 FL("Notifed FW about OP mode: %d for staId=%d"),
4824 pHtOpMode->opMode, pHtOpMode->staId);
4825
4826 return;
4827}
4828#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004829
4830/** -------------------------------------------------------------
4831\fn limProcessSmeDelBaPeerInd
4832\brief handles indication message from HDD to send delete BA request
4833\param tpAniSirGlobal pMac
4834\param tANI_U32 pMsgBuf
4835\return None
4836-------------------------------------------------------------*/
4837void
4838limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4839{
4840 tANI_U16 assocId =0;
4841 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4842 tpDphHashNode pSta;
4843 tpPESession psessionEntry;
4844 tANI_U8 sessionId;
4845
4846
4847
4848 if(NULL == pSmeDelBAPeerInd)
4849 return;
4850
4851 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4852 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004853 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004854 return;
4855 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004856 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004857 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4858
4859 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4860 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4861 pSta,
4862 pSmeDelBAPeerInd->baDirection,
4863 pSmeDelBAPeerInd->baTID,
4864 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4865 {
4866 limLog( pMac, LOGW,
4867 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4868 if (pSta)
4869 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4870 }
4871}
4872
4873// --------------------------------------------------------------------
4874/**
4875 * __limProcessReportMessage
4876 *
4877 * FUNCTION: Processes the next received Radio Resource Management message
4878 *
4879 * LOGIC:
4880 *
4881 * ASSUMPTIONS:
4882 *
4883 * NOTE:
4884 *
4885 * @param None
4886 * @return None
4887 */
4888
4889void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4890{
4891#ifdef WLAN_FEATURE_VOWIFI
4892 switch (pMsg->type)
4893 {
4894 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4895 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4896 break;
4897 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4898 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004899#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004900 tpSirBeaconReportXmitInd pBcnReport=NULL;
4901 tpPESession psessionEntry=NULL;
4902 tANI_U8 sessionId;
4903
4904 if(pMsg->bodyptr == NULL)
4905 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004906 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004907 return;
4908 }
4909 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4910 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4911 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004912 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004913 return;
4914 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004915 if (psessionEntry->isESEconnection)
4916 eseProcessBeaconReportXmit( pMac, pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004917 else
4918#endif
4919 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4920 }
4921 break;
4922 }
4923#endif
4924}
4925
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004926#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI)
Jeff Johnson295189b2012-06-20 16:38:30 -07004927// --------------------------------------------------------------------
4928/**
4929 * limSendSetMaxTxPowerReq
4930 *
4931 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4932 *
4933 * LOGIC:
4934 *
4935 * ASSUMPTIONS:
4936 *
4937 * NOTE:
4938 *
4939 * @param txPower txPower to be set.
4940 * @param pSessionEntry session entry.
4941 * @return None
4942 */
4943tSirRetStatus
4944limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4945{
4946 tpMaxTxPowerParams pMaxTxParams = NULL;
4947 tSirRetStatus retCode = eSIR_SUCCESS;
4948 tSirMsgQ msgQ;
4949
4950 if( pSessionEntry == NULL )
4951 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004952 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004953 return eSIR_FAILURE;
4954 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304955
4956 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4957 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004958 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004959 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004960 return eSIR_MEM_ALLOC_FAILED;
4961
4962 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004963#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304964 limLog( pMac, LOG1,
4965 FL(" Allocated memory for pMaxTxParams, which will be freed in other module"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004966#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004967 if( pMaxTxParams == NULL )
4968 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304969 limLog( pMac, LOGE, FL("pMaxTxParams is NULL"));
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004970 return eSIR_FAILURE;
4971 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004972 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304973 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4974 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004975
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004976 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4977 msgQ.bodyptr = pMaxTxParams;
4978 msgQ.bodyval = 0;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304979 limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004980 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
4981 retCode = wdaPostCtrlMsg(pMac, &msgQ);
4982 if (eSIR_SUCCESS != retCode)
4983 {
4984 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304985 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004986 }
4987 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004988}
4989#endif
4990
4991/**
4992 * __limProcessSmeAddStaSelfReq()
4993 *
4994 *FUNCTION:
4995 * This function is called to process SME_ADD_STA_SELF_REQ message
4996 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4997 *
4998 *LOGIC:
4999 *
5000 *ASSUMPTIONS:
5001 *
5002 *NOTE:
5003 *
5004 * @param pMac Pointer to Global MAC structure
5005 * @param *pMsgBuf A pointer to the SME message buffer
5006 * @return None
5007 */
5008
5009static void
5010__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5011{
5012 tSirMsgQ msg;
5013 tpAddStaSelfParams pAddStaSelfParams;
5014 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
5015
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305016 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
5017 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005018 {
5019 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
5020 return;
5021 }
5022
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305023 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07005024 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07005025 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
5026 msg.reserved = 0;
5027 msg.bodyptr = pAddStaSelfParams;
5028 msg.bodyval = 0;
5029
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005030 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005031 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005032
5033 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5034 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005035 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005036 }
5037 return;
5038} /*** end __limProcessAddStaSelfReq() ***/
5039
5040
5041/**
5042 * __limProcessSmeDelStaSelfReq()
5043 *
5044 *FUNCTION:
5045 * This function is called to process SME_DEL_STA_SELF_REQ message
5046 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
5047 *
5048 *LOGIC:
5049 *
5050 *ASSUMPTIONS:
5051 *
5052 *NOTE:
5053 *
5054 * @param pMac Pointer to Global MAC structure
5055 * @param *pMsgBuf A pointer to the SME message buffer
5056 * @return None
5057 */
5058
5059static void
5060__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5061{
5062 tSirMsgQ msg;
5063 tpDelStaSelfParams pDelStaSelfParams;
5064 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
5065
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305066 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
5067 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005068 {
5069 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
5070 return;
5071 }
5072
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305073 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005074
5075 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
5076 msg.reserved = 0;
5077 msg.bodyptr = pDelStaSelfParams;
5078 msg.bodyval = 0;
5079
Mukul Sharmacaf4aca2015-04-17 20:01:40 +05305080 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_DEL_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005081 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005082
5083 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5084 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005085 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005086 }
5087 return;
5088} /*** end __limProcessSmeDelStaSelfReq() ***/
5089
5090
Jeff Johnson295189b2012-06-20 16:38:30 -07005091/**
5092 * __limProcessSmeRegisterMgmtFrameReq()
5093 *
5094 *FUNCTION:
5095 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
5096 * from SME. It Register this information within PE.
5097 *
5098 *LOGIC:
5099 *
5100 *ASSUMPTIONS:
5101 *
5102 *NOTE:
5103 *
5104 * @param pMac Pointer to Global MAC structure
5105 * @param *pMsgBuf A pointer to the SME message buffer
5106 * @return None
5107 */
5108static void
5109__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5110{
5111 VOS_STATUS vosStatus;
5112 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
5113 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005114 tANI_BOOLEAN match = VOS_FALSE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305115 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005116 FL("registerFrame %d, frameType %d, matchLen %d"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305117 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005118
Jeff Johnsond13512a2012-07-17 11:42:19 -07005119 /* First check whether entry exists already*/
5120
5121 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5122 (vos_list_node_t**)&pLimMgmtRegistration);
5123
5124 while(pLimMgmtRegistration != NULL)
5125 {
5126 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
5127 {
5128 if(pSmeReq->matchLen)
5129 {
5130 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
5131 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305132 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07005133 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
5134 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005135 /* found match! */
5136 match = VOS_TRUE;
5137 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005138 }
5139 }
5140 }
5141 else
5142 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005143 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07005144 match = VOS_TRUE;
5145 break;
5146 }
5147 }
5148 vosStatus = vos_list_peek_next (
5149 &pMac->lim.gLimMgmtFrameRegistratinQueue,
5150 (vos_list_node_t*) pLimMgmtRegistration,
5151 (vos_list_node_t**) &pNext );
5152
5153 pLimMgmtRegistration = pNext;
5154 pNext = NULL;
5155
5156 }
5157
5158 if (match)
5159 {
5160 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5161 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305162 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07005163 }
5164
Jeff Johnson295189b2012-06-20 16:38:30 -07005165 if(pSmeReq->registerFrame)
5166 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305167 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
5168 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005169 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305170 vos_mem_set((void*)pLimMgmtRegistration,
5171 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005172 pLimMgmtRegistration->frameType = pSmeReq->frameType;
5173 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
5174 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
5175 if(pSmeReq->matchLen)
5176 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305177 vos_mem_copy(pLimMgmtRegistration->matchData,
5178 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005179 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005180 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5181 &pLimMgmtRegistration->node);
5182 }
5183 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005184
5185 return;
5186} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08005187
5188static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08005189__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08005190{
5191 tpP2pPsParams pMsgNoA;
5192 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08005193
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305194 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
5195 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08005196 {
5197 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005198 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08005199 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005200 }
5201
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305202 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08005203 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
5204 pMsgNoA->opp_ps = 0;
5205 pMsgNoA->ctWindow = 0;
5206 pMsgNoA->duration = 0;
5207 pMsgNoA->interval = 0;
5208 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08005209
Vinay Malekal62757362012-12-17 12:15:51 -08005210 /* Below params used for Single Shot NOA - so assign proper values */
5211 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08005212 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08005213
Viral Modid86bde22012-12-10 13:09:21 -08005214 /* Start Insert NOA timer
5215 * 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 -08005216 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
5217 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08005218 */
5219 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
5220 == TX_TIMER_ERROR)
5221 {
5222 /// Could not activate Insert NOA timer.
5223 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005224 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08005225
5226 // send the scan response back with status failure and do not even call insert NOA
5227 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305228 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08005229 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005230 }
5231
Viral Modid440e682013-03-06 02:25:31 -08005232 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
5233
Viral Modid86bde22012-12-10 13:09:21 -08005234 msg.type = WDA_SET_P2P_GO_NOA_REQ;
5235 msg.reserved = 0;
5236 msg.bodyptr = pMsgNoA;
5237 msg.bodyval = 0;
5238
5239 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5240 {
5241 /* 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 -07005242 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08005243 /* Deactivate the NOA timer in failure case */
5244 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
5245 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005246 }
Viral Modid440e682013-03-06 02:25:31 -08005247 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08005248
Viral Modid440e682013-03-06 02:25:31 -08005249error:
5250 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
5251 * worrying about the NOA
5252 */
5253 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
5254 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08005255 return FALSE;
5256
5257}
5258
Viral Modid440e682013-03-06 02:25:31 -08005259static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
5260{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005261 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08005262 pMac->lim.gDeferMsgTypeForNOA = msgType;
5263 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
5264}
5265
5266static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5267{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005268 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08005269 pMac->lim.gDeferMsgTypeForNOA = 0;
5270 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
5271 {
5272 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305273 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005274 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5275 }
5276}
5277
5278static
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305279tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType,
5280 tANI_U32 *pMsgBuf, tANI_BOOLEAN isPassiveScan)
Viral Modid440e682013-03-06 02:25:31 -08005281{
5282 tANI_U32 noaDuration = 0;
5283
5284 switch (msgType)
5285 {
5286 case eWNI_SME_SCAN_REQ:
5287 {
5288 tANI_U32 val;
5289 tANI_U8 i;
5290 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
5291 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
5292 {
5293 /*
5294 * Could not get max channel value
5295 * from CFG. Log error.
5296 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005297 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08005298
5299 /* use a default value of 110ms */
5300 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
5301 }
5302
5303 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
5304 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
5305
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05305306 if (pMac->miracast_mode) {
5307 noaDuration += DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST +
5308 DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
5309 } else if (isPassiveScan || !limActiveScanAllowed(pMac, channelNum)) {
Viral Modid440e682013-03-06 02:25:31 -08005310 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
5311 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
5312 */
5313 noaDuration += val;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305314 } else {
5315 /* Use min + max channel time to calculate the total duration of scan */
5316 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
Viral Modid440e682013-03-06 02:25:31 -08005317 }
5318 }
5319
5320 /* Adding an overhead of 20ms to account for the scan messaging delays */
5321 noaDuration += SCAN_MESSAGING_OVERHEAD;
5322 noaDuration *= CONV_MS_TO_US;
5323
5324 break;
5325 }
5326
5327 case eWNI_SME_OEM_DATA_REQ:
5328 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
5329 break;
5330
5331 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5332 {
5333 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
5334 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
5335 break;
5336 }
5337
5338 case eWNI_SME_JOIN_REQ:
5339 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
5340 break;
5341
5342 default:
5343 noaDuration = 0;
5344 break;
5345
5346 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005347 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08005348 return noaDuration;
5349}
5350
5351void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5352{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305353 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08005354
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005355 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005356 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
5357 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
5358 {
5359 switch (pMac->lim.gDeferMsgTypeForNOA)
5360 {
5361 case eWNI_SME_SCAN_REQ:
5362 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5363 break;
5364 case eWNI_SME_OEM_DATA_REQ:
5365 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5366 break;
5367 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305368 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5369 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
5370 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
5371 */
5372 if (FALSE == bufConsumed)
5373 {
5374 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5375 }
Viral Modid440e682013-03-06 02:25:31 -08005376 break;
5377 case eWNI_SME_JOIN_REQ:
5378 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5379 break;
5380 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005381 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005382 break;
5383 }
5384 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5385 }
5386 else
5387 {
5388 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005389 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005390 }
5391}
Jeff Johnson295189b2012-06-20 16:38:30 -07005392
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305393static void
5394__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5395{
5396 tpSirResetAPCapsChange pResetCapsChange;
5397 tpPESession psessionEntry;
5398 tANI_U8 sessionId = 0;
5399 if (pMsgBuf == NULL)
5400 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005401 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305402 return;
5403 }
5404
5405 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5406 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5407 if (psessionEntry == NULL)
5408 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005409 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305410 return;
5411 }
5412
5413 psessionEntry->limSentCapsChangeNtf = false;
5414 return;
5415}
5416
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305417static void
5418__limProcessSmeSpoofMacAddrRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5419{
5420 tSirMsgQ msg;
5421 tpSpoofMacAddrReqParams pSpoofMacAddrParams;
5422 tpSirSpoofMacAddrReq pSmeReq = (tpSirSpoofMacAddrReq) pMsgBuf;
5423
5424 pSpoofMacAddrParams = vos_mem_malloc(sizeof( tSpoofMacAddrReqParams));
5425 if ( NULL == pSpoofMacAddrParams )
5426 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305427 limLog( pMac, LOGE, FL("Unable to allocate memory for tDelStaSelfParams") );
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305428 return;
5429 }
5430
5431 vos_mem_copy( pSpoofMacAddrParams->macAddr, pSmeReq->macAddr, sizeof(tSirMacAddr) );
5432
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305433 vos_mem_copy(pMac->lim.spoofMacAddr, pSmeReq->macAddr, VOS_MAC_ADDRESS_LEN);
5434
5435 limLog( pMac, LOG1, FL("Recieved Spoofed Mac Addr request with Addr:"
5436 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pMac->lim.spoofMacAddr) );
5437
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305438 msg.type = WDA_SPOOF_MAC_ADDR_REQ;
5439 msg.reserved = 0;
5440 msg.bodyptr = pSpoofMacAddrParams;
5441 msg.bodyval = 0;
5442
5443 limLog(pMac, LOG1, FL("sending SIR_HAL_SPOOF_MAC_ADDR_REQ msg to HAL"));
5444 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
5445
5446 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5447 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305448 limLog(pMac, LOGE, FL("wdaPostCtrlMsg failed for SIR_HAL_SPOOF_MAC_ADDR_REQ"));
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305449 vos_mem_free(pSpoofMacAddrParams);
5450 }
5451 return;
5452}
5453
Jeff Johnson295189b2012-06-20 16:38:30 -07005454/**
5455 * limProcessSmeReqMessages()
5456 *
5457 *FUNCTION:
5458 * This function is called by limProcessMessageQueue(). This
5459 * function processes SME request messages from HDD or upper layer
5460 * application.
5461 *
5462 *LOGIC:
5463 *
5464 *ASSUMPTIONS:
5465 *
5466 *NOTE:
5467 *
5468 * @param pMac Pointer to Global MAC structure
5469 * @param msgType Indicates the SME message type
5470 * @param *pMsgBuf A pointer to the SME message buffer
5471 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5472 * FALSE - if pMsgBuf is not to be freed.
5473 */
5474
5475tANI_BOOLEAN
5476limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5477{
5478 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5479 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005480 tpSirSmeScanReq pScanReq;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305481 tANI_BOOLEAN isPassiveScan = FALSE;
5482
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005483 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 -07005484 limMsgStr(pMsg->type), pMsg->type,
5485 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5486 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5487
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005488 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005489 /* Special handling of some SME Req msgs where we have an existing GO session and
5490 * want to insert NOA before processing those msgs. These msgs will be processed later when
5491 * start event happens
5492 */
Sachin Ahuja42354142015-01-06 19:48:35 +05305493 MTRACE(macTraceMsgRx(pMac, NO_SESSION, pMsg->type));
Viral Modid440e682013-03-06 02:25:31 -08005494 switch (pMsg->type)
5495 {
5496 case eWNI_SME_SCAN_REQ:
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305497 pScanReq = (tpSirSmeScanReq) pMsgBuf;
5498 isPassiveScan = (pScanReq->scanType == eSIR_PASSIVE_SCAN) ? TRUE : FALSE;
Viral Modid440e682013-03-06 02:25:31 -08005499 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005500
5501 /* If scan is disabled return from here
5502 */
5503 if (pMac->lim.fScanDisabled)
5504 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005505 if (pMsg->type == eWNI_SME_SCAN_REQ)
5506 {
5507 limSendSmeScanRsp(pMac,
5508 offsetof(tSirSmeScanRsp,bssDescription[0]),
5509 eSIR_SME_INVALID_PARAMETERS,
5510 pScanReq->sessionId,
5511 pScanReq->transactionId);
5512
5513 bufConsumed = TRUE;
5514 }
5515 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5516 {
5517 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5518 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5519 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5520
5521 /*
5522 * limRemainOnChnRsp will free the buffer this change is to
5523 * avoid "double free"
5524 */
5525 bufConsumed = FALSE;
5526 }
5527
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305528 limLog(pMac, LOGE,
5529 FL("Error: Scan Disabled."
5530 " Return with error status for SME Message %s(%d)"),
5531 limMsgStr(pMsg->type), pMsg->type);
5532
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005533 return bufConsumed;
5534 }
5535 /*
5536 * Do not add BREAK here
5537 */
5538 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005539 case eWNI_SME_JOIN_REQ:
5540 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5541 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5542 {
5543 tANI_U32 noaDuration;
5544 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305545 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf, isPassiveScan);
Viral Modid440e682013-03-06 02:25:31 -08005546 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5547 return bufConsumed;
5548 }
5549 }
5550 /* If no insert NOA required then execute the code below */
5551
Jeff Johnson295189b2012-06-20 16:38:30 -07005552 switch (pMsg->type)
5553 {
5554 case eWNI_SME_START_REQ:
5555 __limProcessSmeStartReq(pMac, pMsgBuf);
5556 break;
5557
5558 case eWNI_SME_SYS_READY_IND:
5559 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5560 break;
5561
Jeff Johnson295189b2012-06-20 16:38:30 -07005562 case eWNI_SME_START_BSS_REQ:
5563 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5564 break;
5565
5566 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005567 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005568 break;
5569
Jeff Johnsone7245742012-09-05 17:12:55 -07005570#ifdef FEATURE_OEM_DATA_SUPPORT
5571 case eWNI_SME_OEM_DATA_REQ:
5572 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005573 break;
5574#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005575 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5576 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5577 break;
5578
5579 case eWNI_SME_UPDATE_NOA:
5580 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5581 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305582 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5583 __limProcessClearDfsChannelList(pMac, pMsg);
5584 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005585 case eWNI_SME_JOIN_REQ:
5586 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005587 break;
5588
5589 case eWNI_SME_AUTH_REQ:
5590 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5591
5592 break;
5593
5594 case eWNI_SME_REASSOC_REQ:
5595 __limProcessSmeReassocReq(pMac, pMsgBuf);
5596
5597 break;
5598
5599 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5600 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5601
5602 break;
5603
5604 case eWNI_SME_DISASSOC_REQ:
5605 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5606
5607 break;
5608
5609 case eWNI_SME_DISASSOC_CNF:
5610 case eWNI_SME_DEAUTH_CNF:
5611 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5612
5613 break;
5614
5615 case eWNI_SME_DEAUTH_REQ:
5616 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5617
5618 break;
5619
Jeff Johnson295189b2012-06-20 16:38:30 -07005620
5621
5622 case eWNI_SME_SETCONTEXT_REQ:
5623 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5624
5625 break;
5626
5627 case eWNI_SME_REMOVEKEY_REQ:
5628 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5629
5630 break;
5631
5632 case eWNI_SME_STOP_BSS_REQ:
5633 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5634 break;
5635
5636 case eWNI_SME_ASSOC_CNF:
5637 case eWNI_SME_REASSOC_CNF:
5638 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305639 limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005640 else
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305641 limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005642 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5643 break;
5644
5645 case eWNI_SME_ADDTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305646 limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005647 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5648 break;
5649
5650 case eWNI_SME_DELTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305651 limLog(pMac, LOG1, FL("Received DELTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005652 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5653 break;
5654
5655 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305656 limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005657 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5658 break;
5659
5660 case eWNI_SME_STA_STAT_REQ:
5661 case eWNI_SME_AGGR_STAT_REQ:
5662 case eWNI_SME_GLOBAL_STAT_REQ:
5663 case eWNI_SME_STAT_SUMM_REQ:
5664 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5665 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5666 bufConsumed = FALSE;
5667 break;
5668 case eWNI_SME_GET_STATISTICS_REQ:
5669 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5670 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5671 bufConsumed = FALSE;
5672 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005673#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005674 case eWNI_SME_GET_ROAM_RSSI_REQ:
5675 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5676 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5677 bufConsumed = FALSE;
5678 break;
5679#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005680#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005681 case eWNI_SME_GET_TSM_STATS_REQ:
5682 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5683 bufConsumed = FALSE;
5684 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005685#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005686 case eWNI_SME_DEL_BA_PEER_IND:
5687 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5688 break;
5689 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5690 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5691 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005692 case eWNI_SME_GET_ASSOC_STAS_REQ:
5693 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5694 break;
5695 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5696 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5697 break;
5698
5699 case eWNI_SME_HIDE_SSID_REQ:
5700 __limProcessSmeHideSSID(pMac, pMsgBuf);
5701 break;
5702 case eWNI_SME_UPDATE_APWPSIE_REQ:
5703 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5704 break;
5705 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5706 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5707 break;
5708
5709 case eWNI_SME_SET_APWPARSNIEs_REQ:
5710 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5711 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005712
5713 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5714 //Update the beaconInterval
5715 __limProcessSmeChangeBI(pMac, pMsgBuf );
5716 break;
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05305717
5718#ifdef WLAN_FEATURE_AP_HT40_24G
5719 case eWNI_SME_SET_HT_2040_MODE:
5720 __limProcessSmeSetHT2040Mode(pMac, pMsgBuf);
5721 break;
5722#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005723
5724#if defined WLAN_FEATURE_VOWIFI
5725 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5726 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5727 __limProcessReportMessage(pMac, pMsg);
5728 break;
5729#endif
5730
5731#if defined WLAN_FEATURE_VOWIFI_11R
5732 case eWNI_SME_FT_PRE_AUTH_REQ:
5733 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5734 break;
5735 case eWNI_SME_FT_UPDATE_KEY:
5736 limProcessFTUpdateKey(pMac, pMsgBuf);
5737 break;
5738
5739 case eWNI_SME_FT_AGGR_QOS_REQ:
5740 limProcessFTAggrQosReq(pMac, pMsgBuf);
5741 break;
5742#endif
5743
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005744#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
5745 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07005746 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5747 break;
5748#endif
5749 case eWNI_SME_ADD_STA_SELF_REQ:
5750 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5751 break;
5752 case eWNI_SME_DEL_STA_SELF_REQ:
5753 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5754 break;
5755
Jeff Johnson295189b2012-06-20 16:38:30 -07005756 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5757 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5758 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005759#ifdef FEATURE_WLAN_TDLS
5760 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5761 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5762 break;
5763 case eWNI_SME_TDLS_ADD_STA_REQ:
5764 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5765 break;
5766 case eWNI_SME_TDLS_DEL_STA_REQ:
5767 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5768 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305769 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5770 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5771 break;
Atul Mittalc0f739f2014-07-31 13:47:47 +05305772// tdlsoffchan
5773 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
5774 limProcesSmeTdlsChanSwitchReq(pMac, pMsgBuf);
5775 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005776#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305777 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5778 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5779 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005780
schang86c22c42013-03-13 18:41:24 -07005781 case eWNI_SME_SET_TX_POWER_REQ:
5782 limSendSetTxPowerReq(pMac, pMsgBuf);
5783 break ;
5784
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305785 case eWNI_SME_MAC_SPOOF_ADDR_IND:
5786 __limProcessSmeSpoofMacAddrRequest(pMac, pMsgBuf);
5787 break ;
5788
Jeff Johnson295189b2012-06-20 16:38:30 -07005789 default:
5790 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5791 pMsg->bodyptr = NULL;
5792 break;
5793 } // switch (msgType)
5794
5795 return bufConsumed;
5796} /*** end limProcessSmeReqMessages() ***/