blob: 74647b3f4b599a82565188313f9c5805680d6918 [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:
Abhishek Singh92fbac22015-03-24 17:57:36 +05302996 limLog(pMac, LOGE,FL("Deauth not allowed in IBSS"));
2997 if (pMac->lim.gLimRspReqd)
2998 {
2999 pMac->lim.gLimRspReqd = false;
3000 retCode = eSIR_SME_INVALID_PARAMETERS;
3001 deauthTrigger = eLIM_HOST_DEAUTH;
3002 goto sendDeauth;
3003 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003004 return;
3005
3006 case eLIM_AP_ROLE:
3007 // Fall through
3008
3009 break;
3010
3011 default:
3012 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303013 FL("received unexpected SME_DEAUTH_REQ for role %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05303014 psessionEntry->limSystemRole);
Abhishek Singh92fbac22015-03-24 17:57:36 +05303015 if (pMac->lim.gLimRspReqd)
3016 {
3017 pMac->lim.gLimRspReqd = false;
Jeff Johnson295189b2012-06-20 16:38:30 -07003018
Abhishek Singh92fbac22015-03-24 17:57:36 +05303019 retCode = eSIR_SME_INVALID_PARAMETERS;
3020 deauthTrigger = eLIM_HOST_DEAUTH;
3021 goto sendDeauth;
3022 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003023 return;
Abhishek Singh92fbac22015-03-24 17:57:36 +05303024
Jeff Johnson295189b2012-06-20 16:38:30 -07003025 } // end switch (pMac->lim.gLimSystemRole)
3026
3027 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
3028 {
3029 /// Deauthentication is triggered by Link Monitoring
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303030 limLog(pMac, LOG1,
3031 FL("Deauthentication is triggered by Link Monitoring"));
3032 limLog(pMac, LOG1,
3033 FL("Set Trigger to eLIM_LINK_MONITORING_DEAUTH"));
3034 limLog(pMac, LOG1,
3035 FL("and Reason to eSIR_MAC_UNSPEC_FAILURE_REASON"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
3037 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
3038 }
3039 else
3040 {
3041 deauthTrigger = eLIM_HOST_DEAUTH;
3042 reasonCode = smeDeauthReq.reasonCode;
3043 }
3044
3045 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303046 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
3047 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003048 {
3049 // Log error
Abhishek Singh92fbac22015-03-24 17:57:36 +05303050 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303051 FL("call to AllocateMemory failed for mlmDeauthReq"));
Abhishek Singh92fbac22015-03-24 17:57:36 +05303052 if (pMac->lim.gLimRspReqd)
3053 {
3054 pMac->lim.gLimRspReqd = false;
3055 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
3056 deauthTrigger = eLIM_HOST_DEAUTH;
3057 goto sendDeauth;
3058 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003059 return;
3060 }
3061
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303062 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003063 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
3064 sizeof(tSirMacAddr));
3065
3066 pMlmDeauthReq->reasonCode = reasonCode;
3067 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07003068
3069 /* Update PE session Id*/
3070 pMlmDeauthReq->sessionId = sessionId;
3071
3072 limPostMlmMessage(pMac,
3073 LIM_MLM_DEAUTH_REQ,
3074 (tANI_U32 *) pMlmDeauthReq);
3075 return;
3076
3077sendDeauth:
3078 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
3079 retCode,
3080 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07003081 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 smesessionId, smetransactionId);
3083} /*** end __limProcessSmeDeauthReq() ***/
3084
3085
3086
3087/**
3088 * __limProcessSmeSetContextReq()
3089 *
3090 *FUNCTION:
3091 * This function is called to process SME_SETCONTEXT_REQ message
3092 * from HDD or upper layer application.
3093 *
3094 *LOGIC:
3095 *
3096 *ASSUMPTIONS:
3097 *
3098 *NOTE:
3099 *
3100 * @param pMac Pointer to Global MAC structure
3101 * @param *pMsgBuf A pointer to the SME message buffer
3102 * @return None
3103 */
3104
3105static void
3106__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3107{
3108 tpSirSmeSetContextReq pSetContextReq;
3109 tLimMlmSetKeysReq *pMlmSetKeysReq;
3110 tpPESession psessionEntry;
3111 tANI_U8 sessionId; //PE sessionID
3112 tANI_U8 smesessionId;
3113 tANI_U16 smetransactionId;
3114
3115
3116 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003117 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07003118
3119
3120 if(pMsgBuf == NULL)
3121 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003122 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003123 return;
3124 }
3125
3126 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303127
3128 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
3129 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003130 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303131 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003132 return;
3133 }
3134
3135 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3136 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
3137 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003138 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003139 goto end;
3140 }
3141
3142 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3143 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003144 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 -07003145 limSendSmeSetContextRsp(pMac,
3146 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003148 eSIR_SME_INVALID_PARAMETERS,NULL,
3149 smesessionId,smetransactionId);
3150
3151 goto end;
3152 }
3153
3154
3155 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
3156 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003157 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003158 limSendSmeSetContextRsp(pMac,
3159 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003160 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003161 eSIR_SME_INVALID_PARAMETERS,NULL,
3162 smesessionId,smetransactionId);
3163
3164 goto end;
3165 }
3166
3167#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3168 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
3169#endif //FEATURE_WLAN_DIAG_SUPPORT
3170
3171
3172 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
3173 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3174 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3175 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3176 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3177 {
3178 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303179 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
3180 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003181 {
3182 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303183 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003184 goto end;
3185 }
3186
3187 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
3188 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
3189 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3190 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003191 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003192 goto end;
3193 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303194 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003195 (tANI_U8 *) &pSetContextReq->peerMacAddr,
3196 sizeof(tSirMacAddr));
3197
Jeff Johnson295189b2012-06-20 16:38:30 -07003198
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303199 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07003200 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
3201 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
3202
3203 pMlmSetKeysReq->sessionId = sessionId;
3204#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3205 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003206 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07003207#endif
3208
Jeff Johnson295189b2012-06-20 16:38:30 -07003209 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
3210 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
3211 {
3212 if(pSetContextReq->keyMaterial.key[0].keyLength)
3213 {
3214 tANI_U8 keyId;
3215 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303216 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07003217 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
3218 }
3219 else {
3220 tANI_U32 i;
3221 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3222 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303223 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003224 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3225 }
3226 }
3227 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003228
3229 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003230 }
3231 else
3232 {
3233 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303234 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003235 psessionEntry->limSystemRole,
3236 psessionEntry->limSmeState);
3237 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3238
3239 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003240 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003241 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3242 smesessionId,
3243 smetransactionId);
3244 }
3245
3246end:
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303247 vos_mem_zero(pSetContextReq,
3248 (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303249 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003250 return;
3251} /*** end __limProcessSmeSetContextReq() ***/
3252
3253/**
3254 * __limProcessSmeRemoveKeyReq()
3255 *
3256 *FUNCTION:
3257 * This function is called to process SME_REMOVEKEY_REQ message
3258 * from HDD or upper layer application.
3259 *
3260 *LOGIC:
3261 *
3262 *ASSUMPTIONS:
3263 *
3264 *NOTE:
3265 *
3266 * @param pMac Pointer to Global MAC structure
3267 * @param *pMsgBuf A pointer to the SME message buffer
3268 * @return None
3269 */
3270
3271static void
3272__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3273{
3274 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3275 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3276 tpPESession psessionEntry;
3277 tANI_U8 sessionId; //PE sessionID
3278 tANI_U8 smesessionId;
3279 tANI_U16 smetransactionId;
3280
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303281 limLog(pMac, LOG1,
3282 FL("received SME_REMOVEKEY_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003283
3284 if(pMsgBuf == NULL)
3285 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003286 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003287 return;
3288 }
3289
3290
3291 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3292
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303293 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3294 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 {
3296 //Log error
3297 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303298 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003299
3300 return;
3301 }
3302
3303 if ((limRemoveKeyReqSerDes(pMac,
3304 pRemoveKeyReq,
3305 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3306 {
3307 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003308 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003309
3310 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3311
3312 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3313 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003314 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003315 //goto end;
3316 }
3317
3318 limSendSmeRemoveKeyRsp(pMac,
3319 pRemoveKeyReq->peerMacAddr,
3320 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3321 smesessionId,smetransactionId);
3322
3323 goto end;
3324 }
3325
3326 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3327 {
3328 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003329 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003330 limSendSmeRemoveKeyRsp(pMac,
3331 pRemoveKeyReq->peerMacAddr,
3332 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3333 smesessionId, smetransactionId);
3334 goto end;
3335 }
3336
3337
3338 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3339 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3340 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3341 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3342 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3343 {
3344 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303345 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3346 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003347 {
3348 // Log error
3349 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303350 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003351
3352 goto end;
3353 }
3354
3355 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3356 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3357 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3358 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3359
3360 /* Update PE session Id */
3361 pMlmRemoveKeyReq->sessionId = sessionId;
3362
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303363 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003364 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3365 sizeof(tSirMacAddr));
3366
3367
3368 limPostMlmMessage(pMac,
3369 LIM_MLM_REMOVEKEY_REQ,
3370 (tANI_U32 *) pMlmRemoveKeyReq);
3371 }
3372 else
3373 {
3374 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303375 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003376 psessionEntry->limSystemRole,
3377 psessionEntry->limSmeState);
3378 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3379
3380 limSendSmeRemoveKeyRsp(pMac,
3381 pRemoveKeyReq->peerMacAddr,
3382 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3383 smesessionId,smetransactionId);
3384 }
3385
3386end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303387 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003388} /*** end __limProcessSmeRemoveKeyReq() ***/
3389
Jeff Johnson295189b2012-06-20 16:38:30 -07003390void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3391{
3392 tSirMsgQ mmhMsg;
3393 tpSmeGetScanChnRsp pSirSmeRsp;
3394 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303395 tANI_U8 sessionId;
3396 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003397
3398 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3399 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003400 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003401 pMac->lim.scanChnInfo.numChnInfo);
3402 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3403 }
3404
Abhishek Singh525045c2014-12-15 17:18:45 +05303405 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003406 FL("Sending message %s with number of channels %d"),
Abhishek Singh525045c2014-12-15 17:18:45 +05303407 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07003408
3409 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303410 pSirSmeRsp = vos_mem_malloc(len);
3411 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 {
3413 /// Buffer not available. Log error
3414 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303415 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003416
3417 return;
3418 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303419 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003420
Jeff Johnson295189b2012-06-20 16:38:30 -07003421 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3422 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303423
3424 if (pMac->fScanOffload)
3425 {
3426 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3427 pSirSmeRsp->sessionId = sessionId;
3428 }
3429 else
3430 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003431
3432 if(pMac->lim.scanChnInfo.numChnInfo)
3433 {
3434 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303435 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3436 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003437 }
3438 //Clear the list
3439 limRessetScanChannelInfo(pMac);
3440
3441 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3442 mmhMsg.bodyptr = pSirSmeRsp;
3443 mmhMsg.bodyval = 0;
3444
3445 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003446 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003447 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3448}
3449
3450
Jeff Johnson295189b2012-06-20 16:38:30 -07003451void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3452{
3453 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3454 tpDphHashNode pStaDs = NULL;
3455 tpPESession psessionEntry = NULL;
3456 tSap_Event sapEvent;
3457 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3458 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3459 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3460 tANI_U8 assocId = 0;
3461 tANI_U8 staCount = 0;
3462
3463 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3464 {
3465 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003466 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303467 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003468 }
3469
3470 switch (getAssocSTAsReq.modId)
3471 {
3472/**
3473 case VOS_MODULE_ID_HAL:
3474 wdaPostCtrlMsg( pMac, &msgQ );
3475 return;
3476
3477 case VOS_MODULE_ID_TL:
3478 Post msg TL
3479 return;
3480*/
3481 case VOS_MODULE_ID_PE:
3482 default:
3483 break;
3484 }
3485
Jeff Johnson1250df42012-12-10 14:31:52 -08003486 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003487 // Find PE session Entry
3488 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3489 {
3490 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003491 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003492 goto limAssocStaEnd;
3493 }
3494
3495 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3496 {
3497 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303498 FL("Received unexpected message in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303499 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003500 goto limAssocStaEnd;
3501 }
3502
3503 // Retrieve values obtained in the request message
3504 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3505 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3506
3507 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3508 {
3509 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3510
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303511 if ((NULL == pStaDs) || (NULL == pAssocStasTemp))
Jeff Johnson295189b2012-06-20 16:38:30 -07003512 continue;
3513
3514 if (pStaDs->valid)
3515 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303516 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3517 (tANI_U8 *)&pStaDs->staAddr,
3518 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003519 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3520 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3521
Kiet Lamb1233192013-11-28 13:38:20 +05303522 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003523 (tANI_U8 *)&pStaDs->supportedRates,
3524 sizeof(tSirSupportedRates));
3525 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3526 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3527 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3528
Jeff Johnson295189b2012-06-20 16:38:30 -07003529 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003530 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3531 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003532 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3533 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3534
3535 pAssocStasTemp++;
3536 staCount++;
3537 }
3538 }
3539
3540limAssocStaEnd:
3541 // Call hdd callback with sap event to send the list of associated stations from PE
3542 if (pSapEventCallback != NULL)
3543 {
3544 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3545 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3546 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3547 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3548 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3549 }
3550}
3551
3552
3553/**
3554 * limProcessSmeGetWPSPBCSessions
3555 *
3556 *FUNCTION:
3557 * This function is called when query the WPS PBC overlap message is received
3558 *
3559 *LOGIC:
3560 * This function parses get WPS PBC overlap information message and call callback to pass
3561 * WPS PBC overlap information back to hdd.
3562 *ASSUMPTIONS:
3563 *
3564 *
3565 *NOTE:
3566 *
3567 * @param pMac Pointer to Global MAC structure
3568 * @param pMsgBuf A pointer to WPS PBC overlap query message
3569*
3570 * @return None
3571 */
3572void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3573{
3574 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3575 tpPESession psessionEntry = NULL;
3576 tSap_Event sapEvent;
3577 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3578 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3579 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3580
3581 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3582
3583 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3584 {
3585 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003586 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303587 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003588 }
3589
Jeff Johnson1250df42012-12-10 14:31:52 -08003590 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003591 // Find PE session Entry
3592 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3593 {
3594 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003595 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003596 goto limGetWPSPBCSessionsEnd;
3597 }
3598
3599 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3600 {
3601 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303602 FL("Received unexpected message in role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003603 psessionEntry->limSystemRole);
3604 goto limGetWPSPBCSessionsEnd;
3605 }
3606
Jeff Johnson1250df42012-12-10 14:31:52 -08003607 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003608 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3609 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3610
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303611 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003612 { //This is GetWpsSession call
3613
3614 limGetWPSPBCSessions(pMac,
3615 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3616 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3617 }
3618 else
3619 {
3620 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3621 /* don't have to inform the HDD/Host */
3622 return;
3623 }
3624
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003625 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003626 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3627
3628 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3629
3630limGetWPSPBCSessionsEnd:
3631 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
Abhishek Singh8a99b9f2015-03-31 14:18:26 +05303632
3633 if (NULL != pSapEventCallback)
3634 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
Jeff Johnson295189b2012-06-20 16:38:30 -07003635}
3636
Jeff Johnson295189b2012-06-20 16:38:30 -07003637
3638
3639/**
3640 * __limCounterMeasures()
3641 *
3642 * FUNCTION:
3643 * This function is called to "implement" MIC counter measure
3644 * and is *temporary* only
3645 *
3646 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3647 * we don't do the proper STA disassoc sequence since the
3648 * BSS will be stoped anyway
3649 *
3650 *ASSUMPTIONS:
3651 *
3652 *NOTE:
3653 *
3654 * @param pMac Pointer to Global MAC structure
3655 * @return None
3656 */
3657
3658static void
3659__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3660{
3661 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
Abhishek Singh8944b222014-09-17 16:13:17 +05303662 /* If PMF is enabled then don't send broadcast disassociation */
3663 if ( ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
3664 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
3665 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
3666#ifdef WLAN_FEATURE_11W
3667 && !psessionEntry->limRmfEnabled
3668#endif
3669 )
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003670 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003671
Jeff Johnson295189b2012-06-20 16:38:30 -07003672};
3673
3674
Jeff Johnson295189b2012-06-20 16:38:30 -07003675void
3676limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3677{
3678 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3679 tpPESession psessionEntry;
3680 tANI_U8 sessionId; //PE sessionId
3681
3682 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3683 {
3684 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003685 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003686 return;
3687 }
3688
3689 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3690 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003691 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003692 return;
3693 }
3694
3695 if ( tkipCntrMeasReq.bEnable )
3696 {
3697 __limCounterMeasures( pMac, psessionEntry );
3698 }
3699
3700 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3701}
Jeff Johnson295189b2012-06-20 16:38:30 -07003702
3703
3704static void
3705__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3706{
3707 tSirSmeStopBssReq stopBssReq;
3708 tSirRetStatus status;
3709 tLimSmeStates prevState;
3710 tANI_U8 sessionId; //PE sessionId
3711 tpPESession psessionEntry;
3712 tANI_U8 smesessionId;
3713 tANI_U16 smetransactionId;
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303714 tANI_U8 i = 0;
3715 tpDphHashNode pStaDs = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003716
3717 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3718
3719
3720
3721 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3722 !limIsSmeStopBssReqValid(pMsgBuf))
3723 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003724 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003725 /// Send Stop BSS response to host
3726 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3727 return;
3728 }
3729
3730
3731 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3732 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003733 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003734 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3735 return;
3736 }
3737
3738#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3739 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3740#endif //FEATURE_WLAN_DIAG_SUPPORT
3741
3742
3743 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3744 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3745 {
3746 /**
3747 * Should not have received STOP_BSS_REQ in states
3748 * other than 'normal' state or on STA in Infrastructure
3749 * mode. Log error and return response to host.
3750 */
3751 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303752 FL("received unexpected SME_STOP_BSS_REQ in state %d, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003753 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3754 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3755 /// Send Stop BSS response to host
3756 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3757 return;
3758 }
3759
Jeff Johnson295189b2012-06-20 16:38:30 -07003760 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3761 {
3762 limWPSPBCClose(pMac, psessionEntry);
3763 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003764 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003765
3766 prevState = psessionEntry->limSmeState;
3767
3768 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003769 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003770
3771 /* Update SME session Id and Transaction Id */
3772 psessionEntry->smeSessionId = smesessionId;
3773 psessionEntry->transactionId = smetransactionId;
3774
Abhishek Singh8944b222014-09-17 16:13:17 +05303775 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame.
3776 * If PMF is enabled then don't send broadcast disassociation */
3777 if ( ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) &&
3778 (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3779#ifdef WLAN_FEATURE_11W
3780 && !psessionEntry->limRmfEnabled
3781#endif
3782 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003783 {
3784 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3785 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3786 // Send disassoc all stations associated thru TKIP
3787 __limCounterMeasures(pMac,psessionEntry);
3788 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303789 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003790 }
3791
3792 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3793 pMac->lim.gLimIbssCoalescingHappened = false;
3794
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303795 for(i = 1 ; i < pMac->lim.gLimAssocStaLimit ; i++)
3796 {
3797 pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable);
3798 if (NULL == pStaDs)
3799 continue;
3800 status = limDelSta(pMac, pStaDs, false, psessionEntry) ;
3801 if(eSIR_SUCCESS == status)
3802 {
3803 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ;
3804 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ;
3805 }
3806 else
3807 {
3808 limLog(pMac, LOGE, FL("limDelSta failed with Status : %d"), status);
3809 VOS_ASSERT(0) ;
3810 }
3811 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003812 /* send a delBss to HAL and wait for a response */
3813 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3814
3815 if (status != eSIR_SUCCESS)
3816 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003817 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003818 psessionEntry->limSmeState= prevState;
3819
Jeff Johnsone7245742012-09-05 17:12:55 -07003820 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003821
3822 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3823 }
3824}
3825
3826
3827/**--------------------------------------------------------------
3828\fn __limProcessSmeStopBssReq
3829
3830\brief Wrapper for the function __limHandleSmeStopBssRequest
3831 This message will be defered until softmac come out of
3832 scan mode. Message should be handled even if we have
3833 detected radar in the current operating channel.
3834\param pMac
3835\param pMsg
3836
3837\return TRUE - If we consumed the buffer
3838 FALSE - If have defered the message.
3839 ---------------------------------------------------------------*/
3840static tANI_BOOLEAN
3841__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3842{
3843 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3844 {
3845 /**
3846 * If message defered, buffer is not consumed yet.
3847 * So return false
3848 */
3849 return eANI_BOOLEAN_FALSE;
3850 }
3851 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3852 return eANI_BOOLEAN_TRUE;
3853} /*** end __limProcessSmeStopBssReq() ***/
3854
3855
3856void limProcessSmeDelBssRsp(
3857 tpAniSirGlobal pMac,
3858 tANI_U32 body,tpPESession psessionEntry)
3859{
3860
3861 (void) body;
3862 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3863 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003864 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003865 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3866 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003867 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3868 return;
3869}
3870
3871
Jeff Johnson295189b2012-06-20 16:38:30 -07003872/**---------------------------------------------------------------
3873\fn __limProcessSmeAssocCnfNew
3874\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3875\ in BTAMP AP.
3876\
3877\param pMac
3878\param msgType - message type
3879\param pMsgBuf - a pointer to the SME message buffer
3880\return None
3881------------------------------------------------------------------*/
3882
3883 void
3884__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3885{
3886 tSirSmeAssocCnf assocCnf;
3887 tpDphHashNode pStaDs = NULL;
3888 tpPESession psessionEntry= NULL;
3889 tANI_U8 sessionId;
3890
3891
3892 if(pMsgBuf == NULL)
3893 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003894 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003895 goto end;
3896 }
3897
3898 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3899 !__limIsSmeAssocCnfValid(&assocCnf))
3900 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003901 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003902 goto end;
3903 }
3904
3905 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3906 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003907 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003908 goto end;
3909 }
3910
3911 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3912 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3913 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05303914 limLog(pMac, LOGE, FL("Received unexpected message %X in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303915 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003916 goto end;
3917 }
3918
3919 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3920
3921 if (pStaDs == NULL)
3922 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303923 limLog(pMac, LOGE,
3924 FL("Received invalid message %X due to no STA context, "
3925 "for aid %d, peer "),
3926 msgType, assocCnf.aid);
Jeff Johnson295189b2012-06-20 16:38:30 -07003927 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3928
3929 /*
3930 ** send a DISASSOC_IND message to WSM to make sure
3931 ** the state in WSM and LIM is the same
3932 **/
3933 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3934 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3935 goto end;
3936 }
3937 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303938 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003939 (tANI_U8 *) assocCnf.peerMacAddr,
3940 sizeof(tSirMacAddr)) ) ||
3941 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3942 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3943 (msgType != eWNI_SME_ASSOC_CNF)) ||
3944 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003945 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003946 {
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303947 limLog(pMac, LOGE,
3948 FL("Received invalid message %X due to peerMacAddr mismatched "
3949 "or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "
3950 "StaD mlmState : %d"),
3951 msgType, assocCnf.aid, pStaDs->mlmStaContext.mlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07003952 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3953 goto end;
3954 }
3955
3956 /*
3957 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3958 ** has been received
3959 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003960 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003961 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3962
3963 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3964 {
3965 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3966 * when it had received Assoc Request frame. Now, PE just needs to send
3967 * Association Response frame to the requesting BTAMP-STA.
3968 */
3969 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003970 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003971 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3972 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3973 goto end;
3974 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3975 else
3976 {
3977 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3978 /*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*/
3979 if(!pStaDs->mlmStaContext.updateContext)
3980 pStaDs->mlmStaContext.updateContext = 1;
Sachin Ahuja2fea3d12014-12-18 17:31:31 +05303981 limLog(pMac, LOG1, FL("Receive Assoc Cnf with status Code : %d(assoc id=%d) "),
3982 assocCnf.statusCode, pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003983 limRejectAssociation(pMac, pStaDs->staAddr,
3984 pStaDs->mlmStaContext.subType,
3985 true, pStaDs->mlmStaContext.authType,
3986 pStaDs->assocId, true,
3987 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003988 }
3989
3990end:
3991 if((psessionEntry != NULL) && (pStaDs != NULL))
3992 {
3993 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3994 {
3995 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3996 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303997 vos_mem_free(((tpSirAssocReq)
3998 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07003999 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
4000 }
4001
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304002 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07004003 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
4004 }
4005 }
4006
4007} /*** end __limProcessSmeAssocCnfNew() ***/
4008
4009
Jeff Johnson295189b2012-06-20 16:38:30 -07004010
4011
4012static void
4013__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4014{
4015 tpDphHashNode pStaDs;
4016 tSirMacAddr peerMac;
4017 tpSirAddtsReq pSirAddts;
4018 tANI_U32 timeout;
4019 tpPESession psessionEntry;
4020 tANI_U8 sessionId; //PE sessionId
4021 tANI_U8 smesessionId;
4022 tANI_U16 smetransactionId;
4023
4024
4025 if(pMsgBuf == NULL)
4026 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004027 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004028 return;
4029 }
4030
4031 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4032
4033 pSirAddts = (tpSirAddtsReq) pMsgBuf;
4034
4035 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
4036 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004037 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004038 return;
4039 }
4040#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4041 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
4042#endif //FEATURE_WLAN_DIAG_SUPPORT
4043
4044
4045
4046 /* if sta
4047 * - verify assoc state
4048 * - send addts request to ap
4049 * - wait for addts response from ap
4050 * if ap, just ignore with error log
4051 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304052 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004053 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004054 pSirAddts->req.tspec.tsinfo.traffic.tsid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304055 pSirAddts->req.tspec.tsinfo.traffic.userPrio);
Jeff Johnson295189b2012-06-20 16:38:30 -07004056
4057 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
4058 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004059 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004060 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4061 smesessionId,smetransactionId);
4062 return;
4063 }
4064
4065 //Ignore the request if STA is in 11B mode.
4066 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
4067 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004068 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004069 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4070 smesessionId,smetransactionId);
4071 return;
4072 }
4073
4074
4075 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4076
4077 if(pStaDs == NULL)
4078 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004079 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004080 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4081 smesessionId,smetransactionId);
4082 return;
4083 }
4084
4085 if ((! pStaDs->valid) ||
4086 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
4087 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004088 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004089 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4090 smesessionId,smetransactionId);
4091 return;
4092 }
4093
4094 pSirAddts->req.wsmTspecPresent = 0;
4095 pSirAddts->req.wmeTspecPresent = 0;
4096 pSirAddts->req.lleTspecPresent = 0;
4097
4098 if ((pStaDs->wsmEnabled) &&
4099 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
4100 pSirAddts->req.wsmTspecPresent = 1;
4101 else if (pStaDs->wmeEnabled)
4102 pSirAddts->req.wmeTspecPresent = 1;
4103 else if (pStaDs->lleEnabled)
4104 pSirAddts->req.lleTspecPresent = 1;
4105 else
4106 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004107 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004108 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4109 smesessionId,smetransactionId);
4110 return;
4111 }
4112
4113 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4114 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4115 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004116 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07004117 psessionEntry->limSmeState);
4118 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4119 smesessionId,smetransactionId);
4120 return;
4121 }
4122
4123 if (pMac->lim.gLimAddtsSent)
4124 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004125 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07004126 pMac->lim.gLimAddtsReq.req.dialogToken,
4127 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
4128 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
4129 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4130 smesessionId,smetransactionId);
4131 return;
4132 }
4133
4134 #if 0
4135 val = sizeof(tSirMacAddr);
4136 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
4137 {
4138 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004139 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004140 return;
4141 }
4142 #endif
4143 sirCopyMacAddr(peerMac,psessionEntry->bssId);
4144
4145 // save the addts request
4146 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304147 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07004148
4149 // ship out the message now
4150 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
4151 psessionEntry);
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304152 limLog(pMac, LOG1, FL("Sent ADDTS request"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004153
4154 // start a timer to wait for the response
4155 if (pSirAddts->timeout)
4156 timeout = pSirAddts->timeout;
4157 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
4158 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004159 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004160 WNI_CFG_ADDTS_RSP_TIMEOUT);
4161 return;
4162 }
4163
4164 timeout = SYS_MS_TO_TICKS(timeout);
4165 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
4166 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004167 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004168 return;
4169 }
4170 pMac->lim.gLimAddtsRspTimerCount++;
4171 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
4172 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
4173 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004174 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004175 return;
4176 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004177 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07004178
4179 //add the sessionId to the timer object
4180 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
4181 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
4182 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004183 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004184 return;
4185 }
4186 return;
4187}
4188
4189
4190static void
4191__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4192{
4193 tSirMacAddr peerMacAddr;
4194 tANI_U8 ac;
4195 tSirMacTSInfo *pTsinfo;
4196 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
4197 tpDphHashNode pStaDs = NULL;
4198 tpPESession psessionEntry;
4199 tANI_U8 sessionId;
4200 tANI_U32 status = eSIR_SUCCESS;
4201 tANI_U8 smesessionId;
4202 tANI_U16 smetransactionId;
4203
4204 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4205
4206 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
4207 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004208 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004209 status = eSIR_FAILURE;
4210 goto end;
4211 }
4212#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4213 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
4214#endif //FEATURE_WLAN_DIAG_SUPPORT
4215
4216
4217 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
4218 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004219 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004220 status = eSIR_FAILURE;
4221 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
4222 return;
4223 }
4224
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304225 limLog(pMac, LOG1, FL("Sent DELTS request to station with "
4226 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
4227 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004228
4229 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
4230 psessionEntry);
4231
4232 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
4233
4234 /* We've successfully send DELTS frame to AP. Update the
4235 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
4236 * is no longer trigger enabled or delivery enabled
4237 */
4238 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
4239
4240 /* We're deleting the TSPEC, so this particular AC is no longer
4241 * admitted. PE needs to downgrade the EDCA
4242 * parameters(for the AC for which TS is being deleted) to the
4243 * next best AC for which ACM is not enabled, and send the
4244 * updated values to HAL.
4245 */
4246 ac = upToAc(pTsinfo->traffic.userPrio);
4247
4248 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4249 {
4250 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4251 }
4252 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4253 {
4254 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4255 }
4256 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4257 {
4258 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4259 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4260 }
4261
4262 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4263
4264 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4265 if (pStaDs != NULL)
4266 {
4267 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4268 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4269 else
4270 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4271 status = eSIR_SUCCESS;
4272 }
4273 else
4274 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004275 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004276 status = eSIR_FAILURE;
4277 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004278#ifdef FEATURE_WLAN_ESE
4279#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004280 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4281#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004282 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004283#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004284#endif
4285
4286 // send an sme response back
4287 end:
4288 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4289}
4290
4291
4292void
4293limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4294{
4295 //fetch the sessionEntry based on the sessionId
4296 tpPESession psessionEntry;
4297 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4298 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004299 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004300 return;
4301 }
4302
4303 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4304 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004305 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004306 pMac->lim.gLimAddtsSent = false;
4307 return;
4308 }
4309
4310 if (! pMac->lim.gLimAddtsSent)
4311 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004312 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004313 return;
4314 }
4315
4316 if (param != pMac->lim.gLimAddtsRspTimerCount)
4317 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004318 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004319 param, pMac->lim.gLimAddtsRspTimerCount);
4320 return;
4321 }
4322
4323 // this a real response timeout
4324 pMac->lim.gLimAddtsSent = false;
4325 pMac->lim.gLimAddtsRspTimerCount++;
4326
4327 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4328 psessionEntry->smeSessionId, psessionEntry->transactionId);
4329}
4330
4331
4332/**
4333 * __limProcessSmeStatsRequest()
4334 *
4335 *FUNCTION:
4336 *
4337 *
4338 *NOTE:
4339 *
4340 * @param pMac Pointer to Global MAC structure
4341 * @param *pMsgBuf A pointer to the SME message buffer
4342 * @return None
4343 */
4344static void
4345__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4346{
4347 tpAniGetStatsReq pStatsReq;
4348 tSirMsgQ msgQ;
4349 tpPESession psessionEntry;
4350 tANI_U8 sessionId;
4351
4352
4353 if(pMsgBuf == NULL)
4354 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004355 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004356 return;
4357 }
4358
4359 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4360
4361 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4362 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004363 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304364 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004365 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004366 return;
4367 }
4368
4369
4370
4371 switch(pStatsReq->msgType)
4372 {
4373 //Add Lim stats here. and send reqsponse.
4374
4375 //HAL maintained Stats.
4376 case eWNI_SME_STA_STAT_REQ:
4377 msgQ.type = WDA_STA_STAT_REQ;
4378 break;
4379 case eWNI_SME_AGGR_STAT_REQ:
4380 msgQ.type = WDA_AGGR_STAT_REQ;
4381 break;
4382 case eWNI_SME_GLOBAL_STAT_REQ:
4383 msgQ.type = WDA_GLOBAL_STAT_REQ;
4384 break;
4385 case eWNI_SME_STAT_SUMM_REQ:
4386 msgQ.type = WDA_STAT_SUMM_REQ;
4387 break;
4388 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004389 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304390 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004391 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004392 return;
4393 }
4394
Jeff Johnson295189b2012-06-20 16:38:30 -07004395 msgQ.reserved = 0;
4396 msgQ.bodyptr = pMsgBuf;
4397 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004398 if(NULL == psessionEntry)
4399 {
4400 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4401 }
4402 else
4403 {
4404 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4405 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004406 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004407 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304408 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004409 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004410 return;
4411 }
4412
4413 return;
4414}
4415
4416
4417/**
4418 * __limProcessSmeGetStatisticsRequest()
4419 *
4420 *FUNCTION:
4421 *
4422 *
4423 *NOTE:
4424 *
4425 * @param pMac Pointer to Global MAC structure
4426 * @param *pMsgBuf A pointer to the SME message buffer
4427 * @return None
4428 */
4429static void
4430__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4431{
4432 tpAniGetPEStatsReq pPEStatsReq;
4433 tSirMsgQ msgQ;
4434
4435 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4436
4437 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4438
4439 msgQ.type = WDA_GET_STATISTICS_REQ;
4440
Jeff Johnson295189b2012-06-20 16:38:30 -07004441 msgQ.reserved = 0;
4442 msgQ.bodyptr = pMsgBuf;
4443 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004444 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004445
4446 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304447 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004448 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004449 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004450 return;
4451 }
4452
4453 return;
4454}
4455
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004456#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004457/**
4458 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4459 *
4460 *NOTE:
4461 *
4462 * @param pMac Pointer to Global MAC structure
4463 * @param *pMsgBuf A pointer to the SME message buffer
4464 * @return None
4465 */
4466static void
4467__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4468{
4469 tSirMsgQ msgQ;
4470
4471 msgQ.type = WDA_TSM_STATS_REQ;
4472 msgQ.reserved = 0;
4473 msgQ.bodyptr = pMsgBuf;
4474 msgQ.bodyval = 0;
4475 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4476
4477 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4478 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004479 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004480 limLog(pMac, LOGP, "Unable to forward request");
4481 return;
4482 }
4483}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004484#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004485
4486
Jeff Johnson295189b2012-06-20 16:38:30 -07004487
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004488#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004489/**
4490 * __limProcessSmeGetRoamRssiRequest()
4491 *
4492 *FUNCTION:
4493 *
4494 *
4495 *NOTE:
4496 *
4497 * @param pMac Pointer to Global MAC structure
4498 * @param *pMsgBuf A pointer to the SME message buffer
4499 * @return None
4500 */
4501static void
4502__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4503{
4504 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4505 tSirMsgQ msgQ;
4506
4507 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4508 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4509
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004510 msgQ.reserved = 0;
4511 msgQ.bodyptr = pMsgBuf;
4512 msgQ.bodyval = 0;
4513 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4514
4515 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304516 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004517 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004518 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004519 return;
4520 }
4521
4522 return;
4523}
4524#endif
4525
4526
Jeff Johnson295189b2012-06-20 16:38:30 -07004527static void
4528__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4529{
4530 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4531 tpPESession psessionEntry;
4532 tANI_U8 sessionId; //PE sessionID
4533
4534 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004535 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004536
4537 if(pMsgBuf == NULL)
4538 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004539 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004540 return;
4541 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004542
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304543 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4544 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004545 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304546 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004547 return;
4548 }
4549
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004550 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004551 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004552 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004553 goto end;
4554 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004555
Jeff Johnson295189b2012-06-20 16:38:30 -07004556 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4557 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004558 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004559 goto end;
4560 }
4561
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304562 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004563
Jeff Johnson295189b2012-06-20 16:38:30 -07004564 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004565 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004566
4567end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304568 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004569 return;
4570} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4571
4572static void
4573__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4574{
4575 tpSirUpdateParams pUpdateParams;
4576 tpPESession psessionEntry;
4577
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304578 limLog(pMac, LOG1,
4579 FL("received SME_HIDE_SSID message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004580
4581 if(pMsgBuf == NULL)
4582 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004583 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004584 return;
4585 }
4586
4587 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4588
4589 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4590 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004591 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 pUpdateParams->sessionId);
4593 return;
4594 }
4595
4596 /* Update the session entry */
4597 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4598
4599 /* Update beacon */
4600 schSetFixedBeaconFields(pMac, psessionEntry);
4601 limSendBeaconInd(pMac, psessionEntry);
4602
4603 return;
4604} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4605
4606static void
4607__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4608{
4609 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4610 tpPESession psessionEntry;
4611 tANI_U8 sessionId; //PE sessionID
4612
4613 if(pMsgBuf == NULL)
4614 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004615 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004616 return;
4617 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304618
4619 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4620 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004621 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304622 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004623 return;
4624 }
4625
4626 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4627 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004628 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004629 goto end;
4630 }
4631
4632 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4633 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004634 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004635 goto end;
4636 }
4637
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304638 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4639 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004640
4641 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4642
4643 psessionEntry->pLimStartBssReq->privacy = 1;
4644 psessionEntry->privacy = 1;
4645
4646 schSetFixedBeaconFields(pMac, psessionEntry);
4647 limSendBeaconInd(pMac, psessionEntry);
4648
4649end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304650 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004651 return;
4652} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4653
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004654/*
4655Update the beacon Interval dynamically if beaconInterval is different in MCC
4656*/
4657static void
4658__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4659{
4660 tpSirChangeBIParams pChangeBIParams;
4661 tpPESession psessionEntry;
4662 tANI_U8 sessionId = 0;
4663 tUpdateBeaconParams beaconParams;
4664
4665 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004666 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004667
4668 if(pMsgBuf == NULL)
4669 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004670 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004671 return;
4672 }
4673
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304674 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004675 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4676
4677 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4678 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004679 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004680 return;
4681 }
4682
4683 /*Update sessionEntry Beacon Interval*/
4684 if(psessionEntry->beaconParams.beaconInterval !=
4685 pChangeBIParams->beaconInterval )
4686 {
4687 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4688 }
4689
4690 /*Update sch beaconInterval*/
4691 if(pMac->sch.schObject.gSchBeaconInterval !=
4692 pChangeBIParams->beaconInterval )
4693 {
4694 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4695
4696 PELOG1(limLog(pMac, LOG1,
4697 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4698
4699 /* Update beacon */
4700 schSetFixedBeaconFields(pMac, psessionEntry);
4701
Sunil Ravib96f7b52013-05-22 21:40:05 -07004702 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004703 //Set change in beacon Interval
4704 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004705 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004706 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4707 }
4708
4709 return;
4710} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4711
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304712/** -------------------------------------------------------------
4713\fn
4714\brief handles indication message from HDD to update HT mode
4715\param tpAniSirGlobal pMac
4716\param tANI_U32 pMsgBuf
4717\return None
4718-------------------------------------------------------------*/
4719#ifdef WLAN_FEATURE_AP_HT40_24G
4720static void __limProcessSmeSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4721{
4722 tpSirSetHT2040Mode pSetHT2040Mode;
4723 tpPESession psessionEntry;
4724 tANI_U8 sessionId = 0;
4725 tUpdateVHTOpMode *pHtOpMode = NULL;
4726 vos_msg_t msg;
Jeff Johnson295189b2012-06-20 16:38:30 -07004727
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304728 PELOG1(limLog(pMac, LOGRW,
4729 FL("received Set HT 20/40 mode message")););
4730
4731 if(pMsgBuf == NULL)
4732 {
4733 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
4734 return;
4735 }
4736
4737 pSetHT2040Mode = (tpSirSetHT2040Mode)pMsgBuf;
4738
4739 if((psessionEntry = peFindSessionByBssid(pMac, pSetHT2040Mode->bssId,
4740 &sessionId)) == NULL)
4741 {
4742 limLog(pMac, LOGE, FL("Session does not exist for given BSSID "));
4743 limPrintMacAddr(pMac, pSetHT2040Mode->bssId, LOGE);
4744 return;
4745 }
4746
4747 limLog(pMac, LOGW, FL("Update session entry for cbMod=%d"),
4748 pSetHT2040Mode->cbMode);
4749
4750 /*Update sessionEntry HT related fields*/
4751 switch(pSetHT2040Mode->cbMode)
4752 {
4753 case PHY_SINGLE_CHANNEL_CENTERED:
4754 psessionEntry->htSecondaryChannelOffset = PHY_SINGLE_CHANNEL_CENTERED;
4755 psessionEntry->htRecommendedTxWidthSet = 0;
4756 break;
4757 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
4758 psessionEntry->htSecondaryChannelOffset =
4759 PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
4760 psessionEntry->htRecommendedTxWidthSet = 1;
4761 break;
4762 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
4763 psessionEntry->htSecondaryChannelOffset =
4764 PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
4765 psessionEntry->htRecommendedTxWidthSet = 1;
4766 break;
4767 default:
4768 limLog(pMac, LOGE,FL("Invalid cbMode"));
4769 return;
4770 }
4771
4772 limLog(pMac, LOGW, FL("Channel Bonding mode : %d"
4773 " htSecondaryChannelOffset: %d"
4774 " htRecommendedTxWidthSet :%d"),
4775 pSetHT2040Mode->cbMode,
4776 psessionEntry->htSecondaryChannelOffset,
4777 psessionEntry->htRecommendedTxWidthSet);
4778
4779 limLog(pMac, LOGW, FL("Update Beacon IEs"));
4780
4781 /* Update beacon */
4782 schSetFixedBeaconFields(pMac, psessionEntry);
4783 limSendBeaconInd(pMac, psessionEntry);
4784
4785 /* Update OP Mode */
4786 pHtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode));
4787 if ( NULL == pHtOpMode )
4788 {
4789 limLog(pMac, LOGE,
4790 FL("Not able to allocate memory for setting OP mode"));
4791 return;
4792 }
4793
4794 pHtOpMode->opMode = (psessionEntry->htSecondaryChannelOffset ==
4795 PHY_SINGLE_CHANNEL_CENTERED)?
4796 eHT_CHANNEL_WIDTH_20MHZ:eHT_CHANNEL_WIDTH_40MHZ;
4797
4798 /* Pass Self STA ID to FW. Based on Self STA ID FW will update the
4799 * operating mode for all connected STA.
4800 */
4801
4802 pHtOpMode->staId = psessionEntry->staId;
4803
4804 msg.type = WDA_UPDATE_OP_MODE;
4805 msg.reserved = 0;
4806 msg.bodyptr = pHtOpMode;
4807
4808 if (!VOS_IS_STATUS_SUCCESS(
4809 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
4810 {
4811 limLog(pMac, LOGE,
4812 FL("Not able to post WDA_UPDATE_OP_MODE message to WDA"));
4813 vos_mem_free(pHtOpMode);
4814 return;
4815 }
4816
4817 limLog(pMac, LOGW,
4818 FL("Notifed FW about OP mode: %d for staId=%d"),
4819 pHtOpMode->opMode, pHtOpMode->staId);
4820
4821 return;
4822}
4823#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004824
4825/** -------------------------------------------------------------
4826\fn limProcessSmeDelBaPeerInd
4827\brief handles indication message from HDD to send delete BA request
4828\param tpAniSirGlobal pMac
4829\param tANI_U32 pMsgBuf
4830\return None
4831-------------------------------------------------------------*/
4832void
4833limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4834{
4835 tANI_U16 assocId =0;
4836 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4837 tpDphHashNode pSta;
4838 tpPESession psessionEntry;
4839 tANI_U8 sessionId;
4840
4841
4842
4843 if(NULL == pSmeDelBAPeerInd)
4844 return;
4845
4846 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4847 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004848 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004849 return;
4850 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004851 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004852 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4853
4854 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4855 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4856 pSta,
4857 pSmeDelBAPeerInd->baDirection,
4858 pSmeDelBAPeerInd->baTID,
4859 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4860 {
4861 limLog( pMac, LOGW,
4862 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4863 if (pSta)
4864 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4865 }
4866}
4867
4868// --------------------------------------------------------------------
4869/**
4870 * __limProcessReportMessage
4871 *
4872 * FUNCTION: Processes the next received Radio Resource Management message
4873 *
4874 * LOGIC:
4875 *
4876 * ASSUMPTIONS:
4877 *
4878 * NOTE:
4879 *
4880 * @param None
4881 * @return None
4882 */
4883
4884void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4885{
4886#ifdef WLAN_FEATURE_VOWIFI
4887 switch (pMsg->type)
4888 {
4889 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4890 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4891 break;
4892 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4893 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004894#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004895 tpSirBeaconReportXmitInd pBcnReport=NULL;
4896 tpPESession psessionEntry=NULL;
4897 tANI_U8 sessionId;
4898
4899 if(pMsg->bodyptr == NULL)
4900 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004901 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004902 return;
4903 }
4904 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4905 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4906 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004907 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004908 return;
4909 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004910 if (psessionEntry->isESEconnection)
4911 eseProcessBeaconReportXmit( pMac, pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004912 else
4913#endif
4914 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4915 }
4916 break;
4917 }
4918#endif
4919}
4920
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004921#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI)
Jeff Johnson295189b2012-06-20 16:38:30 -07004922// --------------------------------------------------------------------
4923/**
4924 * limSendSetMaxTxPowerReq
4925 *
4926 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4927 *
4928 * LOGIC:
4929 *
4930 * ASSUMPTIONS:
4931 *
4932 * NOTE:
4933 *
4934 * @param txPower txPower to be set.
4935 * @param pSessionEntry session entry.
4936 * @return None
4937 */
4938tSirRetStatus
4939limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4940{
4941 tpMaxTxPowerParams pMaxTxParams = NULL;
4942 tSirRetStatus retCode = eSIR_SUCCESS;
4943 tSirMsgQ msgQ;
4944
4945 if( pSessionEntry == NULL )
4946 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004947 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004948 return eSIR_FAILURE;
4949 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304950
4951 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4952 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004953 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004954 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004955 return eSIR_MEM_ALLOC_FAILED;
4956
4957 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004958#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304959 limLog( pMac, LOG1,
4960 FL(" Allocated memory for pMaxTxParams, which will be freed in other module"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004961#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004962 if( pMaxTxParams == NULL )
4963 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304964 limLog( pMac, LOGE, FL("pMaxTxParams is NULL"));
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004965 return eSIR_FAILURE;
4966 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004967 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304968 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4969 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004970
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004971 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4972 msgQ.bodyptr = pMaxTxParams;
4973 msgQ.bodyval = 0;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304974 limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004975 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
4976 retCode = wdaPostCtrlMsg(pMac, &msgQ);
4977 if (eSIR_SUCCESS != retCode)
4978 {
4979 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304980 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004981 }
4982 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004983}
4984#endif
4985
4986/**
4987 * __limProcessSmeAddStaSelfReq()
4988 *
4989 *FUNCTION:
4990 * This function is called to process SME_ADD_STA_SELF_REQ message
4991 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4992 *
4993 *LOGIC:
4994 *
4995 *ASSUMPTIONS:
4996 *
4997 *NOTE:
4998 *
4999 * @param pMac Pointer to Global MAC structure
5000 * @param *pMsgBuf A pointer to the SME message buffer
5001 * @return None
5002 */
5003
5004static void
5005__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5006{
5007 tSirMsgQ msg;
5008 tpAddStaSelfParams pAddStaSelfParams;
5009 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
5010
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305011 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
5012 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005013 {
5014 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
5015 return;
5016 }
5017
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305018 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07005019 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07005020 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
5021 msg.reserved = 0;
5022 msg.bodyptr = pAddStaSelfParams;
5023 msg.bodyval = 0;
5024
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005025 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005026 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005027
5028 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5029 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005030 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005031 }
5032 return;
5033} /*** end __limProcessAddStaSelfReq() ***/
5034
5035
5036/**
5037 * __limProcessSmeDelStaSelfReq()
5038 *
5039 *FUNCTION:
5040 * This function is called to process SME_DEL_STA_SELF_REQ message
5041 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
5042 *
5043 *LOGIC:
5044 *
5045 *ASSUMPTIONS:
5046 *
5047 *NOTE:
5048 *
5049 * @param pMac Pointer to Global MAC structure
5050 * @param *pMsgBuf A pointer to the SME message buffer
5051 * @return None
5052 */
5053
5054static void
5055__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5056{
5057 tSirMsgQ msg;
5058 tpDelStaSelfParams pDelStaSelfParams;
5059 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
5060
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305061 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
5062 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07005063 {
5064 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
5065 return;
5066 }
5067
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305068 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07005069
5070 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
5071 msg.reserved = 0;
5072 msg.bodyptr = pDelStaSelfParams;
5073 msg.bodyval = 0;
5074
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005075 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07005076 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07005077
5078 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5079 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005080 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005081 }
5082 return;
5083} /*** end __limProcessSmeDelStaSelfReq() ***/
5084
5085
Jeff Johnson295189b2012-06-20 16:38:30 -07005086/**
5087 * __limProcessSmeRegisterMgmtFrameReq()
5088 *
5089 *FUNCTION:
5090 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
5091 * from SME. It Register this information within PE.
5092 *
5093 *LOGIC:
5094 *
5095 *ASSUMPTIONS:
5096 *
5097 *NOTE:
5098 *
5099 * @param pMac Pointer to Global MAC structure
5100 * @param *pMsgBuf A pointer to the SME message buffer
5101 * @return None
5102 */
5103static void
5104__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5105{
5106 VOS_STATUS vosStatus;
5107 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
5108 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005109 tANI_BOOLEAN match = VOS_FALSE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305110 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005111 FL("registerFrame %d, frameType %d, matchLen %d"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305112 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005113
Jeff Johnsond13512a2012-07-17 11:42:19 -07005114 /* First check whether entry exists already*/
5115
5116 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5117 (vos_list_node_t**)&pLimMgmtRegistration);
5118
5119 while(pLimMgmtRegistration != NULL)
5120 {
5121 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
5122 {
5123 if(pSmeReq->matchLen)
5124 {
5125 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
5126 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305127 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07005128 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
5129 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005130 /* found match! */
5131 match = VOS_TRUE;
5132 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005133 }
5134 }
5135 }
5136 else
5137 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005138 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07005139 match = VOS_TRUE;
5140 break;
5141 }
5142 }
5143 vosStatus = vos_list_peek_next (
5144 &pMac->lim.gLimMgmtFrameRegistratinQueue,
5145 (vos_list_node_t*) pLimMgmtRegistration,
5146 (vos_list_node_t**) &pNext );
5147
5148 pLimMgmtRegistration = pNext;
5149 pNext = NULL;
5150
5151 }
5152
5153 if (match)
5154 {
5155 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5156 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305157 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07005158 }
5159
Jeff Johnson295189b2012-06-20 16:38:30 -07005160 if(pSmeReq->registerFrame)
5161 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305162 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
5163 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005164 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305165 vos_mem_set((void*)pLimMgmtRegistration,
5166 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005167 pLimMgmtRegistration->frameType = pSmeReq->frameType;
5168 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
5169 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
5170 if(pSmeReq->matchLen)
5171 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305172 vos_mem_copy(pLimMgmtRegistration->matchData,
5173 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005174 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005175 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5176 &pLimMgmtRegistration->node);
5177 }
5178 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005179
5180 return;
5181} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08005182
5183static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08005184__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08005185{
5186 tpP2pPsParams pMsgNoA;
5187 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08005188
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305189 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
5190 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08005191 {
5192 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005193 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08005194 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005195 }
5196
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305197 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08005198 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
5199 pMsgNoA->opp_ps = 0;
5200 pMsgNoA->ctWindow = 0;
5201 pMsgNoA->duration = 0;
5202 pMsgNoA->interval = 0;
5203 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08005204
Vinay Malekal62757362012-12-17 12:15:51 -08005205 /* Below params used for Single Shot NOA - so assign proper values */
5206 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08005207 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08005208
Viral Modid86bde22012-12-10 13:09:21 -08005209 /* Start Insert NOA timer
5210 * 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 -08005211 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
5212 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08005213 */
5214 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
5215 == TX_TIMER_ERROR)
5216 {
5217 /// Could not activate Insert NOA timer.
5218 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005219 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08005220
5221 // send the scan response back with status failure and do not even call insert NOA
5222 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305223 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08005224 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005225 }
5226
Viral Modid440e682013-03-06 02:25:31 -08005227 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
5228
Viral Modid86bde22012-12-10 13:09:21 -08005229 msg.type = WDA_SET_P2P_GO_NOA_REQ;
5230 msg.reserved = 0;
5231 msg.bodyptr = pMsgNoA;
5232 msg.bodyval = 0;
5233
5234 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5235 {
5236 /* 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 -07005237 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08005238 /* Deactivate the NOA timer in failure case */
5239 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
5240 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005241 }
Viral Modid440e682013-03-06 02:25:31 -08005242 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08005243
Viral Modid440e682013-03-06 02:25:31 -08005244error:
5245 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
5246 * worrying about the NOA
5247 */
5248 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
5249 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08005250 return FALSE;
5251
5252}
5253
Viral Modid440e682013-03-06 02:25:31 -08005254static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
5255{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005256 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08005257 pMac->lim.gDeferMsgTypeForNOA = msgType;
5258 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
5259}
5260
5261static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5262{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005263 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08005264 pMac->lim.gDeferMsgTypeForNOA = 0;
5265 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
5266 {
5267 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305268 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005269 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5270 }
5271}
5272
5273static
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305274tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType,
5275 tANI_U32 *pMsgBuf, tANI_BOOLEAN isPassiveScan)
Viral Modid440e682013-03-06 02:25:31 -08005276{
5277 tANI_U32 noaDuration = 0;
5278
5279 switch (msgType)
5280 {
5281 case eWNI_SME_SCAN_REQ:
5282 {
5283 tANI_U32 val;
5284 tANI_U8 i;
5285 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
5286 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
5287 {
5288 /*
5289 * Could not get max channel value
5290 * from CFG. Log error.
5291 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005292 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08005293
5294 /* use a default value of 110ms */
5295 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
5296 }
5297
5298 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
5299 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
5300
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05305301 if (pMac->miracast_mode) {
5302 noaDuration += DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST +
5303 DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
5304 } else if (isPassiveScan || !limActiveScanAllowed(pMac, channelNum)) {
Viral Modid440e682013-03-06 02:25:31 -08005305 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
5306 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
5307 */
5308 noaDuration += val;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305309 } else {
5310 /* Use min + max channel time to calculate the total duration of scan */
5311 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
Viral Modid440e682013-03-06 02:25:31 -08005312 }
5313 }
5314
5315 /* Adding an overhead of 20ms to account for the scan messaging delays */
5316 noaDuration += SCAN_MESSAGING_OVERHEAD;
5317 noaDuration *= CONV_MS_TO_US;
5318
5319 break;
5320 }
5321
5322 case eWNI_SME_OEM_DATA_REQ:
5323 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
5324 break;
5325
5326 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5327 {
5328 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
5329 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
5330 break;
5331 }
5332
5333 case eWNI_SME_JOIN_REQ:
5334 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
5335 break;
5336
5337 default:
5338 noaDuration = 0;
5339 break;
5340
5341 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005342 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08005343 return noaDuration;
5344}
5345
5346void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5347{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305348 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08005349
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005350 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005351 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
5352 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
5353 {
5354 switch (pMac->lim.gDeferMsgTypeForNOA)
5355 {
5356 case eWNI_SME_SCAN_REQ:
5357 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5358 break;
5359 case eWNI_SME_OEM_DATA_REQ:
5360 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5361 break;
5362 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305363 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5364 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
5365 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
5366 */
5367 if (FALSE == bufConsumed)
5368 {
5369 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5370 }
Viral Modid440e682013-03-06 02:25:31 -08005371 break;
5372 case eWNI_SME_JOIN_REQ:
5373 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5374 break;
5375 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005376 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005377 break;
5378 }
5379 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5380 }
5381 else
5382 {
5383 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005384 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005385 }
5386}
Jeff Johnson295189b2012-06-20 16:38:30 -07005387
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005388#ifdef FEATURE_WLAN_TDLS_INTERNAL
5389/*
5390 * Process Discovery request recieved from SME and transmit to AP.
5391 */
5392static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
5393 tANI_U32 *pMsgBuf)
5394{
5395 /* get all discovery request parameters */
5396 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
5397 tpPESession psessionEntry;
5398 tANI_U8 sessionId;
5399
5400 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005401 ("Discovery Req Recieved")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005402
5403 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
5404 == NULL)
5405 {
5406 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005407 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005408 disReq->sessionId);
5409 goto lim_tdls_dis_start_error;
5410 }
5411
5412 /* check if we are in proper state to work as TDLS client */
5413 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5414 {
5415 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005416 "dis req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005417 psessionEntry->limSystemRole);
5418 goto lim_tdls_dis_start_error;
5419 }
5420
5421 /*
5422 * if we are still good, go ahead and check if we are in proper state to
5423 * do TDLS discovery procedure.
5424 */
5425 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5426 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5427 {
5428
5429 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005430 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005431 goto lim_tdls_dis_start_error;
5432 }
5433
5434 /*
5435 * if we are still good, go ahead and transmit TDLS discovery request,
5436 * and save Dis Req info for future reference.
5437 */
5438
5439#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
5440 /*
5441 * send message to HAL to set RXP filters to receieve frame on
5442 * direct link..
5443 */
5444 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
5445 // psessionEntry->bssId) ;
5446#endif
5447
5448 /* save dis request message for matching dialog token */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305449 vos_mem_copy((tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
5450 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005451
5452 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005453 "Transmit Discovery Request Frame") ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005454 /* format TDLS discovery request frame and transmit it */
5455 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
5456 psessionEntry) ;
5457
5458 /* prepare for response */
5459 pMac->lim.gLimTdlsDisStaCount = 0 ;
5460 pMac->lim.gLimTdlsDisResultList = NULL ;
5461
5462 /*
5463 * start TDLS discovery request timer to wait for discovery responses
5464 * from all TDLS enabled clients in BSS.
5465 */
5466
5467 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005468 ("Start Discovery request Timeout Timer")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005469 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
5470 eLIM_TDLS_DISCOVERY_RSP_WAIT));
5471
5472 /* assign appropriate sessionId to the timer object */
5473 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
5474 psessionEntry->peSessionId;
5475
5476 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
5477 != TX_SUCCESS)
5478 {
5479 limLog(pMac, LOGP, FL("TDLS discovery response timer \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005480 activation failed!"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005481 goto lim_tdls_dis_start_error;
5482 }
5483 /*
5484 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
5485 * back to SME
5486 */
5487 return (eSIR_SUCCESS) ;
5488lim_tdls_dis_start_error:
5489 /* in error case, PE has to sent the response SME immediately with error code */
5490 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
5491 eWNI_SME_TDLS_DISCOVERY_START_RSP);
5492 return eSIR_FAILURE;
5493}
5494/*
5495 * Process link start request recieved from SME and transmit to AP.
5496 */
5497eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5498{
5499 /* get all discovery request parameters */
5500 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
5501 tLimTdlsLinkSetupInfo *linkSetupInfo;
5502 //tLimTdlsLinkSetupPeer *setupPeer;
5503 tpPESession psessionEntry;
5504 tANI_U8 sessionId;
5505 eHalStatus status;
5506
5507 if((psessionEntry = peFindSessionByBssid(pMac,
5508 setupReq->bssid, &sessionId)) == NULL)
5509 {
5510 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005511 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005512 setupReq->sessionId);
5513 goto lim_tdls_link_start_error;
5514 }
5515
5516 /* check if we are in proper state to work as TDLS client */
5517 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5518 {
5519 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005520 "TDLS link setup req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005521 psessionEntry->limSystemRole);
5522 goto lim_tdls_link_start_error;
5523 }
5524
5525 /*
5526 * if we are still good, go ahead and check if we are in proper state to
5527 * do TDLS setup procedure.
5528 */
5529 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5530 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5531 {
5532 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005533 state (%d)", pMac->lim.gLimSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005534 goto lim_tdls_link_start_error;
5535 }
5536
5537 /*
5538 * Now, go ahead and transmit TDLS discovery request, and save setup Req
5539 * info for future reference.
5540 */
5541 /* create node for Link setup */
5542 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
5543 //setupPeer = NULL ;
5544
5545 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
5546 setupReq->peerMac, psessionEntry) ;
5547 if(eHAL_STATUS_SUCCESS == status)
5548 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5549 TDLS setup cnf TX complete is successful. */
5550 return eSIR_SUCCESS;
5551#if 0
5552
5553 /*
5554 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005555 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005556 * free this memory if any timeout is happen in link setup procedure
5557 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305558 setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
5559 if ( NULL == setupPeer )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005560 {
5561 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005562 FL( "Unable to allocate memory during ADD_STA" ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005563 VOS_ASSERT(0) ;
5564 return eSIR_MEM_ALLOC_FAILED;
5565 }
5566 setupPeer->dialog = setupReq->dialog ;
5567 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
5568 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
5569 /* TDLS_sessionize: remember sessionId for future */
5570 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
5571 setupPeer->tdls_bIsResponder = 1;
5572
5573 /*
5574 * we only populate peer MAC, so it can assit us to find the
5575 * TDLS peer after response/or after response timeout
5576 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305577 vos_mem_copy(setupPeer->peerMac, setupReq->peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005578 sizeof(tSirMacAddr)) ;
5579 /* format TDLS discovery request frame and transmit it */
5580 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
5581 setupReq->dialog, psessionEntry, NULL, 0) ;
5582
5583 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
5584 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
5585 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
5586 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
5587 /* update setup peer list */
5588 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
5589 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
5590 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5591 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
5592 return eSIR_SUCCESS ;
5593#endif
5594lim_tdls_link_start_error:
5595 /* in case of error, return immediately to SME */
5596 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
5597 eWNI_SME_TDLS_LINK_START_RSP);
5598 return eSIR_FAILURE ;
5599}
5600
5601/*
5602 * Process link teardown request recieved from SME and transmit to AP.
5603 */
5604eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5605{
5606 /* get all discovery request parameters */
5607 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
5608 tLimTdlsLinkSetupPeer *setupPeer;
5609 tpPESession psessionEntry;
5610 tANI_U8 sessionId;
5611
5612 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
5613 {
5614 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005615 "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005616 goto lim_tdls_teardown_req_error;
5617 }
5618
5619 /* check if we are in proper state to work as TDLS client */
5620 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5621 {
5622 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005623 "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005624 goto lim_tdls_teardown_req_error;
5625 }
5626
5627 /*
5628 * if we are still good, go ahead and check if we are in proper state to
5629 * do TDLS setup procedure.
5630 */
5631 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5632 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5633 {
5634 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005635 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005636 goto lim_tdls_teardown_req_error;
5637 }
5638
5639 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Arif Hussain24bafea2013-11-15 15:10:03 -08005640 "Teardown for peer = " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(teardownReq->peerMac));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005641 /*
5642 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5643 * info for future reference.
5644 */
5645 /* Verify if this link is setup */
5646 setupPeer = NULL ;
5647 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5648 if(NULL == setupPeer)
5649 {
5650 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005651 ("invalid Peer on teardown ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005652 goto lim_tdls_teardown_req_error;
5653 }
5654
5655
5656 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5657 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5658 /* TDLS_sessionize: check sessionId in case */
5659 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5660 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005661 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005662 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5663 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5664 }
5665
5666 /* format TDLS teardown request frame and transmit it */
5667 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5668 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5669 {
5670 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005671 ("couldn't send teardown frame ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005672 goto lim_tdls_teardown_req_error;
5673 }
5674 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5675 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5676 return eSIR_SUCCESS;
5677lim_tdls_teardown_req_error:
5678 /* in case of error, return immediately to SME */
5679 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5680 eWNI_SME_TDLS_TEARDOWN_RSP);
5681 return eSIR_FAILURE;
5682}
5683
5684
5685#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005686
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305687static void
5688__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5689{
5690 tpSirResetAPCapsChange pResetCapsChange;
5691 tpPESession psessionEntry;
5692 tANI_U8 sessionId = 0;
5693 if (pMsgBuf == NULL)
5694 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005695 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305696 return;
5697 }
5698
5699 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5700 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5701 if (psessionEntry == NULL)
5702 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005703 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305704 return;
5705 }
5706
5707 psessionEntry->limSentCapsChangeNtf = false;
5708 return;
5709}
5710
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305711static void
5712__limProcessSmeSpoofMacAddrRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5713{
5714 tSirMsgQ msg;
5715 tpSpoofMacAddrReqParams pSpoofMacAddrParams;
5716 tpSirSpoofMacAddrReq pSmeReq = (tpSirSpoofMacAddrReq) pMsgBuf;
5717
5718 pSpoofMacAddrParams = vos_mem_malloc(sizeof( tSpoofMacAddrReqParams));
5719 if ( NULL == pSpoofMacAddrParams )
5720 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305721 limLog( pMac, LOGE, FL("Unable to allocate memory for tDelStaSelfParams") );
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305722 return;
5723 }
5724
5725 vos_mem_copy( pSpoofMacAddrParams->macAddr, pSmeReq->macAddr, sizeof(tSirMacAddr) );
5726
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305727 vos_mem_copy(pMac->lim.spoofMacAddr, pSmeReq->macAddr, VOS_MAC_ADDRESS_LEN);
5728
5729 limLog( pMac, LOG1, FL("Recieved Spoofed Mac Addr request with Addr:"
5730 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pMac->lim.spoofMacAddr) );
5731
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305732 msg.type = WDA_SPOOF_MAC_ADDR_REQ;
5733 msg.reserved = 0;
5734 msg.bodyptr = pSpoofMacAddrParams;
5735 msg.bodyval = 0;
5736
5737 limLog(pMac, LOG1, FL("sending SIR_HAL_SPOOF_MAC_ADDR_REQ msg to HAL"));
5738 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
5739
5740 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5741 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305742 limLog(pMac, LOGE, FL("wdaPostCtrlMsg failed for SIR_HAL_SPOOF_MAC_ADDR_REQ"));
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305743 vos_mem_free(pSpoofMacAddrParams);
5744 }
5745 return;
5746}
5747
Jeff Johnson295189b2012-06-20 16:38:30 -07005748/**
5749 * limProcessSmeReqMessages()
5750 *
5751 *FUNCTION:
5752 * This function is called by limProcessMessageQueue(). This
5753 * function processes SME request messages from HDD or upper layer
5754 * application.
5755 *
5756 *LOGIC:
5757 *
5758 *ASSUMPTIONS:
5759 *
5760 *NOTE:
5761 *
5762 * @param pMac Pointer to Global MAC structure
5763 * @param msgType Indicates the SME message type
5764 * @param *pMsgBuf A pointer to the SME message buffer
5765 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5766 * FALSE - if pMsgBuf is not to be freed.
5767 */
5768
5769tANI_BOOLEAN
5770limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5771{
5772 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5773 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005774 tpSirSmeScanReq pScanReq;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305775 tANI_BOOLEAN isPassiveScan = FALSE;
5776
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005777 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 -07005778 limMsgStr(pMsg->type), pMsg->type,
5779 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5780 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5781
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005782 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005783 /* Special handling of some SME Req msgs where we have an existing GO session and
5784 * want to insert NOA before processing those msgs. These msgs will be processed later when
5785 * start event happens
5786 */
Sachin Ahuja42354142015-01-06 19:48:35 +05305787 MTRACE(macTraceMsgRx(pMac, NO_SESSION, pMsg->type));
Viral Modid440e682013-03-06 02:25:31 -08005788 switch (pMsg->type)
5789 {
5790 case eWNI_SME_SCAN_REQ:
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305791 pScanReq = (tpSirSmeScanReq) pMsgBuf;
5792 isPassiveScan = (pScanReq->scanType == eSIR_PASSIVE_SCAN) ? TRUE : FALSE;
Viral Modid440e682013-03-06 02:25:31 -08005793 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005794
5795 /* If scan is disabled return from here
5796 */
5797 if (pMac->lim.fScanDisabled)
5798 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005799 if (pMsg->type == eWNI_SME_SCAN_REQ)
5800 {
5801 limSendSmeScanRsp(pMac,
5802 offsetof(tSirSmeScanRsp,bssDescription[0]),
5803 eSIR_SME_INVALID_PARAMETERS,
5804 pScanReq->sessionId,
5805 pScanReq->transactionId);
5806
5807 bufConsumed = TRUE;
5808 }
5809 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5810 {
5811 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5812 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5813 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5814
5815 /*
5816 * limRemainOnChnRsp will free the buffer this change is to
5817 * avoid "double free"
5818 */
5819 bufConsumed = FALSE;
5820 }
5821
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305822 limLog(pMac, LOGE,
5823 FL("Error: Scan Disabled."
5824 " Return with error status for SME Message %s(%d)"),
5825 limMsgStr(pMsg->type), pMsg->type);
5826
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005827 return bufConsumed;
5828 }
5829 /*
5830 * Do not add BREAK here
5831 */
5832 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005833 case eWNI_SME_JOIN_REQ:
5834 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5835 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5836 {
5837 tANI_U32 noaDuration;
5838 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305839 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf, isPassiveScan);
Viral Modid440e682013-03-06 02:25:31 -08005840 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5841 return bufConsumed;
5842 }
5843 }
5844 /* If no insert NOA required then execute the code below */
5845
Jeff Johnson295189b2012-06-20 16:38:30 -07005846 switch (pMsg->type)
5847 {
5848 case eWNI_SME_START_REQ:
5849 __limProcessSmeStartReq(pMac, pMsgBuf);
5850 break;
5851
5852 case eWNI_SME_SYS_READY_IND:
5853 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5854 break;
5855
Jeff Johnson295189b2012-06-20 16:38:30 -07005856 case eWNI_SME_START_BSS_REQ:
5857 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5858 break;
5859
5860 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005861 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005862 break;
5863
Jeff Johnsone7245742012-09-05 17:12:55 -07005864#ifdef FEATURE_OEM_DATA_SUPPORT
5865 case eWNI_SME_OEM_DATA_REQ:
5866 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005867 break;
5868#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005869 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5870 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5871 break;
5872
5873 case eWNI_SME_UPDATE_NOA:
5874 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5875 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305876 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5877 __limProcessClearDfsChannelList(pMac, pMsg);
5878 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005879 case eWNI_SME_JOIN_REQ:
5880 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005881 break;
5882
5883 case eWNI_SME_AUTH_REQ:
5884 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5885
5886 break;
5887
5888 case eWNI_SME_REASSOC_REQ:
5889 __limProcessSmeReassocReq(pMac, pMsgBuf);
5890
5891 break;
5892
5893 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5894 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5895
5896 break;
5897
5898 case eWNI_SME_DISASSOC_REQ:
5899 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5900
5901 break;
5902
5903 case eWNI_SME_DISASSOC_CNF:
5904 case eWNI_SME_DEAUTH_CNF:
5905 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5906
5907 break;
5908
5909 case eWNI_SME_DEAUTH_REQ:
5910 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5911
5912 break;
5913
Jeff Johnson295189b2012-06-20 16:38:30 -07005914
5915
5916 case eWNI_SME_SETCONTEXT_REQ:
5917 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5918
5919 break;
5920
5921 case eWNI_SME_REMOVEKEY_REQ:
5922 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5923
5924 break;
5925
5926 case eWNI_SME_STOP_BSS_REQ:
5927 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5928 break;
5929
5930 case eWNI_SME_ASSOC_CNF:
5931 case eWNI_SME_REASSOC_CNF:
5932 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305933 limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005934 else
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305935 limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005936 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5937 break;
5938
5939 case eWNI_SME_ADDTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305940 limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005941 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5942 break;
5943
5944 case eWNI_SME_DELTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305945 limLog(pMac, LOG1, FL("Received DELTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005946 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5947 break;
5948
5949 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305950 limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005951 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5952 break;
5953
5954 case eWNI_SME_STA_STAT_REQ:
5955 case eWNI_SME_AGGR_STAT_REQ:
5956 case eWNI_SME_GLOBAL_STAT_REQ:
5957 case eWNI_SME_STAT_SUMM_REQ:
5958 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5959 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5960 bufConsumed = FALSE;
5961 break;
5962 case eWNI_SME_GET_STATISTICS_REQ:
5963 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5964 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5965 bufConsumed = FALSE;
5966 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005967#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005968 case eWNI_SME_GET_ROAM_RSSI_REQ:
5969 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5970 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5971 bufConsumed = FALSE;
5972 break;
5973#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005974#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005975 case eWNI_SME_GET_TSM_STATS_REQ:
5976 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5977 bufConsumed = FALSE;
5978 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005979#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005980 case eWNI_SME_DEL_BA_PEER_IND:
5981 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5982 break;
5983 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5984 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5985 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005986 case eWNI_SME_GET_ASSOC_STAS_REQ:
5987 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5988 break;
5989 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5990 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5991 break;
5992
5993 case eWNI_SME_HIDE_SSID_REQ:
5994 __limProcessSmeHideSSID(pMac, pMsgBuf);
5995 break;
5996 case eWNI_SME_UPDATE_APWPSIE_REQ:
5997 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5998 break;
5999 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
6000 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
6001 break;
6002
6003 case eWNI_SME_SET_APWPARSNIEs_REQ:
6004 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
6005 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08006006
6007 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
6008 //Update the beaconInterval
6009 __limProcessSmeChangeBI(pMac, pMsgBuf );
6010 break;
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05306011
6012#ifdef WLAN_FEATURE_AP_HT40_24G
6013 case eWNI_SME_SET_HT_2040_MODE:
6014 __limProcessSmeSetHT2040Mode(pMac, pMsgBuf);
6015 break;
6016#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07006017
6018#if defined WLAN_FEATURE_VOWIFI
6019 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
6020 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
6021 __limProcessReportMessage(pMac, pMsg);
6022 break;
6023#endif
6024
6025#if defined WLAN_FEATURE_VOWIFI_11R
6026 case eWNI_SME_FT_PRE_AUTH_REQ:
6027 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
6028 break;
6029 case eWNI_SME_FT_UPDATE_KEY:
6030 limProcessFTUpdateKey(pMac, pMsgBuf);
6031 break;
6032
6033 case eWNI_SME_FT_AGGR_QOS_REQ:
6034 limProcessFTAggrQosReq(pMac, pMsgBuf);
6035 break;
6036#endif
6037
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08006038#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
6039 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07006040 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
6041 break;
6042#endif
6043 case eWNI_SME_ADD_STA_SELF_REQ:
6044 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
6045 break;
6046 case eWNI_SME_DEL_STA_SELF_REQ:
6047 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
6048 break;
6049
Jeff Johnson295189b2012-06-20 16:38:30 -07006050 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
6051 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
6052 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006053#ifdef FEATURE_WLAN_TDLS
6054 case eWNI_SME_TDLS_SEND_MGMT_REQ:
6055 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
6056 break;
6057 case eWNI_SME_TDLS_ADD_STA_REQ:
6058 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
6059 break;
6060 case eWNI_SME_TDLS_DEL_STA_REQ:
6061 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
6062 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05306063 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
6064 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
6065 break;
Atul Mittalc0f739f2014-07-31 13:47:47 +05306066// tdlsoffchan
6067 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
6068 limProcesSmeTdlsChanSwitchReq(pMac, pMsgBuf);
6069 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08006070#endif
6071#ifdef FEATURE_WLAN_TDLS_INTERNAL
6072 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
6073 limProcessSmeDisStartReq(pMac, pMsgBuf);
6074 break ;
6075 case eWNI_SME_TDLS_LINK_START_REQ:
6076 limProcessSmeLinkStartReq(pMac, pMsgBuf);
6077 break ;
6078 case eWNI_SME_TDLS_TEARDOWN_REQ:
6079 limProcessSmeTeardownReq(pMac, pMsgBuf);
6080 break ;
6081#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05306082 case eWNI_SME_RESET_AP_CAPS_CHANGED:
6083 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
6084 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07006085
schang86c22c42013-03-13 18:41:24 -07006086 case eWNI_SME_SET_TX_POWER_REQ:
6087 limSendSetTxPowerReq(pMac, pMsgBuf);
6088 break ;
6089
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05306090 case eWNI_SME_MAC_SPOOF_ADDR_IND:
6091 __limProcessSmeSpoofMacAddrRequest(pMac, pMsgBuf);
6092 break ;
6093
Jeff Johnson295189b2012-06-20 16:38:30 -07006094 default:
6095 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
6096 pMsg->bodyptr = NULL;
6097 break;
6098 } // switch (msgType)
6099
6100 return bufConsumed;
6101} /*** end limProcessSmeReqMessages() ***/