blob: fb1ed2f8de0c3b933fba893a9d9eae479d674dee [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
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05302071 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
2072 "Regulatory max = %d, local power constraint = %d,"
Abhishek Singh57aebef2014-02-03 18:47:44 +05302073 " max tx = %d", regMax, localPowerConstraint,
2074 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002075
2076 if (pMac->lim.gLimCurrentBssUapsd)
2077 {
2078 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302079 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2080 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002081
2082 // resetting the dynamic uapsd mask
2083 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
2084 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
2085 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002086
2087 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
2088
2089 // Initialize 11h Enable Flag
2090 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
2091 {
2092 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302093 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002094 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Sushant Kaushike3ca61c2015-03-19 18:33:25 +05302095 psessionEntry->lim11hEnable = 1;
2096 }
2097 else
2098 psessionEntry->lim11hEnable = val;
Jeff Johnson295189b2012-06-20 16:38:30 -07002099 }
2100 else
2101 psessionEntry->lim11hEnable = 0;
2102
2103 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
2104 pMac->lim.gLimIbssCoalescingHappened = false;
2105
Jeff Johnsone7245742012-09-05 17:12:55 -07002106 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2107 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
2108 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002109
Abhishek Singh57aebef2014-02-03 18:47:44 +05302110 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
2111 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
2112 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
2113 psessionEntry->currentOperChannel,
2114 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002115
2116 /* Indicate whether spectrum management is enabled*/
2117 psessionEntry->spectrumMgtEnabled =
2118 pSmeJoinReq->spectrumMgtIndicator;
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302119
2120 /* Enable the spectrum management if this is a DFS channel */
2121 if (psessionEntry->countryInfoPresent &&
2122 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2123 {
2124 psessionEntry->spectrumMgtEnabled = TRUE;
2125 }
2126
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302127 limLog(pMac,LOG1,FL("SessionId: %d LIM_MLM_JOIN_REQ is posted to MLM "
2128 "SM"), pMlmJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002129 /* Issue LIM_MLM_JOIN_REQ to MLM */
2130 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
2131 return;
2132
2133 }
2134 else
2135 {
2136 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05302137 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
Sushant Kaushik1b645382014-10-13 16:39:36 +05302138 "in state %d"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002139 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
2140 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2141 psessionEntry = NULL;
2142 goto end;
2143
2144 }
2145
2146end:
2147 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
2148
2149 if(pSmeJoinReq)
2150 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302151 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002152 pSmeJoinReq = NULL;
2153 if (NULL != psessionEntry)
2154 {
2155 psessionEntry->pLimJoinReq = NULL;
2156 }
2157 }
2158
2159 if(retCode != eSIR_SME_SUCCESS)
2160 {
2161 if(NULL != psessionEntry)
2162 {
2163 peDeleteSession(pMac,psessionEntry);
2164 psessionEntry = NULL;
2165 }
2166 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05302167 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
2168 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002169 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
2170} /*** end __limProcessSmeJoinReq() ***/
2171
2172
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002173#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08002174tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07002175{
2176 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302177 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002178 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2180 maxTxPower = txPower;
2181 else if (txPower < MIN_TX_PWR_CAP)
2182 maxTxPower = MIN_TX_PWR_CAP;
2183 else
2184 maxTxPower = MAX_TX_PWR_CAP;
2185
2186 return (maxTxPower);
2187}
2188#endif
2189
Jeff Johnson295189b2012-06-20 16:38:30 -07002190/**
2191 * __limProcessSmeReassocReq()
2192 *
2193 *FUNCTION:
2194 * This function is called to process SME_REASSOC_REQ message
2195 * from HDD or upper layer application.
2196 *
2197 *LOGIC:
2198 *
2199 *ASSUMPTIONS:
2200 *
2201 *NOTE:
2202 *
2203 * @param pMac Pointer to Global MAC structure
2204 * @param *pMsgBuf A pointer to the SME message buffer
2205 * @return None
2206 */
2207
2208static void
2209__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2210{
2211 tANI_U16 caps;
2212 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002213 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002214 tLimMlmReassocReq *pMlmReassocReq;
2215 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2216 tpPESession psessionEntry = NULL;
2217 tANI_U8 sessionId;
2218 tANI_U8 smeSessionId;
2219 tANI_U16 transactionId;
2220 tPowerdBm localPowerConstraint = 0, regMax = 0;
2221 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002222 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002223
2224
Abhishek Singh127a8442014-12-15 17:31:27 +05302225 limLog(pMac, LOG1, FL("Received SME_REASSOC_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002226
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002227 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302228 pReassocReq = vos_mem_malloc(nSize);
2229 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002230 {
2231 // Log error
2232 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302233 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002234
2235 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2236 goto end;
2237 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302238 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002239 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2240 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2241 (!limIsSmeJoinReqValid(pMac,
2242 (tpSirSmeJoinReq) pReassocReq)))
2243 {
2244 /// Received invalid eWNI_SME_REASSOC_REQ
2245 // Log the event
2246 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002247 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002248
2249 retCode = eSIR_SME_INVALID_PARAMETERS;
2250 goto end;
2251 }
2252
2253 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2254 {
2255 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002256 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002257 retCode = eSIR_SME_INVALID_PARAMETERS;
2258 goto end;
2259 }
2260
2261#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2262 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2263#endif //FEATURE_WLAN_DIAG_SUPPORT
2264 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2265
2266 /* Store the reassoc handle in the session Table.. 23rd sep review */
2267 psessionEntry->pLimReAssocReq = pReassocReq;
Padma, Santhosh Kumar0d25d102014-07-17 15:08:48 +05302268 psessionEntry->dot11mode = pReassocReq->dot11mode;
2269 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(pReassocReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002270
2271 /**
2272 * Reassociate request is expected
2273 * in link established state only.
2274 */
2275
2276 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2277 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002278#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2280 {
2281 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002282 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 psessionEntry->peSessionId);
2284
2285 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302286 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2288 {
2289 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2290 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002291 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002292 retCode = eSIR_SME_INVALID_PARAMETERS;
2293 goto end;
2294 }
2295
2296 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2297 return;
2298 }
2299#endif
2300 /// Should not have received eWNI_SME_REASSOC_REQ
2301 // Log the event
2302 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302303 FL("received unexpected SME_REASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002304 psessionEntry->limSmeState);
2305 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2306
2307 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2308 goto end;
2309 }
2310
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302311 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002312 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2313 sizeof(tSirMacAddr));
2314
2315 psessionEntry->limReassocChannelId =
2316 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2317
Jeff Johnsone7245742012-09-05 17:12:55 -07002318 psessionEntry->reAssocHtSupportedChannelWidthSet =
2319 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2320 psessionEntry->reAssocHtRecommendedTxWidthSet =
2321 psessionEntry->reAssocHtSupportedChannelWidthSet;
2322 psessionEntry->reAssocHtSecondaryChannelOffset =
2323 psessionEntry->pLimReAssocReq->cbMode;
2324
Jeff Johnson295189b2012-06-20 16:38:30 -07002325 psessionEntry->limReassocBssCaps =
2326 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002327 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2328 localPowerConstraint = regMax;
2329 limExtractApCapability( pMac,
2330 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2331 limGetIElenFromBssDescription(
2332 &psessionEntry->pLimReAssocReq->bssDescription),
2333 &psessionEntry->limReassocBssQosCaps,
2334 &psessionEntry->limReassocBssPropCap,
2335 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002336 , &localPowerConstraint,
2337 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002338 );
2339
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302340 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002341#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302342 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2343 "= %d, max tx = %d", regMax, localPowerConstraint,
2344 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002345#endif
2346 {
2347 #if 0
2348 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2349 &cfgLen) != eSIR_SUCCESS)
2350 {
2351 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002352 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002353 }
2354 #endif//TO SUPPORT BT-AMP
2355
2356 /* Copy the SSID from sessio entry to local variable */
2357 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302358 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002359 psessionEntry->ssId.ssId,
2360 psessionEntry->ssId.length);
2361 #endif
2362 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302363 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2365
2366 }
2367
2368 if (pMac->lim.gLimCurrentBssUapsd)
2369 {
2370 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302371 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2372 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002373 }
2374
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302375 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2376 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002377 {
2378 // Log error
2379 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302380 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002381
2382 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2383 goto end;
2384 }
2385
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302386 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002387 psessionEntry->limReAssocbssId,
2388 sizeof(tSirMacAddr));
2389
2390 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2391 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2392 != eSIR_SUCCESS)
2393 {
2394 /**
2395 * Could not get ReassocFailureTimeout value
2396 * from CFG. Log error.
2397 */
2398 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002399 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002400 }
2401
2402 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2403 {
2404 /**
2405 * Could not get Capabilities value
2406 * from CFG. Log error.
2407 */
2408 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002409 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002410 }
2411 pMlmReassocReq->capabilityInfo = caps;
2412
2413 /* Update PE sessionId*/
2414 pMlmReassocReq->sessionId = sessionId;
2415
2416 /* If telescopic beaconing is enabled, set listen interval to
2417 WNI_CFG_TELE_BCN_MAX_LI */
2418 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2419 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002420 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002421
2422 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2423
2424 if(teleBcnEn)
2425 {
2426 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2427 eSIR_SUCCESS)
2428 {
2429 /**
2430 * Could not get ListenInterval value
2431 * from CFG. Log error.
2432 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002433 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002434 }
2435 }
2436 else
2437 {
2438 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2439 {
2440 /**
2441 * Could not get ListenInterval value
2442 * from CFG. Log error.
2443 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002444 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002445 }
2446 }
2447
2448 /* Delete all BA sessions before Re-Assoc.
2449 * BA frames are class 3 frames and the session
2450 * is lost upon disassociation and reassociation.
2451 */
2452
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05302453 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS,
2454 eSIR_MAC_UNSPEC_FAILURE_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002455
2456 pMlmReassocReq->listenInterval = (tANI_U16) val;
2457
2458 /* Indicate whether spectrum management is enabled*/
2459 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2460
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302461 /* Enable the spectrum management if this is a DFS channel */
2462 if (psessionEntry->countryInfoPresent &&
2463 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2464 {
2465 psessionEntry->spectrumMgtEnabled = TRUE;
2466 }
2467
Jeff Johnson295189b2012-06-20 16:38:30 -07002468 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2469 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2470
Jeff Johnsone7245742012-09-05 17:12:55 -07002471 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002472
2473 limPostMlmMessage(pMac,
2474 LIM_MLM_REASSOC_REQ,
2475 (tANI_U32 *) pMlmReassocReq);
2476 return;
2477
2478end:
2479 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302480 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002481
2482 if (psessionEntry)
2483 {
2484 // error occurred after we determined the session so extract
2485 // session and transaction info from there
2486 smeSessionId = psessionEntry->smeSessionId;
2487 transactionId = psessionEntry->transactionId;
2488 }
2489 else
2490 {
2491 // error occurred before or during the time we determined the session
2492 // so extract the session and transaction info from the message
2493 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2494 }
2495
2496 /// Send Reassoc failure response to host
2497 /// (note psessionEntry may be NULL, but that's OK)
2498 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2499 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2500 psessionEntry, smeSessionId, transactionId);
2501
2502} /*** end __limProcessSmeReassocReq() ***/
2503
2504
2505tANI_BOOLEAN sendDisassocFrame = 1;
2506/**
2507 * __limProcessSmeDisassocReq()
2508 *
2509 *FUNCTION:
2510 * This function is called to process SME_DISASSOC_REQ message
2511 * from HDD or upper layer application.
2512 *
2513 *LOGIC:
2514 *
2515 *ASSUMPTIONS:
2516 *
2517 *NOTE:
2518 *
2519 * @param pMac Pointer to Global MAC structure
2520 * @param *pMsgBuf A pointer to the SME message buffer
2521 * @return None
2522 */
2523
2524static void
2525__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2526{
2527 tANI_U16 disassocTrigger, reasonCode;
2528 tLimMlmDisassocReq *pMlmDisassocReq;
2529 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002530 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002531 tSirSmeDisassocReq smeDisassocReq;
2532 tpPESession psessionEntry = NULL;
2533 tANI_U8 sessionId;
2534 tANI_U8 smesessionId;
2535 tANI_U16 smetransactionId;
2536
Jeff Johnson295189b2012-06-20 16:38:30 -07002537
Jeff Johnson43971f52012-07-17 12:26:56 -07002538 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002539 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002540 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002541 return;
2542 }
2543
Jeff Johnson43971f52012-07-17 12:26:56 -07002544 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002545
Jeff Johnson43971f52012-07-17 12:26:56 -07002546 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002547
Jeff Johnson43971f52012-07-17 12:26:56 -07002548 if ( (eSIR_FAILURE == status) ||
2549 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002550 {
2551 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002552 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002553
2554 if (pMac->lim.gLimRspReqd)
2555 {
2556 pMac->lim.gLimRspReqd = false;
2557
2558 retCode = eSIR_SME_INVALID_PARAMETERS;
2559 disassocTrigger = eLIM_HOST_DISASSOC;
2560 goto sendDisassoc;
2561 }
2562
2563 return;
2564 }
2565
Jeff Johnson295189b2012-06-20 16:38:30 -07002566 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2567 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302568 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2569 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002570 retCode = eSIR_SME_INVALID_PARAMETERS;
2571 disassocTrigger = eLIM_HOST_DISASSOC;
2572 goto sendDisassoc;
2573
2574 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302575 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2576 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2577 smesessionId,psessionEntry->limSystemRole,
2578 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2579 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002580
2581#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2582 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2583#endif //FEATURE_WLAN_DIAG_SUPPORT
2584
2585 /* Update SME session Id and SME transaction ID*/
2586
2587 psessionEntry->smeSessionId = smesessionId;
2588 psessionEntry->transactionId = smetransactionId;
2589
2590 switch (psessionEntry->limSystemRole)
2591 {
2592 case eLIM_STA_ROLE:
2593 case eLIM_BT_AMP_STA_ROLE:
2594 switch (psessionEntry->limSmeState)
2595 {
2596 case eLIM_SME_ASSOCIATED_STATE:
2597 case eLIM_SME_LINK_EST_STATE:
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +05302598 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2599 "limSmeState: %d "),psessionEntry->limSmeState);
2600
Jeff Johnson295189b2012-06-20 16:38:30 -07002601 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2602 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002603#ifdef FEATURE_WLAN_TDLS
2604 /* Delete all TDLS peers connected before leaving BSS*/
2605 limDeleteTDLSPeers(pMac, psessionEntry);
2606#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002607 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002608 break;
2609
2610 case eLIM_SME_WT_DEAUTH_STATE:
2611 /* PE shall still process the DISASSOC_REQ and proceed with
2612 * link tear down even if it had already sent a DEAUTH_IND to
2613 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2614 * its been set when PE entered WT_DEAUTH_STATE.
2615 */
2616 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002617 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302618 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2619 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002620 break;
2621
2622 case eLIM_SME_WT_DISASSOC_STATE:
2623 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2624 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2625 * PE can continue processing DISASSOC_REQ and send the response instead
2626 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2627 * for disassoc frame.
2628 *
2629 * It will send a disassoc, which is ok. However, we can use the global flag
2630 * sendDisassoc to not send disassoc frame.
2631 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302632 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2633 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002634 break;
2635
2636 case eLIM_SME_JOIN_FAILURE_STATE: {
2637 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302638 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2639 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002640 if (pMac->lim.gLimRspReqd) {
2641 retCode = eSIR_SME_SUCCESS;
2642 disassocTrigger = eLIM_HOST_DISASSOC;
2643 goto sendDisassoc;
2644 }
2645 }break;
2646 default:
2647 /**
2648 * STA is not currently associated.
2649 * Log error and send response to host
2650 */
2651 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302652 FL("received unexpected SME_DISASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002653 psessionEntry->limSmeState);
2654 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2655
2656 if (pMac->lim.gLimRspReqd)
2657 {
2658 if (psessionEntry->limSmeState !=
2659 eLIM_SME_WT_ASSOC_STATE)
2660 pMac->lim.gLimRspReqd = false;
2661
2662 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2663 disassocTrigger = eLIM_HOST_DISASSOC;
2664 goto sendDisassoc;
2665 }
2666
2667 return;
2668 }
2669
2670 break;
2671
2672 case eLIM_AP_ROLE:
2673 case eLIM_BT_AMP_AP_ROLE:
2674 // Fall through
2675 break;
2676
2677 case eLIM_STA_IN_IBSS_ROLE:
2678 default: // eLIM_UNKNOWN_ROLE
2679 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002680 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002681 psessionEntry->limSystemRole);
2682
2683 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2684 disassocTrigger = eLIM_HOST_DISASSOC;
2685 goto sendDisassoc;
2686 } // end switch (pMac->lim.gLimSystemRole)
2687
2688 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2689 {
2690 /// Disassociation is triggered by Link Monitoring
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302691 limLog(pMac, LOG1, FL("Sending Disasscoc with reason Link Monitoring"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002692 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2693 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2694 }
2695 else
2696 {
2697 disassocTrigger = eLIM_HOST_DISASSOC;
2698 reasonCode = smeDisassocReq.reasonCode;
2699 }
2700
2701 if (smeDisassocReq.doNotSendOverTheAir)
2702 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302703 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002704 sendDisassocFrame = 0;
2705 }
2706 // Trigger Disassociation frame to peer MAC entity
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05302707 limLog(pMac, LOG1, FL("Sending Disasscoc with disassoc Trigger"
2708 " : %d, reasonCode : %d"),
2709 disassocTrigger, reasonCode);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302710 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2711 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002712 {
2713 // Log error
2714 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302715 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002716
2717 return;
2718 }
2719
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302720 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002721 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2722 sizeof(tSirMacAddr));
2723
2724 pMlmDisassocReq->reasonCode = reasonCode;
2725 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2726
2727 /* Update PE session ID*/
2728 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002729
2730 limPostMlmMessage(pMac,
2731 LIM_MLM_DISASSOC_REQ,
2732 (tANI_U32 *) pMlmDisassocReq);
2733 return;
2734
2735sendDisassoc:
2736 if (psessionEntry)
2737 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2738 retCode,
2739 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002740 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002741 else
2742 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2743 retCode,
2744 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002745 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002746
2747
2748} /*** end __limProcessSmeDisassocReq() ***/
2749
2750
2751/** -----------------------------------------------------------------
2752 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2753
2754 This function is called to process SME_DISASSOC_CNF message
2755 from HDD or upper layer application.
2756
2757 \param pMac - global mac structure
2758 \param pStaDs - station dph hash node
2759 \return none
2760 \sa
2761 ----------------------------------------------------------------- */
2762static void
2763__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2764{
2765 tSirSmeDisassocCnf smeDisassocCnf;
2766 tANI_U16 aid;
2767 tpDphHashNode pStaDs;
2768 tSirRetStatus status = eSIR_SUCCESS;
2769 tpPESession psessionEntry;
2770 tANI_U8 sessionId;
2771
2772
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302773 limLog(pMac, LOG1, FL("received SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002774
2775 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2776
2777 if (status == eSIR_FAILURE)
2778 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002779 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002780 return;
2781 }
2782
2783 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2784 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002785 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002786 return;
2787 }
2788
2789 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2790 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302791 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002792 return;
2793 }
2794
2795#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2796 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2797 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2798 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2799 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2800#endif //FEATURE_WLAN_DIAG_SUPPORT
2801
2802 switch (psessionEntry->limSystemRole)
2803 {
2804 case eLIM_STA_ROLE:
2805 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2806 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2807 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2808 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2809 {
2810 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302811 FL("received unexp SME_DISASSOC_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 psessionEntry->limSmeState);
2813 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2814 return;
2815 }
2816 break;
2817
2818 case eLIM_AP_ROLE:
2819 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002820 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002821
2822 case eLIM_STA_IN_IBSS_ROLE:
2823 default: // eLIM_UNKNOWN_ROLE
2824 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002825 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002826 psessionEntry->limSystemRole);
2827
2828 return;
2829 }
2830
2831
2832 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2833 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002834 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002835 )
2836 {
2837 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2838 if (pStaDs == NULL)
2839 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302840 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2841 "does not have context, addr= "MAC_ADDRESS_STR),
2842 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002843 return;
2844 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002845 /* Delete FT session if there exists one */
2846 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002847 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002848
2849 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 }
2851
2852 return;
2853}
2854
2855
2856/**
2857 * __limProcessSmeDeauthReq()
2858 *
2859 *FUNCTION:
2860 * This function is called to process SME_DEAUTH_REQ message
2861 * from HDD or upper layer application.
2862 *
2863 *LOGIC:
2864 *
2865 *ASSUMPTIONS:
2866 *
2867 *NOTE:
2868 *
2869 * @param pMac Pointer to Global MAC structure
2870 * @param *pMsgBuf A pointer to the SME message buffer
2871 * @return None
2872 */
2873
2874static void
2875__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2876{
2877 tANI_U16 deauthTrigger, reasonCode;
2878 tLimMlmDeauthReq *pMlmDeauthReq;
2879 tSirSmeDeauthReq smeDeauthReq;
2880 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2881 tSirRetStatus status = eSIR_SUCCESS;
2882 tpPESession psessionEntry;
2883 tANI_U8 sessionId; //PE sessionId
2884 tANI_U8 smesessionId;
2885 tANI_U16 smetransactionId;
2886
Jeff Johnson295189b2012-06-20 16:38:30 -07002887
2888 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002889 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2890
2891 //We need to get a session first but we don't even know if the message is correct.
2892 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2893 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002894 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002895 retCode = eSIR_SME_INVALID_PARAMETERS;
2896 deauthTrigger = eLIM_HOST_DEAUTH;
2897 goto sendDeauth;
2898
2899 }
2900
2901 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2902 {
Sachin Ahuja42354142015-01-06 19:48:35 +05302903 PELOGE(limLog(pMac, LOGE,FL
2904 ("received invalid SME_DEAUTH_REQ message"));)
2905 pMac->lim.gLimRspReqd = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07002906
Sachin Ahuja42354142015-01-06 19:48:35 +05302907 retCode = eSIR_SME_INVALID_PARAMETERS;
2908 deauthTrigger = eLIM_HOST_DEAUTH;
2909 goto sendDeauth;
Jeff Johnson295189b2012-06-20 16:38:30 -07002910 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302911 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2912 "Systemrole %d with reasoncode %u in limSmestate %d from "
2913 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2914 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2915 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002916#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2917 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2918#endif //FEATURE_WLAN_DIAG_SUPPORT
2919
2920 /* Update SME session ID and Transaction ID */
2921 psessionEntry->smeSessionId = smesessionId;
2922 psessionEntry->transactionId = smetransactionId;
2923
2924
2925 switch (psessionEntry->limSystemRole)
2926 {
2927 case eLIM_STA_ROLE:
2928 case eLIM_BT_AMP_STA_ROLE:
2929
2930 switch (psessionEntry->limSmeState)
2931 {
2932 case eLIM_SME_ASSOCIATED_STATE:
2933 case eLIM_SME_LINK_EST_STATE:
2934 case eLIM_SME_WT_ASSOC_STATE:
2935 case eLIM_SME_JOIN_FAILURE_STATE:
2936 case eLIM_SME_IDLE_STATE:
2937 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2938 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002939 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002940
2941 // Send Deauthentication request to MLM below
2942
2943 break;
Sachin Ahujaa100dcc2014-07-03 14:30:18 +05302944 case eLIM_SME_WT_DEAUTH_STATE:
2945 /*
2946 * PE Recieved a Deauth frame. Normally it gets
2947 * DEAUTH_CNF but it received DEAUTH_REQ. Which
2948 * means host is also trying to disconnect.
2949 * PE can continue processing DEAUTH_REQ and send
2950 * the response instead of failing the request.
2951 * SME will anyway ignore DEAUTH_IND that was sent
2952 * for deauth frame.
2953 */
2954 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
2955 "SME_WT_DEAUTH_STATE. "));
2956 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002957 default:
2958 /**
2959 * STA is not in a state to deauthenticate with
2960 * peer. Log error and send response to host.
2961 */
2962 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302963 FL("received unexp SME_DEAUTH_REQ in state %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05302964 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002965 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2966
2967 if (pMac->lim.gLimRspReqd)
2968 {
2969 pMac->lim.gLimRspReqd = false;
2970
2971 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2972 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08002973 /**
2974 *here we received deauth request from AP so sme state is
2975 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
2976 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
2977 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
2978 so the below condition captures the state where delSta
2979 not done and firmware still in connected state.
2980 */
2981 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
2982 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
2983 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
2984 {
2985 retCode = eSIR_SME_DEAUTH_STATUS;
2986 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002987 goto sendDeauth;
2988 }
2989
2990 return;
2991 }
2992
2993 break;
2994
2995 case eLIM_STA_IN_IBSS_ROLE:
2996
2997 return;
2998
2999 case eLIM_AP_ROLE:
3000 // Fall through
3001
3002 break;
3003
3004 default:
3005 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303006 FL("received unexpected SME_DEAUTH_REQ for role %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05303007 psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003008
3009 return;
3010 } // end switch (pMac->lim.gLimSystemRole)
3011
3012 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
3013 {
3014 /// Deauthentication is triggered by Link Monitoring
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303015 limLog(pMac, LOG1,
3016 FL("Deauthentication is triggered by Link Monitoring"));
3017 limLog(pMac, LOG1,
3018 FL("Set Trigger to eLIM_LINK_MONITORING_DEAUTH"));
3019 limLog(pMac, LOG1,
3020 FL("and Reason to eSIR_MAC_UNSPEC_FAILURE_REASON"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003021 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
3022 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
3023 }
3024 else
3025 {
3026 deauthTrigger = eLIM_HOST_DEAUTH;
3027 reasonCode = smeDeauthReq.reasonCode;
3028 }
3029
3030 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303031 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
3032 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003033 {
3034 // Log error
3035 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303036 FL("call to AllocateMemory failed for mlmDeauthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003037
3038 return;
3039 }
3040
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303041 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003042 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
3043 sizeof(tSirMacAddr));
3044
3045 pMlmDeauthReq->reasonCode = reasonCode;
3046 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07003047
3048 /* Update PE session Id*/
3049 pMlmDeauthReq->sessionId = sessionId;
3050
3051 limPostMlmMessage(pMac,
3052 LIM_MLM_DEAUTH_REQ,
3053 (tANI_U32 *) pMlmDeauthReq);
3054 return;
3055
3056sendDeauth:
3057 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
3058 retCode,
3059 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07003060 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 smesessionId, smetransactionId);
3062} /*** end __limProcessSmeDeauthReq() ***/
3063
3064
3065
3066/**
3067 * __limProcessSmeSetContextReq()
3068 *
3069 *FUNCTION:
3070 * This function is called to process SME_SETCONTEXT_REQ message
3071 * from HDD or upper layer application.
3072 *
3073 *LOGIC:
3074 *
3075 *ASSUMPTIONS:
3076 *
3077 *NOTE:
3078 *
3079 * @param pMac Pointer to Global MAC structure
3080 * @param *pMsgBuf A pointer to the SME message buffer
3081 * @return None
3082 */
3083
3084static void
3085__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3086{
3087 tpSirSmeSetContextReq pSetContextReq;
3088 tLimMlmSetKeysReq *pMlmSetKeysReq;
3089 tpPESession psessionEntry;
3090 tANI_U8 sessionId; //PE sessionID
3091 tANI_U8 smesessionId;
3092 tANI_U16 smetransactionId;
3093
3094
3095 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003096 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07003097
3098
3099 if(pMsgBuf == NULL)
3100 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003101 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003102 return;
3103 }
3104
3105 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303106
3107 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
3108 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003109 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303110 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003111 return;
3112 }
3113
3114 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3115 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
3116 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003117 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003118 goto end;
3119 }
3120
3121 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3122 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003123 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 -07003124 limSendSmeSetContextRsp(pMac,
3125 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003126 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003127 eSIR_SME_INVALID_PARAMETERS,NULL,
3128 smesessionId,smetransactionId);
3129
3130 goto end;
3131 }
3132
3133
3134 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
3135 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003136 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003137 limSendSmeSetContextRsp(pMac,
3138 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003139 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003140 eSIR_SME_INVALID_PARAMETERS,NULL,
3141 smesessionId,smetransactionId);
3142
3143 goto end;
3144 }
3145
3146#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3147 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
3148#endif //FEATURE_WLAN_DIAG_SUPPORT
3149
3150
3151 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
3152 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3153 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3154 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3155 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3156 {
3157 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303158 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
3159 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003160 {
3161 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303162 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003163 goto end;
3164 }
3165
3166 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
3167 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
3168 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3169 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003170 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003171 goto end;
3172 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303173 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003174 (tANI_U8 *) &pSetContextReq->peerMacAddr,
3175 sizeof(tSirMacAddr));
3176
Jeff Johnson295189b2012-06-20 16:38:30 -07003177
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303178 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07003179 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
3180 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
3181
3182 pMlmSetKeysReq->sessionId = sessionId;
3183#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3184 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003185 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07003186#endif
3187
Jeff Johnson295189b2012-06-20 16:38:30 -07003188 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
3189 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
3190 {
3191 if(pSetContextReq->keyMaterial.key[0].keyLength)
3192 {
3193 tANI_U8 keyId;
3194 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303195 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07003196 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
3197 }
3198 else {
3199 tANI_U32 i;
3200 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3201 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303202 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003203 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3204 }
3205 }
3206 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003207
3208 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003209 }
3210 else
3211 {
3212 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303213 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003214 psessionEntry->limSystemRole,
3215 psessionEntry->limSmeState);
3216 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3217
3218 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003219 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003220 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3221 smesessionId,
3222 smetransactionId);
3223 }
3224
3225end:
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303226 vos_mem_zero(pSetContextReq,
3227 (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303228 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003229 return;
3230} /*** end __limProcessSmeSetContextReq() ***/
3231
3232/**
3233 * __limProcessSmeRemoveKeyReq()
3234 *
3235 *FUNCTION:
3236 * This function is called to process SME_REMOVEKEY_REQ message
3237 * from HDD or upper layer application.
3238 *
3239 *LOGIC:
3240 *
3241 *ASSUMPTIONS:
3242 *
3243 *NOTE:
3244 *
3245 * @param pMac Pointer to Global MAC structure
3246 * @param *pMsgBuf A pointer to the SME message buffer
3247 * @return None
3248 */
3249
3250static void
3251__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3252{
3253 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3254 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3255 tpPESession psessionEntry;
3256 tANI_U8 sessionId; //PE sessionID
3257 tANI_U8 smesessionId;
3258 tANI_U16 smetransactionId;
3259
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303260 limLog(pMac, LOG1,
3261 FL("received SME_REMOVEKEY_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003262
3263 if(pMsgBuf == NULL)
3264 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003265 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003266 return;
3267 }
3268
3269
3270 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3271
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303272 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3273 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003274 {
3275 //Log error
3276 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303277 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003278
3279 return;
3280 }
3281
3282 if ((limRemoveKeyReqSerDes(pMac,
3283 pRemoveKeyReq,
3284 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3285 {
3286 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003287 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003288
3289 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3290
3291 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3292 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003293 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003294 //goto end;
3295 }
3296
3297 limSendSmeRemoveKeyRsp(pMac,
3298 pRemoveKeyReq->peerMacAddr,
3299 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3300 smesessionId,smetransactionId);
3301
3302 goto end;
3303 }
3304
3305 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3306 {
3307 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003308 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003309 limSendSmeRemoveKeyRsp(pMac,
3310 pRemoveKeyReq->peerMacAddr,
3311 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3312 smesessionId, smetransactionId);
3313 goto end;
3314 }
3315
3316
3317 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3318 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3319 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3320 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3321 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3322 {
3323 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303324 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3325 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003326 {
3327 // Log error
3328 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303329 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003330
3331 goto end;
3332 }
3333
3334 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3335 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3336 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3337 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3338
3339 /* Update PE session Id */
3340 pMlmRemoveKeyReq->sessionId = sessionId;
3341
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303342 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003343 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3344 sizeof(tSirMacAddr));
3345
3346
3347 limPostMlmMessage(pMac,
3348 LIM_MLM_REMOVEKEY_REQ,
3349 (tANI_U32 *) pMlmRemoveKeyReq);
3350 }
3351 else
3352 {
3353 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303354 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 psessionEntry->limSystemRole,
3356 psessionEntry->limSmeState);
3357 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3358
3359 limSendSmeRemoveKeyRsp(pMac,
3360 pRemoveKeyReq->peerMacAddr,
3361 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3362 smesessionId,smetransactionId);
3363 }
3364
3365end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303366 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003367} /*** end __limProcessSmeRemoveKeyReq() ***/
3368
Jeff Johnson295189b2012-06-20 16:38:30 -07003369void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3370{
3371 tSirMsgQ mmhMsg;
3372 tpSmeGetScanChnRsp pSirSmeRsp;
3373 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303374 tANI_U8 sessionId;
3375 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003376
3377 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3378 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003379 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003380 pMac->lim.scanChnInfo.numChnInfo);
3381 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3382 }
3383
Abhishek Singh525045c2014-12-15 17:18:45 +05303384 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003385 FL("Sending message %s with number of channels %d"),
Abhishek Singh525045c2014-12-15 17:18:45 +05303386 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07003387
3388 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303389 pSirSmeRsp = vos_mem_malloc(len);
3390 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003391 {
3392 /// Buffer not available. Log error
3393 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303394 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003395
3396 return;
3397 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303398 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003399
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3401 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303402
3403 if (pMac->fScanOffload)
3404 {
3405 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3406 pSirSmeRsp->sessionId = sessionId;
3407 }
3408 else
3409 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003410
3411 if(pMac->lim.scanChnInfo.numChnInfo)
3412 {
3413 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303414 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3415 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003416 }
3417 //Clear the list
3418 limRessetScanChannelInfo(pMac);
3419
3420 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3421 mmhMsg.bodyptr = pSirSmeRsp;
3422 mmhMsg.bodyval = 0;
3423
3424 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003425 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003426 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3427}
3428
3429
Jeff Johnson295189b2012-06-20 16:38:30 -07003430void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3431{
3432 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3433 tpDphHashNode pStaDs = NULL;
3434 tpPESession psessionEntry = NULL;
3435 tSap_Event sapEvent;
3436 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3437 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3438 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3439 tANI_U8 assocId = 0;
3440 tANI_U8 staCount = 0;
3441
3442 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3443 {
3444 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003445 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303446 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003447 }
3448
3449 switch (getAssocSTAsReq.modId)
3450 {
3451/**
3452 case VOS_MODULE_ID_HAL:
3453 wdaPostCtrlMsg( pMac, &msgQ );
3454 return;
3455
3456 case VOS_MODULE_ID_TL:
3457 Post msg TL
3458 return;
3459*/
3460 case VOS_MODULE_ID_PE:
3461 default:
3462 break;
3463 }
3464
Jeff Johnson1250df42012-12-10 14:31:52 -08003465 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003466 // Find PE session Entry
3467 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3468 {
3469 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003470 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003471 goto limAssocStaEnd;
3472 }
3473
3474 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3475 {
3476 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303477 FL("Received unexpected message in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303478 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003479 goto limAssocStaEnd;
3480 }
3481
3482 // Retrieve values obtained in the request message
3483 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3484 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3485
3486 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3487 {
3488 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3489
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303490 if ((NULL == pStaDs) || (NULL == pAssocStasTemp))
Jeff Johnson295189b2012-06-20 16:38:30 -07003491 continue;
3492
3493 if (pStaDs->valid)
3494 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303495 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3496 (tANI_U8 *)&pStaDs->staAddr,
3497 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003498 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3499 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3500
Kiet Lamb1233192013-11-28 13:38:20 +05303501 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003502 (tANI_U8 *)&pStaDs->supportedRates,
3503 sizeof(tSirSupportedRates));
3504 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3505 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3506 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3507
Jeff Johnson295189b2012-06-20 16:38:30 -07003508 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003509 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3510 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003511 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3512 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3513
3514 pAssocStasTemp++;
3515 staCount++;
3516 }
3517 }
3518
3519limAssocStaEnd:
3520 // Call hdd callback with sap event to send the list of associated stations from PE
3521 if (pSapEventCallback != NULL)
3522 {
3523 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3524 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3525 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3526 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3527 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3528 }
3529}
3530
3531
3532/**
3533 * limProcessSmeGetWPSPBCSessions
3534 *
3535 *FUNCTION:
3536 * This function is called when query the WPS PBC overlap message is received
3537 *
3538 *LOGIC:
3539 * This function parses get WPS PBC overlap information message and call callback to pass
3540 * WPS PBC overlap information back to hdd.
3541 *ASSUMPTIONS:
3542 *
3543 *
3544 *NOTE:
3545 *
3546 * @param pMac Pointer to Global MAC structure
3547 * @param pMsgBuf A pointer to WPS PBC overlap query message
3548*
3549 * @return None
3550 */
3551void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3552{
3553 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3554 tpPESession psessionEntry = NULL;
3555 tSap_Event sapEvent;
3556 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3557 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3558 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3559
3560 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3561
3562 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3563 {
3564 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003565 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303566 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003567 }
3568
Jeff Johnson1250df42012-12-10 14:31:52 -08003569 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003570 // Find PE session Entry
3571 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3572 {
3573 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003574 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003575 goto limGetWPSPBCSessionsEnd;
3576 }
3577
3578 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3579 {
3580 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303581 FL("Received unexpected message in role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003582 psessionEntry->limSystemRole);
3583 goto limGetWPSPBCSessionsEnd;
3584 }
3585
Jeff Johnson1250df42012-12-10 14:31:52 -08003586 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003587 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3588 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3589
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303590 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003591 { //This is GetWpsSession call
3592
3593 limGetWPSPBCSessions(pMac,
3594 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3595 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3596 }
3597 else
3598 {
3599 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3600 /* don't have to inform the HDD/Host */
3601 return;
3602 }
3603
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003604 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003605 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3606
3607 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3608
3609limGetWPSPBCSessionsEnd:
3610 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303611
3612 if (NULL != pSapEventCallback)
3613 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07003614}
3615
Jeff Johnson295189b2012-06-20 16:38:30 -07003616
3617
3618/**
3619 * __limCounterMeasures()
3620 *
3621 * FUNCTION:
3622 * This function is called to "implement" MIC counter measure
3623 * and is *temporary* only
3624 *
3625 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3626 * we don't do the proper STA disassoc sequence since the
3627 * BSS will be stoped anyway
3628 *
3629 *ASSUMPTIONS:
3630 *
3631 *NOTE:
3632 *
3633 * @param pMac Pointer to Global MAC structure
3634 * @return None
3635 */
3636
3637static void
3638__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3639{
3640 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
Abhishek Singh8944b222014-09-17 16:13:17 +05303641 /* If PMF is enabled then don't send broadcast disassociation */
3642 if ( ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
3643 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
3644 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
3645#ifdef WLAN_FEATURE_11W
3646 && !psessionEntry->limRmfEnabled
3647#endif
3648 )
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003649 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003650
Jeff Johnson295189b2012-06-20 16:38:30 -07003651};
3652
3653
Jeff Johnson295189b2012-06-20 16:38:30 -07003654void
3655limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3656{
3657 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3658 tpPESession psessionEntry;
3659 tANI_U8 sessionId; //PE sessionId
3660
3661 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3662 {
3663 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003664 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003665 return;
3666 }
3667
3668 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3669 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003670 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003671 return;
3672 }
3673
3674 if ( tkipCntrMeasReq.bEnable )
3675 {
3676 __limCounterMeasures( pMac, psessionEntry );
3677 }
3678
3679 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3680}
Jeff Johnson295189b2012-06-20 16:38:30 -07003681
3682
3683static void
3684__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3685{
3686 tSirSmeStopBssReq stopBssReq;
3687 tSirRetStatus status;
3688 tLimSmeStates prevState;
3689 tANI_U8 sessionId; //PE sessionId
3690 tpPESession psessionEntry;
3691 tANI_U8 smesessionId;
3692 tANI_U16 smetransactionId;
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303693 tANI_U8 i = 0;
3694 tpDphHashNode pStaDs = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003695
3696 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3697
3698
3699
3700 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3701 !limIsSmeStopBssReqValid(pMsgBuf))
3702 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003703 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003704 /// Send Stop BSS response to host
3705 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3706 return;
3707 }
3708
3709
3710 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3711 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003712 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003713 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3714 return;
3715 }
3716
3717#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3718 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3719#endif //FEATURE_WLAN_DIAG_SUPPORT
3720
3721
3722 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3723 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3724 {
3725 /**
3726 * Should not have received STOP_BSS_REQ in states
3727 * other than 'normal' state or on STA in Infrastructure
3728 * mode. Log error and return response to host.
3729 */
3730 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303731 FL("received unexpected SME_STOP_BSS_REQ in state %d, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003732 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3733 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3734 /// Send Stop BSS response to host
3735 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3736 return;
3737 }
3738
Jeff Johnson295189b2012-06-20 16:38:30 -07003739 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3740 {
3741 limWPSPBCClose(pMac, psessionEntry);
3742 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003743 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003744
3745 prevState = psessionEntry->limSmeState;
3746
3747 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003748 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003749
3750 /* Update SME session Id and Transaction Id */
3751 psessionEntry->smeSessionId = smesessionId;
3752 psessionEntry->transactionId = smetransactionId;
3753
Abhishek Singh8944b222014-09-17 16:13:17 +05303754 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame.
3755 * If PMF is enabled then don't send broadcast disassociation */
3756 if ( ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) &&
3757 (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3758#ifdef WLAN_FEATURE_11W
3759 && !psessionEntry->limRmfEnabled
3760#endif
3761 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003762 {
3763 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3764 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3765 // Send disassoc all stations associated thru TKIP
3766 __limCounterMeasures(pMac,psessionEntry);
3767 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303768 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003769 }
3770
3771 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3772 pMac->lim.gLimIbssCoalescingHappened = false;
3773
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303774 for(i = 1 ; i < pMac->lim.gLimAssocStaLimit ; i++)
3775 {
3776 pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable);
3777 if (NULL == pStaDs)
3778 continue;
3779 status = limDelSta(pMac, pStaDs, false, psessionEntry) ;
3780 if(eSIR_SUCCESS == status)
3781 {
3782 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ;
3783 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ;
3784 }
3785 else
3786 {
3787 limLog(pMac, LOGE, FL("limDelSta failed with Status : %d"), status);
3788 VOS_ASSERT(0) ;
3789 }
3790 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003791 /* send a delBss to HAL and wait for a response */
3792 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3793
3794 if (status != eSIR_SUCCESS)
3795 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003796 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003797 psessionEntry->limSmeState= prevState;
3798
Jeff Johnsone7245742012-09-05 17:12:55 -07003799 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003800
3801 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3802 }
3803}
3804
3805
3806/**--------------------------------------------------------------
3807\fn __limProcessSmeStopBssReq
3808
3809\brief Wrapper for the function __limHandleSmeStopBssRequest
3810 This message will be defered until softmac come out of
3811 scan mode. Message should be handled even if we have
3812 detected radar in the current operating channel.
3813\param pMac
3814\param pMsg
3815
3816\return TRUE - If we consumed the buffer
3817 FALSE - If have defered the message.
3818 ---------------------------------------------------------------*/
3819static tANI_BOOLEAN
3820__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3821{
3822 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3823 {
3824 /**
3825 * If message defered, buffer is not consumed yet.
3826 * So return false
3827 */
3828 return eANI_BOOLEAN_FALSE;
3829 }
3830 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3831 return eANI_BOOLEAN_TRUE;
3832} /*** end __limProcessSmeStopBssReq() ***/
3833
3834
3835void limProcessSmeDelBssRsp(
3836 tpAniSirGlobal pMac,
3837 tANI_U32 body,tpPESession psessionEntry)
3838{
3839
3840 (void) body;
3841 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3842 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003843 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003844 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3845 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003846 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3847 return;
3848}
3849
3850
Jeff Johnson295189b2012-06-20 16:38:30 -07003851/**---------------------------------------------------------------
3852\fn __limProcessSmeAssocCnfNew
3853\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3854\ in BTAMP AP.
3855\
3856\param pMac
3857\param msgType - message type
3858\param pMsgBuf - a pointer to the SME message buffer
3859\return None
3860------------------------------------------------------------------*/
3861
3862 void
3863__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3864{
3865 tSirSmeAssocCnf assocCnf;
3866 tpDphHashNode pStaDs = NULL;
3867 tpPESession psessionEntry= NULL;
3868 tANI_U8 sessionId;
3869
3870
3871 if(pMsgBuf == NULL)
3872 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003873 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003874 goto end;
3875 }
3876
3877 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3878 !__limIsSmeAssocCnfValid(&assocCnf))
3879 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003880 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003881 goto end;
3882 }
3883
3884 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3885 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003886 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003887 goto end;
3888 }
3889
3890 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3891 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3892 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05303893 limLog(pMac, LOGE, FL("Received unexpected message %X in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303894 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003895 goto end;
3896 }
3897
3898 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3899
3900 if (pStaDs == NULL)
3901 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303902 limLog(pMac, LOGE,
3903 FL("Received invalid message %X due to no STA context, "
3904 "for aid %d, peer "),
3905 msgType, assocCnf.aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07003906 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3907
3908 /*
3909 ** send a DISASSOC_IND message to WSM to make sure
3910 ** the state in WSM and LIM is the same
3911 **/
3912 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3913 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3914 goto end;
3915 }
3916 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303917 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003918 (tANI_U8 *) assocCnf.peerMacAddr,
3919 sizeof(tSirMacAddr)) ) ||
3920 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3921 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3922 (msgType != eWNI_SME_ASSOC_CNF)) ||
3923 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003924 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003925 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303926 limLog(pMac, LOGE,
3927 FL("Received invalid message %X due to peerMacAddr mismatched "
3928 "or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "
3929 "StaD mlmState : %d"),
3930 msgType, assocCnf.aid, pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3932 goto end;
3933 }
3934
3935 /*
3936 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3937 ** has been received
3938 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003939 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003940 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3941
3942 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3943 {
3944 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3945 * when it had received Assoc Request frame. Now, PE just needs to send
3946 * Association Response frame to the requesting BTAMP-STA.
3947 */
3948 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003949 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003950 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3951 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3952 goto end;
3953 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3954 else
3955 {
3956 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3957 /*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*/
3958 if(!pStaDs->mlmStaContext.updateContext)
3959 pStaDs->mlmStaContext.updateContext = 1;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303960 limLog(pMac, LOG1, FL("Receive Assoc Cnf with status Code : %d(assoc id=%d) "),
3961 assocCnf.statusCode, pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003962 limRejectAssociation(pMac, pStaDs->staAddr,
3963 pStaDs->mlmStaContext.subType,
3964 true, pStaDs->mlmStaContext.authType,
3965 pStaDs->assocId, true,
3966 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003967 }
3968
3969end:
3970 if((psessionEntry != NULL) && (pStaDs != NULL))
3971 {
3972 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3973 {
3974 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3975 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303976 vos_mem_free(((tpSirAssocReq)
3977 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07003978 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
3979 }
3980
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303981 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003982 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
3983 }
3984 }
3985
3986} /*** end __limProcessSmeAssocCnfNew() ***/
3987
3988
Jeff Johnson295189b2012-06-20 16:38:30 -07003989
3990
3991static void
3992__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3993{
3994 tpDphHashNode pStaDs;
3995 tSirMacAddr peerMac;
3996 tpSirAddtsReq pSirAddts;
3997 tANI_U32 timeout;
3998 tpPESession psessionEntry;
3999 tANI_U8 sessionId; //PE sessionId
4000 tANI_U8 smesessionId;
4001 tANI_U16 smetransactionId;
4002
4003
4004 if(pMsgBuf == NULL)
4005 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004006 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004007 return;
4008 }
4009
4010 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4011
4012 pSirAddts = (tpSirAddtsReq) pMsgBuf;
4013
4014 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
4015 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004016 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004017 return;
4018 }
4019#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4020 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
4021#endif //FEATURE_WLAN_DIAG_SUPPORT
4022
4023
4024
4025 /* if sta
4026 * - verify assoc state
4027 * - send addts request to ap
4028 * - wait for addts response from ap
4029 * if ap, just ignore with error log
4030 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304031 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004032 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004033 pSirAddts->req.tspec.tsinfo.traffic.tsid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304034 pSirAddts->req.tspec.tsinfo.traffic.userPrio);
Jeff Johnson295189b2012-06-20 16:38:30 -07004035
4036 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
4037 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004038 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004039 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4040 smesessionId,smetransactionId);
4041 return;
4042 }
4043
4044 //Ignore the request if STA is in 11B mode.
4045 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
4046 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004047 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004048 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4049 smesessionId,smetransactionId);
4050 return;
4051 }
4052
4053
4054 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4055
4056 if(pStaDs == NULL)
4057 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004058 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004059 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4060 smesessionId,smetransactionId);
4061 return;
4062 }
4063
4064 if ((! pStaDs->valid) ||
4065 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
4066 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004067 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004068 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4069 smesessionId,smetransactionId);
4070 return;
4071 }
4072
4073 pSirAddts->req.wsmTspecPresent = 0;
4074 pSirAddts->req.wmeTspecPresent = 0;
4075 pSirAddts->req.lleTspecPresent = 0;
4076
4077 if ((pStaDs->wsmEnabled) &&
4078 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
4079 pSirAddts->req.wsmTspecPresent = 1;
4080 else if (pStaDs->wmeEnabled)
4081 pSirAddts->req.wmeTspecPresent = 1;
4082 else if (pStaDs->lleEnabled)
4083 pSirAddts->req.lleTspecPresent = 1;
4084 else
4085 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004086 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004087 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4088 smesessionId,smetransactionId);
4089 return;
4090 }
4091
4092 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4093 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4094 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004095 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07004096 psessionEntry->limSmeState);
4097 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4098 smesessionId,smetransactionId);
4099 return;
4100 }
4101
4102 if (pMac->lim.gLimAddtsSent)
4103 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004104 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07004105 pMac->lim.gLimAddtsReq.req.dialogToken,
4106 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
4107 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
4108 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4109 smesessionId,smetransactionId);
4110 return;
4111 }
4112
4113 #if 0
4114 val = sizeof(tSirMacAddr);
4115 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
4116 {
4117 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004118 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004119 return;
4120 }
4121 #endif
4122 sirCopyMacAddr(peerMac,psessionEntry->bssId);
4123
4124 // save the addts request
4125 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304126 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07004127
4128 // ship out the message now
4129 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
4130 psessionEntry);
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304131 limLog(pMac, LOG1, FL("Sent ADDTS request"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004132
4133 // start a timer to wait for the response
4134 if (pSirAddts->timeout)
4135 timeout = pSirAddts->timeout;
4136 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
4137 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004138 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004139 WNI_CFG_ADDTS_RSP_TIMEOUT);
4140 return;
4141 }
4142
4143 timeout = SYS_MS_TO_TICKS(timeout);
4144 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
4145 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004146 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004147 return;
4148 }
4149 pMac->lim.gLimAddtsRspTimerCount++;
4150 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
4151 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
4152 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004153 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004154 return;
4155 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004156 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07004157
4158 //add the sessionId to the timer object
4159 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
4160 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
4161 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004162 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004163 return;
4164 }
4165 return;
4166}
4167
4168
4169static void
4170__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4171{
4172 tSirMacAddr peerMacAddr;
4173 tANI_U8 ac;
4174 tSirMacTSInfo *pTsinfo;
4175 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
4176 tpDphHashNode pStaDs = NULL;
4177 tpPESession psessionEntry;
4178 tANI_U8 sessionId;
4179 tANI_U32 status = eSIR_SUCCESS;
4180 tANI_U8 smesessionId;
4181 tANI_U16 smetransactionId;
4182
4183 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4184
4185 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
4186 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004187 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004188 status = eSIR_FAILURE;
4189 goto end;
4190 }
4191#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4192 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
4193#endif //FEATURE_WLAN_DIAG_SUPPORT
4194
4195
4196 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
4197 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004198 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004199 status = eSIR_FAILURE;
4200 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
4201 return;
4202 }
4203
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304204 limLog(pMac, LOG1, FL("Sent DELTS request to station with "
4205 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
4206 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004207
4208 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
4209 psessionEntry);
4210
4211 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
4212
4213 /* We've successfully send DELTS frame to AP. Update the
4214 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
4215 * is no longer trigger enabled or delivery enabled
4216 */
4217 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
4218
4219 /* We're deleting the TSPEC, so this particular AC is no longer
4220 * admitted. PE needs to downgrade the EDCA
4221 * parameters(for the AC for which TS is being deleted) to the
4222 * next best AC for which ACM is not enabled, and send the
4223 * updated values to HAL.
4224 */
4225 ac = upToAc(pTsinfo->traffic.userPrio);
4226
4227 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4228 {
4229 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4230 }
4231 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4232 {
4233 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4234 }
4235 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4236 {
4237 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4238 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4239 }
4240
4241 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4242
4243 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4244 if (pStaDs != NULL)
4245 {
4246 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4247 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4248 else
4249 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4250 status = eSIR_SUCCESS;
4251 }
4252 else
4253 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004254 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004255 status = eSIR_FAILURE;
4256 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004257#ifdef FEATURE_WLAN_ESE
4258#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004259 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4260#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004262#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004263#endif
4264
4265 // send an sme response back
4266 end:
4267 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4268}
4269
4270
4271void
4272limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4273{
4274 //fetch the sessionEntry based on the sessionId
4275 tpPESession psessionEntry;
4276 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4277 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004278 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004279 return;
4280 }
4281
4282 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4283 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004284 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004285 pMac->lim.gLimAddtsSent = false;
4286 return;
4287 }
4288
4289 if (! pMac->lim.gLimAddtsSent)
4290 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004291 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004292 return;
4293 }
4294
4295 if (param != pMac->lim.gLimAddtsRspTimerCount)
4296 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004297 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004298 param, pMac->lim.gLimAddtsRspTimerCount);
4299 return;
4300 }
4301
4302 // this a real response timeout
4303 pMac->lim.gLimAddtsSent = false;
4304 pMac->lim.gLimAddtsRspTimerCount++;
4305
4306 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4307 psessionEntry->smeSessionId, psessionEntry->transactionId);
4308}
4309
4310
4311/**
4312 * __limProcessSmeStatsRequest()
4313 *
4314 *FUNCTION:
4315 *
4316 *
4317 *NOTE:
4318 *
4319 * @param pMac Pointer to Global MAC structure
4320 * @param *pMsgBuf A pointer to the SME message buffer
4321 * @return None
4322 */
4323static void
4324__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4325{
4326 tpAniGetStatsReq pStatsReq;
4327 tSirMsgQ msgQ;
4328 tpPESession psessionEntry;
4329 tANI_U8 sessionId;
4330
4331
4332 if(pMsgBuf == NULL)
4333 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004334 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004335 return;
4336 }
4337
4338 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4339
4340 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4341 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004342 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304343 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004344 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004345 return;
4346 }
4347
4348
4349
4350 switch(pStatsReq->msgType)
4351 {
4352 //Add Lim stats here. and send reqsponse.
4353
4354 //HAL maintained Stats.
4355 case eWNI_SME_STA_STAT_REQ:
4356 msgQ.type = WDA_STA_STAT_REQ;
4357 break;
4358 case eWNI_SME_AGGR_STAT_REQ:
4359 msgQ.type = WDA_AGGR_STAT_REQ;
4360 break;
4361 case eWNI_SME_GLOBAL_STAT_REQ:
4362 msgQ.type = WDA_GLOBAL_STAT_REQ;
4363 break;
4364 case eWNI_SME_STAT_SUMM_REQ:
4365 msgQ.type = WDA_STAT_SUMM_REQ;
4366 break;
4367 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004368 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
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
Jeff Johnson295189b2012-06-20 16:38:30 -07004374 msgQ.reserved = 0;
4375 msgQ.bodyptr = pMsgBuf;
4376 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004377 if(NULL == psessionEntry)
4378 {
4379 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4380 }
4381 else
4382 {
4383 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4384 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004385 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004386 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304387 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004388 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004389 return;
4390 }
4391
4392 return;
4393}
4394
4395
4396/**
4397 * __limProcessSmeGetStatisticsRequest()
4398 *
4399 *FUNCTION:
4400 *
4401 *
4402 *NOTE:
4403 *
4404 * @param pMac Pointer to Global MAC structure
4405 * @param *pMsgBuf A pointer to the SME message buffer
4406 * @return None
4407 */
4408static void
4409__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4410{
4411 tpAniGetPEStatsReq pPEStatsReq;
4412 tSirMsgQ msgQ;
4413
4414 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4415
4416 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4417
4418 msgQ.type = WDA_GET_STATISTICS_REQ;
4419
Jeff Johnson295189b2012-06-20 16:38:30 -07004420 msgQ.reserved = 0;
4421 msgQ.bodyptr = pMsgBuf;
4422 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004423 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004424
4425 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304426 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004427 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004428 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004429 return;
4430 }
4431
4432 return;
4433}
4434
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004435#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004436/**
4437 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4438 *
4439 *NOTE:
4440 *
4441 * @param pMac Pointer to Global MAC structure
4442 * @param *pMsgBuf A pointer to the SME message buffer
4443 * @return None
4444 */
4445static void
4446__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4447{
4448 tSirMsgQ msgQ;
4449
4450 msgQ.type = WDA_TSM_STATS_REQ;
4451 msgQ.reserved = 0;
4452 msgQ.bodyptr = pMsgBuf;
4453 msgQ.bodyval = 0;
4454 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4455
4456 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4457 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004458 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004459 limLog(pMac, LOGP, "Unable to forward request");
4460 return;
4461 }
4462}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004463#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004464
4465
Jeff Johnson295189b2012-06-20 16:38:30 -07004466
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004467#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004468/**
4469 * __limProcessSmeGetRoamRssiRequest()
4470 *
4471 *FUNCTION:
4472 *
4473 *
4474 *NOTE:
4475 *
4476 * @param pMac Pointer to Global MAC structure
4477 * @param *pMsgBuf A pointer to the SME message buffer
4478 * @return None
4479 */
4480static void
4481__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4482{
4483 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4484 tSirMsgQ msgQ;
4485
4486 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4487 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4488
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004489 msgQ.reserved = 0;
4490 msgQ.bodyptr = pMsgBuf;
4491 msgQ.bodyval = 0;
4492 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4493
4494 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304495 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004496 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004497 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004498 return;
4499 }
4500
4501 return;
4502}
4503#endif
4504
4505
Jeff Johnson295189b2012-06-20 16:38:30 -07004506static void
4507__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4508{
4509 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4510 tpPESession psessionEntry;
4511 tANI_U8 sessionId; //PE sessionID
4512
4513 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004514 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004515
4516 if(pMsgBuf == NULL)
4517 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004518 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004519 return;
4520 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004521
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304522 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4523 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004524 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304525 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004526 return;
4527 }
4528
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004529 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004530 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004531 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004532 goto end;
4533 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004534
Jeff Johnson295189b2012-06-20 16:38:30 -07004535 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4536 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004537 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004538 goto end;
4539 }
4540
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304541 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004542
Jeff Johnson295189b2012-06-20 16:38:30 -07004543 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004544 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004545
4546end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304547 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004548 return;
4549} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4550
4551static void
4552__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4553{
4554 tpSirUpdateParams pUpdateParams;
4555 tpPESession psessionEntry;
4556
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304557 limLog(pMac, LOG1,
4558 FL("received SME_HIDE_SSID message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004559
4560 if(pMsgBuf == NULL)
4561 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004562 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004563 return;
4564 }
4565
4566 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4567
4568 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4569 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004570 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004571 pUpdateParams->sessionId);
4572 return;
4573 }
4574
4575 /* Update the session entry */
4576 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4577
4578 /* Update beacon */
4579 schSetFixedBeaconFields(pMac, psessionEntry);
4580 limSendBeaconInd(pMac, psessionEntry);
4581
4582 return;
4583} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4584
4585static void
4586__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4587{
4588 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4589 tpPESession psessionEntry;
4590 tANI_U8 sessionId; //PE sessionID
4591
4592 if(pMsgBuf == NULL)
4593 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004594 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 return;
4596 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304597
4598 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4599 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004600 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304601 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004602 return;
4603 }
4604
4605 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4606 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004607 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004608 goto end;
4609 }
4610
4611 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4612 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004613 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004614 goto end;
4615 }
4616
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304617 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4618 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004619
4620 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4621
4622 psessionEntry->pLimStartBssReq->privacy = 1;
4623 psessionEntry->privacy = 1;
4624
4625 schSetFixedBeaconFields(pMac, psessionEntry);
4626 limSendBeaconInd(pMac, psessionEntry);
4627
4628end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304629 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004630 return;
4631} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4632
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004633/*
4634Update the beacon Interval dynamically if beaconInterval is different in MCC
4635*/
4636static void
4637__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4638{
4639 tpSirChangeBIParams pChangeBIParams;
4640 tpPESession psessionEntry;
4641 tANI_U8 sessionId = 0;
4642 tUpdateBeaconParams beaconParams;
4643
4644 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004645 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004646
4647 if(pMsgBuf == NULL)
4648 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004649 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004650 return;
4651 }
4652
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304653 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004654 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4655
4656 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4657 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004658 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004659 return;
4660 }
4661
4662 /*Update sessionEntry Beacon Interval*/
4663 if(psessionEntry->beaconParams.beaconInterval !=
4664 pChangeBIParams->beaconInterval )
4665 {
4666 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4667 }
4668
4669 /*Update sch beaconInterval*/
4670 if(pMac->sch.schObject.gSchBeaconInterval !=
4671 pChangeBIParams->beaconInterval )
4672 {
4673 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4674
4675 PELOG1(limLog(pMac, LOG1,
4676 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4677
4678 /* Update beacon */
4679 schSetFixedBeaconFields(pMac, psessionEntry);
4680
Sunil Ravib96f7b52013-05-22 21:40:05 -07004681 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004682 //Set change in beacon Interval
4683 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004684 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004685 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4686 }
4687
4688 return;
4689} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4690
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304691/** -------------------------------------------------------------
4692\fn
4693\brief handles indication message from HDD to update HT mode
4694\param tpAniSirGlobal pMac
4695\param tANI_U32 pMsgBuf
4696\return None
4697-------------------------------------------------------------*/
4698#ifdef WLAN_FEATURE_AP_HT40_24G
4699static void __limProcessSmeSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4700{
4701 tpSirSetHT2040Mode pSetHT2040Mode;
4702 tpPESession psessionEntry;
4703 tANI_U8 sessionId = 0;
4704 tUpdateVHTOpMode *pHtOpMode = NULL;
4705 vos_msg_t msg;
Jeff Johnson295189b2012-06-20 16:38:30 -07004706
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304707 PELOG1(limLog(pMac, LOGRW,
4708 FL("received Set HT 20/40 mode message")););
4709
4710 if(pMsgBuf == NULL)
4711 {
4712 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
4713 return;
4714 }
4715
4716 pSetHT2040Mode = (tpSirSetHT2040Mode)pMsgBuf;
4717
4718 if((psessionEntry = peFindSessionByBssid(pMac, pSetHT2040Mode->bssId,
4719 &sessionId)) == NULL)
4720 {
4721 limLog(pMac, LOGE, FL("Session does not exist for given BSSID "));
4722 limPrintMacAddr(pMac, pSetHT2040Mode->bssId, LOGE);
4723 return;
4724 }
4725
4726 limLog(pMac, LOGW, FL("Update session entry for cbMod=%d"),
4727 pSetHT2040Mode->cbMode);
4728
4729 /*Update sessionEntry HT related fields*/
4730 switch(pSetHT2040Mode->cbMode)
4731 {
4732 case PHY_SINGLE_CHANNEL_CENTERED:
4733 psessionEntry->htSecondaryChannelOffset = PHY_SINGLE_CHANNEL_CENTERED;
4734 psessionEntry->htRecommendedTxWidthSet = 0;
4735 break;
4736 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
4737 psessionEntry->htSecondaryChannelOffset =
4738 PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
4739 psessionEntry->htRecommendedTxWidthSet = 1;
4740 break;
4741 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
4742 psessionEntry->htSecondaryChannelOffset =
4743 PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
4744 psessionEntry->htRecommendedTxWidthSet = 1;
4745 break;
4746 default:
4747 limLog(pMac, LOGE,FL("Invalid cbMode"));
4748 return;
4749 }
4750
4751 limLog(pMac, LOGW, FL("Channel Bonding mode : %d"
4752 " htSecondaryChannelOffset: %d"
4753 " htRecommendedTxWidthSet :%d"),
4754 pSetHT2040Mode->cbMode,
4755 psessionEntry->htSecondaryChannelOffset,
4756 psessionEntry->htRecommendedTxWidthSet);
4757
4758 limLog(pMac, LOGW, FL("Update Beacon IEs"));
4759
4760 /* Update beacon */
4761 schSetFixedBeaconFields(pMac, psessionEntry);
4762 limSendBeaconInd(pMac, psessionEntry);
4763
4764 /* Update OP Mode */
4765 pHtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode));
4766 if ( NULL == pHtOpMode )
4767 {
4768 limLog(pMac, LOGE,
4769 FL("Not able to allocate memory for setting OP mode"));
4770 return;
4771 }
4772
4773 pHtOpMode->opMode = (psessionEntry->htSecondaryChannelOffset ==
4774 PHY_SINGLE_CHANNEL_CENTERED)?
4775 eHT_CHANNEL_WIDTH_20MHZ:eHT_CHANNEL_WIDTH_40MHZ;
4776
4777 /* Pass Self STA ID to FW. Based on Self STA ID FW will update the
4778 * operating mode for all connected STA.
4779 */
4780
4781 pHtOpMode->staId = psessionEntry->staId;
4782
4783 msg.type = WDA_UPDATE_OP_MODE;
4784 msg.reserved = 0;
4785 msg.bodyptr = pHtOpMode;
4786
4787 if (!VOS_IS_STATUS_SUCCESS(
4788 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
4789 {
4790 limLog(pMac, LOGE,
4791 FL("Not able to post WDA_UPDATE_OP_MODE message to WDA"));
4792 vos_mem_free(pHtOpMode);
4793 return;
4794 }
4795
4796 limLog(pMac, LOGW,
4797 FL("Notifed FW about OP mode: %d for staId=%d"),
4798 pHtOpMode->opMode, pHtOpMode->staId);
4799
4800 return;
4801}
4802#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004803
4804/** -------------------------------------------------------------
4805\fn limProcessSmeDelBaPeerInd
4806\brief handles indication message from HDD to send delete BA request
4807\param tpAniSirGlobal pMac
4808\param tANI_U32 pMsgBuf
4809\return None
4810-------------------------------------------------------------*/
4811void
4812limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4813{
4814 tANI_U16 assocId =0;
4815 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4816 tpDphHashNode pSta;
4817 tpPESession psessionEntry;
4818 tANI_U8 sessionId;
4819
4820
4821
4822 if(NULL == pSmeDelBAPeerInd)
4823 return;
4824
4825 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4826 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004827 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004828 return;
4829 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004830 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004831 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4832
4833 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4834 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4835 pSta,
4836 pSmeDelBAPeerInd->baDirection,
4837 pSmeDelBAPeerInd->baTID,
4838 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4839 {
4840 limLog( pMac, LOGW,
4841 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4842 if (pSta)
4843 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4844 }
4845}
4846
4847// --------------------------------------------------------------------
4848/**
4849 * __limProcessReportMessage
4850 *
4851 * FUNCTION: Processes the next received Radio Resource Management message
4852 *
4853 * LOGIC:
4854 *
4855 * ASSUMPTIONS:
4856 *
4857 * NOTE:
4858 *
4859 * @param None
4860 * @return None
4861 */
4862
4863void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4864{
4865#ifdef WLAN_FEATURE_VOWIFI
4866 switch (pMsg->type)
4867 {
4868 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4869 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4870 break;
4871 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4872 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004873#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004874 tpSirBeaconReportXmitInd pBcnReport=NULL;
4875 tpPESession psessionEntry=NULL;
4876 tANI_U8 sessionId;
4877
4878 if(pMsg->bodyptr == NULL)
4879 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004880 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004881 return;
4882 }
4883 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4884 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4885 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004886 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004887 return;
4888 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004889 if (psessionEntry->isESEconnection)
4890 eseProcessBeaconReportXmit( pMac, pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004891 else
4892#endif
4893 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4894 }
4895 break;
4896 }
4897#endif
4898}
4899
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004900#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI)
Jeff Johnson295189b2012-06-20 16:38:30 -07004901// --------------------------------------------------------------------
4902/**
4903 * limSendSetMaxTxPowerReq
4904 *
4905 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4906 *
4907 * LOGIC:
4908 *
4909 * ASSUMPTIONS:
4910 *
4911 * NOTE:
4912 *
4913 * @param txPower txPower to be set.
4914 * @param pSessionEntry session entry.
4915 * @return None
4916 */
4917tSirRetStatus
4918limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4919{
4920 tpMaxTxPowerParams pMaxTxParams = NULL;
4921 tSirRetStatus retCode = eSIR_SUCCESS;
4922 tSirMsgQ msgQ;
4923
4924 if( pSessionEntry == NULL )
4925 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004926 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004927 return eSIR_FAILURE;
4928 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304929
4930 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4931 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004932 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004933 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004934 return eSIR_MEM_ALLOC_FAILED;
4935
4936 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004937#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304938 limLog( pMac, LOG1,
4939 FL(" Allocated memory for pMaxTxParams, which will be freed in other module"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004940#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004941 if( pMaxTxParams == NULL )
4942 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304943 limLog( pMac, LOGE, FL("pMaxTxParams is NULL"));
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004944 return eSIR_FAILURE;
4945 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004946 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304947 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4948 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004949
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004950 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4951 msgQ.bodyptr = pMaxTxParams;
4952 msgQ.bodyval = 0;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304953 limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004954 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
4955 retCode = wdaPostCtrlMsg(pMac, &msgQ);
4956 if (eSIR_SUCCESS != retCode)
4957 {
4958 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304959 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004960 }
4961 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004962}
4963#endif
4964
4965/**
4966 * __limProcessSmeAddStaSelfReq()
4967 *
4968 *FUNCTION:
4969 * This function is called to process SME_ADD_STA_SELF_REQ message
4970 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4971 *
4972 *LOGIC:
4973 *
4974 *ASSUMPTIONS:
4975 *
4976 *NOTE:
4977 *
4978 * @param pMac Pointer to Global MAC structure
4979 * @param *pMsgBuf A pointer to the SME message buffer
4980 * @return None
4981 */
4982
4983static void
4984__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4985{
4986 tSirMsgQ msg;
4987 tpAddStaSelfParams pAddStaSelfParams;
4988 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
4989
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304990 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
4991 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004992 {
4993 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
4994 return;
4995 }
4996
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304997 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07004998 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004999 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
5000 msg.reserved = 0;
5001 msg.bodyptr = pAddStaSelfParams;
5002 msg.bodyval = 0;
5003
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005004 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005005 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005006
5007 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5008 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005009 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005010 }
5011 return;
5012} /*** end __limProcessAddStaSelfReq() ***/
5013
5014
5015/**
5016 * __limProcessSmeDelStaSelfReq()
5017 *
5018 *FUNCTION:
5019 * This function is called to process SME_DEL_STA_SELF_REQ message
5020 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
5021 *
5022 *LOGIC:
5023 *
5024 *ASSUMPTIONS:
5025 *
5026 *NOTE:
5027 *
5028 * @param pMac Pointer to Global MAC structure
5029 * @param *pMsgBuf A pointer to the SME message buffer
5030 * @return None
5031 */
5032
5033static void
5034__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5035{
5036 tSirMsgQ msg;
5037 tpDelStaSelfParams pDelStaSelfParams;
5038 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
5039
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305040 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
5041 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005042 {
5043 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
5044 return;
5045 }
5046
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305047 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005048
5049 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
5050 msg.reserved = 0;
5051 msg.bodyptr = pDelStaSelfParams;
5052 msg.bodyval = 0;
5053
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005054 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005055 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005056
5057 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5058 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005059 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005060 }
5061 return;
5062} /*** end __limProcessSmeDelStaSelfReq() ***/
5063
5064
Jeff Johnson295189b2012-06-20 16:38:30 -07005065/**
5066 * __limProcessSmeRegisterMgmtFrameReq()
5067 *
5068 *FUNCTION:
5069 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
5070 * from SME. It Register this information within PE.
5071 *
5072 *LOGIC:
5073 *
5074 *ASSUMPTIONS:
5075 *
5076 *NOTE:
5077 *
5078 * @param pMac Pointer to Global MAC structure
5079 * @param *pMsgBuf A pointer to the SME message buffer
5080 * @return None
5081 */
5082static void
5083__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5084{
5085 VOS_STATUS vosStatus;
5086 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
5087 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005088 tANI_BOOLEAN match = VOS_FALSE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305089 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005090 FL("registerFrame %d, frameType %d, matchLen %d"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305091 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005092
Jeff Johnsond13512a2012-07-17 11:42:19 -07005093 /* First check whether entry exists already*/
5094
5095 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5096 (vos_list_node_t**)&pLimMgmtRegistration);
5097
5098 while(pLimMgmtRegistration != NULL)
5099 {
5100 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
5101 {
5102 if(pSmeReq->matchLen)
5103 {
5104 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
5105 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305106 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07005107 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
5108 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005109 /* found match! */
5110 match = VOS_TRUE;
5111 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005112 }
5113 }
5114 }
5115 else
5116 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005117 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07005118 match = VOS_TRUE;
5119 break;
5120 }
5121 }
5122 vosStatus = vos_list_peek_next (
5123 &pMac->lim.gLimMgmtFrameRegistratinQueue,
5124 (vos_list_node_t*) pLimMgmtRegistration,
5125 (vos_list_node_t**) &pNext );
5126
5127 pLimMgmtRegistration = pNext;
5128 pNext = NULL;
5129
5130 }
5131
5132 if (match)
5133 {
5134 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5135 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305136 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07005137 }
5138
Jeff Johnson295189b2012-06-20 16:38:30 -07005139 if(pSmeReq->registerFrame)
5140 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305141 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
5142 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005143 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305144 vos_mem_set((void*)pLimMgmtRegistration,
5145 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005146 pLimMgmtRegistration->frameType = pSmeReq->frameType;
5147 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
5148 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
5149 if(pSmeReq->matchLen)
5150 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305151 vos_mem_copy(pLimMgmtRegistration->matchData,
5152 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005153 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005154 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5155 &pLimMgmtRegistration->node);
5156 }
5157 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005158
5159 return;
5160} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08005161
5162static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08005163__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08005164{
5165 tpP2pPsParams pMsgNoA;
5166 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08005167
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305168 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
5169 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08005170 {
5171 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005172 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08005173 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005174 }
5175
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305176 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08005177 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
5178 pMsgNoA->opp_ps = 0;
5179 pMsgNoA->ctWindow = 0;
5180 pMsgNoA->duration = 0;
5181 pMsgNoA->interval = 0;
5182 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08005183
Vinay Malekal62757362012-12-17 12:15:51 -08005184 /* Below params used for Single Shot NOA - so assign proper values */
5185 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08005186 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08005187
Viral Modid86bde22012-12-10 13:09:21 -08005188 /* Start Insert NOA timer
5189 * 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 -08005190 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
5191 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08005192 */
5193 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
5194 == TX_TIMER_ERROR)
5195 {
5196 /// Could not activate Insert NOA timer.
5197 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005198 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08005199
5200 // send the scan response back with status failure and do not even call insert NOA
5201 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305202 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08005203 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005204 }
5205
Viral Modid440e682013-03-06 02:25:31 -08005206 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
5207
Viral Modid86bde22012-12-10 13:09:21 -08005208 msg.type = WDA_SET_P2P_GO_NOA_REQ;
5209 msg.reserved = 0;
5210 msg.bodyptr = pMsgNoA;
5211 msg.bodyval = 0;
5212
5213 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5214 {
5215 /* 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 -07005216 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08005217 /* Deactivate the NOA timer in failure case */
5218 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
5219 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005220 }
Viral Modid440e682013-03-06 02:25:31 -08005221 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08005222
Viral Modid440e682013-03-06 02:25:31 -08005223error:
5224 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
5225 * worrying about the NOA
5226 */
5227 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
5228 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08005229 return FALSE;
5230
5231}
5232
Viral Modid440e682013-03-06 02:25:31 -08005233static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
5234{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005235 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08005236 pMac->lim.gDeferMsgTypeForNOA = msgType;
5237 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
5238}
5239
5240static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5241{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005242 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08005243 pMac->lim.gDeferMsgTypeForNOA = 0;
5244 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
5245 {
5246 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305247 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005248 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5249 }
5250}
5251
5252static
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305253tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType,
5254 tANI_U32 *pMsgBuf, tANI_BOOLEAN isPassiveScan)
Viral Modid440e682013-03-06 02:25:31 -08005255{
5256 tANI_U32 noaDuration = 0;
5257
5258 switch (msgType)
5259 {
5260 case eWNI_SME_SCAN_REQ:
5261 {
5262 tANI_U32 val;
5263 tANI_U8 i;
5264 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
5265 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
5266 {
5267 /*
5268 * Could not get max channel value
5269 * from CFG. Log error.
5270 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005271 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08005272
5273 /* use a default value of 110ms */
5274 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
5275 }
5276
5277 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
5278 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
5279
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05305280 if (pMac->miracast_mode) {
5281 noaDuration += DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST +
5282 DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
5283 } else if (isPassiveScan || !limActiveScanAllowed(pMac, channelNum)) {
Viral Modid440e682013-03-06 02:25:31 -08005284 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
5285 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
5286 */
5287 noaDuration += val;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305288 } else {
5289 /* Use min + max channel time to calculate the total duration of scan */
5290 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
Viral Modid440e682013-03-06 02:25:31 -08005291 }
5292 }
5293
5294 /* Adding an overhead of 20ms to account for the scan messaging delays */
5295 noaDuration += SCAN_MESSAGING_OVERHEAD;
5296 noaDuration *= CONV_MS_TO_US;
5297
5298 break;
5299 }
5300
5301 case eWNI_SME_OEM_DATA_REQ:
5302 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
5303 break;
5304
5305 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5306 {
5307 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
5308 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
5309 break;
5310 }
5311
5312 case eWNI_SME_JOIN_REQ:
5313 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
5314 break;
5315
5316 default:
5317 noaDuration = 0;
5318 break;
5319
5320 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005321 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08005322 return noaDuration;
5323}
5324
5325void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5326{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305327 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08005328
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005329 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005330 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
5331 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
5332 {
5333 switch (pMac->lim.gDeferMsgTypeForNOA)
5334 {
5335 case eWNI_SME_SCAN_REQ:
5336 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5337 break;
5338 case eWNI_SME_OEM_DATA_REQ:
5339 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5340 break;
5341 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305342 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5343 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
5344 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
5345 */
5346 if (FALSE == bufConsumed)
5347 {
5348 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5349 }
Viral Modid440e682013-03-06 02:25:31 -08005350 break;
5351 case eWNI_SME_JOIN_REQ:
5352 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5353 break;
5354 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005355 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005356 break;
5357 }
5358 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5359 }
5360 else
5361 {
5362 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005363 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005364 }
5365}
Jeff Johnson295189b2012-06-20 16:38:30 -07005366
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005367#ifdef FEATURE_WLAN_TDLS_INTERNAL
5368/*
5369 * Process Discovery request recieved from SME and transmit to AP.
5370 */
5371static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
5372 tANI_U32 *pMsgBuf)
5373{
5374 /* get all discovery request parameters */
5375 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
5376 tpPESession psessionEntry;
5377 tANI_U8 sessionId;
5378
5379 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005380 ("Discovery Req Recieved")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005381
5382 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
5383 == NULL)
5384 {
5385 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005386 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005387 disReq->sessionId);
5388 goto lim_tdls_dis_start_error;
5389 }
5390
5391 /* check if we are in proper state to work as TDLS client */
5392 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5393 {
5394 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005395 "dis req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005396 psessionEntry->limSystemRole);
5397 goto lim_tdls_dis_start_error;
5398 }
5399
5400 /*
5401 * if we are still good, go ahead and check if we are in proper state to
5402 * do TDLS discovery procedure.
5403 */
5404 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5405 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5406 {
5407
5408 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005409 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005410 goto lim_tdls_dis_start_error;
5411 }
5412
5413 /*
5414 * if we are still good, go ahead and transmit TDLS discovery request,
5415 * and save Dis Req info for future reference.
5416 */
5417
5418#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
5419 /*
5420 * send message to HAL to set RXP filters to receieve frame on
5421 * direct link..
5422 */
5423 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
5424 // psessionEntry->bssId) ;
5425#endif
5426
5427 /* save dis request message for matching dialog token */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305428 vos_mem_copy((tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
5429 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005430
5431 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005432 "Transmit Discovery Request Frame") ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005433 /* format TDLS discovery request frame and transmit it */
5434 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
5435 psessionEntry) ;
5436
5437 /* prepare for response */
5438 pMac->lim.gLimTdlsDisStaCount = 0 ;
5439 pMac->lim.gLimTdlsDisResultList = NULL ;
5440
5441 /*
5442 * start TDLS discovery request timer to wait for discovery responses
5443 * from all TDLS enabled clients in BSS.
5444 */
5445
5446 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005447 ("Start Discovery request Timeout Timer")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005448 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
5449 eLIM_TDLS_DISCOVERY_RSP_WAIT));
5450
5451 /* assign appropriate sessionId to the timer object */
5452 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
5453 psessionEntry->peSessionId;
5454
5455 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
5456 != TX_SUCCESS)
5457 {
5458 limLog(pMac, LOGP, FL("TDLS discovery response timer \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005459 activation failed!"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005460 goto lim_tdls_dis_start_error;
5461 }
5462 /*
5463 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
5464 * back to SME
5465 */
5466 return (eSIR_SUCCESS) ;
5467lim_tdls_dis_start_error:
5468 /* in error case, PE has to sent the response SME immediately with error code */
5469 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
5470 eWNI_SME_TDLS_DISCOVERY_START_RSP);
5471 return eSIR_FAILURE;
5472}
5473/*
5474 * Process link start request recieved from SME and transmit to AP.
5475 */
5476eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5477{
5478 /* get all discovery request parameters */
5479 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
5480 tLimTdlsLinkSetupInfo *linkSetupInfo;
5481 //tLimTdlsLinkSetupPeer *setupPeer;
5482 tpPESession psessionEntry;
5483 tANI_U8 sessionId;
5484 eHalStatus status;
5485
5486 if((psessionEntry = peFindSessionByBssid(pMac,
5487 setupReq->bssid, &sessionId)) == NULL)
5488 {
5489 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005490 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005491 setupReq->sessionId);
5492 goto lim_tdls_link_start_error;
5493 }
5494
5495 /* check if we are in proper state to work as TDLS client */
5496 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5497 {
5498 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005499 "TDLS link setup req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005500 psessionEntry->limSystemRole);
5501 goto lim_tdls_link_start_error;
5502 }
5503
5504 /*
5505 * if we are still good, go ahead and check if we are in proper state to
5506 * do TDLS setup procedure.
5507 */
5508 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5509 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5510 {
5511 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005512 state (%d)", pMac->lim.gLimSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005513 goto lim_tdls_link_start_error;
5514 }
5515
5516 /*
5517 * Now, go ahead and transmit TDLS discovery request, and save setup Req
5518 * info for future reference.
5519 */
5520 /* create node for Link setup */
5521 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
5522 //setupPeer = NULL ;
5523
5524 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
5525 setupReq->peerMac, psessionEntry) ;
5526 if(eHAL_STATUS_SUCCESS == status)
5527 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5528 TDLS setup cnf TX complete is successful. */
5529 return eSIR_SUCCESS;
5530#if 0
5531
5532 /*
5533 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005534 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005535 * free this memory if any timeout is happen in link setup procedure
5536 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305537 setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
5538 if ( NULL == setupPeer )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005539 {
5540 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005541 FL( "Unable to allocate memory during ADD_STA" ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005542 VOS_ASSERT(0) ;
5543 return eSIR_MEM_ALLOC_FAILED;
5544 }
5545 setupPeer->dialog = setupReq->dialog ;
5546 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
5547 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
5548 /* TDLS_sessionize: remember sessionId for future */
5549 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
5550 setupPeer->tdls_bIsResponder = 1;
5551
5552 /*
5553 * we only populate peer MAC, so it can assit us to find the
5554 * TDLS peer after response/or after response timeout
5555 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305556 vos_mem_copy(setupPeer->peerMac, setupReq->peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005557 sizeof(tSirMacAddr)) ;
5558 /* format TDLS discovery request frame and transmit it */
5559 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
5560 setupReq->dialog, psessionEntry, NULL, 0) ;
5561
5562 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
5563 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
5564 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
5565 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
5566 /* update setup peer list */
5567 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
5568 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
5569 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5570 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
5571 return eSIR_SUCCESS ;
5572#endif
5573lim_tdls_link_start_error:
5574 /* in case of error, return immediately to SME */
5575 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
5576 eWNI_SME_TDLS_LINK_START_RSP);
5577 return eSIR_FAILURE ;
5578}
5579
5580/*
5581 * Process link teardown request recieved from SME and transmit to AP.
5582 */
5583eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5584{
5585 /* get all discovery request parameters */
5586 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
5587 tLimTdlsLinkSetupPeer *setupPeer;
5588 tpPESession psessionEntry;
5589 tANI_U8 sessionId;
5590
5591 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
5592 {
5593 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005594 "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005595 goto lim_tdls_teardown_req_error;
5596 }
5597
5598 /* check if we are in proper state to work as TDLS client */
5599 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5600 {
5601 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005602 "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005603 goto lim_tdls_teardown_req_error;
5604 }
5605
5606 /*
5607 * if we are still good, go ahead and check if we are in proper state to
5608 * do TDLS setup procedure.
5609 */
5610 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5611 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5612 {
5613 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005614 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005615 goto lim_tdls_teardown_req_error;
5616 }
5617
5618 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Arif Hussain24bafea2013-11-15 15:10:03 -08005619 "Teardown for peer = " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(teardownReq->peerMac));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005620 /*
5621 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5622 * info for future reference.
5623 */
5624 /* Verify if this link is setup */
5625 setupPeer = NULL ;
5626 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5627 if(NULL == setupPeer)
5628 {
5629 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005630 ("invalid Peer on teardown ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005631 goto lim_tdls_teardown_req_error;
5632 }
5633
5634
5635 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5636 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5637 /* TDLS_sessionize: check sessionId in case */
5638 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5639 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005640 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005641 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5642 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5643 }
5644
5645 /* format TDLS teardown request frame and transmit it */
5646 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5647 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5648 {
5649 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005650 ("couldn't send teardown frame ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005651 goto lim_tdls_teardown_req_error;
5652 }
5653 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5654 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5655 return eSIR_SUCCESS;
5656lim_tdls_teardown_req_error:
5657 /* in case of error, return immediately to SME */
5658 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5659 eWNI_SME_TDLS_TEARDOWN_RSP);
5660 return eSIR_FAILURE;
5661}
5662
5663
5664#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005665
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305666static void
5667__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5668{
5669 tpSirResetAPCapsChange pResetCapsChange;
5670 tpPESession psessionEntry;
5671 tANI_U8 sessionId = 0;
5672 if (pMsgBuf == NULL)
5673 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005674 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305675 return;
5676 }
5677
5678 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5679 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5680 if (psessionEntry == NULL)
5681 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005682 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305683 return;
5684 }
5685
5686 psessionEntry->limSentCapsChangeNtf = false;
5687 return;
5688}
5689
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305690static void
5691__limProcessSmeSpoofMacAddrRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5692{
5693 tSirMsgQ msg;
5694 tpSpoofMacAddrReqParams pSpoofMacAddrParams;
5695 tpSirSpoofMacAddrReq pSmeReq = (tpSirSpoofMacAddrReq) pMsgBuf;
5696
5697 pSpoofMacAddrParams = vos_mem_malloc(sizeof( tSpoofMacAddrReqParams));
5698 if ( NULL == pSpoofMacAddrParams )
5699 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305700 limLog( pMac, LOGE, FL("Unable to allocate memory for tDelStaSelfParams") );
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305701 return;
5702 }
5703
5704 vos_mem_copy( pSpoofMacAddrParams->macAddr, pSmeReq->macAddr, sizeof(tSirMacAddr) );
5705
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305706 vos_mem_copy(pMac->lim.spoofMacAddr, pSmeReq->macAddr, VOS_MAC_ADDRESS_LEN);
5707
5708 limLog( pMac, LOG1, FL("Recieved Spoofed Mac Addr request with Addr:"
5709 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pMac->lim.spoofMacAddr) );
5710
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305711 msg.type = WDA_SPOOF_MAC_ADDR_REQ;
5712 msg.reserved = 0;
5713 msg.bodyptr = pSpoofMacAddrParams;
5714 msg.bodyval = 0;
5715
5716 limLog(pMac, LOG1, FL("sending SIR_HAL_SPOOF_MAC_ADDR_REQ msg to HAL"));
5717 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
5718
5719 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5720 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305721 limLog(pMac, LOGE, FL("wdaPostCtrlMsg failed for SIR_HAL_SPOOF_MAC_ADDR_REQ"));
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305722 vos_mem_free(pSpoofMacAddrParams);
5723 }
5724 return;
5725}
5726
Jeff Johnson295189b2012-06-20 16:38:30 -07005727/**
5728 * limProcessSmeReqMessages()
5729 *
5730 *FUNCTION:
5731 * This function is called by limProcessMessageQueue(). This
5732 * function processes SME request messages from HDD or upper layer
5733 * application.
5734 *
5735 *LOGIC:
5736 *
5737 *ASSUMPTIONS:
5738 *
5739 *NOTE:
5740 *
5741 * @param pMac Pointer to Global MAC structure
5742 * @param msgType Indicates the SME message type
5743 * @param *pMsgBuf A pointer to the SME message buffer
5744 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5745 * FALSE - if pMsgBuf is not to be freed.
5746 */
5747
5748tANI_BOOLEAN
5749limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5750{
5751 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5752 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005753 tpSirSmeScanReq pScanReq;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305754 tANI_BOOLEAN isPassiveScan = FALSE;
5755
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005756 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 -07005757 limMsgStr(pMsg->type), pMsg->type,
5758 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5759 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5760
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005761 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005762 /* Special handling of some SME Req msgs where we have an existing GO session and
5763 * want to insert NOA before processing those msgs. These msgs will be processed later when
5764 * start event happens
5765 */
Sachin Ahuja42354142015-01-06 19:48:35 +05305766 MTRACE(macTraceMsgRx(pMac, NO_SESSION, pMsg->type));
Viral Modid440e682013-03-06 02:25:31 -08005767 switch (pMsg->type)
5768 {
5769 case eWNI_SME_SCAN_REQ:
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305770 pScanReq = (tpSirSmeScanReq) pMsgBuf;
5771 isPassiveScan = (pScanReq->scanType == eSIR_PASSIVE_SCAN) ? TRUE : FALSE;
Viral Modid440e682013-03-06 02:25:31 -08005772 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005773
5774 /* If scan is disabled return from here
5775 */
5776 if (pMac->lim.fScanDisabled)
5777 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005778 if (pMsg->type == eWNI_SME_SCAN_REQ)
5779 {
5780 limSendSmeScanRsp(pMac,
5781 offsetof(tSirSmeScanRsp,bssDescription[0]),
5782 eSIR_SME_INVALID_PARAMETERS,
5783 pScanReq->sessionId,
5784 pScanReq->transactionId);
5785
5786 bufConsumed = TRUE;
5787 }
5788 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5789 {
5790 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5791 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5792 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5793
5794 /*
5795 * limRemainOnChnRsp will free the buffer this change is to
5796 * avoid "double free"
5797 */
5798 bufConsumed = FALSE;
5799 }
5800
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305801 limLog(pMac, LOGE,
5802 FL("Error: Scan Disabled."
5803 " Return with error status for SME Message %s(%d)"),
5804 limMsgStr(pMsg->type), pMsg->type);
5805
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005806 return bufConsumed;
5807 }
5808 /*
5809 * Do not add BREAK here
5810 */
5811 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005812 case eWNI_SME_JOIN_REQ:
5813 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5814 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5815 {
5816 tANI_U32 noaDuration;
5817 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305818 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf, isPassiveScan);
Viral Modid440e682013-03-06 02:25:31 -08005819 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5820 return bufConsumed;
5821 }
5822 }
5823 /* If no insert NOA required then execute the code below */
5824
Jeff Johnson295189b2012-06-20 16:38:30 -07005825 switch (pMsg->type)
5826 {
5827 case eWNI_SME_START_REQ:
5828 __limProcessSmeStartReq(pMac, pMsgBuf);
5829 break;
5830
5831 case eWNI_SME_SYS_READY_IND:
5832 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5833 break;
5834
Jeff Johnson295189b2012-06-20 16:38:30 -07005835 case eWNI_SME_START_BSS_REQ:
5836 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5837 break;
5838
5839 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005840 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005841 break;
5842
Jeff Johnsone7245742012-09-05 17:12:55 -07005843#ifdef FEATURE_OEM_DATA_SUPPORT
5844 case eWNI_SME_OEM_DATA_REQ:
5845 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005846 break;
5847#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005848 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5849 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5850 break;
5851
5852 case eWNI_SME_UPDATE_NOA:
5853 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5854 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305855 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5856 __limProcessClearDfsChannelList(pMac, pMsg);
5857 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005858 case eWNI_SME_JOIN_REQ:
5859 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005860 break;
5861
5862 case eWNI_SME_AUTH_REQ:
5863 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5864
5865 break;
5866
5867 case eWNI_SME_REASSOC_REQ:
5868 __limProcessSmeReassocReq(pMac, pMsgBuf);
5869
5870 break;
5871
5872 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5873 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5874
5875 break;
5876
5877 case eWNI_SME_DISASSOC_REQ:
5878 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5879
5880 break;
5881
5882 case eWNI_SME_DISASSOC_CNF:
5883 case eWNI_SME_DEAUTH_CNF:
5884 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5885
5886 break;
5887
5888 case eWNI_SME_DEAUTH_REQ:
5889 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5890
5891 break;
5892
Jeff Johnson295189b2012-06-20 16:38:30 -07005893
5894
5895 case eWNI_SME_SETCONTEXT_REQ:
5896 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5897
5898 break;
5899
5900 case eWNI_SME_REMOVEKEY_REQ:
5901 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5902
5903 break;
5904
5905 case eWNI_SME_STOP_BSS_REQ:
5906 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5907 break;
5908
5909 case eWNI_SME_ASSOC_CNF:
5910 case eWNI_SME_REASSOC_CNF:
5911 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305912 limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005913 else
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305914 limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005915 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5916 break;
5917
5918 case eWNI_SME_ADDTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305919 limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005920 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5921 break;
5922
5923 case eWNI_SME_DELTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305924 limLog(pMac, LOG1, FL("Received DELTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005925 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5926 break;
5927
5928 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305929 limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005930 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5931 break;
5932
5933 case eWNI_SME_STA_STAT_REQ:
5934 case eWNI_SME_AGGR_STAT_REQ:
5935 case eWNI_SME_GLOBAL_STAT_REQ:
5936 case eWNI_SME_STAT_SUMM_REQ:
5937 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5938 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5939 bufConsumed = FALSE;
5940 break;
5941 case eWNI_SME_GET_STATISTICS_REQ:
5942 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5943 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5944 bufConsumed = FALSE;
5945 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005946#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005947 case eWNI_SME_GET_ROAM_RSSI_REQ:
5948 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5949 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5950 bufConsumed = FALSE;
5951 break;
5952#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005953#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005954 case eWNI_SME_GET_TSM_STATS_REQ:
5955 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5956 bufConsumed = FALSE;
5957 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005958#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005959 case eWNI_SME_DEL_BA_PEER_IND:
5960 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5961 break;
5962 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5963 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5964 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005965 case eWNI_SME_GET_ASSOC_STAS_REQ:
5966 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5967 break;
5968 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5969 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5970 break;
5971
5972 case eWNI_SME_HIDE_SSID_REQ:
5973 __limProcessSmeHideSSID(pMac, pMsgBuf);
5974 break;
5975 case eWNI_SME_UPDATE_APWPSIE_REQ:
5976 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5977 break;
5978 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5979 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5980 break;
5981
5982 case eWNI_SME_SET_APWPARSNIEs_REQ:
5983 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5984 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005985
5986 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5987 //Update the beaconInterval
5988 __limProcessSmeChangeBI(pMac, pMsgBuf );
5989 break;
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05305990
5991#ifdef WLAN_FEATURE_AP_HT40_24G
5992 case eWNI_SME_SET_HT_2040_MODE:
5993 __limProcessSmeSetHT2040Mode(pMac, pMsgBuf);
5994 break;
5995#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005996
5997#if defined WLAN_FEATURE_VOWIFI
5998 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5999 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
6000 __limProcessReportMessage(pMac, pMsg);
6001 break;
6002#endif
6003
6004#if defined WLAN_FEATURE_VOWIFI_11R
6005 case eWNI_SME_FT_PRE_AUTH_REQ:
6006 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
6007 break;
6008 case eWNI_SME_FT_UPDATE_KEY:
6009 limProcessFTUpdateKey(pMac, pMsgBuf);
6010 break;
6011
6012 case eWNI_SME_FT_AGGR_QOS_REQ:
6013 limProcessFTAggrQosReq(pMac, pMsgBuf);
6014 break;
6015#endif
6016
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006017#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
6018 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07006019 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
6020 break;
6021#endif
6022 case eWNI_SME_ADD_STA_SELF_REQ:
6023 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
6024 break;
6025 case eWNI_SME_DEL_STA_SELF_REQ:
6026 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
6027 break;
6028
Jeff Johnson295189b2012-06-20 16:38:30 -07006029 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
6030 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
6031 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006032#ifdef FEATURE_WLAN_TDLS
6033 case eWNI_SME_TDLS_SEND_MGMT_REQ:
6034 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
6035 break;
6036 case eWNI_SME_TDLS_ADD_STA_REQ:
6037 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
6038 break;
6039 case eWNI_SME_TDLS_DEL_STA_REQ:
6040 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
6041 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05306042 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
6043 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
6044 break;
Atul Mittalc0f739f2014-07-31 13:47:47 +05306045// tdlsoffchan
6046 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
6047 limProcesSmeTdlsChanSwitchReq(pMac, pMsgBuf);
6048 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006049#endif
6050#ifdef FEATURE_WLAN_TDLS_INTERNAL
6051 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
6052 limProcessSmeDisStartReq(pMac, pMsgBuf);
6053 break ;
6054 case eWNI_SME_TDLS_LINK_START_REQ:
6055 limProcessSmeLinkStartReq(pMac, pMsgBuf);
6056 break ;
6057 case eWNI_SME_TDLS_TEARDOWN_REQ:
6058 limProcessSmeTeardownReq(pMac, pMsgBuf);
6059 break ;
6060#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05306061 case eWNI_SME_RESET_AP_CAPS_CHANGED:
6062 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
6063 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07006064
schang86c22c42013-03-13 18:41:24 -07006065 case eWNI_SME_SET_TX_POWER_REQ:
6066 limSendSetTxPowerReq(pMac, pMsgBuf);
6067 break ;
6068
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05306069 case eWNI_SME_MAC_SPOOF_ADDR_IND:
6070 __limProcessSmeSpoofMacAddrRequest(pMac, pMsgBuf);
6071 break ;
6072
Jeff Johnson295189b2012-06-20 16:38:30 -07006073 default:
6074 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
6075 pMsg->bodyptr = NULL;
6076 break;
6077 } // switch (msgType)
6078
6079 return bufConsumed;
6080} /*** end limProcessSmeReqMessages() ***/