blob: 098a06f8f540f11c5d4b96ac4321738ea9bd2a60 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
3 *
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"
Jeff Johnson295189b2012-06-20 16:38:30 -070044#include "wniCfgSta.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
Viral Modid86bde22012-12-10 13:09:21 -080083/* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK
84 * 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 -080085 * taking care of sending null data and receiving ACK to/from AP/Also SetChannel with calibration is taking
86 * around 7ms .
Viral Modid86bde22012-12-10 13:09:21 -080087 */
Viral Modid440e682013-03-06 02:25:31 -080088#define SCAN_MESSAGING_OVERHEAD 20 // in msecs
89#define JOIN_NOA_DURATION 2000 // in msecs
90#define OEM_DATA_NOA_DURATION 60 // in msecs
91#define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 // in msecs
Jeff Johnson295189b2012-06-20 16:38:30 -070092
Gopichand Nakkala096a1052012-12-21 07:05:34 -080093#define CONV_MS_TO_US 1024 //conversion factor from ms to us
94
Jeff Johnson295189b2012-06-20 16:38:30 -070095// SME REQ processing function templates
96static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *);
97static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *);
98static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
Viral Modid440e682013-03-06 02:25:31 -080099static void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *);
Jeff Johnson295189b2012-06-20 16:38:30 -0700100static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *);
101static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *);
102static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *);
103static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *);
104static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *);
105static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *);
106static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
107
Jeff Johnson295189b2012-06-20 16:38:30 -0700108void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *);
109
Jeff Johnson295189b2012-06-20 16:38:30 -0700110extern void peRegisterTLHandle(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700111
Jeff Johnson295189b2012-06-20 16:38:30 -0700112
Jeff Johnson295189b2012-06-20 16:38:30 -0700113#ifdef BACKGROUND_SCAN_ENABLED
114
115// start the background scan timers if it hasn't already started
116static void
117__limBackgroundScanInitiate(tpAniSirGlobal pMac)
118{
119 if (pMac->lim.gLimBackgroundScanStarted)
120 return;
121
122 //make sure timer is created first
123 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
124 {
125 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -0700126 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700127 if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700128 limLog(pMac, LOGP, FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700129 pMac->lim.gLimBackgroundScanStarted = true;
130 pMac->lim.gLimBackgroundScanChannelId = 0;
131 }
132}
133
134#endif // BACKGROUND_SCAN_ENABLED
Jeff Johnson295189b2012-06-20 16:38:30 -0700135
136// determine if a fresh scan request must be issued or not
137/*
138* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
139* If one of the sessions is not in one of the above states, then PE does not do fresh scan
140* If no session exists (scanning very first time), then PE will always do fresh scan if SME
141* asks it to do that.
142*/
143static tANI_U8
144__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
145{
146
147 tANI_U8 validState = TRUE;
148 int i;
149
150 if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
151 {
152 return FALSE;
153 }
154 for(i =0; i < pMac->lim.maxBssId; i++)
155 {
156
157 if(pMac->lim.gpSession[i].valid == TRUE)
158 {
159 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
160 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
161 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
162
163 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
164 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
165 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
166 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700167 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
168 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
169 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
170 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700171 ))
172 {
173 validState = FALSE;
174 break;
175 }
176
177 }
178 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530179 limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700180
181 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
182 return TRUE;
183
184 return FALSE;
185}
186
Jeff Johnson295189b2012-06-20 16:38:30 -0700187
188
189/**
190 * __limIsSmeAssocCnfValid()
191 *
192 *FUNCTION:
193 * This function is called by limProcessLmmMessages() upon
194 * receiving SME_ASSOC_CNF.
195 *
196 *LOGIC:
197 * Message validity checks are performed in this function
198 *
199 *ASSUMPTIONS:
200 *
201 *NOTE:
202 *
203 * @param pMeasReq Pointer to Received ASSOC_CNF message
204 * @return true When received SME_ASSOC_CNF is formatted
205 * correctly
206 * false otherwise
207 */
208
209inline static tANI_U8
210__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
211{
212 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
213 return false;
214 else
215 return true;
216} /*** end __limIsSmeAssocCnfValid() ***/
217
218
219/**
220 * __limGetSmeJoinReqSizeForAlloc()
221 *
222 *FUNCTION:
223 * This function is called in various places to get IE length
224 * from tSirBssDescription structure
225 * number being scanned.
226 *
227 *PARAMS:
228 *
229 *LOGIC:
230 *
231 *ASSUMPTIONS:
232 * NA
233 *
234 *NOTE:
235 * NA
236 *
237 * @param pBssDescr
238 * @return Total IE length
239 */
240
241static tANI_U16
242__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
243{
244 tANI_U16 len = 0;
245
246 if (!pBuf)
247 return len;
248
249 pBuf += sizeof(tANI_U16);
250 len = limGetU16( pBuf );
251 return (len + sizeof( tANI_U16 ));
252} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
253
254
255/**----------------------------------------------------------------
256\fn __limIsDeferedMsgForLearn
257
258\brief Has role only if 11h is enabled. Not used on STA side.
259 Defers the message if SME is in learn state and brings
260 the LIM back to normal mode.
261
262\param pMac
263\param pMsg - Pointer to message posted from SME to LIM.
264\return TRUE - If defered
265 FALSE - Otherwise
266------------------------------------------------------------------*/
267static tANI_BOOLEAN
268__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
269{
270 if (limIsSystemInScanState(pMac))
271 {
272 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
273 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700274 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 return eANI_BOOLEAN_FALSE;
276 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700277 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 pMsg->type);)
279
280 /** Send finish scan req to HAL only if LIM is not waiting for any response
281 * from HAL like init scan rsp, start scan rsp etc.
282 */
283 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
284 {
285 //Set the resume channel to Any valid channel (invalid).
286 //This will instruct HAL to set it to any previous valid channel.
287 peSetResumeChannel(pMac, 0, 0);
288 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
289 }
290
291 return eANI_BOOLEAN_TRUE;
292 }
293 return eANI_BOOLEAN_FALSE;
294}
295
296/**----------------------------------------------------------------
297\fn __limIsDeferedMsgForRadar
298
299\brief Has role only if 11h is enabled. Not used on STA side.
300 Defers the message if radar is detected.
301
302\param pMac
303\param pMsg - Pointer to message posted from SME to LIM.
304\return TRUE - If defered
305 FALSE - Otherwise
306------------------------------------------------------------------*/
307static tANI_BOOLEAN
308__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
309{
310 /** fRadarDetCurOperChan will be set only if we detect radar in current
311 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700312 //TODO: Need to take care radar detection.
313 //if (LIM_IS_RADAR_DETECTED(pMac))
314 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 {
316 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
317 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700318 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 return eANI_BOOLEAN_FALSE;
320 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700321 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 pMsg->type);)
323 return eANI_BOOLEAN_TRUE;
324 }
325 return eANI_BOOLEAN_FALSE;
326}
327
328
329/**
330 * __limProcessSmeStartReq()
331 *
332 *FUNCTION:
333 * This function is called to process SME_START_REQ message
334 * from HDD or upper layer application.
335 *
336 *LOGIC:
337 *
338 *ASSUMPTIONS:
339 *
340 *NOTE:
341 *
342 * @param pMac Pointer to Global MAC structure
343 * @param *pMsgBuf A pointer to the SME message buffer
344 * @return None
345 */
346
347static void
348__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
349{
350 tSirResultCodes retCode = eSIR_SME_SUCCESS;
351 tANI_U8 smesessionId;
352 tANI_U16 smetransactionId;
353
354
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530355 limLog(pMac, LOG1, FL("Received SME_START_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700356
357 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
358
359 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
360 {
361 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
362
Jeff Johnsone7245742012-09-05 17:12:55 -0700363 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700364
365 /// By default do not return after first scan match
366 pMac->lim.gLimReturnAfterFirstMatch = 0;
367
368 /// Initialize MLM state machine
369 limInitMlm(pMac);
370
371 /// By default return unique scan results
372 pMac->lim.gLimReturnUniqueResults = true;
373 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700374#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
375 pMac->lim.gLimSmeLfrScanResultLength = 0;
376#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700377
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
379 {
380 /*
381 * Need to indicate new BSSs found during background scanning to
382 * host. Update this parameter at CFG
383 */
384 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
385 != eSIR_SUCCESS)
386 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700387 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
389 }
390 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700391 }
392 else
393 {
394 /**
395 * Should not have received eWNI_SME_START_REQ in states
396 * other than OFFLINE. Return response to host and
397 * log error
398 */
Sushant Kaushik1b645382014-10-13 16:39:36 +0530399 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %d"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
401 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
402 }
403 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
404} /*** end __limProcessSmeStartReq() ***/
405
406
407/** -------------------------------------------------------------
408\fn __limProcessSmeSysReadyInd
409\brief handles the notification from HDD. PE just forwards this message to HAL.
410\param tpAniSirGlobal pMac
411\param tANI_U32* pMsgBuf
412\return TRUE-Posting to HAL failed, so PE will consume the buffer.
413\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
414 -------------------------------------------------------------*/
415static tANI_BOOLEAN
416__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
417{
418 tSirMsgQ msg;
419
420 msg.type = WDA_SYS_READY_IND;
421 msg.reserved = 0;
422 msg.bodyptr = pMsgBuf;
423 msg.bodyval = 0;
424
Jeff Johnson92751692013-03-06 16:00:33 -0800425 if (pMac->gDriverType != eDRIVER_TYPE_MFG)
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 {
Jeff Johnson92751692013-03-06 16:00:33 -0800427 peRegisterTLHandle(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700429 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700430 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700431
Jeff Johnson92751692013-03-06 16:00:33 -0800432 if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700434 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 return eANI_BOOLEAN_TRUE;
436 }
437 return eANI_BOOLEAN_FALSE;
438}
439
Jeff Johnsone7245742012-09-05 17:12:55 -0700440#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700441
Jeff Johnsone7245742012-09-05 17:12:55 -0700442tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
443{
444 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
445 {
446 switch(secondaryChanOffset)
447 {
448 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
449 return primarychanNum;
450 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
451 return primarychanNum + 2;
452 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
453 return primarychanNum - 2;
454 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
455 return primarychanNum + 6;
456 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
457 return primarychanNum + 2;
458 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
459 return primarychanNum - 2;
460 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
461 return primarychanNum - 6;
462 default :
463 return eSIR_CFG_INVALID_ID;
464 }
465 }
466 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
467 {
468 switch(secondaryChanOffset)
469 {
470 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
471 return primarychanNum + 2;
472 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
473 return primarychanNum - 2;
474 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
475 return primarychanNum;
476 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
477 return primarychanNum + 2;
478 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
479 return primarychanNum - 2;
480 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
481 return primarychanNum + 2;
482 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
483 return primarychanNum - 2;
484 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
485 return primarychanNum + 2;
486 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
487 return primarychanNum - 2;
488 default :
489 return eSIR_CFG_INVALID_ID;
490 }
491 }
492 return primarychanNum;
493}
494
495#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700496/**
497 * __limHandleSmeStartBssRequest()
498 *
499 *FUNCTION:
500 * This function is called to process SME_START_BSS_REQ message
501 * from HDD or upper layer application.
502 *
503 *LOGIC:
504 *
505 *ASSUMPTIONS:
506 *
507 *NOTE:
508 *
509 * @param pMac Pointer to Global MAC structure
510 * @param *pMsgBuf A pointer to the SME message buffer
511 * @return None
512 */
513
514static void
515__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
516{
517 tANI_U16 size;
518 tANI_U32 val = 0;
519 tSirRetStatus retStatus;
520 tSirMacChanNum channelNumber;
Jeff Johnsonace91102013-04-05 08:03:18 -0700521 tLimMlmStartReq *pMlmStartReq = NULL;
522 tpSirSmeStartBssReq pSmeStartBssReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 tSirResultCodes retCode = eSIR_SME_SUCCESS;
524 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 tANI_U8 sessionId;
526 tpPESession psessionEntry = NULL;
527 tANI_U8 smesessionId;
528 tANI_U16 smetransactionId;
529
530#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
531 //Since the session is not created yet, sending NULL. The response should have the correct state.
532 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
533#endif //FEATURE_WLAN_DIAG_SUPPORT
534
Abhishek Singh3cbf6052014-12-15 16:46:42 +0530535 limLog(pMac, LOG1, FL("Received SME_START_BSS_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700536
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530537 /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
539 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
540 {
541 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
542
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530543 pSmeStartBssReq = vos_mem_malloc(size);
544 if ( NULL == pSmeStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530546 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pMac->lim.gpLimStartBssReq"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 /// Send failure response to host
548 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
549 goto end;
550 }
551
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530552 vos_mem_set((void *)pSmeStartBssReq, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700553
554 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
555 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
556 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700557 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 retCode = eSIR_SME_INVALID_PARAMETERS;
559 goto free;
560 }
561#if 0
562 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700563 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
565#endif
566
567 /* This is the place where PE is going to create a session.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530568 * If session is not existed, then create a new session */
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
570 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700571 limLog(pMac, LOGW, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
573 psessionEntry = NULL;
574 goto free;
575 }
576 else
577 {
578 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
579 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700580 limLog(pMac, LOGW, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
582 goto free;
583 }
584
585 }
586
587 /* Store the session related parameters in newly created session */
588 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
589
590 /* Store PE sessionId in session Table */
591 psessionEntry->peSessionId = sessionId;
592
593 /* Store SME session Id in sessionTable */
594 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
595
596 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
597
598 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
599
600 /* Copy SSID to session table */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530601 vos_mem_copy( (tANI_U8 *)&psessionEntry->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 (tANI_U8 *)&pSmeStartBssReq->ssId,
603 (pSmeStartBssReq->ssId.length + 1));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530604
Jeff Johnson295189b2012-06-20 16:38:30 -0700605 psessionEntry->bssType = pSmeStartBssReq->bssType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530606
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 psessionEntry->nwType = pSmeStartBssReq->nwType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530608
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
610
611 /* Store the channel number in session Table */
612 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
613
614 /*Store Persona */
615 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700616 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 psessionEntry->pePersona);
618
619 /*Update the phymode*/
620 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
621
622 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
623 psessionEntry->currentOperChannel );
Hardik Kantilal Pateldd107952014-11-20 15:24:52 +0530624
625#ifdef WLAN_FEATURE_AP_HT40_24G
626 /*Store Overlapping BSS Scan Parameters IEs to session table */
627 if (pSmeStartBssReq->apHT40_24GEnabled)
628 {
629 limInitOBSSScanParams(pMac, psessionEntry);
630 }
631#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 /* Store the dot 11 mode in to the session Table*/
633
634 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700635 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
636#ifdef WLAN_FEATURE_11AC
637 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700638 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
639 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700640#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800641
642 psessionEntry->txLdpcIniFeatureEnabled =
643 pSmeStartBssReq->txLdpcIniFeatureEnabled;
644
Chet Lanctot8cecea22014-02-11 19:09:36 -0800645#ifdef WLAN_FEATURE_11W
646 psessionEntry->limRmfEnabled = pSmeStartBssReq->pmfCapable ? 1 : 0;
647 limLog(pMac, LOG1, FL("Session RMF enabled: %d"), psessionEntry->limRmfEnabled);
648#endif
649
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530650 vos_mem_copy((void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 (void*)&pSmeStartBssReq->operationalRateSet,
652 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530653 vos_mem_copy((void*)&psessionEntry->extRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 (void*)&pSmeStartBssReq->extendedRateSet,
655 sizeof(tSirMacRateSet));
656
657 switch(pSmeStartBssReq->bssType)
658 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 case eSIR_INFRA_AP_MODE:
660 psessionEntry->limSystemRole = eLIM_AP_ROLE;
661 psessionEntry->privacy = pSmeStartBssReq->privacy;
662 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
663 psessionEntry->authType = pSmeStartBssReq->authType;
664 /* Store the DTIM period */
665 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
666 /*Enable/disable UAPSD*/
667 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
668 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
669 {
670 psessionEntry->proxyProbeRspEn = 0;
671 }
672 else
673 {
674 /* To detect PBC overlap in SAP WPS mode, Host handles
675 * Probe Requests.
676 */
677 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
678 {
679 psessionEntry->proxyProbeRspEn = 1;
680 }
681 else
682 {
683 psessionEntry->proxyProbeRspEn = 0;
684 }
685 }
686 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
687 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
krunal soni45b9eb62014-03-26 12:54:25 -0700688 limGetShortSlotFromPhyMode(pMac, psessionEntry,
689 psessionEntry->gLimPhyMode,
690 &psessionEntry->shortSlotTimeSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -0700691 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700692 case eSIR_IBSS_MODE:
693 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
krunal soni45b9eb62014-03-26 12:54:25 -0700694 limGetShortSlotFromPhyMode(pMac, psessionEntry,
695 psessionEntry->gLimPhyMode,
696 &psessionEntry->shortSlotTimeSupported);
Abhishek Singhd5c31272014-03-07 14:46:50 +0530697 /* In WPA-NONE case we wont get the privacy bit in ibss config
698 * from supplicant, but we are updating WNI_CFG_PRIVACY_ENABLED
699 * on basis of Encryption type in csrRoamSetBssConfigCfg. So
700 * get the privacy info from WNI_CFG_PRIVACY_ENABLED
701 */
702 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &val)
703 != eSIR_SUCCESS)
704 limLog(pMac, LOGE, FL("cfg get WNI_CFG_PRIVACY_ENABLED"
705 " failed"));
706 psessionEntry->privacy =(tANI_U8) val;
krunal sonie9002db2013-11-25 14:24:17 -0800707 psessionEntry->isCoalesingInIBSSAllowed =
708 pSmeStartBssReq->isCoalesingInIBSSAllowed;
Jeff Johnson295189b2012-06-20 16:38:30 -0700709 break;
710
711 case eSIR_BTAMP_AP_MODE:
712 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
713 break;
714
715 case eSIR_BTAMP_STA_MODE:
716 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
717 break;
718
719 /* There is one more mode called auto mode. which is used no where */
720
721 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
722
723
724 default:
725 //not used anywhere...used in scan function
726 break;
727 }
728
729 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
730 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 )
733 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530734 psessionEntry->parsedAssocReq = vos_mem_malloc(
735 psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq));
736 if ( NULL == psessionEntry->parsedAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530738 limLog(pMac, LOGW, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
740 goto free;
741 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530742 vos_mem_set(psessionEntry->parsedAssocReq,
743 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)),
744 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700745 }
746
747 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
748 if (pSmeStartBssReq->channelId)
749 {
750 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700751 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
752 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
753 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700754 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700755 FL("cbMode %u"), pSmeStartBssReq->cbMode);
756#ifdef WLAN_FEATURE_11AC
757 if(psessionEntry->vhtCapability)
758 {
759 tANI_U32 centerChan;
760 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700761
Jeff Johnsone7245742012-09-05 17:12:55 -0700762 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
763 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700765 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700766 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700767 }
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530768
Abhishek Singh921926b2014-02-13 17:21:01 +0530769 if(channelNumber <= RF_CHAN_14 &&
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530770 chanWidth != eHT_CHANNEL_WIDTH_20MHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -0700771 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530772 chanWidth = eHT_CHANNEL_WIDTH_20MHZ;
Abhishek Singh921926b2014-02-13 17:21:01 +0530773 limLog(pMac, LOG1, FL("Setting chanWidth to 20Mhz for"
774 " channel %d"),channelNumber);
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700776
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530777 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ ||
778 chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
Abhishek Singh921926b2014-02-13 17:21:01 +0530779 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530780 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
781 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
782 != eSIR_SUCCESS)
783 {
784 limLog(pMac, LOGP, FL("could not set "
785 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
786 retCode = eSIR_LOGP_EXCEPTION;
787 goto free;
788 }
789 }
790 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
791 {
792 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
793 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
794 != eSIR_SUCCESS)
795 {
796 limLog(pMac, LOGP, FL("could not set "
797 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
798 retCode = eSIR_LOGP_EXCEPTION;
799 goto free;
800 }
801
802 centerChan = limGetCenterChannel( pMac, channelNumber,
803 pSmeStartBssReq->cbMode,
804 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
Jeff Johnsone7245742012-09-05 17:12:55 -0700805 if(centerChan != eSIR_CFG_INVALID_ID)
806 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530807 limLog(pMac, LOGW, FL("***Center Channel for "
808 "80MHZ channel width = %d"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700809 psessionEntry->apCenterChan = centerChan;
Abhishek Singh921926b2014-02-13 17:21:01 +0530810 if (cfgSetInt(pMac,
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530811 WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
812 centerChan) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -0700813 {
Abhishek Singh921926b2014-02-13 17:21:01 +0530814 limLog(pMac, LOGP, FL("could not set "
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530815 "WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700816 retCode = eSIR_LOGP_EXCEPTION;
817 goto free;
818 }
819 }
820 }
821
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530822 /* All the translation is done by now for gVhtChannelWidth
823 * from .ini file to the actual values as defined in spec.
824 * So, grabing the spec value which is
825 * updated in .dat file by the above logic */
826 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
827 &chanWidth) != eSIR_SUCCESS)
828 {
829 limLog(pMac, LOGP,
830 FL("Unable to retrieve Channel Width from CFG"));
831 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700832 /*For Sta+p2p-Go concurrency
833 vhtTxChannelWidthSet is used for storing p2p-GO channel width
834 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
835 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
836 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700837 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700838 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700839 }
840 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
841#endif
842 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 else
844 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700845 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 retCode = eSIR_SME_INVALID_PARAMETERS;
847 goto free;
848 }
849
850 // Delete pre-auth list if any
851 limDeletePreAuthList(pMac);
852
853 // Delete IBSS peer BSSdescription list if any
854 //limIbssDelete(pMac); sep 26 review
855
856
857
858#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
859 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 limInitMlm(pMac);
861#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700862
Jeff Johnsone7245742012-09-05 17:12:55 -0700863 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700864
Jeff Johnson295189b2012-06-20 16:38:30 -0700865 /* keep the RSN/WPA IE information in PE Session Entry
866 * later will be using this to check when received (Re)Assoc req
867 * */
868 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
869
Jeff Johnson295189b2012-06-20 16:38:30 -0700870
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 //Taken care for only softAP case rest need to be done
872 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
873 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
874 /*each byte will have the following info
875 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
876 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530877 vos_mem_copy( (void *) &psessionEntry->cfgProtection,
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700879 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
881 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700882
883 // Prepare and Issue LIM_MLM_START_REQ to MLM
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530884 pMlmStartReq = vos_mem_malloc(sizeof(tLimMlmStartReq));
885 if ( NULL == pMlmStartReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530887 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
889 goto free;
890 }
891
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530892 vos_mem_set((void *) pMlmStartReq, sizeof(tLimMlmStartReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700893
894 /* Copy SSID to the MLM start structure */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530895 vos_mem_copy( (tANI_U8 *) &pMlmStartReq->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700896 (tANI_U8 *) &pSmeStartBssReq->ssId,
897 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
899 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700900
901
902 pMlmStartReq->bssType = psessionEntry->bssType;
903
904 /* Fill PE session Id from the session Table */
905 pMlmStartReq->sessionId = psessionEntry->peSessionId;
906
907 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700908 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700909 )
910 {
911 //len = sizeof(tSirMacAddr);
912 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
913 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700914 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700915
916 /* Copy the BSSId from sessionTable to mlmStartReq struct */
917 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
918 }
919
920 else // ibss mode
921 {
922 pMac->lim.gLimIbssCoalescingHappened = false;
923
924 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
925 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700926 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700927 retCode = eSIR_LOGP_EXCEPTION;
928 goto free;
929 }
930
931 if(!autoGenBssId)
932 {
933 // We're not auto generating BSSID. Instead, get it from session entry
934 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
935
936 if(pMlmStartReq->bssId[0] & 0x01)
937 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700938 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 autoGenBssId = TRUE;
940 }
941 }
942
943 if( autoGenBssId )
944 { //if BSSID is not any uc id. then use locally generated BSSID.
945 //Autogenerate the BSSID
946 limGetRandomBssid( pMac, pMlmStartReq->bssId);
947 pMlmStartReq->bssId[0]= 0x02;
948
949 /* Copy randomly generated BSSID to the session Table */
950 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
951 }
952 }
953 /* store the channel num in mlmstart req structure */
954 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
955 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
956 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
957
Jeff Johnson295189b2012-06-20 16:38:30 -0700958 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
959 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
960 pMlmStartReq->wps_state = psessionEntry->wps_state;
961
962 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700963 {
964 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700965 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 pMlmStartReq->dtimPeriod = (tANI_U8)val;
967 }
968
969 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700970 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700971 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
972
973 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700974 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700975 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
976
977 //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 +0530978 vos_mem_copy((void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700979 sizeof(tSirMacRateSet));
980
Jeff Johnson295189b2012-06-20 16:38:30 -0700981 // Now populate the 11n related parameters
982 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700983 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700984 //
985 // FIXME_GEN4 - Determine the appropriate defaults...
986 //
987 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
988 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700989 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700990
991 /* sep26 review */
992 psessionEntry->limRFBand = limGetRFBand(channelNumber);
993
994 // Initialize 11h Enable Flag
995 psessionEntry->lim11hEnable = 0;
996 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
997 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
998 {
999 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001000 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 psessionEntry->lim11hEnable = val;
1002 }
1003
1004 if (!psessionEntry->lim11hEnable)
1005 {
1006 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001007 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001008 }
1009
Jeff Johnson295189b2012-06-20 16:38:30 -07001010 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
1011 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001012 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001013
1014 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
1015 return;
1016 }
1017 else
1018 {
1019
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001020 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
1022 goto end;
1023 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
1024
1025free:
Jeff Johnsonace91102013-04-05 08:03:18 -07001026 if ((psessionEntry != NULL) &&
1027 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
1028 {
1029 psessionEntry->pLimStartBssReq = NULL;
1030 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301031 vos_mem_free( pSmeStartBssReq);
1032 vos_mem_free( pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001033
1034end:
1035
1036 /* This routine should return the sme sessionId and SME transaction Id */
1037 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1038
1039 if(NULL != psessionEntry)
1040 {
1041 peDeleteSession(pMac,psessionEntry);
1042 psessionEntry = NULL;
1043 }
1044 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
1045} /*** end __limHandleSmeStartBssRequest() ***/
1046
1047
1048/**--------------------------------------------------------------
1049\fn __limProcessSmeStartBssReq
1050
1051\brief Wrapper for the function __limHandleSmeStartBssRequest
1052 This message will be defered until softmac come out of
1053 scan mode or if we have detected radar on the current
1054 operating channel.
1055\param pMac
1056\param pMsg
1057
1058\return TRUE - If we consumed the buffer
1059 FALSE - If have defered the message.
1060 ---------------------------------------------------------------*/
1061static tANI_BOOLEAN
1062__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1063{
1064 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1065 __limIsDeferedMsgForRadar(pMac, pMsg))
1066 {
1067 /**
1068 * If message defered, buffer is not consumed yet.
1069 * So return false
1070 */
1071 return eANI_BOOLEAN_FALSE;
1072 }
1073
1074 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1075 return eANI_BOOLEAN_TRUE;
1076}
1077
1078
1079/**
1080 * limGetRandomBssid()
1081 *
1082 * FUNCTION:This function is called to process generate the random number for bssid
1083 * This function is called to process SME_SCAN_REQ message
1084 * from HDD or upper layer application.
1085 *
1086 * LOGIC:
1087 *
1088 * ASSUMPTIONS:
1089 *
1090 * NOTE:
1091 * 1. geneartes the unique random number for bssid in ibss
1092 *
1093 * @param pMac Pointer to Global MAC structure
1094 * @param *data Pointer to bssid buffer
1095 * @return None
1096 */
1097void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1098{
1099 tANI_U32 random[2] ;
1100 random[0] = tx_time_get();
1101 random[0] |= (random[0] << 15) ;
1102 random[1] = random[0] >> 1;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301103 vos_mem_copy( data, (tANI_U8*)random, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001104}
1105
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301106static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
1107 tpSirSmeScanReq pScanReq)
1108{
1109 tSirScanOffloadReq *pScanOffloadReq;
1110 tANI_U8 *p;
1111 tSirMsgQ msg;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301112 tANI_U16 i, len;
1113 tSirRetStatus rc = eSIR_SUCCESS;
1114
1115 /* The tSirScanOffloadReq will reserve the space for first channel,
1116 so allocate the memory for (numChannels - 1) and uIEFieldLen */
1117 len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
1118 pScanReq->uIEFieldLen;
1119
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301120 pScanOffloadReq = vos_mem_malloc(len);
1121 if ( NULL == pScanOffloadReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301122 {
1123 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301124 FL("AllocateMemory failed for pScanOffloadReq"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301125 return eHAL_STATUS_FAILURE;
1126 }
1127
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301128 vos_mem_set( (tANI_U8 *) pScanOffloadReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301129
1130 msg.type = WDA_START_SCAN_OFFLOAD_REQ;
1131 msg.bodyptr = pScanOffloadReq;
1132 msg.bodyval = 0;
1133
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301134 vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301135 (tANI_U8*) pScanReq->bssId,
1136 sizeof(tSirMacAddr));
1137
1138 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
1139 {
1140 limLog(pMac, LOGE,
1141 FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
Kiet Lamb1233192013-11-28 13:38:20 +05301142 vos_mem_free (pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301143 return eHAL_STATUS_FAILURE;
1144 }
1145
1146 pScanOffloadReq->numSsid = pScanReq->numSsid;
1147 for (i = 0; i < pScanOffloadReq->numSsid; i++)
1148 {
1149 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301150 vos_mem_copy((tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301151 (tANI_U8 *) pScanReq->ssId[i].ssId,
1152 pScanOffloadReq->ssId[i].length);
1153 }
1154
1155 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301156 vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301157 (tANI_U8 *) pScanReq->selfMacAddr,
1158 sizeof(tSirMacAddr));
1159 pScanOffloadReq->bssType = pScanReq->bssType;
1160 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1161 pScanOffloadReq->scanType = pScanReq->scanType;
1162 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1163 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1164 pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
1165 pScanOffloadReq->sessionId = pScanReq->sessionId;
1166 pScanOffloadReq->channelList.numChannels =
1167 pScanReq->channelList.numChannels;
1168 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1169 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1170 p[i] = pScanReq->channelList.channelNumber[i];
1171
1172 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1173 pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301174 vos_mem_copy((tANI_U8 *) p + i,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301175 (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
1176 pScanOffloadReq->uIEFieldLen);
1177
1178 rc = wdaPostCtrlMsg(pMac, &msg);
1179 if (rc != eSIR_SUCCESS)
1180 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001181 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301182 vos_mem_free(pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301183 return eHAL_STATUS_FAILURE;
1184 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301185 limLog(pMac, LOG1, FL("Processed Offload Scan Request Successfully"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301186
1187 return eHAL_STATUS_SUCCESS;
1188}
Jeff Johnson295189b2012-06-20 16:38:30 -07001189
1190/**
1191 * __limProcessSmeScanReq()
1192 *
1193 *FUNCTION:
1194 * This function is called to process SME_SCAN_REQ message
1195 * from HDD or upper layer application.
1196 *
1197 *LOGIC:
1198 *
1199 *ASSUMPTIONS:
1200 *
1201 *NOTE:
1202 * 1. Periodic scanning should be requesting to return unique
1203 * scan results.
1204 *
1205 * @param pMac Pointer to Global MAC structure
1206 * @param *pMsgBuf A pointer to the SME message buffer
1207 * @return None
1208 */
1209
Viral Modid440e682013-03-06 02:25:31 -08001210static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001211__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1212{
1213 tANI_U32 len;
1214 tLimMlmScanReq *pMlmScanReq;
1215 tpSirSmeScanReq pScanReq;
1216 tANI_U8 i = 0;
1217
1218#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1219 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1220#endif //FEATURE_WLAN_DIAG_SUPPORT
1221
1222 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301223 limLog(pMac, LOG1,FL("SME SCAN REQ numChan %d min %d max %d IELen %d"
1224 "first %d fresh %d unique %d type %s (%d)"
1225 " mode %s (%d)rsp %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001226 pScanReq->channelList.numChannels,
1227 pScanReq->minChannelTime,
1228 pScanReq->maxChannelTime,
1229 pScanReq->uIEFieldLen,
1230 pScanReq->returnAfterFirstMatch,
1231 pScanReq->returnFreshResults,
1232 pScanReq->returnUniqueResults,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301233 lim_ScanTypetoString(pScanReq->scanType),
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001234 pScanReq->scanType,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301235 lim_BackgroundScanModetoString(pScanReq->backgroundScanMode),
1236 pScanReq->backgroundScanMode, pMac->lim.gLimRspReqd ? 1 : 0);
Viral Modid86bde22012-12-10 13:09:21 -08001237
1238 /* Since scan req always requires a response, we will overwrite response required here.
1239 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1240 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1241 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1242 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1243 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1244 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1245 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1246 * the global flag gLimRspReqd to TRUE here.
1247 */
1248 pMac->lim.gLimRspReqd = TRUE;
1249
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301250 /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001251 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1252
1253 /* This routine should return the sme sessionId and SME transaction Id */
1254
1255 if (!limIsSmeScanReqValid(pMac, pScanReq))
1256 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301257 limLog(pMac, LOGE, FL("Received SME_SCAN_REQ with invalid parameters"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001258
1259 if (pMac->lim.gLimRspReqd)
1260 {
1261 pMac->lim.gLimRspReqd = false;
1262
1263 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1264
1265 } // if (pMac->lim.gLimRspReqd)
1266
1267 return;
1268 }
1269
1270 //if scan is disabled then return as invalid scan request.
1271 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1272 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1273 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301274 limLog(pMac, LOGE, FL("SCAN is disabled or SCAN in power save"
1275 " is disabled and system is in power save."));
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001276 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001277 return;
1278 }
1279
1280
1281 /**
1282 * If scan request is received in idle, joinFailed
1283 * states or in link established state (in STA role)
1284 * or in normal state (in STA-in-IBSS/AP role) with
1285 * 'return fresh scan results' request from HDD or
1286 * it is periodic background scanning request,
1287 * trigger fresh scan request to MLM
1288 */
1289 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1290 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301291 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1292 {
1293 // Discard previously cached scan results
1294 limReInitScanResults(pMac);
1295 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001296
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301297 pMac->lim.gLim24Band11dScanDone = 0;
1298 pMac->lim.gLim50Band11dScanDone = 0;
1299 pMac->lim.gLimReturnAfterFirstMatch =
1300 pScanReq->returnAfterFirstMatch;
1301 pMac->lim.gLimBackgroundScanMode =
1302 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001303
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301304 pMac->lim.gLimReturnUniqueResults =
1305 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1306 /* De-activate Heartbeat timers for connected sessions while
1307 * scan is in progress if the system is in Active mode *
1308 * AND it is not a ROAMING ("background") scan */
1309 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1310 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1311 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1312 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1313 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001314 for(i=0;i<pMac->lim.maxBssId;i++)
1315 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301316 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1317 (pMac->lim.gpSession[i].valid == TRUE) &&
1318 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1319 {
1320 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1321 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001322 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301323 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001324
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301325 if (pMac->fScanOffload)
1326 {
1327 if (eHAL_STATUS_SUCCESS !=
1328 limSendHalStartScanOffloadReq(pMac, pScanReq))
1329 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301330 limLog(pMac, LOGE, FL("Couldn't send Offload scan request"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301331 limSendSmeScanRsp(pMac,
1332 offsetof(tSirSmeScanRsp, bssDescription[0]),
1333 eSIR_SME_INVALID_PARAMETERS,
1334 pScanReq->sessionId,
1335 pScanReq->transactionId);
1336 return;
1337 }
1338 }
1339 else
1340 {
1341
1342 /*Change Global SME state */
1343 /* Store the previous SME state */
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301344 limLog(pMac, LOG1, FL("Non Offload SCAN request "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301345 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1346 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1347 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1348
1349 if (pScanReq->channelList.numChannels == 0)
1350 {
1351 tANI_U32 cfg_len;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301352
1353 limLog(pMac, LOG1,
1354 FL("Scan all channels as Number of channels is 0"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301355 // Scan all channels
1356 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001357 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1358 pScanReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301359 pMlmScanReq = vos_mem_malloc(len);
1360 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301361 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301362 // Log error
1363 limLog(pMac, LOGP,
1364 FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001365
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301366 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301367 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001368
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301369 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301370 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001371
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301372 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1373 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001374 pMlmScanReq->channelList.channelNumber,
1375 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301376 {
1377 /**
1378 * Could not get Valid channel list from CFG.
1379 * Log error.
1380 */
1381 limLog(pMac, LOGP,
1382 FL("could not retrieve Valid channel list"));
1383 }
1384 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
1385 }
1386 else
1387 {
1388 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1389 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1390 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001391
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301392 pMlmScanReq = vos_mem_malloc(len);
1393 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301394 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301395 // Log error
1396 limLog(pMac, LOGP,
1397 FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001398
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301399 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301400 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001401
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301402 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301403 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301404 pMlmScanReq->channelList.numChannels =
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301405 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001406
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301407 vos_mem_copy( pMlmScanReq->channelList.channelNumber,
1408 pScanReq->channelList.channelNumber,
1409 pScanReq->channelList.numChannels);
1410 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001411
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301412 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1413 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1414 if(pScanReq->uIEFieldLen)
1415 {
1416 vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1417 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1418 pScanReq->uIEFieldLen);
1419 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001420
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301421 pMlmScanReq->bssType = pScanReq->bssType;
1422 vos_mem_copy( pMlmScanReq->bssId,
1423 pScanReq->bssId,
1424 sizeof(tSirMacAddr));
1425 pMlmScanReq->numSsid = pScanReq->numSsid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001426
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301427 i = 0;
1428 while (i < pMlmScanReq->numSsid)
1429 {
1430 vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001431 (tANI_U8 *) &pScanReq->ssId[i],
1432 pScanReq->ssId[i].length + 1);
1433
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301434 i++;
1435 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001436
Jeff Johnson295189b2012-06-20 16:38:30 -07001437
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301438 pMlmScanReq->scanType = pScanReq->scanType;
1439 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05301440 if (pMac->miracast_mode)
1441 {
1442 pMlmScanReq->minChannelTime = DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST;
1443 pMlmScanReq->maxChannelTime = DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
1444 }
1445 else
1446 {
1447 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1448 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1449 }
1450
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301451 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1452 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
1453 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1454 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001455
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301456 //Store the smeSessionID and transaction ID for later use.
1457 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1458 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001459
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301460 // Issue LIM_MLM_SCAN_REQ to MLM
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301461 limLog(pMac, LOG1, FL("Issue Scan request command to MLM "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301462 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1463 }
1464 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001465
1466 else
1467 {
1468 /// In all other cases return 'cached' scan results
1469 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1470 {
1471 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1472
1473 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001474#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1475 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001477 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1478 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1479 {
1480 limSendSmeLfrScanRsp(pMac, scanRspLen,
1481 eSIR_SME_SUCCESS,
1482 pScanReq->sessionId,
1483 pScanReq->transactionId);
1484 }
1485 else
1486 {
1487 scanRspLen = sizeof(tSirSmeScanRsp) +
1488 pMac->lim.gLimSmeLfrScanResultLength -
1489 sizeof(tSirBssDescription);
1490 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1491 pScanReq->sessionId, pScanReq->transactionId);
1492 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001493 }
1494 else
1495 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001496#endif
1497 if (pMac->lim.gLimSmeScanResultLength == 0)
1498 {
1499 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1500 pScanReq->sessionId, pScanReq->transactionId);
1501 }
1502 else
1503 {
1504 scanRspLen = sizeof(tSirSmeScanRsp) +
1505 pMac->lim.gLimSmeScanResultLength -
1506 sizeof(tSirBssDescription);
1507 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1508 pScanReq->sessionId, pScanReq->transactionId);
1509 }
1510#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001511 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001512#endif
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301513 limLog(pMac, LOG1, FL("Cached scan results are returned "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001514
1515 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1516 {
1517 // Discard previously cached scan results
1518 limReInitScanResults(pMac);
1519 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001520#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1521 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1522 {
1523 // Discard previously cached scan results
1524 limReInitLfrScanResults(pMac);
1525 }
1526#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001527
1528 } // if (pMac->lim.gLimRspReqd)
1529 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1530
Jeff Johnson295189b2012-06-20 16:38:30 -07001531#ifdef BACKGROUND_SCAN_ENABLED
1532 // start background scans if needed
1533 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1534 __limBackgroundScanInitiate(pMac);
1535#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001536
1537} /*** end __limProcessSmeScanReq() ***/
1538
Jeff Johnsone7245742012-09-05 17:12:55 -07001539#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001540
Jeff Johnsone7245742012-09-05 17:12:55 -07001541static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1542{
1543 tpSirOemDataReq pOemDataReq;
1544 tLimMlmOemDataReq* pMlmOemDataReq;
1545
1546 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1547
1548 //post the lim mlm message now
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301549 pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq));
1550 if ( NULL == pMlmOemDataReq )
Jeff Johnsone7245742012-09-05 17:12:55 -07001551 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301552 limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001553 return;
1554 }
1555
1556 //Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301557 vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001558
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301559 vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr,
1560 sizeof(tSirMacAddr));
1561 vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq,
1562 OEM_DATA_REQ_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001563
1564 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1565 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1566
1567 return;
1568
1569} /*** end __limProcessSmeOemDataReq() ***/
1570
1571#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001572
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301573/**
1574 * __limProcessClearDfsChannelList()
1575 *
1576 *FUNCTION:
1577 *Clear DFS channel list when country is changed/aquired.
1578.*This message is sent from SME.
1579 *
1580 *LOGIC:
1581 *
1582 *ASSUMPTIONS:
1583 *
1584 *NOTE:
1585 *
1586 * @param pMac Pointer to Global MAC structure
1587 * @param *pMsgBuf A pointer to the SME message buffer
1588 * @return None
1589 */
1590static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1591 tpSirMsgQ pMsg)
1592{
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301593 vos_mem_set( &pMac->lim.dfschannelList,
1594 sizeof(tSirDFSChannelList), 0);
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301595}
Jeff Johnson295189b2012-06-20 16:38:30 -07001596
1597/**
1598 * __limProcessSmeJoinReq()
1599 *
1600 *FUNCTION:
1601 * This function is called to process SME_JOIN_REQ message
1602 * from HDD or upper layer application.
1603 *
1604 *LOGIC:
1605 *
1606 *ASSUMPTIONS:
1607 *
1608 *NOTE:
1609 *
1610 * @param pMac Pointer to Global MAC structure
1611 * @param *pMsgBuf A pointer to the SME message buffer
1612 * @return None
1613 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001614static void
1615__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1616{
1617 // tANI_U8 *pBuf;
1618 //tANI_U32 len;
1619// tSirMacAddr currentBssId;
1620 tpSirSmeJoinReq pSmeJoinReq = NULL;
1621 tLimMlmJoinReq *pMlmJoinReq;
1622 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1623 tANI_U32 val = 0;
1624 tANI_U16 nSize;
1625 tANI_U8 sessionId;
1626 tpPESession psessionEntry = NULL;
1627 tANI_U8 smesessionId;
1628 tANI_U16 smetransactionId;
1629 tPowerdBm localPowerConstraint = 0, regMax = 0;
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301630 tANI_U16 ieLen;
1631 v_U8_t *vendorIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001632
1633#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1634 //Not sending any session, since it is not created yet. The response whould have correct state.
1635 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1636#endif //FEATURE_WLAN_DIAG_SUPPORT
1637
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301638 limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001639
1640#ifdef WLAN_FEATURE_VOWIFI
1641 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1642 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1643 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1644 * like not honoring power constraint on 1st association after driver loading. */
1645 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001646 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1648 val = 0;
1649#endif /* WLAN_FEATURE_VOWIFI */
1650
1651 /**
1652 * Expect Join request in idle state.
1653 * Reassociate request is expected in link established state.
1654 */
1655
1656 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1657 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1658 {
1659 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301660
1661 pSmeJoinReq = vos_mem_malloc(nSize);
1662 if ( NULL == pSmeJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001663 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301664 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1665 "pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001666 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1667 goto end;
1668 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301669 (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001670
Jeff Johnson295189b2012-06-20 16:38:30 -07001671 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1672 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1673 {
1674 /// Received invalid eWNI_SME_JOIN_REQ
1675 // Log the event
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301676 limLog(pMac, LOGW, FL("SessionId:%d Received SME_JOIN_REQ with"
1677 "invalid data"),pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001678 retCode = eSIR_SME_INVALID_PARAMETERS;
1679 goto end;
1680 }
1681
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301682 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23
Jeff Johnson295189b2012-06-20 16:38:30 -07001683
1684 /* check for the existence of start BSS session */
1685#ifdef FIXME_GEN6
1686 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1687 {
1688 if(peValidateBtJoinRequest(pMac)!= TRUE)
1689 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301690 limLog(pMac, LOGW, FL("SessionId:%d Start Bss session"
1691 "not present::SME_JOIN_REQ in unexpected state"),
1692 pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001693 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1694 psessionEntry = NULL;
1695 goto end;
1696 }
1697 }
1698
1699#endif
1700
1701
1702 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1703 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301704 limLog(pMac, LOGE, FL("Session(%d) Already exists for BSSID: "
Sushant Kaushik1b645382014-10-13 16:39:36 +05301705 MAC_ADDRESS_STR" in limSmeState = %d"),sessionId,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301706 MAC_ADDR_ARRAY(pSmeJoinReq->bssDescription.bssId),
1707 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001708
1709 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1710 {
1711 // Received eWNI_SME_JOIN_REQ for same
1712 // BSS as currently associated.
1713 // Log the event and send success
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301714 PELOGW(limLog(pMac, LOGW, FL("SessionId:%d Received"
1715 "SME_JOIN_REQ for currently joined BSS"),sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001716 /// Send Join success response to host
Deepthi Gowrif3e27252013-12-11 20:50:01 +05301717 retCode = eSIR_SME_ALREADY_JOINED_A_BSS;
1718 psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001719 goto end;
1720 }
1721 else
1722 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301723 PELOGE(limLog(pMac, LOGE, FL("SME_JOIN_REQ not for"
1724 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 retCode = eSIR_SME_REFUSED;
1726 psessionEntry = NULL;
1727 goto end;
1728 }
1729 }
1730 else /* Session Entry does not exist for given BSSId */
1731 {
1732 /* Try to Create a new session */
1733 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1734 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001735 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001736 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1737 goto end;
1738 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301739 else
1740 limLog(pMac,LOG1,FL("SessionId:%d New session created"),
1741 sessionId);
Masti, Narayanraddi67ea5912015-01-08 12:34:05 +05301742 }
1743
1744 if(psessionEntry != NULL && pSmeJoinReq->operationalRateSet.numRates > 0 ){
1745 if(!limCheck11BRateBitmap(pSmeJoinReq->rateBitMap)){
1746 psessionEntry->is11Gonly = true;
1747 }
1748 }
1749
Jeff Johnsone7245742012-09-05 17:12:55 -07001750 handleHTCapabilityandHTInfo(pMac, psessionEntry);
krunal soni5afa96c2013-09-06 22:19:02 -07001751 psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
Jeff Johnsone7245742012-09-05 17:12:55 -07001752
Jeff Johnson295189b2012-06-20 16:38:30 -07001753 /* Store Session related parameters */
1754 /* Store PE session Id in session Table */
1755 psessionEntry->peSessionId = sessionId;
1756
1757 /* store the smejoin req handle in session table */
1758 psessionEntry->pLimJoinReq = pSmeJoinReq;
1759
1760 /* Store SME session Id in sessionTable */
1761 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1762
1763 /* Store SME transaction Id in session Table */
1764 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1765
1766 /* Store beaconInterval */
1767 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1768
1769 /* Copying of bssId is already done, while creating session */
1770 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1771 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1772 psessionEntry->bssType = pSmeJoinReq->bsstype;
1773
1774 psessionEntry->statypeForBss = STA_ENTRY_PEER;
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301775 psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled;
1776 psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001777
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301778 /* Store vendor specfic IE for CISCO AP */
1779 ieLen = (pSmeJoinReq->bssDescription.length +
1780 sizeof( pSmeJoinReq->bssDescription.length ) -
1781 GET_FIELD_OFFSET( tSirBssDescription, ieFields ));
1782
1783 vendorIE = limGetVendorIEOuiPtr(pMac, SIR_MAC_CISCO_OUI,
1784 SIR_MAC_CISCO_OUI_SIZE,
1785 ((tANI_U8 *)&pSmeJoinReq->bssDescription.ieFields) , ieLen);
1786
1787 if ( NULL != vendorIE )
1788 {
1789 limLog(pMac, LOGE,
1790 FL("DUT is trying to connect to Cisco AP"));
1791 psessionEntry->isCiscoVendorAP = TRUE;
1792 }
1793 else
1794 {
1795 psessionEntry->isCiscoVendorAP = FALSE;
1796 }
1797
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 /* Copy the dot 11 mode in to the session table */
1799
1800 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1801 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001802#ifdef WLAN_FEATURE_11AC
1803 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001804 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001805 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001806 if (psessionEntry->vhtCapability )
1807 {
1808 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1809
1810 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001811 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001812 psessionEntry->txBFIniFeatureEnabled);
1813
1814 if( psessionEntry->txBFIniFeatureEnabled )
1815 {
1816 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1817 != eSIR_SUCCESS)
1818 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301819 limLog(pMac, LOGP, FL("could not set "
1820 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001821 retCode = eSIR_LOGP_EXCEPTION;
1822 goto end;
1823 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001824 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301825 "***__limProcessSmeJoinReq: txBFCsnValue=%d****",
1826 pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001827
1828 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001829 != eSIR_SUCCESS)
1830 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301831 limLog(pMac, LOGP, FL("could not set "
1832 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001833 retCode = eSIR_LOGP_EXCEPTION;
1834 goto end;
1835 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301836
1837 if ( FALSE == pMac->isMuBfsessionexist )
1838 psessionEntry->txMuBformee = pSmeJoinReq->txMuBformee;
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001839 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301840
1841 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1842 "SmeJoinReq:txMuBformee=%d psessionEntry: txMuBformee = %d",
1843 pSmeJoinReq->txMuBformee, psessionEntry->txMuBformee);
1844
1845 if(cfgSetInt(pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, psessionEntry->txMuBformee)
1846 != eSIR_SUCCESS)
1847 {
1848 limLog(pMac, LOGE, FL("could not set "
1849 "WNI_CFG_VHT_MU_BEAMFORMEE_CAP at CFG"));
1850 retCode = eSIR_LOGP_EXCEPTION;
1851 goto end;
1852 }
1853
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001854 }
1855
Jeff Johnsone7245742012-09-05 17:12:55 -07001856#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001857
1858 /*Phy mode*/
1859 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1860
1861 /* Copy The channel Id to the session Table */
1862 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001863 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1864 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1865 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001866
Chet Lanctot186b5732013-03-18 10:26:30 -07001867 /* Record if management frames need to be protected */
1868#ifdef WLAN_FEATURE_11W
1869 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1870 {
1871 psessionEntry->limRmfEnabled = 1;
1872 }
1873 else
1874 {
1875 psessionEntry->limRmfEnabled = 0;
1876 }
1877#endif
1878
krunal soni8d13b092013-07-19 13:23:29 -07001879#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1880 psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi;
1881#endif
1882
Jeff Johnson295189b2012-06-20 16:38:30 -07001883 /*Store Persona */
1884 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1885 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301886 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona,
1887 pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001888
1889 /* Copy the SSID from smejoinreq to session entry */
1890 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301891 vos_mem_copy( psessionEntry->ssId.ssId,
1892 pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length);
1893
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001894 // Determin 11r or ESE connection based on input from SME
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301895 // which inturn is dependent on the profile the user wants to connect
1896 // to, So input is coming from supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07001897#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301898 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001899#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001900#ifdef FEATURE_WLAN_ESE
1901 psessionEntry->isESEconnection = pSmeJoinReq->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001902#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001903#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301904 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001905#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301906
Jeff Johnson43971f52012-07-17 12:26:56 -07001907#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301908 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
Jeff Johnson43971f52012-07-17 12:26:56 -07001909#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301910 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001911
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301912 if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001913 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301914 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1915 }
1916 else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1917 {
1918 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1919 }
1920 else
1921 {
1922 /* Throw an error and return and make sure to delete the session.*/
Abhishek Singh57aebef2014-02-03 18:47:44 +05301923 limLog(pMac, LOGE, FL("received SME_JOIN_REQ with invalid"
1924 " bss type %d"), psessionEntry->bssType);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301925 retCode = eSIR_SME_INVALID_PARAMETERS;
1926 goto end;
1927 }
1928
1929 if (pSmeJoinReq->addIEScan.length)
1930 {
1931 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan,
Jeff Johnson295189b2012-06-20 16:38:30 -07001932 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
1933 }
1934
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301935 if (pSmeJoinReq->addIEAssoc.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301937 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc,
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
1939 }
1940
Jeff Johnson295189b2012-06-20 16:38:30 -07001941 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301942 pMlmJoinReq = vos_mem_malloc(val);
1943 if ( NULL == pMlmJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301945 limLog(pMac, LOGP, FL("call to AllocateMemory "
1946 "failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001947 return;
1948 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301949 (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001950
1951 /* PE SessionId is stored as a part of JoinReq*/
1952 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
1953
1954 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
1955 != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001956 limLog(pMac, LOGP, FL("could not retrieve JoinFailureTimer value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001957
1958 /* copy operational rate from psessionEntry*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301959 vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001960 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301961 vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001962 sizeof(tSirMacRateSet));
1963 //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 +05301964 vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001965 sizeof(tSirMacRateSet));
1966
1967 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
1968
Jeff Johnson295189b2012-06-20 16:38:30 -07001969 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
1970
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301971 vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001972 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
1973 psessionEntry->pLimJoinReq->bssDescription.length + 2);
1974
Jeff Johnson295189b2012-06-20 16:38:30 -07001975 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07001976 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001977
Jeff Johnsone7245742012-09-05 17:12:55 -07001978 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05301979 localPowerConstraint = regMax;
Jeff Johnsone7245742012-09-05 17:12:55 -07001980 limExtractApCapability( pMac,
1981 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
1982 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
1983 &psessionEntry->limCurrentBssQosCaps,
1984 &psessionEntry->limCurrentBssPropCap,
1985 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07001986 , &localPowerConstraint,
1987 psessionEntry
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05301988 );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05301989
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001990#ifdef FEATURE_WLAN_ESE
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001991 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07001992#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301993 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001994#endif
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05301995 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1996 "Regulatory max = %d, local power constraint = %d,"
Abhishek Singh57aebef2014-02-03 18:47:44 +05301997 " max tx = %d", regMax, localPowerConstraint,
1998 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07001999
2000 if (pMac->lim.gLimCurrentBssUapsd)
2001 {
2002 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302003 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2004 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002005
2006 // resetting the dynamic uapsd mask
2007 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
2008 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
2009 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002010
2011 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
2012
2013 // Initialize 11h Enable Flag
2014 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
2015 {
2016 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002017 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002018 psessionEntry->lim11hEnable = val;
2019 }
2020 else
2021 psessionEntry->lim11hEnable = 0;
2022
2023 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
2024 pMac->lim.gLimIbssCoalescingHappened = false;
2025
Jeff Johnsone7245742012-09-05 17:12:55 -07002026 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2027 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
2028 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002029
Abhishek Singh57aebef2014-02-03 18:47:44 +05302030 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
2031 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
2032 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
2033 psessionEntry->currentOperChannel,
2034 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002035
2036 /* Indicate whether spectrum management is enabled*/
2037 psessionEntry->spectrumMgtEnabled =
2038 pSmeJoinReq->spectrumMgtIndicator;
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302039
2040 /* Enable the spectrum management if this is a DFS channel */
2041 if (psessionEntry->countryInfoPresent &&
2042 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2043 {
2044 psessionEntry->spectrumMgtEnabled = TRUE;
2045 }
2046
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302047 limLog(pMac,LOG1,FL("SessionId: %d LIM_MLM_JOIN_REQ is posted to MLM "
2048 "SM"), pMlmJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002049 /* Issue LIM_MLM_JOIN_REQ to MLM */
2050 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
2051 return;
2052
2053 }
2054 else
2055 {
2056 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05302057 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
Sushant Kaushik1b645382014-10-13 16:39:36 +05302058 "in state %d"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002059 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
2060 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2061 psessionEntry = NULL;
2062 goto end;
2063
2064 }
2065
2066end:
2067 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
2068
2069 if(pSmeJoinReq)
2070 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302071 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002072 pSmeJoinReq = NULL;
2073 if (NULL != psessionEntry)
2074 {
2075 psessionEntry->pLimJoinReq = NULL;
2076 }
2077 }
2078
2079 if(retCode != eSIR_SME_SUCCESS)
2080 {
2081 if(NULL != psessionEntry)
2082 {
2083 peDeleteSession(pMac,psessionEntry);
2084 psessionEntry = NULL;
2085 }
2086 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05302087 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
2088 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002089 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
2090} /*** end __limProcessSmeJoinReq() ***/
2091
2092
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002093#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08002094tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07002095{
2096 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302097 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002098 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07002099 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2100 maxTxPower = txPower;
2101 else if (txPower < MIN_TX_PWR_CAP)
2102 maxTxPower = MIN_TX_PWR_CAP;
2103 else
2104 maxTxPower = MAX_TX_PWR_CAP;
2105
2106 return (maxTxPower);
2107}
2108#endif
2109
Jeff Johnson295189b2012-06-20 16:38:30 -07002110/**
2111 * __limProcessSmeReassocReq()
2112 *
2113 *FUNCTION:
2114 * This function is called to process SME_REASSOC_REQ message
2115 * from HDD or upper layer application.
2116 *
2117 *LOGIC:
2118 *
2119 *ASSUMPTIONS:
2120 *
2121 *NOTE:
2122 *
2123 * @param pMac Pointer to Global MAC structure
2124 * @param *pMsgBuf A pointer to the SME message buffer
2125 * @return None
2126 */
2127
2128static void
2129__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2130{
2131 tANI_U16 caps;
2132 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002133 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002134 tLimMlmReassocReq *pMlmReassocReq;
2135 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2136 tpPESession psessionEntry = NULL;
2137 tANI_U8 sessionId;
2138 tANI_U8 smeSessionId;
2139 tANI_U16 transactionId;
2140 tPowerdBm localPowerConstraint = 0, regMax = 0;
2141 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002142 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002143
2144
Abhishek Singh127a8442014-12-15 17:31:27 +05302145 limLog(pMac, LOG1, FL("Received SME_REASSOC_REQ"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002146
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002147 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302148 pReassocReq = vos_mem_malloc(nSize);
2149 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002150 {
2151 // Log error
2152 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302153 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002154
2155 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2156 goto end;
2157 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302158 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2160 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2161 (!limIsSmeJoinReqValid(pMac,
2162 (tpSirSmeJoinReq) pReassocReq)))
2163 {
2164 /// Received invalid eWNI_SME_REASSOC_REQ
2165 // Log the event
2166 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002167 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002168
2169 retCode = eSIR_SME_INVALID_PARAMETERS;
2170 goto end;
2171 }
2172
2173 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2174 {
2175 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002176 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002177 retCode = eSIR_SME_INVALID_PARAMETERS;
2178 goto end;
2179 }
2180
2181#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2182 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2183#endif //FEATURE_WLAN_DIAG_SUPPORT
2184 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2185
2186 /* Store the reassoc handle in the session Table.. 23rd sep review */
2187 psessionEntry->pLimReAssocReq = pReassocReq;
Padma, Santhosh Kumar0d25d102014-07-17 15:08:48 +05302188 psessionEntry->dot11mode = pReassocReq->dot11mode;
2189 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(pReassocReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002190
2191 /**
2192 * Reassociate request is expected
2193 * in link established state only.
2194 */
2195
2196 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2197 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002198#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2200 {
2201 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002202 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002203 psessionEntry->peSessionId);
2204
2205 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302206 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002207 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2208 {
2209 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2210 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002211 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 retCode = eSIR_SME_INVALID_PARAMETERS;
2213 goto end;
2214 }
2215
2216 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2217 return;
2218 }
2219#endif
2220 /// Should not have received eWNI_SME_REASSOC_REQ
2221 // Log the event
2222 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302223 FL("received unexpected SME_REASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002224 psessionEntry->limSmeState);
2225 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2226
2227 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2228 goto end;
2229 }
2230
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302231 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002232 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2233 sizeof(tSirMacAddr));
2234
2235 psessionEntry->limReassocChannelId =
2236 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2237
Jeff Johnsone7245742012-09-05 17:12:55 -07002238 psessionEntry->reAssocHtSupportedChannelWidthSet =
2239 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2240 psessionEntry->reAssocHtRecommendedTxWidthSet =
2241 psessionEntry->reAssocHtSupportedChannelWidthSet;
2242 psessionEntry->reAssocHtSecondaryChannelOffset =
2243 psessionEntry->pLimReAssocReq->cbMode;
2244
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 psessionEntry->limReassocBssCaps =
2246 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002247 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2248 localPowerConstraint = regMax;
2249 limExtractApCapability( pMac,
2250 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2251 limGetIElenFromBssDescription(
2252 &psessionEntry->pLimReAssocReq->bssDescription),
2253 &psessionEntry->limReassocBssQosCaps,
2254 &psessionEntry->limReassocBssPropCap,
2255 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002256 , &localPowerConstraint,
2257 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002258 );
2259
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302260 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002261#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302262 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2263 "= %d, max tx = %d", regMax, localPowerConstraint,
2264 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002265#endif
2266 {
2267 #if 0
2268 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2269 &cfgLen) != eSIR_SUCCESS)
2270 {
2271 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002272 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 }
2274 #endif//TO SUPPORT BT-AMP
2275
2276 /* Copy the SSID from sessio entry to local variable */
2277 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302278 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002279 psessionEntry->ssId.ssId,
2280 psessionEntry->ssId.length);
2281 #endif
2282 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302283 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002284 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2285
2286 }
2287
2288 if (pMac->lim.gLimCurrentBssUapsd)
2289 {
2290 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302291 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2292 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002293 }
2294
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302295 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2296 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002297 {
2298 // Log error
2299 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302300 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002301
2302 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2303 goto end;
2304 }
2305
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302306 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 psessionEntry->limReAssocbssId,
2308 sizeof(tSirMacAddr));
2309
2310 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2311 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2312 != eSIR_SUCCESS)
2313 {
2314 /**
2315 * Could not get ReassocFailureTimeout value
2316 * from CFG. Log error.
2317 */
2318 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002319 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002320 }
2321
2322 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2323 {
2324 /**
2325 * Could not get Capabilities value
2326 * from CFG. Log error.
2327 */
2328 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002329 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002330 }
2331 pMlmReassocReq->capabilityInfo = caps;
2332
2333 /* Update PE sessionId*/
2334 pMlmReassocReq->sessionId = sessionId;
2335
2336 /* If telescopic beaconing is enabled, set listen interval to
2337 WNI_CFG_TELE_BCN_MAX_LI */
2338 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2339 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002340 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002341
2342 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2343
2344 if(teleBcnEn)
2345 {
2346 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2347 eSIR_SUCCESS)
2348 {
2349 /**
2350 * Could not get ListenInterval value
2351 * from CFG. Log error.
2352 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002353 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002354 }
2355 }
2356 else
2357 {
2358 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2359 {
2360 /**
2361 * Could not get ListenInterval value
2362 * from CFG. Log error.
2363 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002364 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002365 }
2366 }
2367
2368 /* Delete all BA sessions before Re-Assoc.
2369 * BA frames are class 3 frames and the session
2370 * is lost upon disassociation and reassociation.
2371 */
2372
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05302373 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS,
2374 eSIR_MAC_UNSPEC_FAILURE_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002375
2376 pMlmReassocReq->listenInterval = (tANI_U16) val;
2377
2378 /* Indicate whether spectrum management is enabled*/
2379 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2380
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302381 /* Enable the spectrum management if this is a DFS channel */
2382 if (psessionEntry->countryInfoPresent &&
2383 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2384 {
2385 psessionEntry->spectrumMgtEnabled = TRUE;
2386 }
2387
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2389 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2390
Jeff Johnsone7245742012-09-05 17:12:55 -07002391 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002392
2393 limPostMlmMessage(pMac,
2394 LIM_MLM_REASSOC_REQ,
2395 (tANI_U32 *) pMlmReassocReq);
2396 return;
2397
2398end:
2399 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302400 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002401
2402 if (psessionEntry)
2403 {
2404 // error occurred after we determined the session so extract
2405 // session and transaction info from there
2406 smeSessionId = psessionEntry->smeSessionId;
2407 transactionId = psessionEntry->transactionId;
2408 }
2409 else
2410 {
2411 // error occurred before or during the time we determined the session
2412 // so extract the session and transaction info from the message
2413 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2414 }
2415
2416 /// Send Reassoc failure response to host
2417 /// (note psessionEntry may be NULL, but that's OK)
2418 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2419 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2420 psessionEntry, smeSessionId, transactionId);
2421
2422} /*** end __limProcessSmeReassocReq() ***/
2423
2424
2425tANI_BOOLEAN sendDisassocFrame = 1;
2426/**
2427 * __limProcessSmeDisassocReq()
2428 *
2429 *FUNCTION:
2430 * This function is called to process SME_DISASSOC_REQ message
2431 * from HDD or upper layer application.
2432 *
2433 *LOGIC:
2434 *
2435 *ASSUMPTIONS:
2436 *
2437 *NOTE:
2438 *
2439 * @param pMac Pointer to Global MAC structure
2440 * @param *pMsgBuf A pointer to the SME message buffer
2441 * @return None
2442 */
2443
2444static void
2445__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2446{
2447 tANI_U16 disassocTrigger, reasonCode;
2448 tLimMlmDisassocReq *pMlmDisassocReq;
2449 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002450 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002451 tSirSmeDisassocReq smeDisassocReq;
2452 tpPESession psessionEntry = NULL;
2453 tANI_U8 sessionId;
2454 tANI_U8 smesessionId;
2455 tANI_U16 smetransactionId;
2456
Jeff Johnson295189b2012-06-20 16:38:30 -07002457
Jeff Johnson43971f52012-07-17 12:26:56 -07002458 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002459 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002460 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002461 return;
2462 }
2463
Jeff Johnson43971f52012-07-17 12:26:56 -07002464 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002465
Jeff Johnson43971f52012-07-17 12:26:56 -07002466 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002467
Jeff Johnson43971f52012-07-17 12:26:56 -07002468 if ( (eSIR_FAILURE == status) ||
2469 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002470 {
2471 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002472 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002473
2474 if (pMac->lim.gLimRspReqd)
2475 {
2476 pMac->lim.gLimRspReqd = false;
2477
2478 retCode = eSIR_SME_INVALID_PARAMETERS;
2479 disassocTrigger = eLIM_HOST_DISASSOC;
2480 goto sendDisassoc;
2481 }
2482
2483 return;
2484 }
2485
Jeff Johnson295189b2012-06-20 16:38:30 -07002486 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2487 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302488 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2489 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002490 retCode = eSIR_SME_INVALID_PARAMETERS;
2491 disassocTrigger = eLIM_HOST_DISASSOC;
2492 goto sendDisassoc;
2493
2494 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302495 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2496 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2497 smesessionId,psessionEntry->limSystemRole,
2498 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2499 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002500
2501#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2502 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2503#endif //FEATURE_WLAN_DIAG_SUPPORT
2504
2505 /* Update SME session Id and SME transaction ID*/
2506
2507 psessionEntry->smeSessionId = smesessionId;
2508 psessionEntry->transactionId = smetransactionId;
2509
2510 switch (psessionEntry->limSystemRole)
2511 {
2512 case eLIM_STA_ROLE:
2513 case eLIM_BT_AMP_STA_ROLE:
2514 switch (psessionEntry->limSmeState)
2515 {
2516 case eLIM_SME_ASSOCIATED_STATE:
2517 case eLIM_SME_LINK_EST_STATE:
2518 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2519 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002520#ifdef FEATURE_WLAN_TDLS
2521 /* Delete all TDLS peers connected before leaving BSS*/
2522 limDeleteTDLSPeers(pMac, psessionEntry);
2523#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002524 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302525 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2526 "limSmeState: %d "),psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 break;
2528
2529 case eLIM_SME_WT_DEAUTH_STATE:
2530 /* PE shall still process the DISASSOC_REQ and proceed with
2531 * link tear down even if it had already sent a DEAUTH_IND to
2532 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2533 * its been set when PE entered WT_DEAUTH_STATE.
2534 */
2535 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002536 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302537 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2538 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002539 break;
2540
2541 case eLIM_SME_WT_DISASSOC_STATE:
2542 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2543 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2544 * PE can continue processing DISASSOC_REQ and send the response instead
2545 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2546 * for disassoc frame.
2547 *
2548 * It will send a disassoc, which is ok. However, we can use the global flag
2549 * sendDisassoc to not send disassoc frame.
2550 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302551 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2552 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002553 break;
2554
2555 case eLIM_SME_JOIN_FAILURE_STATE: {
2556 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302557 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2558 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002559 if (pMac->lim.gLimRspReqd) {
2560 retCode = eSIR_SME_SUCCESS;
2561 disassocTrigger = eLIM_HOST_DISASSOC;
2562 goto sendDisassoc;
2563 }
2564 }break;
2565 default:
2566 /**
2567 * STA is not currently associated.
2568 * Log error and send response to host
2569 */
2570 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302571 FL("received unexpected SME_DISASSOC_REQ in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002572 psessionEntry->limSmeState);
2573 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2574
2575 if (pMac->lim.gLimRspReqd)
2576 {
2577 if (psessionEntry->limSmeState !=
2578 eLIM_SME_WT_ASSOC_STATE)
2579 pMac->lim.gLimRspReqd = false;
2580
2581 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2582 disassocTrigger = eLIM_HOST_DISASSOC;
2583 goto sendDisassoc;
2584 }
2585
2586 return;
2587 }
2588
2589 break;
2590
2591 case eLIM_AP_ROLE:
2592 case eLIM_BT_AMP_AP_ROLE:
2593 // Fall through
2594 break;
2595
2596 case eLIM_STA_IN_IBSS_ROLE:
2597 default: // eLIM_UNKNOWN_ROLE
2598 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002599 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002600 psessionEntry->limSystemRole);
2601
2602 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2603 disassocTrigger = eLIM_HOST_DISASSOC;
2604 goto sendDisassoc;
2605 } // end switch (pMac->lim.gLimSystemRole)
2606
2607 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2608 {
2609 /// Disassociation is triggered by Link Monitoring
Abhishek Singhcd09b562013-12-24 16:02:20 +05302610 limLog(pMac, LOG1, FL("**** Lost link with AP ****"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002611 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2612 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2613 }
2614 else
2615 {
2616 disassocTrigger = eLIM_HOST_DISASSOC;
2617 reasonCode = smeDisassocReq.reasonCode;
2618 }
2619
2620 if (smeDisassocReq.doNotSendOverTheAir)
2621 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302622 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002623 sendDisassocFrame = 0;
2624 }
2625 // Trigger Disassociation frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302626
2627 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2628 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002629 {
2630 // Log error
2631 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302632 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002633
2634 return;
2635 }
2636
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302637 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002638 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2639 sizeof(tSirMacAddr));
2640
2641 pMlmDisassocReq->reasonCode = reasonCode;
2642 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2643
2644 /* Update PE session ID*/
2645 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002646
2647 limPostMlmMessage(pMac,
2648 LIM_MLM_DISASSOC_REQ,
2649 (tANI_U32 *) pMlmDisassocReq);
2650 return;
2651
2652sendDisassoc:
2653 if (psessionEntry)
2654 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2655 retCode,
2656 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002657 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002658 else
2659 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2660 retCode,
2661 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002662 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002663
2664
2665} /*** end __limProcessSmeDisassocReq() ***/
2666
2667
2668/** -----------------------------------------------------------------
2669 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2670
2671 This function is called to process SME_DISASSOC_CNF message
2672 from HDD or upper layer application.
2673
2674 \param pMac - global mac structure
2675 \param pStaDs - station dph hash node
2676 \return none
2677 \sa
2678 ----------------------------------------------------------------- */
2679static void
2680__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2681{
2682 tSirSmeDisassocCnf smeDisassocCnf;
2683 tANI_U16 aid;
2684 tpDphHashNode pStaDs;
2685 tSirRetStatus status = eSIR_SUCCESS;
2686 tpPESession psessionEntry;
2687 tANI_U8 sessionId;
2688
2689
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302690 limLog(pMac, LOG1, FL("received SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002691
2692 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2693
2694 if (status == eSIR_FAILURE)
2695 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002696 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002697 return;
2698 }
2699
2700 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2701 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002702 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 return;
2704 }
2705
2706 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2707 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302708 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 return;
2710 }
2711
2712#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2713 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2714 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2715 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2716 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2717#endif //FEATURE_WLAN_DIAG_SUPPORT
2718
2719 switch (psessionEntry->limSystemRole)
2720 {
2721 case eLIM_STA_ROLE:
2722 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2723 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2724 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2725 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2726 {
2727 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302728 FL("received unexp SME_DISASSOC_CNF in state %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002729 psessionEntry->limSmeState);
2730 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2731 return;
2732 }
2733 break;
2734
2735 case eLIM_AP_ROLE:
2736 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002737 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002738
2739 case eLIM_STA_IN_IBSS_ROLE:
2740 default: // eLIM_UNKNOWN_ROLE
2741 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002742 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002743 psessionEntry->limSystemRole);
2744
2745 return;
2746 }
2747
2748
2749 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2750 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002751 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002752 )
2753 {
2754 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2755 if (pStaDs == NULL)
2756 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302757 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2758 "does not have context, addr= "MAC_ADDRESS_STR),
2759 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002760 return;
2761 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002762 /* Delete FT session if there exists one */
2763 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002764 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002765
2766 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002767 }
2768
2769 return;
2770}
2771
2772
2773/**
2774 * __limProcessSmeDeauthReq()
2775 *
2776 *FUNCTION:
2777 * This function is called to process SME_DEAUTH_REQ message
2778 * from HDD or upper layer application.
2779 *
2780 *LOGIC:
2781 *
2782 *ASSUMPTIONS:
2783 *
2784 *NOTE:
2785 *
2786 * @param pMac Pointer to Global MAC structure
2787 * @param *pMsgBuf A pointer to the SME message buffer
2788 * @return None
2789 */
2790
2791static void
2792__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2793{
2794 tANI_U16 deauthTrigger, reasonCode;
2795 tLimMlmDeauthReq *pMlmDeauthReq;
2796 tSirSmeDeauthReq smeDeauthReq;
2797 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2798 tSirRetStatus status = eSIR_SUCCESS;
2799 tpPESession psessionEntry;
2800 tANI_U8 sessionId; //PE sessionId
2801 tANI_U8 smesessionId;
2802 tANI_U16 smetransactionId;
2803
Jeff Johnson295189b2012-06-20 16:38:30 -07002804
2805 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002806 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2807
2808 //We need to get a session first but we don't even know if the message is correct.
2809 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2810 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002811 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002812 retCode = eSIR_SME_INVALID_PARAMETERS;
2813 deauthTrigger = eLIM_HOST_DEAUTH;
2814 goto sendDeauth;
2815
2816 }
2817
2818 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2819 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002820 PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002821 if (pMac->lim.gLimRspReqd)
2822 {
2823 pMac->lim.gLimRspReqd = false;
2824
2825 retCode = eSIR_SME_INVALID_PARAMETERS;
2826 deauthTrigger = eLIM_HOST_DEAUTH;
2827 goto sendDeauth;
2828 }
2829
2830 return;
2831 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302832 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2833 "Systemrole %d with reasoncode %u in limSmestate %d from "
2834 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2835 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2836 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002837#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2838 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2839#endif //FEATURE_WLAN_DIAG_SUPPORT
2840
2841 /* Update SME session ID and Transaction ID */
2842 psessionEntry->smeSessionId = smesessionId;
2843 psessionEntry->transactionId = smetransactionId;
2844
2845
2846 switch (psessionEntry->limSystemRole)
2847 {
2848 case eLIM_STA_ROLE:
2849 case eLIM_BT_AMP_STA_ROLE:
2850
2851 switch (psessionEntry->limSmeState)
2852 {
2853 case eLIM_SME_ASSOCIATED_STATE:
2854 case eLIM_SME_LINK_EST_STATE:
2855 case eLIM_SME_WT_ASSOC_STATE:
2856 case eLIM_SME_JOIN_FAILURE_STATE:
2857 case eLIM_SME_IDLE_STATE:
2858 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2859 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002860 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002861
2862 // Send Deauthentication request to MLM below
2863
2864 break;
Sachin Ahujaa100dcc2014-07-03 14:30:18 +05302865 case eLIM_SME_WT_DEAUTH_STATE:
2866 /*
2867 * PE Recieved a Deauth frame. Normally it gets
2868 * DEAUTH_CNF but it received DEAUTH_REQ. Which
2869 * means host is also trying to disconnect.
2870 * PE can continue processing DEAUTH_REQ and send
2871 * the response instead of failing the request.
2872 * SME will anyway ignore DEAUTH_IND that was sent
2873 * for deauth frame.
2874 */
2875 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
2876 "SME_WT_DEAUTH_STATE. "));
2877 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002878 default:
2879 /**
2880 * STA is not in a state to deauthenticate with
2881 * peer. Log error and send response to host.
2882 */
2883 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302884 FL("received unexp SME_DEAUTH_REQ in state %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05302885 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002886 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2887
2888 if (pMac->lim.gLimRspReqd)
2889 {
2890 pMac->lim.gLimRspReqd = false;
2891
2892 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2893 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08002894 /**
2895 *here we received deauth request from AP so sme state is
2896 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
2897 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
2898 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
2899 so the below condition captures the state where delSta
2900 not done and firmware still in connected state.
2901 */
2902 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
2903 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
2904 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
2905 {
2906 retCode = eSIR_SME_DEAUTH_STATUS;
2907 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002908 goto sendDeauth;
2909 }
2910
2911 return;
2912 }
2913
2914 break;
2915
2916 case eLIM_STA_IN_IBSS_ROLE:
2917
2918 return;
2919
2920 case eLIM_AP_ROLE:
2921 // Fall through
2922
2923 break;
2924
2925 default:
2926 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05302927 FL("received unexpected SME_DEAUTH_REQ for role %d"),
Abhishek Singhcd09b562013-12-24 16:02:20 +05302928 psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07002929
2930 return;
2931 } // end switch (pMac->lim.gLimSystemRole)
2932
2933 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
2934 {
2935 /// Deauthentication is triggered by Link Monitoring
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302936 limLog(pMac, LOG1,
2937 FL("Deauthentication is triggered by Link Monitoring"));
2938 limLog(pMac, LOG1,
2939 FL("Set Trigger to eLIM_LINK_MONITORING_DEAUTH"));
2940 limLog(pMac, LOG1,
2941 FL("and Reason to eSIR_MAC_UNSPEC_FAILURE_REASON"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002942 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
2943 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
2944 }
2945 else
2946 {
2947 deauthTrigger = eLIM_HOST_DEAUTH;
2948 reasonCode = smeDeauthReq.reasonCode;
2949 }
2950
2951 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302952 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
2953 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002954 {
2955 // Log error
2956 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302957 FL("call to AllocateMemory failed for mlmDeauthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002958
2959 return;
2960 }
2961
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302962 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002963 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
2964 sizeof(tSirMacAddr));
2965
2966 pMlmDeauthReq->reasonCode = reasonCode;
2967 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07002968
2969 /* Update PE session Id*/
2970 pMlmDeauthReq->sessionId = sessionId;
2971
2972 limPostMlmMessage(pMac,
2973 LIM_MLM_DEAUTH_REQ,
2974 (tANI_U32 *) pMlmDeauthReq);
2975 return;
2976
2977sendDeauth:
2978 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
2979 retCode,
2980 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002981 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002982 smesessionId, smetransactionId);
2983} /*** end __limProcessSmeDeauthReq() ***/
2984
2985
2986
2987/**
2988 * __limProcessSmeSetContextReq()
2989 *
2990 *FUNCTION:
2991 * This function is called to process SME_SETCONTEXT_REQ message
2992 * from HDD or upper layer application.
2993 *
2994 *LOGIC:
2995 *
2996 *ASSUMPTIONS:
2997 *
2998 *NOTE:
2999 *
3000 * @param pMac Pointer to Global MAC structure
3001 * @param *pMsgBuf A pointer to the SME message buffer
3002 * @return None
3003 */
3004
3005static void
3006__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3007{
3008 tpSirSmeSetContextReq pSetContextReq;
3009 tLimMlmSetKeysReq *pMlmSetKeysReq;
3010 tpPESession psessionEntry;
3011 tANI_U8 sessionId; //PE sessionID
3012 tANI_U8 smesessionId;
3013 tANI_U16 smetransactionId;
3014
3015
3016 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003017 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07003018
3019
3020 if(pMsgBuf == NULL)
3021 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003022 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003023 return;
3024 }
3025
3026 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303027
3028 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
3029 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003030 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303031 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003032 return;
3033 }
3034
3035 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3036 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
3037 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003038 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003039 goto end;
3040 }
3041
3042 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3043 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003044 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 -07003045 limSendSmeSetContextRsp(pMac,
3046 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003047 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003048 eSIR_SME_INVALID_PARAMETERS,NULL,
3049 smesessionId,smetransactionId);
3050
3051 goto end;
3052 }
3053
3054
3055 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
3056 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003057 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003058 limSendSmeSetContextRsp(pMac,
3059 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003060 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003061 eSIR_SME_INVALID_PARAMETERS,NULL,
3062 smesessionId,smetransactionId);
3063
3064 goto end;
3065 }
3066
3067#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3068 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
3069#endif //FEATURE_WLAN_DIAG_SUPPORT
3070
3071
3072 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
3073 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3074 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3075 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3076 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3077 {
3078 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303079 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
3080 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003081 {
3082 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303083 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003084 goto end;
3085 }
3086
3087 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
3088 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
3089 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3090 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003091 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003092 goto end;
3093 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303094 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003095 (tANI_U8 *) &pSetContextReq->peerMacAddr,
3096 sizeof(tSirMacAddr));
3097
Jeff Johnson295189b2012-06-20 16:38:30 -07003098
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303099 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07003100 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
3101 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
3102
3103 pMlmSetKeysReq->sessionId = sessionId;
3104#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3105 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003106 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07003107#endif
3108
Jeff Johnson295189b2012-06-20 16:38:30 -07003109 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
3110 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
3111 {
3112 if(pSetContextReq->keyMaterial.key[0].keyLength)
3113 {
3114 tANI_U8 keyId;
3115 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303116 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07003117 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
3118 }
3119 else {
3120 tANI_U32 i;
3121 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3122 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303123 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003124 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3125 }
3126 }
3127 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003128
3129 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003130 }
3131 else
3132 {
3133 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303134 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003135 psessionEntry->limSystemRole,
3136 psessionEntry->limSmeState);
3137 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3138
3139 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003140 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003141 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3142 smesessionId,
3143 smetransactionId);
3144 }
3145
3146end:
Vinay Krishna Eranna6f22c1f2014-10-13 16:03:06 +05303147 vos_mem_zero(pSetContextReq,
3148 (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303149 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003150 return;
3151} /*** end __limProcessSmeSetContextReq() ***/
3152
3153/**
3154 * __limProcessSmeRemoveKeyReq()
3155 *
3156 *FUNCTION:
3157 * This function is called to process SME_REMOVEKEY_REQ message
3158 * from HDD or upper layer application.
3159 *
3160 *LOGIC:
3161 *
3162 *ASSUMPTIONS:
3163 *
3164 *NOTE:
3165 *
3166 * @param pMac Pointer to Global MAC structure
3167 * @param *pMsgBuf A pointer to the SME message buffer
3168 * @return None
3169 */
3170
3171static void
3172__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3173{
3174 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3175 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3176 tpPESession psessionEntry;
3177 tANI_U8 sessionId; //PE sessionID
3178 tANI_U8 smesessionId;
3179 tANI_U16 smetransactionId;
3180
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303181 limLog(pMac, LOG1,
3182 FL("received SME_REMOVEKEY_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003183
3184 if(pMsgBuf == NULL)
3185 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003186 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003187 return;
3188 }
3189
3190
3191 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3192
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303193 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3194 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003195 {
3196 //Log error
3197 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303198 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003199
3200 return;
3201 }
3202
3203 if ((limRemoveKeyReqSerDes(pMac,
3204 pRemoveKeyReq,
3205 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3206 {
3207 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003208 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003209
3210 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3211
3212 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3213 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003214 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003215 //goto end;
3216 }
3217
3218 limSendSmeRemoveKeyRsp(pMac,
3219 pRemoveKeyReq->peerMacAddr,
3220 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3221 smesessionId,smetransactionId);
3222
3223 goto end;
3224 }
3225
3226 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3227 {
3228 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003229 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003230 limSendSmeRemoveKeyRsp(pMac,
3231 pRemoveKeyReq->peerMacAddr,
3232 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3233 smesessionId, smetransactionId);
3234 goto end;
3235 }
3236
3237
3238 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3239 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3240 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3241 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3242 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3243 {
3244 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303245 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3246 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003247 {
3248 // Log error
3249 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303250 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003251
3252 goto end;
3253 }
3254
3255 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3256 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3257 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3258 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3259
3260 /* Update PE session Id */
3261 pMlmRemoveKeyReq->sessionId = sessionId;
3262
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303263 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003264 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3265 sizeof(tSirMacAddr));
3266
3267
3268 limPostMlmMessage(pMac,
3269 LIM_MLM_REMOVEKEY_REQ,
3270 (tANI_U32 *) pMlmRemoveKeyReq);
3271 }
3272 else
3273 {
3274 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303275 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003276 psessionEntry->limSystemRole,
3277 psessionEntry->limSmeState);
3278 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3279
3280 limSendSmeRemoveKeyRsp(pMac,
3281 pRemoveKeyReq->peerMacAddr,
3282 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3283 smesessionId,smetransactionId);
3284 }
3285
3286end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303287 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003288} /*** end __limProcessSmeRemoveKeyReq() ***/
3289
Jeff Johnson295189b2012-06-20 16:38:30 -07003290void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3291{
3292 tSirMsgQ mmhMsg;
3293 tpSmeGetScanChnRsp pSirSmeRsp;
3294 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303295 tANI_U8 sessionId;
3296 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003297
3298 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3299 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003300 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003301 pMac->lim.scanChnInfo.numChnInfo);
3302 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3303 }
3304
Abhishek Singh525045c2014-12-15 17:18:45 +05303305 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003306 FL("Sending message %s with number of channels %d"),
Abhishek Singh525045c2014-12-15 17:18:45 +05303307 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -07003308
3309 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303310 pSirSmeRsp = vos_mem_malloc(len);
3311 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003312 {
3313 /// Buffer not available. Log error
3314 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303315 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003316
3317 return;
3318 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303319 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003320
Jeff Johnson295189b2012-06-20 16:38:30 -07003321 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3322 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303323
3324 if (pMac->fScanOffload)
3325 {
3326 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3327 pSirSmeRsp->sessionId = sessionId;
3328 }
3329 else
3330 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003331
3332 if(pMac->lim.scanChnInfo.numChnInfo)
3333 {
3334 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303335 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3336 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003337 }
3338 //Clear the list
3339 limRessetScanChannelInfo(pMac);
3340
3341 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3342 mmhMsg.bodyptr = pSirSmeRsp;
3343 mmhMsg.bodyval = 0;
3344
3345 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003346 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003347 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3348}
3349
3350
Jeff Johnson295189b2012-06-20 16:38:30 -07003351void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3352{
3353 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3354 tpDphHashNode pStaDs = NULL;
3355 tpPESession psessionEntry = NULL;
3356 tSap_Event sapEvent;
3357 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3358 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3359 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3360 tANI_U8 assocId = 0;
3361 tANI_U8 staCount = 0;
3362
3363 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3364 {
3365 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003366 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303367 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003368 }
3369
3370 switch (getAssocSTAsReq.modId)
3371 {
3372/**
3373 case VOS_MODULE_ID_HAL:
3374 wdaPostCtrlMsg( pMac, &msgQ );
3375 return;
3376
3377 case VOS_MODULE_ID_TL:
3378 Post msg TL
3379 return;
3380*/
3381 case VOS_MODULE_ID_PE:
3382 default:
3383 break;
3384 }
3385
Jeff Johnson1250df42012-12-10 14:31:52 -08003386 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003387 // Find PE session Entry
3388 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3389 {
3390 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003391 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003392 goto limAssocStaEnd;
3393 }
3394
3395 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3396 {
3397 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303398 FL("Received unexpected message in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303399 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 goto limAssocStaEnd;
3401 }
3402
3403 // Retrieve values obtained in the request message
3404 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3405 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3406
3407 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3408 {
3409 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3410
3411 if (NULL == pStaDs)
3412 continue;
3413
3414 if (pStaDs->valid)
3415 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303416 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3417 (tANI_U8 *)&pStaDs->staAddr,
3418 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003419 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3420 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3421
Kiet Lamb1233192013-11-28 13:38:20 +05303422 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003423 (tANI_U8 *)&pStaDs->supportedRates,
3424 sizeof(tSirSupportedRates));
3425 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3426 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3427 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3428
Jeff Johnson295189b2012-06-20 16:38:30 -07003429 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003430 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3431 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003432 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3433 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3434
3435 pAssocStasTemp++;
3436 staCount++;
3437 }
3438 }
3439
3440limAssocStaEnd:
3441 // Call hdd callback with sap event to send the list of associated stations from PE
3442 if (pSapEventCallback != NULL)
3443 {
3444 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3445 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3446 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3447 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3448 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3449 }
3450}
3451
3452
3453/**
3454 * limProcessSmeGetWPSPBCSessions
3455 *
3456 *FUNCTION:
3457 * This function is called when query the WPS PBC overlap message is received
3458 *
3459 *LOGIC:
3460 * This function parses get WPS PBC overlap information message and call callback to pass
3461 * WPS PBC overlap information back to hdd.
3462 *ASSUMPTIONS:
3463 *
3464 *
3465 *NOTE:
3466 *
3467 * @param pMac Pointer to Global MAC structure
3468 * @param pMsgBuf A pointer to WPS PBC overlap query message
3469*
3470 * @return None
3471 */
3472void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3473{
3474 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3475 tpPESession psessionEntry = NULL;
3476 tSap_Event sapEvent;
3477 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3478 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3479 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3480
3481 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3482
3483 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3484 {
3485 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003486 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Girish Gowliafd42312014-07-24 13:13:59 +05303487 return;
Jeff Johnson295189b2012-06-20 16:38:30 -07003488 }
3489
Jeff Johnson1250df42012-12-10 14:31:52 -08003490 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003491 // Find PE session Entry
3492 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3493 {
3494 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003495 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003496 goto limGetWPSPBCSessionsEnd;
3497 }
3498
3499 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3500 {
3501 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303502 FL("Received unexpected message in role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003503 psessionEntry->limSystemRole);
3504 goto limGetWPSPBCSessionsEnd;
3505 }
3506
Jeff Johnson1250df42012-12-10 14:31:52 -08003507 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003508 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3509 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3510
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303511 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003512 { //This is GetWpsSession call
3513
3514 limGetWPSPBCSessions(pMac,
3515 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3516 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3517 }
3518 else
3519 {
3520 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3521 /* don't have to inform the HDD/Host */
3522 return;
3523 }
3524
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003525 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003526 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3527
3528 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3529
3530limGetWPSPBCSessionsEnd:
3531 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
3532 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
3533}
3534
Jeff Johnson295189b2012-06-20 16:38:30 -07003535
3536
3537/**
3538 * __limCounterMeasures()
3539 *
3540 * FUNCTION:
3541 * This function is called to "implement" MIC counter measure
3542 * and is *temporary* only
3543 *
3544 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3545 * we don't do the proper STA disassoc sequence since the
3546 * BSS will be stoped anyway
3547 *
3548 *ASSUMPTIONS:
3549 *
3550 *NOTE:
3551 *
3552 * @param pMac Pointer to Global MAC structure
3553 * @return None
3554 */
3555
3556static void
3557__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3558{
3559 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
Abhishek Singh8944b222014-09-17 16:13:17 +05303560 /* If PMF is enabled then don't send broadcast disassociation */
3561 if ( ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) ||
3562 (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) ||
3563 (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))
3564#ifdef WLAN_FEATURE_11W
3565 && !psessionEntry->limRmfEnabled
3566#endif
3567 )
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003568 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003569
Jeff Johnson295189b2012-06-20 16:38:30 -07003570};
3571
3572
Jeff Johnson295189b2012-06-20 16:38:30 -07003573void
3574limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3575{
3576 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3577 tpPESession psessionEntry;
3578 tANI_U8 sessionId; //PE sessionId
3579
3580 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3581 {
3582 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003583 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003584 return;
3585 }
3586
3587 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3588 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003589 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003590 return;
3591 }
3592
3593 if ( tkipCntrMeasReq.bEnable )
3594 {
3595 __limCounterMeasures( pMac, psessionEntry );
3596 }
3597
3598 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3599}
Jeff Johnson295189b2012-06-20 16:38:30 -07003600
3601
3602static void
3603__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3604{
3605 tSirSmeStopBssReq stopBssReq;
3606 tSirRetStatus status;
3607 tLimSmeStates prevState;
3608 tANI_U8 sessionId; //PE sessionId
3609 tpPESession psessionEntry;
3610 tANI_U8 smesessionId;
3611 tANI_U16 smetransactionId;
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303612 tANI_U8 i = 0;
3613 tpDphHashNode pStaDs = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003614
3615 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3616
3617
3618
3619 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3620 !limIsSmeStopBssReqValid(pMsgBuf))
3621 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003622 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003623 /// Send Stop BSS response to host
3624 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3625 return;
3626 }
3627
3628
3629 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3630 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003631 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003632 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3633 return;
3634 }
3635
3636#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3637 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3638#endif //FEATURE_WLAN_DIAG_SUPPORT
3639
3640
3641 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3642 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3643 {
3644 /**
3645 * Should not have received STOP_BSS_REQ in states
3646 * other than 'normal' state or on STA in Infrastructure
3647 * mode. Log error and return response to host.
3648 */
3649 limLog(pMac, LOGE,
Sushant Kaushik1b645382014-10-13 16:39:36 +05303650 FL("received unexpected SME_STOP_BSS_REQ in state %d, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003651 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3652 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3653 /// Send Stop BSS response to host
3654 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3655 return;
3656 }
3657
Jeff Johnson295189b2012-06-20 16:38:30 -07003658 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3659 {
3660 limWPSPBCClose(pMac, psessionEntry);
3661 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003662 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003663
3664 prevState = psessionEntry->limSmeState;
3665
3666 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003667 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003668
3669 /* Update SME session Id and Transaction Id */
3670 psessionEntry->smeSessionId = smesessionId;
3671 psessionEntry->transactionId = smetransactionId;
3672
Abhishek Singh8944b222014-09-17 16:13:17 +05303673 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame.
3674 * If PMF is enabled then don't send broadcast disassociation */
3675 if ( ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) &&
3676 (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3677#ifdef WLAN_FEATURE_11W
3678 && !psessionEntry->limRmfEnabled
3679#endif
3680 )
Jeff Johnson295189b2012-06-20 16:38:30 -07003681 {
3682 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3683 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3684 // Send disassoc all stations associated thru TKIP
3685 __limCounterMeasures(pMac,psessionEntry);
3686 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303687 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 }
3689
3690 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3691 pMac->lim.gLimIbssCoalescingHappened = false;
3692
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303693 for(i = 1 ; i < pMac->lim.gLimAssocStaLimit ; i++)
3694 {
3695 pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable);
3696 if (NULL == pStaDs)
3697 continue;
3698 status = limDelSta(pMac, pStaDs, false, psessionEntry) ;
3699 if(eSIR_SUCCESS == status)
3700 {
3701 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ;
3702 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ;
3703 }
3704 else
3705 {
3706 limLog(pMac, LOGE, FL("limDelSta failed with Status : %d"), status);
3707 VOS_ASSERT(0) ;
3708 }
3709 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003710 /* send a delBss to HAL and wait for a response */
3711 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3712
3713 if (status != eSIR_SUCCESS)
3714 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003715 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003716 psessionEntry->limSmeState= prevState;
3717
Jeff Johnsone7245742012-09-05 17:12:55 -07003718 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003719
3720 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3721 }
3722}
3723
3724
3725/**--------------------------------------------------------------
3726\fn __limProcessSmeStopBssReq
3727
3728\brief Wrapper for the function __limHandleSmeStopBssRequest
3729 This message will be defered until softmac come out of
3730 scan mode. Message should be handled even if we have
3731 detected radar in the current operating channel.
3732\param pMac
3733\param pMsg
3734
3735\return TRUE - If we consumed the buffer
3736 FALSE - If have defered the message.
3737 ---------------------------------------------------------------*/
3738static tANI_BOOLEAN
3739__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3740{
3741 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3742 {
3743 /**
3744 * If message defered, buffer is not consumed yet.
3745 * So return false
3746 */
3747 return eANI_BOOLEAN_FALSE;
3748 }
3749 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3750 return eANI_BOOLEAN_TRUE;
3751} /*** end __limProcessSmeStopBssReq() ***/
3752
3753
3754void limProcessSmeDelBssRsp(
3755 tpAniSirGlobal pMac,
3756 tANI_U32 body,tpPESession psessionEntry)
3757{
3758
3759 (void) body;
3760 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3761 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003762 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003763 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3764 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003765 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3766 return;
3767}
3768
3769
Jeff Johnson295189b2012-06-20 16:38:30 -07003770/**---------------------------------------------------------------
3771\fn __limProcessSmeAssocCnfNew
3772\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3773\ in BTAMP AP.
3774\
3775\param pMac
3776\param msgType - message type
3777\param pMsgBuf - a pointer to the SME message buffer
3778\return None
3779------------------------------------------------------------------*/
3780
3781 void
3782__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3783{
3784 tSirSmeAssocCnf assocCnf;
3785 tpDphHashNode pStaDs = NULL;
3786 tpPESession psessionEntry= NULL;
3787 tANI_U8 sessionId;
3788
3789
3790 if(pMsgBuf == NULL)
3791 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003792 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003793 goto end;
3794 }
3795
3796 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3797 !__limIsSmeAssocCnfValid(&assocCnf))
3798 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003799 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003800 goto end;
3801 }
3802
3803 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3804 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003805 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003806 goto end;
3807 }
3808
3809 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3810 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3811 {
Sushant Kaushik1b645382014-10-13 16:39:36 +05303812 limLog(pMac, LOGE, FL("Received unexpected message %X in state %d, in role %d"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303813 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003814 goto end;
3815 }
3816
3817 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3818
3819 if (pStaDs == NULL)
3820 {
3821 limLog(pMac, LOG1,
3822 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
3823 msgType, assocCnf.aid);
3824 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3825
3826 /*
3827 ** send a DISASSOC_IND message to WSM to make sure
3828 ** the state in WSM and LIM is the same
3829 **/
3830 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3831 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3832 goto end;
3833 }
3834 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303835 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003836 (tANI_U8 *) assocCnf.peerMacAddr,
3837 sizeof(tSirMacAddr)) ) ||
3838 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3839 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3840 (msgType != eWNI_SME_ASSOC_CNF)) ||
3841 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003842 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003843 {
3844 limLog(pMac, LOG1,
3845 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
3846 msgType, assocCnf.aid);
3847 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3848 goto end;
3849 }
3850
3851 /*
3852 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3853 ** has been received
3854 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003855 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003856 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3857
3858 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3859 {
3860 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3861 * when it had received Assoc Request frame. Now, PE just needs to send
3862 * Association Response frame to the requesting BTAMP-STA.
3863 */
3864 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003865 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003866 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3867 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3868 goto end;
3869 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3870 else
3871 {
3872 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3873 /*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*/
3874 if(!pStaDs->mlmStaContext.updateContext)
3875 pStaDs->mlmStaContext.updateContext = 1;
3876 limRejectAssociation(pMac, pStaDs->staAddr,
3877 pStaDs->mlmStaContext.subType,
3878 true, pStaDs->mlmStaContext.authType,
3879 pStaDs->assocId, true,
3880 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003881 }
3882
3883end:
3884 if((psessionEntry != NULL) && (pStaDs != NULL))
3885 {
3886 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3887 {
3888 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3889 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303890 vos_mem_free(((tpSirAssocReq)
3891 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07003892 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
3893 }
3894
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303895 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003896 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
3897 }
3898 }
3899
3900} /*** end __limProcessSmeAssocCnfNew() ***/
3901
3902
Jeff Johnson295189b2012-06-20 16:38:30 -07003903
3904
3905static void
3906__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3907{
3908 tpDphHashNode pStaDs;
3909 tSirMacAddr peerMac;
3910 tpSirAddtsReq pSirAddts;
3911 tANI_U32 timeout;
3912 tpPESession psessionEntry;
3913 tANI_U8 sessionId; //PE sessionId
3914 tANI_U8 smesessionId;
3915 tANI_U16 smetransactionId;
3916
3917
3918 if(pMsgBuf == NULL)
3919 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003920 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003921 return;
3922 }
3923
3924 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3925
3926 pSirAddts = (tpSirAddtsReq) pMsgBuf;
3927
3928 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
3929 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003930 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 return;
3932 }
3933#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3934 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
3935#endif //FEATURE_WLAN_DIAG_SUPPORT
3936
3937
3938
3939 /* if sta
3940 * - verify assoc state
3941 * - send addts request to ap
3942 * - wait for addts response from ap
3943 * if ap, just ignore with error log
3944 */
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303945 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003946 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003947 pSirAddts->req.tspec.tsinfo.traffic.tsid,
Abhishek Singh3cbf6052014-12-15 16:46:42 +05303948 pSirAddts->req.tspec.tsinfo.traffic.userPrio);
Jeff Johnson295189b2012-06-20 16:38:30 -07003949
3950 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
3951 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003952 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003953 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3954 smesessionId,smetransactionId);
3955 return;
3956 }
3957
3958 //Ignore the request if STA is in 11B mode.
3959 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
3960 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003961 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003962 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3963 smesessionId,smetransactionId);
3964 return;
3965 }
3966
3967
3968 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3969
3970 if(pStaDs == NULL)
3971 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003972 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003973 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3974 smesessionId,smetransactionId);
3975 return;
3976 }
3977
3978 if ((! pStaDs->valid) ||
3979 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
3980 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003981 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003982 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3983 smesessionId,smetransactionId);
3984 return;
3985 }
3986
3987 pSirAddts->req.wsmTspecPresent = 0;
3988 pSirAddts->req.wmeTspecPresent = 0;
3989 pSirAddts->req.lleTspecPresent = 0;
3990
3991 if ((pStaDs->wsmEnabled) &&
3992 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
3993 pSirAddts->req.wsmTspecPresent = 1;
3994 else if (pStaDs->wmeEnabled)
3995 pSirAddts->req.wmeTspecPresent = 1;
3996 else if (pStaDs->lleEnabled)
3997 pSirAddts->req.lleTspecPresent = 1;
3998 else
3999 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004000 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004001 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4002 smesessionId,smetransactionId);
4003 return;
4004 }
4005
4006 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4007 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4008 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004009 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07004010 psessionEntry->limSmeState);
4011 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4012 smesessionId,smetransactionId);
4013 return;
4014 }
4015
4016 if (pMac->lim.gLimAddtsSent)
4017 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004018 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07004019 pMac->lim.gLimAddtsReq.req.dialogToken,
4020 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
4021 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
4022 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4023 smesessionId,smetransactionId);
4024 return;
4025 }
4026
4027 #if 0
4028 val = sizeof(tSirMacAddr);
4029 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
4030 {
4031 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004032 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004033 return;
4034 }
4035 #endif
4036 sirCopyMacAddr(peerMac,psessionEntry->bssId);
4037
4038 // save the addts request
4039 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304040 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07004041
4042 // ship out the message now
4043 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
4044 psessionEntry);
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304045 limLog(pMac, LOG1, FL("Sent ADDTS request"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004046
4047 // start a timer to wait for the response
4048 if (pSirAddts->timeout)
4049 timeout = pSirAddts->timeout;
4050 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
4051 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004052 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004053 WNI_CFG_ADDTS_RSP_TIMEOUT);
4054 return;
4055 }
4056
4057 timeout = SYS_MS_TO_TICKS(timeout);
4058 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
4059 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004060 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004061 return;
4062 }
4063 pMac->lim.gLimAddtsRspTimerCount++;
4064 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
4065 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
4066 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004067 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004068 return;
4069 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004070 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07004071
4072 //add the sessionId to the timer object
4073 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
4074 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
4075 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004076 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004077 return;
4078 }
4079 return;
4080}
4081
4082
4083static void
4084__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4085{
4086 tSirMacAddr peerMacAddr;
4087 tANI_U8 ac;
4088 tSirMacTSInfo *pTsinfo;
4089 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
4090 tpDphHashNode pStaDs = NULL;
4091 tpPESession psessionEntry;
4092 tANI_U8 sessionId;
4093 tANI_U32 status = eSIR_SUCCESS;
4094 tANI_U8 smesessionId;
4095 tANI_U16 smetransactionId;
4096
4097 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4098
4099 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
4100 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004101 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004102 status = eSIR_FAILURE;
4103 goto end;
4104 }
4105#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4106 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
4107#endif //FEATURE_WLAN_DIAG_SUPPORT
4108
4109
4110 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
4111 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004112 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004113 status = eSIR_FAILURE;
4114 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
4115 return;
4116 }
4117
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304118 limLog(pMac, LOG1, FL("Sent DELTS request to station with "
4119 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
4120 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07004121
4122 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
4123 psessionEntry);
4124
4125 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
4126
4127 /* We've successfully send DELTS frame to AP. Update the
4128 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
4129 * is no longer trigger enabled or delivery enabled
4130 */
4131 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
4132
4133 /* We're deleting the TSPEC, so this particular AC is no longer
4134 * admitted. PE needs to downgrade the EDCA
4135 * parameters(for the AC for which TS is being deleted) to the
4136 * next best AC for which ACM is not enabled, and send the
4137 * updated values to HAL.
4138 */
4139 ac = upToAc(pTsinfo->traffic.userPrio);
4140
4141 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4142 {
4143 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4144 }
4145 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4146 {
4147 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4148 }
4149 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4150 {
4151 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4152 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4153 }
4154
4155 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4156
4157 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4158 if (pStaDs != NULL)
4159 {
4160 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4161 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4162 else
4163 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4164 status = eSIR_SUCCESS;
4165 }
4166 else
4167 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004168 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004169 status = eSIR_FAILURE;
4170 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004171#ifdef FEATURE_WLAN_ESE
4172#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004173 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4174#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004175 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004176#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004177#endif
4178
4179 // send an sme response back
4180 end:
4181 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4182}
4183
4184
4185void
4186limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4187{
4188 //fetch the sessionEntry based on the sessionId
4189 tpPESession psessionEntry;
4190 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4191 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004192 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004193 return;
4194 }
4195
4196 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4197 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004198 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004199 pMac->lim.gLimAddtsSent = false;
4200 return;
4201 }
4202
4203 if (! pMac->lim.gLimAddtsSent)
4204 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004205 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004206 return;
4207 }
4208
4209 if (param != pMac->lim.gLimAddtsRspTimerCount)
4210 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004211 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004212 param, pMac->lim.gLimAddtsRspTimerCount);
4213 return;
4214 }
4215
4216 // this a real response timeout
4217 pMac->lim.gLimAddtsSent = false;
4218 pMac->lim.gLimAddtsRspTimerCount++;
4219
4220 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4221 psessionEntry->smeSessionId, psessionEntry->transactionId);
4222}
4223
4224
4225/**
4226 * __limProcessSmeStatsRequest()
4227 *
4228 *FUNCTION:
4229 *
4230 *
4231 *NOTE:
4232 *
4233 * @param pMac Pointer to Global MAC structure
4234 * @param *pMsgBuf A pointer to the SME message buffer
4235 * @return None
4236 */
4237static void
4238__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4239{
4240 tpAniGetStatsReq pStatsReq;
4241 tSirMsgQ msgQ;
4242 tpPESession psessionEntry;
4243 tANI_U8 sessionId;
4244
4245
4246 if(pMsgBuf == NULL)
4247 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004248 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004249 return;
4250 }
4251
4252 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4253
4254 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4255 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004256 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304257 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004258 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004259 return;
4260 }
4261
4262
4263
4264 switch(pStatsReq->msgType)
4265 {
4266 //Add Lim stats here. and send reqsponse.
4267
4268 //HAL maintained Stats.
4269 case eWNI_SME_STA_STAT_REQ:
4270 msgQ.type = WDA_STA_STAT_REQ;
4271 break;
4272 case eWNI_SME_AGGR_STAT_REQ:
4273 msgQ.type = WDA_AGGR_STAT_REQ;
4274 break;
4275 case eWNI_SME_GLOBAL_STAT_REQ:
4276 msgQ.type = WDA_GLOBAL_STAT_REQ;
4277 break;
4278 case eWNI_SME_STAT_SUMM_REQ:
4279 msgQ.type = WDA_STAT_SUMM_REQ;
4280 break;
4281 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004282 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304283 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004284 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004285 return;
4286 }
4287
Jeff Johnson295189b2012-06-20 16:38:30 -07004288 msgQ.reserved = 0;
4289 msgQ.bodyptr = pMsgBuf;
4290 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004291 if(NULL == psessionEntry)
4292 {
4293 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4294 }
4295 else
4296 {
4297 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4298 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004299 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004300 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304301 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004302 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004303 return;
4304 }
4305
4306 return;
4307}
4308
4309
4310/**
4311 * __limProcessSmeGetStatisticsRequest()
4312 *
4313 *FUNCTION:
4314 *
4315 *
4316 *NOTE:
4317 *
4318 * @param pMac Pointer to Global MAC structure
4319 * @param *pMsgBuf A pointer to the SME message buffer
4320 * @return None
4321 */
4322static void
4323__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4324{
4325 tpAniGetPEStatsReq pPEStatsReq;
4326 tSirMsgQ msgQ;
4327
4328 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4329
4330 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4331
4332 msgQ.type = WDA_GET_STATISTICS_REQ;
4333
Jeff Johnson295189b2012-06-20 16:38:30 -07004334 msgQ.reserved = 0;
4335 msgQ.bodyptr = pMsgBuf;
4336 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004337 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004338
4339 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304340 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004341 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004342 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004343 return;
4344 }
4345
4346 return;
4347}
4348
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004349#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004350/**
4351 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4352 *
4353 *NOTE:
4354 *
4355 * @param pMac Pointer to Global MAC structure
4356 * @param *pMsgBuf A pointer to the SME message buffer
4357 * @return None
4358 */
4359static void
4360__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4361{
4362 tSirMsgQ msgQ;
4363
4364 msgQ.type = WDA_TSM_STATS_REQ;
4365 msgQ.reserved = 0;
4366 msgQ.bodyptr = pMsgBuf;
4367 msgQ.bodyval = 0;
4368 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4369
4370 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4371 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004372 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004373 limLog(pMac, LOGP, "Unable to forward request");
4374 return;
4375 }
4376}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004377#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004378
4379
Jeff Johnson295189b2012-06-20 16:38:30 -07004380
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004381#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004382/**
4383 * __limProcessSmeGetRoamRssiRequest()
4384 *
4385 *FUNCTION:
4386 *
4387 *
4388 *NOTE:
4389 *
4390 * @param pMac Pointer to Global MAC structure
4391 * @param *pMsgBuf A pointer to the SME message buffer
4392 * @return None
4393 */
4394static void
4395__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4396{
4397 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4398 tSirMsgQ msgQ;
4399
4400 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4401 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4402
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004403 msgQ.reserved = 0;
4404 msgQ.bodyptr = pMsgBuf;
4405 msgQ.bodyval = 0;
4406 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4407
4408 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304409 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004410 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004411 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004412 return;
4413 }
4414
4415 return;
4416}
4417#endif
4418
4419
Jeff Johnson295189b2012-06-20 16:38:30 -07004420static void
4421__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4422{
4423 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4424 tpPESession psessionEntry;
4425 tANI_U8 sessionId; //PE sessionID
4426
4427 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004428 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004429
4430 if(pMsgBuf == NULL)
4431 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004432 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004433 return;
4434 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004435
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304436 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4437 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004438 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304439 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004440 return;
4441 }
4442
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004443 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004444 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004445 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004446 goto end;
4447 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004448
Jeff Johnson295189b2012-06-20 16:38:30 -07004449 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4450 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004451 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004452 goto end;
4453 }
4454
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304455 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004456
Jeff Johnson295189b2012-06-20 16:38:30 -07004457 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004458 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004459
4460end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304461 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004462 return;
4463} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4464
4465static void
4466__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4467{
4468 tpSirUpdateParams pUpdateParams;
4469 tpPESession psessionEntry;
4470
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304471 limLog(pMac, LOG1,
4472 FL("received SME_HIDE_SSID message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004473
4474 if(pMsgBuf == NULL)
4475 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004476 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004477 return;
4478 }
4479
4480 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4481
4482 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4483 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004484 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004485 pUpdateParams->sessionId);
4486 return;
4487 }
4488
4489 /* Update the session entry */
4490 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4491
4492 /* Update beacon */
4493 schSetFixedBeaconFields(pMac, psessionEntry);
4494 limSendBeaconInd(pMac, psessionEntry);
4495
4496 return;
4497} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4498
4499static void
4500__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4501{
4502 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4503 tpPESession psessionEntry;
4504 tANI_U8 sessionId; //PE sessionID
4505
4506 if(pMsgBuf == NULL)
4507 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004508 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004509 return;
4510 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304511
4512 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4513 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004514 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304515 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004516 return;
4517 }
4518
4519 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4520 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004521 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004522 goto end;
4523 }
4524
4525 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4526 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004527 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004528 goto end;
4529 }
4530
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304531 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4532 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004533
4534 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4535
4536 psessionEntry->pLimStartBssReq->privacy = 1;
4537 psessionEntry->privacy = 1;
4538
4539 schSetFixedBeaconFields(pMac, psessionEntry);
4540 limSendBeaconInd(pMac, psessionEntry);
4541
4542end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304543 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004544 return;
4545} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4546
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004547/*
4548Update the beacon Interval dynamically if beaconInterval is different in MCC
4549*/
4550static void
4551__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4552{
4553 tpSirChangeBIParams pChangeBIParams;
4554 tpPESession psessionEntry;
4555 tANI_U8 sessionId = 0;
4556 tUpdateBeaconParams beaconParams;
4557
4558 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004559 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004560
4561 if(pMsgBuf == NULL)
4562 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004563 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004564 return;
4565 }
4566
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304567 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004568 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4569
4570 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4571 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004572 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004573 return;
4574 }
4575
4576 /*Update sessionEntry Beacon Interval*/
4577 if(psessionEntry->beaconParams.beaconInterval !=
4578 pChangeBIParams->beaconInterval )
4579 {
4580 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4581 }
4582
4583 /*Update sch beaconInterval*/
4584 if(pMac->sch.schObject.gSchBeaconInterval !=
4585 pChangeBIParams->beaconInterval )
4586 {
4587 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4588
4589 PELOG1(limLog(pMac, LOG1,
4590 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4591
4592 /* Update beacon */
4593 schSetFixedBeaconFields(pMac, psessionEntry);
4594
Sunil Ravib96f7b52013-05-22 21:40:05 -07004595 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004596 //Set change in beacon Interval
4597 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004598 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004599 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4600 }
4601
4602 return;
4603} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4604
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304605/** -------------------------------------------------------------
4606\fn
4607\brief handles indication message from HDD to update HT mode
4608\param tpAniSirGlobal pMac
4609\param tANI_U32 pMsgBuf
4610\return None
4611-------------------------------------------------------------*/
4612#ifdef WLAN_FEATURE_AP_HT40_24G
4613static void __limProcessSmeSetHT2040Mode(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4614{
4615 tpSirSetHT2040Mode pSetHT2040Mode;
4616 tpPESession psessionEntry;
4617 tANI_U8 sessionId = 0;
4618 tUpdateVHTOpMode *pHtOpMode = NULL;
4619 vos_msg_t msg;
Jeff Johnson295189b2012-06-20 16:38:30 -07004620
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05304621 PELOG1(limLog(pMac, LOGRW,
4622 FL("received Set HT 20/40 mode message")););
4623
4624 if(pMsgBuf == NULL)
4625 {
4626 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
4627 return;
4628 }
4629
4630 pSetHT2040Mode = (tpSirSetHT2040Mode)pMsgBuf;
4631
4632 if((psessionEntry = peFindSessionByBssid(pMac, pSetHT2040Mode->bssId,
4633 &sessionId)) == NULL)
4634 {
4635 limLog(pMac, LOGE, FL("Session does not exist for given BSSID "));
4636 limPrintMacAddr(pMac, pSetHT2040Mode->bssId, LOGE);
4637 return;
4638 }
4639
4640 limLog(pMac, LOGW, FL("Update session entry for cbMod=%d"),
4641 pSetHT2040Mode->cbMode);
4642
4643 /*Update sessionEntry HT related fields*/
4644 switch(pSetHT2040Mode->cbMode)
4645 {
4646 case PHY_SINGLE_CHANNEL_CENTERED:
4647 psessionEntry->htSecondaryChannelOffset = PHY_SINGLE_CHANNEL_CENTERED;
4648 psessionEntry->htRecommendedTxWidthSet = 0;
4649 break;
4650 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
4651 psessionEntry->htSecondaryChannelOffset =
4652 PHY_DOUBLE_CHANNEL_LOW_PRIMARY;
4653 psessionEntry->htRecommendedTxWidthSet = 1;
4654 break;
4655 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
4656 psessionEntry->htSecondaryChannelOffset =
4657 PHY_DOUBLE_CHANNEL_HIGH_PRIMARY;
4658 psessionEntry->htRecommendedTxWidthSet = 1;
4659 break;
4660 default:
4661 limLog(pMac, LOGE,FL("Invalid cbMode"));
4662 return;
4663 }
4664
4665 limLog(pMac, LOGW, FL("Channel Bonding mode : %d"
4666 " htSecondaryChannelOffset: %d"
4667 " htRecommendedTxWidthSet :%d"),
4668 pSetHT2040Mode->cbMode,
4669 psessionEntry->htSecondaryChannelOffset,
4670 psessionEntry->htRecommendedTxWidthSet);
4671
4672 limLog(pMac, LOGW, FL("Update Beacon IEs"));
4673
4674 /* Update beacon */
4675 schSetFixedBeaconFields(pMac, psessionEntry);
4676 limSendBeaconInd(pMac, psessionEntry);
4677
4678 /* Update OP Mode */
4679 pHtOpMode = vos_mem_malloc(sizeof(tUpdateVHTOpMode));
4680 if ( NULL == pHtOpMode )
4681 {
4682 limLog(pMac, LOGE,
4683 FL("Not able to allocate memory for setting OP mode"));
4684 return;
4685 }
4686
4687 pHtOpMode->opMode = (psessionEntry->htSecondaryChannelOffset ==
4688 PHY_SINGLE_CHANNEL_CENTERED)?
4689 eHT_CHANNEL_WIDTH_20MHZ:eHT_CHANNEL_WIDTH_40MHZ;
4690
4691 /* Pass Self STA ID to FW. Based on Self STA ID FW will update the
4692 * operating mode for all connected STA.
4693 */
4694
4695 pHtOpMode->staId = psessionEntry->staId;
4696
4697 msg.type = WDA_UPDATE_OP_MODE;
4698 msg.reserved = 0;
4699 msg.bodyptr = pHtOpMode;
4700
4701 if (!VOS_IS_STATUS_SUCCESS(
4702 vos_mq_post_message(VOS_MODULE_ID_WDA, &msg)))
4703 {
4704 limLog(pMac, LOGE,
4705 FL("Not able to post WDA_UPDATE_OP_MODE message to WDA"));
4706 vos_mem_free(pHtOpMode);
4707 return;
4708 }
4709
4710 limLog(pMac, LOGW,
4711 FL("Notifed FW about OP mode: %d for staId=%d"),
4712 pHtOpMode->opMode, pHtOpMode->staId);
4713
4714 return;
4715}
4716#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07004717
4718/** -------------------------------------------------------------
4719\fn limProcessSmeDelBaPeerInd
4720\brief handles indication message from HDD to send delete BA request
4721\param tpAniSirGlobal pMac
4722\param tANI_U32 pMsgBuf
4723\return None
4724-------------------------------------------------------------*/
4725void
4726limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4727{
4728 tANI_U16 assocId =0;
4729 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4730 tpDphHashNode pSta;
4731 tpPESession psessionEntry;
4732 tANI_U8 sessionId;
4733
4734
4735
4736 if(NULL == pSmeDelBAPeerInd)
4737 return;
4738
4739 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4740 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004741 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004742 return;
4743 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004744 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004745 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4746
4747 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4748 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4749 pSta,
4750 pSmeDelBAPeerInd->baDirection,
4751 pSmeDelBAPeerInd->baTID,
4752 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4753 {
4754 limLog( pMac, LOGW,
4755 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4756 if (pSta)
4757 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4758 }
4759}
4760
4761// --------------------------------------------------------------------
4762/**
4763 * __limProcessReportMessage
4764 *
4765 * FUNCTION: Processes the next received Radio Resource Management message
4766 *
4767 * LOGIC:
4768 *
4769 * ASSUMPTIONS:
4770 *
4771 * NOTE:
4772 *
4773 * @param None
4774 * @return None
4775 */
4776
4777void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4778{
4779#ifdef WLAN_FEATURE_VOWIFI
4780 switch (pMsg->type)
4781 {
4782 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4783 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4784 break;
4785 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4786 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004787#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004788 tpSirBeaconReportXmitInd pBcnReport=NULL;
4789 tpPESession psessionEntry=NULL;
4790 tANI_U8 sessionId;
4791
4792 if(pMsg->bodyptr == NULL)
4793 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004794 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004795 return;
4796 }
4797 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4798 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4799 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004800 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004801 return;
4802 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004803 if (psessionEntry->isESEconnection)
4804 eseProcessBeaconReportXmit( pMac, pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004805 else
4806#endif
4807 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4808 }
4809 break;
4810 }
4811#endif
4812}
4813
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004814#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI)
Jeff Johnson295189b2012-06-20 16:38:30 -07004815// --------------------------------------------------------------------
4816/**
4817 * limSendSetMaxTxPowerReq
4818 *
4819 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4820 *
4821 * LOGIC:
4822 *
4823 * ASSUMPTIONS:
4824 *
4825 * NOTE:
4826 *
4827 * @param txPower txPower to be set.
4828 * @param pSessionEntry session entry.
4829 * @return None
4830 */
4831tSirRetStatus
4832limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4833{
4834 tpMaxTxPowerParams pMaxTxParams = NULL;
4835 tSirRetStatus retCode = eSIR_SUCCESS;
4836 tSirMsgQ msgQ;
4837
4838 if( pSessionEntry == NULL )
4839 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004840 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004841 return eSIR_FAILURE;
4842 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304843
4844 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4845 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004846 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004847 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004848 return eSIR_MEM_ALLOC_FAILED;
4849
4850 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004851#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304852 limLog( pMac, LOG1,
4853 FL(" Allocated memory for pMaxTxParams, which will be freed in other module"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004854#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004855 if( pMaxTxParams == NULL )
4856 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304857 limLog( pMac, LOGE, FL("pMaxTxParams is NULL"));
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004858 return eSIR_FAILURE;
4859 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004860 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304861 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4862 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004863
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004864 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4865 msgQ.bodyptr = pMaxTxParams;
4866 msgQ.bodyval = 0;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05304867 limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004868 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
4869 retCode = wdaPostCtrlMsg(pMac, &msgQ);
4870 if (eSIR_SUCCESS != retCode)
4871 {
4872 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304873 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004874 }
4875 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004876}
4877#endif
4878
4879/**
4880 * __limProcessSmeAddStaSelfReq()
4881 *
4882 *FUNCTION:
4883 * This function is called to process SME_ADD_STA_SELF_REQ message
4884 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4885 *
4886 *LOGIC:
4887 *
4888 *ASSUMPTIONS:
4889 *
4890 *NOTE:
4891 *
4892 * @param pMac Pointer to Global MAC structure
4893 * @param *pMsgBuf A pointer to the SME message buffer
4894 * @return None
4895 */
4896
4897static void
4898__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4899{
4900 tSirMsgQ msg;
4901 tpAddStaSelfParams pAddStaSelfParams;
4902 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
4903
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304904 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
4905 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004906 {
4907 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
4908 return;
4909 }
4910
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304911 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07004912 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004913 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
4914 msg.reserved = 0;
4915 msg.bodyptr = pAddStaSelfParams;
4916 msg.bodyval = 0;
4917
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004918 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004919 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004920
4921 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4922 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004923 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004924 }
4925 return;
4926} /*** end __limProcessAddStaSelfReq() ***/
4927
4928
4929/**
4930 * __limProcessSmeDelStaSelfReq()
4931 *
4932 *FUNCTION:
4933 * This function is called to process SME_DEL_STA_SELF_REQ message
4934 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
4935 *
4936 *LOGIC:
4937 *
4938 *ASSUMPTIONS:
4939 *
4940 *NOTE:
4941 *
4942 * @param pMac Pointer to Global MAC structure
4943 * @param *pMsgBuf A pointer to the SME message buffer
4944 * @return None
4945 */
4946
4947static void
4948__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4949{
4950 tSirMsgQ msg;
4951 tpDelStaSelfParams pDelStaSelfParams;
4952 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
4953
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304954 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
4955 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004956 {
4957 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
4958 return;
4959 }
4960
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304961 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004962
4963 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
4964 msg.reserved = 0;
4965 msg.bodyptr = pDelStaSelfParams;
4966 msg.bodyval = 0;
4967
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004968 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004969 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004970
4971 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4972 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004973 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004974 }
4975 return;
4976} /*** end __limProcessSmeDelStaSelfReq() ***/
4977
4978
Jeff Johnson295189b2012-06-20 16:38:30 -07004979/**
4980 * __limProcessSmeRegisterMgmtFrameReq()
4981 *
4982 *FUNCTION:
4983 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
4984 * from SME. It Register this information within PE.
4985 *
4986 *LOGIC:
4987 *
4988 *ASSUMPTIONS:
4989 *
4990 *NOTE:
4991 *
4992 * @param pMac Pointer to Global MAC structure
4993 * @param *pMsgBuf A pointer to the SME message buffer
4994 * @return None
4995 */
4996static void
4997__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4998{
4999 VOS_STATUS vosStatus;
5000 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
5001 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005002 tANI_BOOLEAN match = VOS_FALSE;
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305003 limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005004 FL("registerFrame %d, frameType %d, matchLen %d"),
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305005 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005006
Jeff Johnsond13512a2012-07-17 11:42:19 -07005007 /* First check whether entry exists already*/
5008
5009 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5010 (vos_list_node_t**)&pLimMgmtRegistration);
5011
5012 while(pLimMgmtRegistration != NULL)
5013 {
5014 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
5015 {
5016 if(pSmeReq->matchLen)
5017 {
5018 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
5019 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305020 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07005021 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
5022 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005023 /* found match! */
5024 match = VOS_TRUE;
5025 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07005026 }
5027 }
5028 }
5029 else
5030 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07005031 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07005032 match = VOS_TRUE;
5033 break;
5034 }
5035 }
5036 vosStatus = vos_list_peek_next (
5037 &pMac->lim.gLimMgmtFrameRegistratinQueue,
5038 (vos_list_node_t*) pLimMgmtRegistration,
5039 (vos_list_node_t**) &pNext );
5040
5041 pLimMgmtRegistration = pNext;
5042 pNext = NULL;
5043
5044 }
5045
5046 if (match)
5047 {
5048 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5049 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305050 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07005051 }
5052
Jeff Johnson295189b2012-06-20 16:38:30 -07005053 if(pSmeReq->registerFrame)
5054 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305055 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
5056 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07005057 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305058 vos_mem_set((void*)pLimMgmtRegistration,
5059 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07005060 pLimMgmtRegistration->frameType = pSmeReq->frameType;
5061 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
5062 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
5063 if(pSmeReq->matchLen)
5064 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305065 vos_mem_copy(pLimMgmtRegistration->matchData,
5066 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07005067 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005068 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
5069 &pLimMgmtRegistration->node);
5070 }
5071 }
Jeff Johnson295189b2012-06-20 16:38:30 -07005072
5073 return;
5074} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08005075
5076static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08005077__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08005078{
5079 tpP2pPsParams pMsgNoA;
5080 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08005081
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305082 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
5083 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08005084 {
5085 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005086 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08005087 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005088 }
5089
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305090 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08005091 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
5092 pMsgNoA->opp_ps = 0;
5093 pMsgNoA->ctWindow = 0;
5094 pMsgNoA->duration = 0;
5095 pMsgNoA->interval = 0;
5096 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08005097
Vinay Malekal62757362012-12-17 12:15:51 -08005098 /* Below params used for Single Shot NOA - so assign proper values */
5099 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08005100 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08005101
Viral Modid86bde22012-12-10 13:09:21 -08005102 /* Start Insert NOA timer
5103 * 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 -08005104 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
5105 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08005106 */
5107 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
5108 == TX_TIMER_ERROR)
5109 {
5110 /// Could not activate Insert NOA timer.
5111 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005112 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08005113
5114 // send the scan response back with status failure and do not even call insert NOA
5115 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305116 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08005117 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005118 }
5119
Viral Modid440e682013-03-06 02:25:31 -08005120 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
5121
Viral Modid86bde22012-12-10 13:09:21 -08005122 msg.type = WDA_SET_P2P_GO_NOA_REQ;
5123 msg.reserved = 0;
5124 msg.bodyptr = pMsgNoA;
5125 msg.bodyval = 0;
5126
5127 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5128 {
5129 /* 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 -07005130 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08005131 /* Deactivate the NOA timer in failure case */
5132 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
5133 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08005134 }
Viral Modid440e682013-03-06 02:25:31 -08005135 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08005136
Viral Modid440e682013-03-06 02:25:31 -08005137error:
5138 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
5139 * worrying about the NOA
5140 */
5141 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
5142 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08005143 return FALSE;
5144
5145}
5146
Viral Modid440e682013-03-06 02:25:31 -08005147static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
5148{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005149 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08005150 pMac->lim.gDeferMsgTypeForNOA = msgType;
5151 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
5152}
5153
5154static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5155{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005156 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08005157 pMac->lim.gDeferMsgTypeForNOA = 0;
5158 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
5159 {
5160 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305161 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005162 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5163 }
5164}
5165
5166static
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305167tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType,
5168 tANI_U32 *pMsgBuf, tANI_BOOLEAN isPassiveScan)
Viral Modid440e682013-03-06 02:25:31 -08005169{
5170 tANI_U32 noaDuration = 0;
5171
5172 switch (msgType)
5173 {
5174 case eWNI_SME_SCAN_REQ:
5175 {
5176 tANI_U32 val;
5177 tANI_U8 i;
5178 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
5179 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
5180 {
5181 /*
5182 * Could not get max channel value
5183 * from CFG. Log error.
5184 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005185 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08005186
5187 /* use a default value of 110ms */
5188 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
5189 }
5190
5191 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
5192 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
5193
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +05305194 if (pMac->miracast_mode) {
5195 noaDuration += DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST +
5196 DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST;
5197 } else if (isPassiveScan || !limActiveScanAllowed(pMac, channelNum)) {
Viral Modid440e682013-03-06 02:25:31 -08005198 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
5199 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
5200 */
5201 noaDuration += val;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305202 } else {
5203 /* Use min + max channel time to calculate the total duration of scan */
5204 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
Viral Modid440e682013-03-06 02:25:31 -08005205 }
5206 }
5207
5208 /* Adding an overhead of 20ms to account for the scan messaging delays */
5209 noaDuration += SCAN_MESSAGING_OVERHEAD;
5210 noaDuration *= CONV_MS_TO_US;
5211
5212 break;
5213 }
5214
5215 case eWNI_SME_OEM_DATA_REQ:
5216 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
5217 break;
5218
5219 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5220 {
5221 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
5222 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
5223 break;
5224 }
5225
5226 case eWNI_SME_JOIN_REQ:
5227 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
5228 break;
5229
5230 default:
5231 noaDuration = 0;
5232 break;
5233
5234 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005235 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08005236 return noaDuration;
5237}
5238
5239void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5240{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305241 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08005242
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005243 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005244 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
5245 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
5246 {
5247 switch (pMac->lim.gDeferMsgTypeForNOA)
5248 {
5249 case eWNI_SME_SCAN_REQ:
5250 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5251 break;
5252 case eWNI_SME_OEM_DATA_REQ:
5253 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5254 break;
5255 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305256 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5257 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
5258 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
5259 */
5260 if (FALSE == bufConsumed)
5261 {
5262 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5263 }
Viral Modid440e682013-03-06 02:25:31 -08005264 break;
5265 case eWNI_SME_JOIN_REQ:
5266 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5267 break;
5268 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005269 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005270 break;
5271 }
5272 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5273 }
5274 else
5275 {
5276 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005277 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005278 }
5279}
Jeff Johnson295189b2012-06-20 16:38:30 -07005280
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005281#ifdef FEATURE_WLAN_TDLS_INTERNAL
5282/*
5283 * Process Discovery request recieved from SME and transmit to AP.
5284 */
5285static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
5286 tANI_U32 *pMsgBuf)
5287{
5288 /* get all discovery request parameters */
5289 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
5290 tpPESession psessionEntry;
5291 tANI_U8 sessionId;
5292
5293 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005294 ("Discovery Req Recieved")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005295
5296 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
5297 == NULL)
5298 {
5299 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005300 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005301 disReq->sessionId);
5302 goto lim_tdls_dis_start_error;
5303 }
5304
5305 /* check if we are in proper state to work as TDLS client */
5306 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5307 {
5308 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005309 "dis req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005310 psessionEntry->limSystemRole);
5311 goto lim_tdls_dis_start_error;
5312 }
5313
5314 /*
5315 * if we are still good, go ahead and check if we are in proper state to
5316 * do TDLS discovery procedure.
5317 */
5318 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5319 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5320 {
5321
5322 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005323 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005324 goto lim_tdls_dis_start_error;
5325 }
5326
5327 /*
5328 * if we are still good, go ahead and transmit TDLS discovery request,
5329 * and save Dis Req info for future reference.
5330 */
5331
5332#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
5333 /*
5334 * send message to HAL to set RXP filters to receieve frame on
5335 * direct link..
5336 */
5337 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
5338 // psessionEntry->bssId) ;
5339#endif
5340
5341 /* save dis request message for matching dialog token */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305342 vos_mem_copy((tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
5343 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005344
5345 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005346 "Transmit Discovery Request Frame") ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005347 /* format TDLS discovery request frame and transmit it */
5348 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
5349 psessionEntry) ;
5350
5351 /* prepare for response */
5352 pMac->lim.gLimTdlsDisStaCount = 0 ;
5353 pMac->lim.gLimTdlsDisResultList = NULL ;
5354
5355 /*
5356 * start TDLS discovery request timer to wait for discovery responses
5357 * from all TDLS enabled clients in BSS.
5358 */
5359
5360 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005361 ("Start Discovery request Timeout Timer")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005362 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
5363 eLIM_TDLS_DISCOVERY_RSP_WAIT));
5364
5365 /* assign appropriate sessionId to the timer object */
5366 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
5367 psessionEntry->peSessionId;
5368
5369 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
5370 != TX_SUCCESS)
5371 {
5372 limLog(pMac, LOGP, FL("TDLS discovery response timer \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005373 activation failed!"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005374 goto lim_tdls_dis_start_error;
5375 }
5376 /*
5377 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
5378 * back to SME
5379 */
5380 return (eSIR_SUCCESS) ;
5381lim_tdls_dis_start_error:
5382 /* in error case, PE has to sent the response SME immediately with error code */
5383 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
5384 eWNI_SME_TDLS_DISCOVERY_START_RSP);
5385 return eSIR_FAILURE;
5386}
5387/*
5388 * Process link start request recieved from SME and transmit to AP.
5389 */
5390eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5391{
5392 /* get all discovery request parameters */
5393 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
5394 tLimTdlsLinkSetupInfo *linkSetupInfo;
5395 //tLimTdlsLinkSetupPeer *setupPeer;
5396 tpPESession psessionEntry;
5397 tANI_U8 sessionId;
5398 eHalStatus status;
5399
5400 if((psessionEntry = peFindSessionByBssid(pMac,
5401 setupReq->bssid, &sessionId)) == NULL)
5402 {
5403 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005404 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005405 setupReq->sessionId);
5406 goto lim_tdls_link_start_error;
5407 }
5408
5409 /* check if we are in proper state to work as TDLS client */
5410 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5411 {
5412 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005413 "TDLS link setup req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005414 psessionEntry->limSystemRole);
5415 goto lim_tdls_link_start_error;
5416 }
5417
5418 /*
5419 * if we are still good, go ahead and check if we are in proper state to
5420 * do TDLS setup procedure.
5421 */
5422 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5423 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5424 {
5425 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005426 state (%d)", pMac->lim.gLimSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005427 goto lim_tdls_link_start_error;
5428 }
5429
5430 /*
5431 * Now, go ahead and transmit TDLS discovery request, and save setup Req
5432 * info for future reference.
5433 */
5434 /* create node for Link setup */
5435 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
5436 //setupPeer = NULL ;
5437
5438 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
5439 setupReq->peerMac, psessionEntry) ;
5440 if(eHAL_STATUS_SUCCESS == status)
5441 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5442 TDLS setup cnf TX complete is successful. */
5443 return eSIR_SUCCESS;
5444#if 0
5445
5446 /*
5447 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005448 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005449 * free this memory if any timeout is happen in link setup procedure
5450 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305451 setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
5452 if ( NULL == setupPeer )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005453 {
5454 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005455 FL( "Unable to allocate memory during ADD_STA" ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005456 VOS_ASSERT(0) ;
5457 return eSIR_MEM_ALLOC_FAILED;
5458 }
5459 setupPeer->dialog = setupReq->dialog ;
5460 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
5461 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
5462 /* TDLS_sessionize: remember sessionId for future */
5463 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
5464 setupPeer->tdls_bIsResponder = 1;
5465
5466 /*
5467 * we only populate peer MAC, so it can assit us to find the
5468 * TDLS peer after response/or after response timeout
5469 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305470 vos_mem_copy(setupPeer->peerMac, setupReq->peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005471 sizeof(tSirMacAddr)) ;
5472 /* format TDLS discovery request frame and transmit it */
5473 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
5474 setupReq->dialog, psessionEntry, NULL, 0) ;
5475
5476 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
5477 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
5478 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
5479 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
5480 /* update setup peer list */
5481 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
5482 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
5483 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5484 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
5485 return eSIR_SUCCESS ;
5486#endif
5487lim_tdls_link_start_error:
5488 /* in case of error, return immediately to SME */
5489 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
5490 eWNI_SME_TDLS_LINK_START_RSP);
5491 return eSIR_FAILURE ;
5492}
5493
5494/*
5495 * Process link teardown request recieved from SME and transmit to AP.
5496 */
5497eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5498{
5499 /* get all discovery request parameters */
5500 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
5501 tLimTdlsLinkSetupPeer *setupPeer;
5502 tpPESession psessionEntry;
5503 tANI_U8 sessionId;
5504
5505 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
5506 {
5507 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005508 "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005509 goto lim_tdls_teardown_req_error;
5510 }
5511
5512 /* check if we are in proper state to work as TDLS client */
5513 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5514 {
5515 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005516 "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005517 goto lim_tdls_teardown_req_error;
5518 }
5519
5520 /*
5521 * if we are still good, go ahead and check if we are in proper state to
5522 * do TDLS setup procedure.
5523 */
5524 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5525 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5526 {
5527 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005528 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005529 goto lim_tdls_teardown_req_error;
5530 }
5531
5532 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Arif Hussain24bafea2013-11-15 15:10:03 -08005533 "Teardown for peer = " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(teardownReq->peerMac));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005534 /*
5535 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5536 * info for future reference.
5537 */
5538 /* Verify if this link is setup */
5539 setupPeer = NULL ;
5540 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5541 if(NULL == setupPeer)
5542 {
5543 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005544 ("invalid Peer on teardown ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005545 goto lim_tdls_teardown_req_error;
5546 }
5547
5548
5549 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5550 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5551 /* TDLS_sessionize: check sessionId in case */
5552 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5553 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005554 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005555 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5556 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5557 }
5558
5559 /* format TDLS teardown request frame and transmit it */
5560 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5561 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5562 {
5563 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005564 ("couldn't send teardown frame ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005565 goto lim_tdls_teardown_req_error;
5566 }
5567 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5568 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5569 return eSIR_SUCCESS;
5570lim_tdls_teardown_req_error:
5571 /* in case of error, return immediately to SME */
5572 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5573 eWNI_SME_TDLS_TEARDOWN_RSP);
5574 return eSIR_FAILURE;
5575}
5576
5577
5578#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005579
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305580static void
5581__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5582{
5583 tpSirResetAPCapsChange pResetCapsChange;
5584 tpPESession psessionEntry;
5585 tANI_U8 sessionId = 0;
5586 if (pMsgBuf == NULL)
5587 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005588 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305589 return;
5590 }
5591
5592 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5593 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5594 if (psessionEntry == NULL)
5595 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005596 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305597 return;
5598 }
5599
5600 psessionEntry->limSentCapsChangeNtf = false;
5601 return;
5602}
5603
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305604static void
5605__limProcessSmeSpoofMacAddrRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5606{
5607 tSirMsgQ msg;
5608 tpSpoofMacAddrReqParams pSpoofMacAddrParams;
5609 tpSirSpoofMacAddrReq pSmeReq = (tpSirSpoofMacAddrReq) pMsgBuf;
5610
5611 pSpoofMacAddrParams = vos_mem_malloc(sizeof( tSpoofMacAddrReqParams));
5612 if ( NULL == pSpoofMacAddrParams )
5613 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305614 limLog( pMac, LOGE, FL("Unable to allocate memory for tDelStaSelfParams") );
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305615 return;
5616 }
5617
5618 vos_mem_copy( pSpoofMacAddrParams->macAddr, pSmeReq->macAddr, sizeof(tSirMacAddr) );
5619
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305620 vos_mem_copy(pMac->lim.spoofMacAddr, pSmeReq->macAddr, VOS_MAC_ADDRESS_LEN);
5621
5622 limLog( pMac, LOG1, FL("Recieved Spoofed Mac Addr request with Addr:"
5623 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pMac->lim.spoofMacAddr) );
5624
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305625 msg.type = WDA_SPOOF_MAC_ADDR_REQ;
5626 msg.reserved = 0;
5627 msg.bodyptr = pSpoofMacAddrParams;
5628 msg.bodyval = 0;
5629
5630 limLog(pMac, LOG1, FL("sending SIR_HAL_SPOOF_MAC_ADDR_REQ msg to HAL"));
5631 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
5632
5633 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
5634 {
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05305635 limLog(pMac, LOGE, FL("wdaPostCtrlMsg failed for SIR_HAL_SPOOF_MAC_ADDR_REQ"));
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305636 vos_mem_free(pSpoofMacAddrParams);
5637 }
5638 return;
5639}
5640
Jeff Johnson295189b2012-06-20 16:38:30 -07005641/**
5642 * limProcessSmeReqMessages()
5643 *
5644 *FUNCTION:
5645 * This function is called by limProcessMessageQueue(). This
5646 * function processes SME request messages from HDD or upper layer
5647 * application.
5648 *
5649 *LOGIC:
5650 *
5651 *ASSUMPTIONS:
5652 *
5653 *NOTE:
5654 *
5655 * @param pMac Pointer to Global MAC structure
5656 * @param msgType Indicates the SME message type
5657 * @param *pMsgBuf A pointer to the SME message buffer
5658 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5659 * FALSE - if pMsgBuf is not to be freed.
5660 */
5661
5662tANI_BOOLEAN
5663limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5664{
5665 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5666 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005667 tpSirSmeScanReq pScanReq;
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305668 tANI_BOOLEAN isPassiveScan = FALSE;
5669
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005670 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 -07005671 limMsgStr(pMsg->type), pMsg->type,
5672 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5673 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5674
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005675 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005676 /* Special handling of some SME Req msgs where we have an existing GO session and
5677 * want to insert NOA before processing those msgs. These msgs will be processed later when
5678 * start event happens
5679 */
5680 switch (pMsg->type)
5681 {
5682 case eWNI_SME_SCAN_REQ:
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305683 pScanReq = (tpSirSmeScanReq) pMsgBuf;
5684 isPassiveScan = (pScanReq->scanType == eSIR_PASSIVE_SCAN) ? TRUE : FALSE;
Viral Modid440e682013-03-06 02:25:31 -08005685 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005686
5687 /* If scan is disabled return from here
5688 */
5689 if (pMac->lim.fScanDisabled)
5690 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005691 if (pMsg->type == eWNI_SME_SCAN_REQ)
5692 {
5693 limSendSmeScanRsp(pMac,
5694 offsetof(tSirSmeScanRsp,bssDescription[0]),
5695 eSIR_SME_INVALID_PARAMETERS,
5696 pScanReq->sessionId,
5697 pScanReq->transactionId);
5698
5699 bufConsumed = TRUE;
5700 }
5701 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5702 {
5703 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5704 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5705 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5706
5707 /*
5708 * limRemainOnChnRsp will free the buffer this change is to
5709 * avoid "double free"
5710 */
5711 bufConsumed = FALSE;
5712 }
5713
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305714 limLog(pMac, LOGE,
5715 FL("Error: Scan Disabled."
5716 " Return with error status for SME Message %s(%d)"),
5717 limMsgStr(pMsg->type), pMsg->type);
5718
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005719 return bufConsumed;
5720 }
5721 /*
5722 * Do not add BREAK here
5723 */
5724 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005725 case eWNI_SME_JOIN_REQ:
5726 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5727 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5728 {
5729 tANI_U32 noaDuration;
5730 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
Ganesh Kondabattini16930072014-08-22 16:02:34 +05305731 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf, isPassiveScan);
Viral Modid440e682013-03-06 02:25:31 -08005732 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5733 return bufConsumed;
5734 }
5735 }
5736 /* If no insert NOA required then execute the code below */
5737
Jeff Johnson295189b2012-06-20 16:38:30 -07005738 switch (pMsg->type)
5739 {
5740 case eWNI_SME_START_REQ:
5741 __limProcessSmeStartReq(pMac, pMsgBuf);
5742 break;
5743
5744 case eWNI_SME_SYS_READY_IND:
5745 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5746 break;
5747
Jeff Johnson295189b2012-06-20 16:38:30 -07005748 case eWNI_SME_START_BSS_REQ:
5749 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5750 break;
5751
5752 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005753 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005754 break;
5755
Jeff Johnsone7245742012-09-05 17:12:55 -07005756#ifdef FEATURE_OEM_DATA_SUPPORT
5757 case eWNI_SME_OEM_DATA_REQ:
5758 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005759 break;
5760#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005761 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5762 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5763 break;
5764
5765 case eWNI_SME_UPDATE_NOA:
5766 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5767 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305768 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5769 __limProcessClearDfsChannelList(pMac, pMsg);
5770 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005771 case eWNI_SME_JOIN_REQ:
5772 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005773 break;
5774
5775 case eWNI_SME_AUTH_REQ:
5776 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5777
5778 break;
5779
5780 case eWNI_SME_REASSOC_REQ:
5781 __limProcessSmeReassocReq(pMac, pMsgBuf);
5782
5783 break;
5784
5785 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5786 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5787
5788 break;
5789
5790 case eWNI_SME_DISASSOC_REQ:
5791 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5792
5793 break;
5794
5795 case eWNI_SME_DISASSOC_CNF:
5796 case eWNI_SME_DEAUTH_CNF:
5797 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5798
5799 break;
5800
5801 case eWNI_SME_DEAUTH_REQ:
5802 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5803
5804 break;
5805
Jeff Johnson295189b2012-06-20 16:38:30 -07005806
5807
5808 case eWNI_SME_SETCONTEXT_REQ:
5809 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5810
5811 break;
5812
5813 case eWNI_SME_REMOVEKEY_REQ:
5814 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5815
5816 break;
5817
5818 case eWNI_SME_STOP_BSS_REQ:
5819 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5820 break;
5821
5822 case eWNI_SME_ASSOC_CNF:
5823 case eWNI_SME_REASSOC_CNF:
5824 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305825 limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005826 else
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305827 limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005828 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5829 break;
5830
5831 case eWNI_SME_ADDTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305832 limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005833 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5834 break;
5835
5836 case eWNI_SME_DELTS_REQ:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305837 limLog(pMac, LOG1, FL("Received DELTS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07005838 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5839 break;
5840
5841 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Abhishek Singh3cbf6052014-12-15 16:46:42 +05305842 limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07005843 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5844 break;
5845
5846 case eWNI_SME_STA_STAT_REQ:
5847 case eWNI_SME_AGGR_STAT_REQ:
5848 case eWNI_SME_GLOBAL_STAT_REQ:
5849 case eWNI_SME_STAT_SUMM_REQ:
5850 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5851 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5852 bufConsumed = FALSE;
5853 break;
5854 case eWNI_SME_GET_STATISTICS_REQ:
5855 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5856 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5857 bufConsumed = FALSE;
5858 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005859#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005860 case eWNI_SME_GET_ROAM_RSSI_REQ:
5861 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5862 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5863 bufConsumed = FALSE;
5864 break;
5865#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005866#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005867 case eWNI_SME_GET_TSM_STATS_REQ:
5868 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5869 bufConsumed = FALSE;
5870 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005871#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005872 case eWNI_SME_DEL_BA_PEER_IND:
5873 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5874 break;
5875 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5876 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5877 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005878 case eWNI_SME_GET_ASSOC_STAS_REQ:
5879 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5880 break;
5881 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5882 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5883 break;
5884
5885 case eWNI_SME_HIDE_SSID_REQ:
5886 __limProcessSmeHideSSID(pMac, pMsgBuf);
5887 break;
5888 case eWNI_SME_UPDATE_APWPSIE_REQ:
5889 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5890 break;
5891 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5892 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5893 break;
5894
5895 case eWNI_SME_SET_APWPARSNIEs_REQ:
5896 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5897 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005898
5899 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5900 //Update the beaconInterval
5901 __limProcessSmeChangeBI(pMac, pMsgBuf );
5902 break;
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05305903
5904#ifdef WLAN_FEATURE_AP_HT40_24G
5905 case eWNI_SME_SET_HT_2040_MODE:
5906 __limProcessSmeSetHT2040Mode(pMac, pMsgBuf);
5907 break;
5908#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005909
5910#if defined WLAN_FEATURE_VOWIFI
5911 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5912 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5913 __limProcessReportMessage(pMac, pMsg);
5914 break;
5915#endif
5916
5917#if defined WLAN_FEATURE_VOWIFI_11R
5918 case eWNI_SME_FT_PRE_AUTH_REQ:
5919 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5920 break;
5921 case eWNI_SME_FT_UPDATE_KEY:
5922 limProcessFTUpdateKey(pMac, pMsgBuf);
5923 break;
5924
5925 case eWNI_SME_FT_AGGR_QOS_REQ:
5926 limProcessFTAggrQosReq(pMac, pMsgBuf);
5927 break;
5928#endif
5929
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005930#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
5931 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07005932 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5933 break;
5934#endif
5935 case eWNI_SME_ADD_STA_SELF_REQ:
5936 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5937 break;
5938 case eWNI_SME_DEL_STA_SELF_REQ:
5939 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5940 break;
5941
Jeff Johnson295189b2012-06-20 16:38:30 -07005942 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5943 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5944 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005945#ifdef FEATURE_WLAN_TDLS
5946 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5947 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5948 break;
5949 case eWNI_SME_TDLS_ADD_STA_REQ:
5950 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5951 break;
5952 case eWNI_SME_TDLS_DEL_STA_REQ:
5953 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5954 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305955 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5956 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5957 break;
Atul Mittalc0f739f2014-07-31 13:47:47 +05305958// tdlsoffchan
5959 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
5960 limProcesSmeTdlsChanSwitchReq(pMac, pMsgBuf);
5961 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005962#endif
5963#ifdef FEATURE_WLAN_TDLS_INTERNAL
5964 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
5965 limProcessSmeDisStartReq(pMac, pMsgBuf);
5966 break ;
5967 case eWNI_SME_TDLS_LINK_START_REQ:
5968 limProcessSmeLinkStartReq(pMac, pMsgBuf);
5969 break ;
5970 case eWNI_SME_TDLS_TEARDOWN_REQ:
5971 limProcessSmeTeardownReq(pMac, pMsgBuf);
5972 break ;
5973#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305974 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5975 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5976 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005977
schang86c22c42013-03-13 18:41:24 -07005978 case eWNI_SME_SET_TX_POWER_REQ:
5979 limSendSetTxPowerReq(pMac, pMsgBuf);
5980 break ;
5981
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05305982 case eWNI_SME_MAC_SPOOF_ADDR_IND:
5983 __limProcessSmeSpoofMacAddrRequest(pMac, pMsgBuf);
5984 break ;
5985
Jeff Johnson295189b2012-06-20 16:38:30 -07005986 default:
5987 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5988 pMsg->bodyptr = NULL;
5989 break;
5990 } // switch (msgType)
5991
5992 return bufConsumed;
5993} /*** end limProcessSmeReqMessages() ***/