blob: 2192ef9e0e0ac68a0af5510fa08213ce2d82f925 [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 Lamaa8e15a2014-02-11 23:30:06 -080023 * Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
24 * All Rights Reserved.
25 * Qualcomm Atheros Confidential and Proprietary.
Kiet Lam842dad02014-02-18 18:44:02 -080026 *
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080027 */
Kiet Lam842dad02014-02-18 18:44:02 -080028
29
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080030/*
Jeff Johnson295189b2012-06-20 16:38:30 -070031 * This file limProcessSmeReqMessages.cc contains the code
32 * for processing SME request messages.
33 * Author: Chandra Modumudi
34 * Date: 02/11/02
35 * History:-
36 * Date Modified by Modification Information
37 * --------------------------------------------------------------------
38 *
39 */
40
41#include "palTypes.h"
42#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070043#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070044#include "cfgApi.h"
45#include "sirApi.h"
46#include "schApi.h"
47#include "utilsApi.h"
48#include "limTypes.h"
49#include "limUtils.h"
50#include "limAssocUtils.h"
51#include "limSecurityUtils.h"
52#include "limSerDesUtils.h"
53#include "limSmeReqUtils.h"
54#include "limIbssPeerMgmt.h"
55#include "limAdmitControl.h"
56#include "dphHashTable.h"
57#include "limSendMessages.h"
58#include "limApi.h"
59#include "wmmApsd.h"
60
Jeff Johnson295189b2012-06-20 16:38:30 -070061#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070062
63#if defined WLAN_FEATURE_VOWIFI
64#include "rrmApi.h"
65#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080066#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
67#include "eseApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070068#endif
69
70#if defined WLAN_FEATURE_VOWIFI_11R
71#include <limFT.h>
72#endif
73
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080074#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -070075/* These are the min/max tx power (non virtual rates) range
76 supported by prima hardware */
Sandeep Puligilla33ccf332013-12-19 16:06:42 +053077#define MIN_TX_PWR_CAP 8
78#define MAX_TX_PWR_CAP 22
Jeff Johnson295189b2012-06-20 16:38:30 -070079
80#endif
81
Viral Modid86bde22012-12-10 13:09:21 -080082/* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK
83 * 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 -080084 * taking care of sending null data and receiving ACK to/from AP/Also SetChannel with calibration is taking
85 * around 7ms .
Viral Modid86bde22012-12-10 13:09:21 -080086 */
Viral Modid440e682013-03-06 02:25:31 -080087#define SCAN_MESSAGING_OVERHEAD 20 // in msecs
88#define JOIN_NOA_DURATION 2000 // in msecs
89#define OEM_DATA_NOA_DURATION 60 // in msecs
90#define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 // in msecs
Jeff Johnson295189b2012-06-20 16:38:30 -070091
Gopichand Nakkala096a1052012-12-21 07:05:34 -080092#define CONV_MS_TO_US 1024 //conversion factor from ms to us
93
Jeff Johnson295189b2012-06-20 16:38:30 -070094// SME REQ processing function templates
95static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *);
96static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *);
97static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
Viral Modid440e682013-03-06 02:25:31 -080098static void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *);
Jeff Johnson295189b2012-06-20 16:38:30 -070099static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *);
100static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *);
101static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *);
102static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *);
103static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *);
104static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *);
105static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
106
Jeff Johnson295189b2012-06-20 16:38:30 -0700107void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *);
108
Jeff Johnson295189b2012-06-20 16:38:30 -0700109extern void peRegisterTLHandle(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700110
Jeff Johnson295189b2012-06-20 16:38:30 -0700111
Jeff Johnson295189b2012-06-20 16:38:30 -0700112#ifdef BACKGROUND_SCAN_ENABLED
113
114// start the background scan timers if it hasn't already started
115static void
116__limBackgroundScanInitiate(tpAniSirGlobal pMac)
117{
118 if (pMac->lim.gLimBackgroundScanStarted)
119 return;
120
121 //make sure timer is created first
122 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
123 {
124 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -0700125 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700126 if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700127 limLog(pMac, LOGP, FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700128 pMac->lim.gLimBackgroundScanStarted = true;
129 pMac->lim.gLimBackgroundScanChannelId = 0;
130 }
131}
132
133#endif // BACKGROUND_SCAN_ENABLED
Jeff Johnson295189b2012-06-20 16:38:30 -0700134
135// determine if a fresh scan request must be issued or not
136/*
137* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
138* If one of the sessions is not in one of the above states, then PE does not do fresh scan
139* If no session exists (scanning very first time), then PE will always do fresh scan if SME
140* asks it to do that.
141*/
142static tANI_U8
143__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
144{
145
146 tANI_U8 validState = TRUE;
147 int i;
148
149 if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
150 {
151 return FALSE;
152 }
153 for(i =0; i < pMac->lim.maxBssId; i++)
154 {
155
156 if(pMac->lim.gpSession[i].valid == TRUE)
157 {
158 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
159 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
160 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
161
162 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
163 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
164 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
165 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700166 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
167 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
168 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
169 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700170 ))
171 {
172 validState = FALSE;
173 break;
174 }
175
176 }
177 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530178 limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700179
180 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
181 return TRUE;
182
183 return FALSE;
184}
185
Jeff Johnson295189b2012-06-20 16:38:30 -0700186
187
188/**
189 * __limIsSmeAssocCnfValid()
190 *
191 *FUNCTION:
192 * This function is called by limProcessLmmMessages() upon
193 * receiving SME_ASSOC_CNF.
194 *
195 *LOGIC:
196 * Message validity checks are performed in this function
197 *
198 *ASSUMPTIONS:
199 *
200 *NOTE:
201 *
202 * @param pMeasReq Pointer to Received ASSOC_CNF message
203 * @return true When received SME_ASSOC_CNF is formatted
204 * correctly
205 * false otherwise
206 */
207
208inline static tANI_U8
209__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
210{
211 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
212 return false;
213 else
214 return true;
215} /*** end __limIsSmeAssocCnfValid() ***/
216
217
218/**
219 * __limGetSmeJoinReqSizeForAlloc()
220 *
221 *FUNCTION:
222 * This function is called in various places to get IE length
223 * from tSirBssDescription structure
224 * number being scanned.
225 *
226 *PARAMS:
227 *
228 *LOGIC:
229 *
230 *ASSUMPTIONS:
231 * NA
232 *
233 *NOTE:
234 * NA
235 *
236 * @param pBssDescr
237 * @return Total IE length
238 */
239
240static tANI_U16
241__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
242{
243 tANI_U16 len = 0;
244
245 if (!pBuf)
246 return len;
247
248 pBuf += sizeof(tANI_U16);
249 len = limGetU16( pBuf );
250 return (len + sizeof( tANI_U16 ));
251} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
252
253
254/**----------------------------------------------------------------
255\fn __limIsDeferedMsgForLearn
256
257\brief Has role only if 11h is enabled. Not used on STA side.
258 Defers the message if SME is in learn state and brings
259 the LIM back to normal mode.
260
261\param pMac
262\param pMsg - Pointer to message posted from SME to LIM.
263\return TRUE - If defered
264 FALSE - Otherwise
265------------------------------------------------------------------*/
266static tANI_BOOLEAN
267__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
268{
269 if (limIsSystemInScanState(pMac))
270 {
271 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
272 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700273 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 return eANI_BOOLEAN_FALSE;
275 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700276 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 pMsg->type);)
278
279 /** Send finish scan req to HAL only if LIM is not waiting for any response
280 * from HAL like init scan rsp, start scan rsp etc.
281 */
282 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
283 {
284 //Set the resume channel to Any valid channel (invalid).
285 //This will instruct HAL to set it to any previous valid channel.
286 peSetResumeChannel(pMac, 0, 0);
287 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
288 }
289
290 return eANI_BOOLEAN_TRUE;
291 }
292 return eANI_BOOLEAN_FALSE;
293}
294
295/**----------------------------------------------------------------
296\fn __limIsDeferedMsgForRadar
297
298\brief Has role only if 11h is enabled. Not used on STA side.
299 Defers the message if radar is detected.
300
301\param pMac
302\param pMsg - Pointer to message posted from SME to LIM.
303\return TRUE - If defered
304 FALSE - Otherwise
305------------------------------------------------------------------*/
306static tANI_BOOLEAN
307__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
308{
309 /** fRadarDetCurOperChan will be set only if we detect radar in current
310 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700311 //TODO: Need to take care radar detection.
312 //if (LIM_IS_RADAR_DETECTED(pMac))
313 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700314 {
315 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
316 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700317 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 return eANI_BOOLEAN_FALSE;
319 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700320 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 pMsg->type);)
322 return eANI_BOOLEAN_TRUE;
323 }
324 return eANI_BOOLEAN_FALSE;
325}
326
327
328/**
329 * __limProcessSmeStartReq()
330 *
331 *FUNCTION:
332 * This function is called to process SME_START_REQ message
333 * from HDD or upper layer application.
334 *
335 *LOGIC:
336 *
337 *ASSUMPTIONS:
338 *
339 *NOTE:
340 *
341 * @param pMac Pointer to Global MAC structure
342 * @param *pMsgBuf A pointer to the SME message buffer
343 * @return None
344 */
345
346static void
347__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
348{
349 tSirResultCodes retCode = eSIR_SME_SUCCESS;
350 tANI_U8 smesessionId;
351 tANI_U16 smetransactionId;
352
353
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700354 PELOG1(limLog(pMac, LOG1, FL("Received START_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700355
356 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
357
358 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
359 {
360 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
361
Jeff Johnsone7245742012-09-05 17:12:55 -0700362 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700363
364 /// By default do not return after first scan match
365 pMac->lim.gLimReturnAfterFirstMatch = 0;
366
367 /// Initialize MLM state machine
368 limInitMlm(pMac);
369
370 /// By default return unique scan results
371 pMac->lim.gLimReturnUniqueResults = true;
372 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700373#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
374 pMac->lim.gLimSmeLfrScanResultLength = 0;
375#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700376
Jeff Johnson295189b2012-06-20 16:38:30 -0700377 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
378 {
379 /*
380 * Need to indicate new BSSs found during background scanning to
381 * host. Update this parameter at CFG
382 */
383 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
384 != eSIR_SUCCESS)
385 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700386 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
388 }
389 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 }
391 else
392 {
393 /**
394 * Should not have received eWNI_SME_START_REQ in states
395 * other than OFFLINE. Return response to host and
396 * log error
397 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700398 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
400 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
401 }
402 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
403} /*** end __limProcessSmeStartReq() ***/
404
405
406/** -------------------------------------------------------------
407\fn __limProcessSmeSysReadyInd
408\brief handles the notification from HDD. PE just forwards this message to HAL.
409\param tpAniSirGlobal pMac
410\param tANI_U32* pMsgBuf
411\return TRUE-Posting to HAL failed, so PE will consume the buffer.
412\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
413 -------------------------------------------------------------*/
414static tANI_BOOLEAN
415__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
416{
417 tSirMsgQ msg;
418
419 msg.type = WDA_SYS_READY_IND;
420 msg.reserved = 0;
421 msg.bodyptr = pMsgBuf;
422 msg.bodyval = 0;
423
Jeff Johnson92751692013-03-06 16:00:33 -0800424 if (pMac->gDriverType != eDRIVER_TYPE_MFG)
Jeff Johnson295189b2012-06-20 16:38:30 -0700425 {
Jeff Johnson92751692013-03-06 16:00:33 -0800426 peRegisterTLHandle(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700427 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700428 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700429 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700430
Jeff Johnson92751692013-03-06 16:00:33 -0800431 if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700433 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 return eANI_BOOLEAN_TRUE;
435 }
436 return eANI_BOOLEAN_FALSE;
437}
438
Jeff Johnsone7245742012-09-05 17:12:55 -0700439#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700440
Jeff Johnsone7245742012-09-05 17:12:55 -0700441tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
442{
443 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
444 {
445 switch(secondaryChanOffset)
446 {
447 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
448 return primarychanNum;
449 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
450 return primarychanNum + 2;
451 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
452 return primarychanNum - 2;
453 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
454 return primarychanNum + 6;
455 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
456 return primarychanNum + 2;
457 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
458 return primarychanNum - 2;
459 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
460 return primarychanNum - 6;
461 default :
462 return eSIR_CFG_INVALID_ID;
463 }
464 }
465 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
466 {
467 switch(secondaryChanOffset)
468 {
469 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
470 return primarychanNum + 2;
471 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
472 return primarychanNum - 2;
473 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
474 return primarychanNum;
475 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
476 return primarychanNum + 2;
477 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
478 return primarychanNum - 2;
479 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
480 return primarychanNum + 2;
481 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
482 return primarychanNum - 2;
483 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
484 return primarychanNum + 2;
485 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
486 return primarychanNum - 2;
487 default :
488 return eSIR_CFG_INVALID_ID;
489 }
490 }
491 return primarychanNum;
492}
493
494#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700495/**
496 * __limHandleSmeStartBssRequest()
497 *
498 *FUNCTION:
499 * This function is called to process SME_START_BSS_REQ message
500 * from HDD or upper layer application.
501 *
502 *LOGIC:
503 *
504 *ASSUMPTIONS:
505 *
506 *NOTE:
507 *
508 * @param pMac Pointer to Global MAC structure
509 * @param *pMsgBuf A pointer to the SME message buffer
510 * @return None
511 */
512
513static void
514__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
515{
516 tANI_U16 size;
517 tANI_U32 val = 0;
518 tSirRetStatus retStatus;
519 tSirMacChanNum channelNumber;
Jeff Johnsonace91102013-04-05 08:03:18 -0700520 tLimMlmStartReq *pMlmStartReq = NULL;
521 tpSirSmeStartBssReq pSmeStartBssReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700522 tSirResultCodes retCode = eSIR_SME_SUCCESS;
523 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 tANI_U8 sessionId;
525 tpPESession psessionEntry = NULL;
526 tANI_U8 smesessionId;
527 tANI_U16 smetransactionId;
528
529#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
530 //Since the session is not created yet, sending NULL. The response should have the correct state.
531 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
532#endif //FEATURE_WLAN_DIAG_SUPPORT
533
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700534 PELOG1(limLog(pMac, LOG1, FL("Received START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700535
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530536 /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
538 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
539 {
540 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
541
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530542 pSmeStartBssReq = vos_mem_malloc(size);
543 if ( NULL == pSmeStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530545 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pMac->lim.gpLimStartBssReq"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 /// Send failure response to host
547 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
548 goto end;
549 }
550
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530551 vos_mem_set((void *)pSmeStartBssReq, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700552
553 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
554 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
555 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700556 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 retCode = eSIR_SME_INVALID_PARAMETERS;
558 goto free;
559 }
560#if 0
561 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700562 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
564#endif
565
566 /* This is the place where PE is going to create a session.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530567 * If session is not existed, then create a new session */
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
569 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700570 limLog(pMac, LOGW, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
572 psessionEntry = NULL;
573 goto free;
574 }
575 else
576 {
577 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
578 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700579 limLog(pMac, LOGW, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700580 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
581 goto free;
582 }
583
584 }
585
586 /* Store the session related parameters in newly created session */
587 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
588
589 /* Store PE sessionId in session Table */
590 psessionEntry->peSessionId = sessionId;
591
592 /* Store SME session Id in sessionTable */
593 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
594
595 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
596
597 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
598
599 /* Copy SSID to session table */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530600 vos_mem_copy( (tANI_U8 *)&psessionEntry->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 (tANI_U8 *)&pSmeStartBssReq->ssId,
602 (pSmeStartBssReq->ssId.length + 1));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530603
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 psessionEntry->bssType = pSmeStartBssReq->bssType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530605
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 psessionEntry->nwType = pSmeStartBssReq->nwType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530607
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
609
610 /* Store the channel number in session Table */
611 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
612
613 /*Store Persona */
614 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700615 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 psessionEntry->pePersona);
617
618 /*Update the phymode*/
619 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
620
621 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
622 psessionEntry->currentOperChannel );
623 /* Store the dot 11 mode in to the session Table*/
624
625 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700626 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
627#ifdef WLAN_FEATURE_11AC
628 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700629 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
630 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700631#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800632
633 psessionEntry->txLdpcIniFeatureEnabled =
634 pSmeStartBssReq->txLdpcIniFeatureEnabled;
635
Chet Lanctot8cecea22014-02-11 19:09:36 -0800636#ifdef WLAN_FEATURE_11W
637 psessionEntry->limRmfEnabled = pSmeStartBssReq->pmfCapable ? 1 : 0;
638 limLog(pMac, LOG1, FL("Session RMF enabled: %d"), psessionEntry->limRmfEnabled);
639#endif
640
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530641 vos_mem_copy((void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 (void*)&pSmeStartBssReq->operationalRateSet,
643 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530644 vos_mem_copy((void*)&psessionEntry->extRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 (void*)&pSmeStartBssReq->extendedRateSet,
646 sizeof(tSirMacRateSet));
647
648 switch(pSmeStartBssReq->bssType)
649 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 case eSIR_INFRA_AP_MODE:
651 psessionEntry->limSystemRole = eLIM_AP_ROLE;
652 psessionEntry->privacy = pSmeStartBssReq->privacy;
653 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
654 psessionEntry->authType = pSmeStartBssReq->authType;
655 /* Store the DTIM period */
656 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
657 /*Enable/disable UAPSD*/
658 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
659 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
660 {
661 psessionEntry->proxyProbeRspEn = 0;
662 }
663 else
664 {
665 /* To detect PBC overlap in SAP WPS mode, Host handles
666 * Probe Requests.
667 */
668 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
669 {
670 psessionEntry->proxyProbeRspEn = 1;
671 }
672 else
673 {
674 psessionEntry->proxyProbeRspEn = 0;
675 }
676 }
677 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
678 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
krunal soni45b9eb62014-03-26 12:54:25 -0700679 limGetShortSlotFromPhyMode(pMac, psessionEntry,
680 psessionEntry->gLimPhyMode,
681 &psessionEntry->shortSlotTimeSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 case eSIR_IBSS_MODE:
684 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
krunal soni45b9eb62014-03-26 12:54:25 -0700685 limGetShortSlotFromPhyMode(pMac, psessionEntry,
686 psessionEntry->gLimPhyMode,
687 &psessionEntry->shortSlotTimeSupported);
Abhishek Singhd5c31272014-03-07 14:46:50 +0530688 /* In WPA-NONE case we wont get the privacy bit in ibss config
689 * from supplicant, but we are updating WNI_CFG_PRIVACY_ENABLED
690 * on basis of Encryption type in csrRoamSetBssConfigCfg. So
691 * get the privacy info from WNI_CFG_PRIVACY_ENABLED
692 */
693 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &val)
694 != eSIR_SUCCESS)
695 limLog(pMac, LOGE, FL("cfg get WNI_CFG_PRIVACY_ENABLED"
696 " failed"));
697 psessionEntry->privacy =(tANI_U8) val;
krunal sonie9002db2013-11-25 14:24:17 -0800698 psessionEntry->isCoalesingInIBSSAllowed =
699 pSmeStartBssReq->isCoalesingInIBSSAllowed;
Jeff Johnson295189b2012-06-20 16:38:30 -0700700 break;
701
702 case eSIR_BTAMP_AP_MODE:
703 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
704 break;
705
706 case eSIR_BTAMP_STA_MODE:
707 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
708 break;
709
710 /* There is one more mode called auto mode. which is used no where */
711
712 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
713
714
715 default:
716 //not used anywhere...used in scan function
717 break;
718 }
719
720 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
721 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700722 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 )
724 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530725 psessionEntry->parsedAssocReq = vos_mem_malloc(
726 psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq));
727 if ( NULL == psessionEntry->parsedAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530729 limLog(pMac, LOGW, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700730 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
731 goto free;
732 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530733 vos_mem_set(psessionEntry->parsedAssocReq,
734 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)),
735 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700736 }
737
738 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
739 if (pSmeStartBssReq->channelId)
740 {
741 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700742 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
743 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
744 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700745 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700746 FL("cbMode %u"), pSmeStartBssReq->cbMode);
747#ifdef WLAN_FEATURE_11AC
748 if(psessionEntry->vhtCapability)
749 {
750 tANI_U32 centerChan;
751 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700752
Jeff Johnsone7245742012-09-05 17:12:55 -0700753 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
754 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700756 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700757 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700758 }
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530759
Abhishek Singh921926b2014-02-13 17:21:01 +0530760 if(channelNumber <= RF_CHAN_14 &&
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530761 chanWidth != eHT_CHANNEL_WIDTH_20MHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -0700762 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530763 chanWidth = eHT_CHANNEL_WIDTH_20MHZ;
Abhishek Singh921926b2014-02-13 17:21:01 +0530764 limLog(pMac, LOG1, FL("Setting chanWidth to 20Mhz for"
765 " channel %d"),channelNumber);
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700767
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530768 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ ||
769 chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
Abhishek Singh921926b2014-02-13 17:21:01 +0530770 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530771 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
772 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
773 != eSIR_SUCCESS)
774 {
775 limLog(pMac, LOGP, FL("could not set "
776 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
777 retCode = eSIR_LOGP_EXCEPTION;
778 goto free;
779 }
780 }
781 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
782 {
783 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
784 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
785 != eSIR_SUCCESS)
786 {
787 limLog(pMac, LOGP, FL("could not set "
788 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
789 retCode = eSIR_LOGP_EXCEPTION;
790 goto free;
791 }
792
793 centerChan = limGetCenterChannel( pMac, channelNumber,
794 pSmeStartBssReq->cbMode,
795 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
Jeff Johnsone7245742012-09-05 17:12:55 -0700796 if(centerChan != eSIR_CFG_INVALID_ID)
797 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530798 limLog(pMac, LOGW, FL("***Center Channel for "
799 "80MHZ channel width = %d"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700800 psessionEntry->apCenterChan = centerChan;
Abhishek Singh921926b2014-02-13 17:21:01 +0530801 if (cfgSetInt(pMac,
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530802 WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
803 centerChan) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -0700804 {
Abhishek Singh921926b2014-02-13 17:21:01 +0530805 limLog(pMac, LOGP, FL("could not set "
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530806 "WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700807 retCode = eSIR_LOGP_EXCEPTION;
808 goto free;
809 }
810 }
811 }
812
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530813 /* All the translation is done by now for gVhtChannelWidth
814 * from .ini file to the actual values as defined in spec.
815 * So, grabing the spec value which is
816 * updated in .dat file by the above logic */
817 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
818 &chanWidth) != eSIR_SUCCESS)
819 {
820 limLog(pMac, LOGP,
821 FL("Unable to retrieve Channel Width from CFG"));
822 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700823 /*For Sta+p2p-Go concurrency
824 vhtTxChannelWidthSet is used for storing p2p-GO channel width
825 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
826 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
827 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700828 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700829 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700830 }
831 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
832#endif
833 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 else
835 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700836 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 retCode = eSIR_SME_INVALID_PARAMETERS;
838 goto free;
839 }
840
841 // Delete pre-auth list if any
842 limDeletePreAuthList(pMac);
843
844 // Delete IBSS peer BSSdescription list if any
845 //limIbssDelete(pMac); sep 26 review
846
847
848
849#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
850 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 limInitMlm(pMac);
852#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700853
Jeff Johnsone7245742012-09-05 17:12:55 -0700854 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700855
Jeff Johnson295189b2012-06-20 16:38:30 -0700856 /* keep the RSN/WPA IE information in PE Session Entry
857 * later will be using this to check when received (Re)Assoc req
858 * */
859 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
860
Jeff Johnson295189b2012-06-20 16:38:30 -0700861
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 //Taken care for only softAP case rest need to be done
863 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
864 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
865 /*each byte will have the following info
866 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
867 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530868 vos_mem_copy( (void *) &psessionEntry->cfgProtection,
Jeff Johnson295189b2012-06-20 16:38:30 -0700869 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700870 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
872 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700873
874 // Prepare and Issue LIM_MLM_START_REQ to MLM
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530875 pMlmStartReq = vos_mem_malloc(sizeof(tLimMlmStartReq));
876 if ( NULL == pMlmStartReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530878 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700879 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
880 goto free;
881 }
882
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530883 vos_mem_set((void *) pMlmStartReq, sizeof(tLimMlmStartReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700884
885 /* Copy SSID to the MLM start structure */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530886 vos_mem_copy( (tANI_U8 *) &pMlmStartReq->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 (tANI_U8 *) &pSmeStartBssReq->ssId,
888 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
890 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700891
892
893 pMlmStartReq->bssType = psessionEntry->bssType;
894
895 /* Fill PE session Id from the session Table */
896 pMlmStartReq->sessionId = psessionEntry->peSessionId;
897
898 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700900 )
901 {
902 //len = sizeof(tSirMacAddr);
903 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
904 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700905 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700906
907 /* Copy the BSSId from sessionTable to mlmStartReq struct */
908 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
909 }
910
911 else // ibss mode
912 {
913 pMac->lim.gLimIbssCoalescingHappened = false;
914
915 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
916 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700917 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700918 retCode = eSIR_LOGP_EXCEPTION;
919 goto free;
920 }
921
922 if(!autoGenBssId)
923 {
924 // We're not auto generating BSSID. Instead, get it from session entry
925 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
926
927 if(pMlmStartReq->bssId[0] & 0x01)
928 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700929 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 autoGenBssId = TRUE;
931 }
932 }
933
934 if( autoGenBssId )
935 { //if BSSID is not any uc id. then use locally generated BSSID.
936 //Autogenerate the BSSID
937 limGetRandomBssid( pMac, pMlmStartReq->bssId);
938 pMlmStartReq->bssId[0]= 0x02;
939
940 /* Copy randomly generated BSSID to the session Table */
941 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
942 }
943 }
944 /* store the channel num in mlmstart req structure */
945 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
946 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
947 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
948
Jeff Johnson295189b2012-06-20 16:38:30 -0700949 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
950 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
951 pMlmStartReq->wps_state = psessionEntry->wps_state;
952
953 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700954 {
955 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700956 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700957 pMlmStartReq->dtimPeriod = (tANI_U8)val;
958 }
959
960 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700961 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700962 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
963
964 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700965 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
967
968 //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 +0530969 vos_mem_copy((void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700970 sizeof(tSirMacRateSet));
971
Jeff Johnson295189b2012-06-20 16:38:30 -0700972 // Now populate the 11n related parameters
973 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700974 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700975 //
976 // FIXME_GEN4 - Determine the appropriate defaults...
977 //
978 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
979 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700980 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700981
982 /* sep26 review */
983 psessionEntry->limRFBand = limGetRFBand(channelNumber);
984
985 // Initialize 11h Enable Flag
986 psessionEntry->lim11hEnable = 0;
987 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
988 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
989 {
990 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700991 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 psessionEntry->lim11hEnable = val;
993 }
994
995 if (!psessionEntry->lim11hEnable)
996 {
997 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700998 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700999 }
1000
Jeff Johnson295189b2012-06-20 16:38:30 -07001001 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
1002 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001003 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001004
1005 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
1006 return;
1007 }
1008 else
1009 {
1010
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001011 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001012 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
1013 goto end;
1014 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
1015
1016free:
Jeff Johnsonace91102013-04-05 08:03:18 -07001017 if ((psessionEntry != NULL) &&
1018 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
1019 {
1020 psessionEntry->pLimStartBssReq = NULL;
1021 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301022 vos_mem_free( pSmeStartBssReq);
1023 vos_mem_free( pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001024
1025end:
1026
1027 /* This routine should return the sme sessionId and SME transaction Id */
1028 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1029
1030 if(NULL != psessionEntry)
1031 {
1032 peDeleteSession(pMac,psessionEntry);
1033 psessionEntry = NULL;
1034 }
1035 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
1036} /*** end __limHandleSmeStartBssRequest() ***/
1037
1038
1039/**--------------------------------------------------------------
1040\fn __limProcessSmeStartBssReq
1041
1042\brief Wrapper for the function __limHandleSmeStartBssRequest
1043 This message will be defered until softmac come out of
1044 scan mode or if we have detected radar on the current
1045 operating channel.
1046\param pMac
1047\param pMsg
1048
1049\return TRUE - If we consumed the buffer
1050 FALSE - If have defered the message.
1051 ---------------------------------------------------------------*/
1052static tANI_BOOLEAN
1053__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1054{
1055 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1056 __limIsDeferedMsgForRadar(pMac, pMsg))
1057 {
1058 /**
1059 * If message defered, buffer is not consumed yet.
1060 * So return false
1061 */
1062 return eANI_BOOLEAN_FALSE;
1063 }
1064
1065 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1066 return eANI_BOOLEAN_TRUE;
1067}
1068
1069
1070/**
1071 * limGetRandomBssid()
1072 *
1073 * FUNCTION:This function is called to process generate the random number for bssid
1074 * This function is called to process SME_SCAN_REQ message
1075 * from HDD or upper layer application.
1076 *
1077 * LOGIC:
1078 *
1079 * ASSUMPTIONS:
1080 *
1081 * NOTE:
1082 * 1. geneartes the unique random number for bssid in ibss
1083 *
1084 * @param pMac Pointer to Global MAC structure
1085 * @param *data Pointer to bssid buffer
1086 * @return None
1087 */
1088void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1089{
1090 tANI_U32 random[2] ;
1091 random[0] = tx_time_get();
1092 random[0] |= (random[0] << 15) ;
1093 random[1] = random[0] >> 1;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301094 vos_mem_copy( data, (tANI_U8*)random, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001095}
1096
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301097static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
1098 tpSirSmeScanReq pScanReq)
1099{
1100 tSirScanOffloadReq *pScanOffloadReq;
1101 tANI_U8 *p;
1102 tSirMsgQ msg;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301103 tANI_U16 i, len;
1104 tSirRetStatus rc = eSIR_SUCCESS;
1105
1106 /* The tSirScanOffloadReq will reserve the space for first channel,
1107 so allocate the memory for (numChannels - 1) and uIEFieldLen */
1108 len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
1109 pScanReq->uIEFieldLen;
1110
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301111 pScanOffloadReq = vos_mem_malloc(len);
1112 if ( NULL == pScanOffloadReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301113 {
1114 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301115 FL("AllocateMemory failed for pScanOffloadReq"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301116 return eHAL_STATUS_FAILURE;
1117 }
1118
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301119 vos_mem_set( (tANI_U8 *) pScanOffloadReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301120
1121 msg.type = WDA_START_SCAN_OFFLOAD_REQ;
1122 msg.bodyptr = pScanOffloadReq;
1123 msg.bodyval = 0;
1124
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301125 vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301126 (tANI_U8*) pScanReq->bssId,
1127 sizeof(tSirMacAddr));
1128
1129 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
1130 {
1131 limLog(pMac, LOGE,
1132 FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
Kiet Lamb1233192013-11-28 13:38:20 +05301133 vos_mem_free (pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301134 return eHAL_STATUS_FAILURE;
1135 }
1136
1137 pScanOffloadReq->numSsid = pScanReq->numSsid;
1138 for (i = 0; i < pScanOffloadReq->numSsid; i++)
1139 {
1140 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301141 vos_mem_copy((tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301142 (tANI_U8 *) pScanReq->ssId[i].ssId,
1143 pScanOffloadReq->ssId[i].length);
1144 }
1145
1146 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301147 vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301148 (tANI_U8 *) pScanReq->selfMacAddr,
1149 sizeof(tSirMacAddr));
1150 pScanOffloadReq->bssType = pScanReq->bssType;
1151 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1152 pScanOffloadReq->scanType = pScanReq->scanType;
1153 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1154 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1155 pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
1156 pScanOffloadReq->sessionId = pScanReq->sessionId;
1157 pScanOffloadReq->channelList.numChannels =
1158 pScanReq->channelList.numChannels;
1159 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1160 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1161 p[i] = pScanReq->channelList.channelNumber[i];
1162
1163 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1164 pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301165 vos_mem_copy((tANI_U8 *) p + i,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301166 (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
1167 pScanOffloadReq->uIEFieldLen);
1168
1169 rc = wdaPostCtrlMsg(pMac, &msg);
1170 if (rc != eSIR_SUCCESS)
1171 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001172 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301173 vos_mem_free(pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301174 return eHAL_STATUS_FAILURE;
1175 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301176 limLog(pMac, LOG1, FL("Processed Offload Scan Request Successfully"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301177
1178 return eHAL_STATUS_SUCCESS;
1179}
Jeff Johnson295189b2012-06-20 16:38:30 -07001180
1181/**
1182 * __limProcessSmeScanReq()
1183 *
1184 *FUNCTION:
1185 * This function is called to process SME_SCAN_REQ message
1186 * from HDD or upper layer application.
1187 *
1188 *LOGIC:
1189 *
1190 *ASSUMPTIONS:
1191 *
1192 *NOTE:
1193 * 1. Periodic scanning should be requesting to return unique
1194 * scan results.
1195 *
1196 * @param pMac Pointer to Global MAC structure
1197 * @param *pMsgBuf A pointer to the SME message buffer
1198 * @return None
1199 */
1200
Viral Modid440e682013-03-06 02:25:31 -08001201static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001202__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1203{
1204 tANI_U32 len;
1205 tLimMlmScanReq *pMlmScanReq;
1206 tpSirSmeScanReq pScanReq;
1207 tANI_U8 i = 0;
1208
1209#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1210 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1211#endif //FEATURE_WLAN_DIAG_SUPPORT
1212
1213 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301214 limLog(pMac, LOG1,FL("SME SCAN REQ numChan %d min %d max %d IELen %d"
1215 "first %d fresh %d unique %d type %s (%d)"
1216 " mode %s (%d)rsp %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001217 pScanReq->channelList.numChannels,
1218 pScanReq->minChannelTime,
1219 pScanReq->maxChannelTime,
1220 pScanReq->uIEFieldLen,
1221 pScanReq->returnAfterFirstMatch,
1222 pScanReq->returnFreshResults,
1223 pScanReq->returnUniqueResults,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301224 lim_ScanTypetoString(pScanReq->scanType),
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001225 pScanReq->scanType,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301226 lim_BackgroundScanModetoString(pScanReq->backgroundScanMode),
1227 pScanReq->backgroundScanMode, pMac->lim.gLimRspReqd ? 1 : 0);
Viral Modid86bde22012-12-10 13:09:21 -08001228
1229 /* Since scan req always requires a response, we will overwrite response required here.
1230 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1231 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1232 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1233 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1234 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1235 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1236 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1237 * the global flag gLimRspReqd to TRUE here.
1238 */
1239 pMac->lim.gLimRspReqd = TRUE;
1240
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301241 /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001242 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1243
1244 /* This routine should return the sme sessionId and SME transaction Id */
1245
1246 if (!limIsSmeScanReqValid(pMac, pScanReq))
1247 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301248 limLog(pMac, LOGE, FL("Received SME_SCAN_REQ with invalid parameters"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001249
1250 if (pMac->lim.gLimRspReqd)
1251 {
1252 pMac->lim.gLimRspReqd = false;
1253
1254 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1255
1256 } // if (pMac->lim.gLimRspReqd)
1257
1258 return;
1259 }
1260
1261 //if scan is disabled then return as invalid scan request.
1262 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1263 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1264 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301265 limLog(pMac, LOGE, FL("SCAN is disabled or SCAN in power save"
1266 " is disabled and system is in power save."));
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001267 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001268 return;
1269 }
1270
1271
1272 /**
1273 * If scan request is received in idle, joinFailed
1274 * states or in link established state (in STA role)
1275 * or in normal state (in STA-in-IBSS/AP role) with
1276 * 'return fresh scan results' request from HDD or
1277 * it is periodic background scanning request,
1278 * trigger fresh scan request to MLM
1279 */
1280 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1281 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301282 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1283 {
1284 // Discard previously cached scan results
1285 limReInitScanResults(pMac);
1286 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001287
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301288 pMac->lim.gLim24Band11dScanDone = 0;
1289 pMac->lim.gLim50Band11dScanDone = 0;
1290 pMac->lim.gLimReturnAfterFirstMatch =
1291 pScanReq->returnAfterFirstMatch;
1292 pMac->lim.gLimBackgroundScanMode =
1293 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001294
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301295 pMac->lim.gLimReturnUniqueResults =
1296 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1297 /* De-activate Heartbeat timers for connected sessions while
1298 * scan is in progress if the system is in Active mode *
1299 * AND it is not a ROAMING ("background") scan */
1300 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1301 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1302 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1303 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1304 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001305 for(i=0;i<pMac->lim.maxBssId;i++)
1306 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301307 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1308 (pMac->lim.gpSession[i].valid == TRUE) &&
1309 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1310 {
1311 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1312 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001313 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301314 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001315
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301316 if (pMac->fScanOffload)
1317 {
1318 if (eHAL_STATUS_SUCCESS !=
1319 limSendHalStartScanOffloadReq(pMac, pScanReq))
1320 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301321 limLog(pMac, LOGE, FL("Couldn't send Offload scan request"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301322 limSendSmeScanRsp(pMac,
1323 offsetof(tSirSmeScanRsp, bssDescription[0]),
1324 eSIR_SME_INVALID_PARAMETERS,
1325 pScanReq->sessionId,
1326 pScanReq->transactionId);
1327 return;
1328 }
1329 }
1330 else
1331 {
1332
1333 /*Change Global SME state */
1334 /* Store the previous SME state */
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301335 limLog(pMac, LOG1, FL("Non Offload SCAN request "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301336 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1337 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1338 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1339
1340 if (pScanReq->channelList.numChannels == 0)
1341 {
1342 tANI_U32 cfg_len;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301343
1344 limLog(pMac, LOG1,
1345 FL("Scan all channels as Number of channels is 0"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301346 // Scan all channels
1347 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001348 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1349 pScanReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301350 pMlmScanReq = vos_mem_malloc(len);
1351 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301352 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301353 // Log error
1354 limLog(pMac, LOGP,
1355 FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001356
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301357 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301358 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001359
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301360 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301361 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001362
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301363 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1364 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001365 pMlmScanReq->channelList.channelNumber,
1366 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301367 {
1368 /**
1369 * Could not get Valid channel list from CFG.
1370 * Log error.
1371 */
1372 limLog(pMac, LOGP,
1373 FL("could not retrieve Valid channel list"));
1374 }
1375 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
1376 }
1377 else
1378 {
1379 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1380 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1381 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001382
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301383 pMlmScanReq = vos_mem_malloc(len);
1384 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301385 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301386 // Log error
1387 limLog(pMac, LOGP,
1388 FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001389
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301390 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301391 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001392
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301393 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301394 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301395 pMlmScanReq->channelList.numChannels =
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301396 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001397
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301398 vos_mem_copy( pMlmScanReq->channelList.channelNumber,
1399 pScanReq->channelList.channelNumber,
1400 pScanReq->channelList.numChannels);
1401 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001402
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301403 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1404 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1405 if(pScanReq->uIEFieldLen)
1406 {
1407 vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1408 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1409 pScanReq->uIEFieldLen);
1410 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001411
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301412 pMlmScanReq->bssType = pScanReq->bssType;
1413 vos_mem_copy( pMlmScanReq->bssId,
1414 pScanReq->bssId,
1415 sizeof(tSirMacAddr));
1416 pMlmScanReq->numSsid = pScanReq->numSsid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001417
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301418 i = 0;
1419 while (i < pMlmScanReq->numSsid)
1420 {
1421 vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 (tANI_U8 *) &pScanReq->ssId[i],
1423 pScanReq->ssId[i].length + 1);
1424
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301425 i++;
1426 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001427
Jeff Johnson295189b2012-06-20 16:38:30 -07001428
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301429 pMlmScanReq->scanType = pScanReq->scanType;
1430 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
1431 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1432 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1433 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1434 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
1435 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1436 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001437
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301438 //Store the smeSessionID and transaction ID for later use.
1439 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1440 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001441
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301442 // Issue LIM_MLM_SCAN_REQ to MLM
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301443 limLog(pMac, LOG1, FL("Issue Scan request command to MLM "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301444 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1445 }
1446 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001447
1448 else
1449 {
1450 /// In all other cases return 'cached' scan results
1451 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1452 {
1453 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1454
1455 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001456#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1457 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001459 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1460 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1461 {
1462 limSendSmeLfrScanRsp(pMac, scanRspLen,
1463 eSIR_SME_SUCCESS,
1464 pScanReq->sessionId,
1465 pScanReq->transactionId);
1466 }
1467 else
1468 {
1469 scanRspLen = sizeof(tSirSmeScanRsp) +
1470 pMac->lim.gLimSmeLfrScanResultLength -
1471 sizeof(tSirBssDescription);
1472 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1473 pScanReq->sessionId, pScanReq->transactionId);
1474 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001475 }
1476 else
1477 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001478#endif
1479 if (pMac->lim.gLimSmeScanResultLength == 0)
1480 {
1481 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1482 pScanReq->sessionId, pScanReq->transactionId);
1483 }
1484 else
1485 {
1486 scanRspLen = sizeof(tSirSmeScanRsp) +
1487 pMac->lim.gLimSmeScanResultLength -
1488 sizeof(tSirBssDescription);
1489 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1490 pScanReq->sessionId, pScanReq->transactionId);
1491 }
1492#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001493 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001494#endif
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301495 limLog(pMac, LOG1, FL("Cached scan results are returned "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001496
1497 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1498 {
1499 // Discard previously cached scan results
1500 limReInitScanResults(pMac);
1501 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001502#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1503 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1504 {
1505 // Discard previously cached scan results
1506 limReInitLfrScanResults(pMac);
1507 }
1508#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001509
1510 } // if (pMac->lim.gLimRspReqd)
1511 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1512
Jeff Johnson295189b2012-06-20 16:38:30 -07001513#ifdef BACKGROUND_SCAN_ENABLED
1514 // start background scans if needed
1515 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1516 __limBackgroundScanInitiate(pMac);
1517#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001518
1519} /*** end __limProcessSmeScanReq() ***/
1520
Jeff Johnsone7245742012-09-05 17:12:55 -07001521#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001522
Jeff Johnsone7245742012-09-05 17:12:55 -07001523static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1524{
1525 tpSirOemDataReq pOemDataReq;
1526 tLimMlmOemDataReq* pMlmOemDataReq;
1527
1528 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1529
1530 //post the lim mlm message now
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301531 pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq));
1532 if ( NULL == pMlmOemDataReq )
Jeff Johnsone7245742012-09-05 17:12:55 -07001533 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301534 limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001535 return;
1536 }
1537
1538 //Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301539 vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001540
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301541 vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr,
1542 sizeof(tSirMacAddr));
1543 vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq,
1544 OEM_DATA_REQ_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001545
1546 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1547 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1548
1549 return;
1550
1551} /*** end __limProcessSmeOemDataReq() ***/
1552
1553#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001554
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301555/**
1556 * __limProcessClearDfsChannelList()
1557 *
1558 *FUNCTION:
1559 *Clear DFS channel list when country is changed/aquired.
1560.*This message is sent from SME.
1561 *
1562 *LOGIC:
1563 *
1564 *ASSUMPTIONS:
1565 *
1566 *NOTE:
1567 *
1568 * @param pMac Pointer to Global MAC structure
1569 * @param *pMsgBuf A pointer to the SME message buffer
1570 * @return None
1571 */
1572static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1573 tpSirMsgQ pMsg)
1574{
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301575 vos_mem_set( &pMac->lim.dfschannelList,
1576 sizeof(tSirDFSChannelList), 0);
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301577}
Jeff Johnson295189b2012-06-20 16:38:30 -07001578
1579/**
1580 * __limProcessSmeJoinReq()
1581 *
1582 *FUNCTION:
1583 * This function is called to process SME_JOIN_REQ message
1584 * from HDD or upper layer application.
1585 *
1586 *LOGIC:
1587 *
1588 *ASSUMPTIONS:
1589 *
1590 *NOTE:
1591 *
1592 * @param pMac Pointer to Global MAC structure
1593 * @param *pMsgBuf A pointer to the SME message buffer
1594 * @return None
1595 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001596static void
1597__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1598{
1599 // tANI_U8 *pBuf;
1600 //tANI_U32 len;
1601// tSirMacAddr currentBssId;
1602 tpSirSmeJoinReq pSmeJoinReq = NULL;
1603 tLimMlmJoinReq *pMlmJoinReq;
1604 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1605 tANI_U32 val = 0;
1606 tANI_U16 nSize;
1607 tANI_U8 sessionId;
1608 tpPESession psessionEntry = NULL;
1609 tANI_U8 smesessionId;
1610 tANI_U16 smetransactionId;
1611 tPowerdBm localPowerConstraint = 0, regMax = 0;
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301612 tANI_U16 ieLen;
1613 v_U8_t *vendorIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001614
1615#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1616 //Not sending any session, since it is not created yet. The response whould have correct state.
1617 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1618#endif //FEATURE_WLAN_DIAG_SUPPORT
1619
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001620 PELOG1(limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001621
1622#ifdef WLAN_FEATURE_VOWIFI
1623 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1624 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1625 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1626 * like not honoring power constraint on 1st association after driver loading. */
1627 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001628 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001629 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1630 val = 0;
1631#endif /* WLAN_FEATURE_VOWIFI */
1632
1633 /**
1634 * Expect Join request in idle state.
1635 * Reassociate request is expected in link established state.
1636 */
1637
1638 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1639 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1640 {
1641 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301642
1643 pSmeJoinReq = vos_mem_malloc(nSize);
1644 if ( NULL == pSmeJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301646 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1647 "pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1649 goto end;
1650 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301651 (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001652
Jeff Johnson295189b2012-06-20 16:38:30 -07001653 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1654 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1655 {
1656 /// Received invalid eWNI_SME_JOIN_REQ
1657 // Log the event
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301658 limLog(pMac, LOGW, FL("SessionId:%d Received SME_JOIN_REQ with"
1659 "invalid data"),pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001660 retCode = eSIR_SME_INVALID_PARAMETERS;
1661 goto end;
1662 }
1663
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301664 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23
Jeff Johnson295189b2012-06-20 16:38:30 -07001665
1666 /* check for the existence of start BSS session */
1667#ifdef FIXME_GEN6
1668 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1669 {
1670 if(peValidateBtJoinRequest(pMac)!= TRUE)
1671 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301672 limLog(pMac, LOGW, FL("SessionId:%d Start Bss session"
1673 "not present::SME_JOIN_REQ in unexpected state"),
1674 pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001675 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1676 psessionEntry = NULL;
1677 goto end;
1678 }
1679 }
1680
1681#endif
1682
1683
1684 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1685 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301686 limLog(pMac, LOGE, FL("Session(%d) Already exists for BSSID: "
1687 MAC_ADDRESS_STR" in limSmeState = %X"),sessionId,
1688 MAC_ADDR_ARRAY(pSmeJoinReq->bssDescription.bssId),
1689 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001690
1691 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1692 {
1693 // Received eWNI_SME_JOIN_REQ for same
1694 // BSS as currently associated.
1695 // Log the event and send success
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301696 PELOGW(limLog(pMac, LOGW, FL("SessionId:%d Received"
1697 "SME_JOIN_REQ for currently joined BSS"),sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001698 /// Send Join success response to host
Deepthi Gowrif3e27252013-12-11 20:50:01 +05301699 retCode = eSIR_SME_ALREADY_JOINED_A_BSS;
1700 psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001701 goto end;
1702 }
1703 else
1704 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301705 PELOGE(limLog(pMac, LOGE, FL("SME_JOIN_REQ not for"
1706 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001707 retCode = eSIR_SME_REFUSED;
1708 psessionEntry = NULL;
1709 goto end;
1710 }
1711 }
1712 else /* Session Entry does not exist for given BSSId */
1713 {
1714 /* Try to Create a new session */
1715 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1716 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001717 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001718 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1719 goto end;
1720 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301721 else
1722 limLog(pMac,LOG1,FL("SessionId:%d New session created"),
1723 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001724 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001725 handleHTCapabilityandHTInfo(pMac, psessionEntry);
krunal soni5afa96c2013-09-06 22:19:02 -07001726 psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
Jeff Johnsone7245742012-09-05 17:12:55 -07001727
Jeff Johnson295189b2012-06-20 16:38:30 -07001728 /* Store Session related parameters */
1729 /* Store PE session Id in session Table */
1730 psessionEntry->peSessionId = sessionId;
1731
1732 /* store the smejoin req handle in session table */
1733 psessionEntry->pLimJoinReq = pSmeJoinReq;
1734
1735 /* Store SME session Id in sessionTable */
1736 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1737
1738 /* Store SME transaction Id in session Table */
1739 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1740
1741 /* Store beaconInterval */
1742 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1743
1744 /* Copying of bssId is already done, while creating session */
1745 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1746 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1747 psessionEntry->bssType = pSmeJoinReq->bsstype;
1748
1749 psessionEntry->statypeForBss = STA_ENTRY_PEER;
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301750 psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled;
1751 psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001752
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301753 /* Store vendor specfic IE for CISCO AP */
1754 ieLen = (pSmeJoinReq->bssDescription.length +
1755 sizeof( pSmeJoinReq->bssDescription.length ) -
1756 GET_FIELD_OFFSET( tSirBssDescription, ieFields ));
1757
1758 vendorIE = limGetVendorIEOuiPtr(pMac, SIR_MAC_CISCO_OUI,
1759 SIR_MAC_CISCO_OUI_SIZE,
1760 ((tANI_U8 *)&pSmeJoinReq->bssDescription.ieFields) , ieLen);
1761
1762 if ( NULL != vendorIE )
1763 {
1764 limLog(pMac, LOGE,
1765 FL("DUT is trying to connect to Cisco AP"));
1766 psessionEntry->isCiscoVendorAP = TRUE;
1767 }
1768 else
1769 {
1770 psessionEntry->isCiscoVendorAP = FALSE;
1771 }
1772
Jeff Johnson295189b2012-06-20 16:38:30 -07001773 /* Copy the dot 11 mode in to the session table */
1774
1775 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1776 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001777#ifdef WLAN_FEATURE_11AC
1778 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001779 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001780 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001781 if (psessionEntry->vhtCapability )
1782 {
1783 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1784
1785 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001786 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001787 psessionEntry->txBFIniFeatureEnabled);
1788
1789 if( psessionEntry->txBFIniFeatureEnabled )
1790 {
1791 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1792 != eSIR_SUCCESS)
1793 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301794 limLog(pMac, LOGP, FL("could not set "
1795 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001796 retCode = eSIR_LOGP_EXCEPTION;
1797 goto end;
1798 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001799 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301800 "***__limProcessSmeJoinReq: txBFCsnValue=%d****",
1801 pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001802
1803 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001804 != eSIR_SUCCESS)
1805 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301806 limLog(pMac, LOGP, FL("could not set "
1807 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001808 retCode = eSIR_LOGP_EXCEPTION;
1809 goto end;
1810 }
1811 }
1812 }
1813
Jeff Johnsone7245742012-09-05 17:12:55 -07001814#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001815
1816 /*Phy mode*/
1817 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1818
1819 /* Copy The channel Id to the session Table */
1820 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001821 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1822 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1823 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001824
Chet Lanctot186b5732013-03-18 10:26:30 -07001825 /* Record if management frames need to be protected */
1826#ifdef WLAN_FEATURE_11W
1827 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1828 {
1829 psessionEntry->limRmfEnabled = 1;
1830 }
1831 else
1832 {
1833 psessionEntry->limRmfEnabled = 0;
1834 }
1835#endif
1836
krunal soni8d13b092013-07-19 13:23:29 -07001837#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1838 psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi;
1839#endif
1840
Jeff Johnson295189b2012-06-20 16:38:30 -07001841 /*Store Persona */
1842 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1843 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301844 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona,
1845 pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001846
1847 /* Copy the SSID from smejoinreq to session entry */
1848 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301849 vos_mem_copy( psessionEntry->ssId.ssId,
1850 pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length);
1851
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001852 // Determin 11r or ESE connection based on input from SME
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301853 // which inturn is dependent on the profile the user wants to connect
1854 // to, So input is coming from supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07001855#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301856 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001857#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001858#ifdef FEATURE_WLAN_ESE
1859 psessionEntry->isESEconnection = pSmeJoinReq->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001860#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001861#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301862 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001863#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301864
Jeff Johnson43971f52012-07-17 12:26:56 -07001865#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301866 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
Jeff Johnson43971f52012-07-17 12:26:56 -07001867#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301868 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001869
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301870 if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001871 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301872 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1873 }
1874 else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1875 {
1876 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1877 }
1878 else
1879 {
1880 /* Throw an error and return and make sure to delete the session.*/
Abhishek Singh57aebef2014-02-03 18:47:44 +05301881 limLog(pMac, LOGE, FL("received SME_JOIN_REQ with invalid"
1882 " bss type %d"), psessionEntry->bssType);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301883 retCode = eSIR_SME_INVALID_PARAMETERS;
1884 goto end;
1885 }
1886
1887 if (pSmeJoinReq->addIEScan.length)
1888 {
1889 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan,
Jeff Johnson295189b2012-06-20 16:38:30 -07001890 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
1891 }
1892
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301893 if (pSmeJoinReq->addIEAssoc.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07001894 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301895 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc,
Jeff Johnson295189b2012-06-20 16:38:30 -07001896 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
1897 }
1898
Jeff Johnson295189b2012-06-20 16:38:30 -07001899 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301900 pMlmJoinReq = vos_mem_malloc(val);
1901 if ( NULL == pMlmJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001902 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301903 limLog(pMac, LOGP, FL("call to AllocateMemory "
1904 "failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001905 return;
1906 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301907 (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001908
1909 /* PE SessionId is stored as a part of JoinReq*/
1910 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
1911
1912 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
1913 != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001914 limLog(pMac, LOGP, FL("could not retrieve JoinFailureTimer value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001915
1916 /* copy operational rate from psessionEntry*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301917 vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001918 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301919 vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 sizeof(tSirMacRateSet));
1921 //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 +05301922 vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001923 sizeof(tSirMacRateSet));
1924
1925 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
1926
Jeff Johnson295189b2012-06-20 16:38:30 -07001927 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
1928
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301929 vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001930 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
1931 psessionEntry->pLimJoinReq->bssDescription.length + 2);
1932
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07001934 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001935
Jeff Johnsone7245742012-09-05 17:12:55 -07001936 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Jeff Johnsone7245742012-09-05 17:12:55 -07001937 limExtractApCapability( pMac,
1938 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
1939 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
1940 &psessionEntry->limCurrentBssQosCaps,
1941 &psessionEntry->limCurrentBssPropCap,
1942 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07001943 , &localPowerConstraint,
1944 psessionEntry
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05301945 );
1946 /* If power constraint is zero then update it with Region max.
1947 MaxTxpower will be the MIN of regmax and power constraint */
1948 if( localPowerConstraint == 0 )
1949 {
1950 localPowerConstraint = regMax;
1951 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001952#ifdef FEATURE_WLAN_ESE
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001953 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07001954#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301955 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001956#endif
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05301957 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1958 "Regulatory max = %d, local power constraint = %d,"
Abhishek Singh57aebef2014-02-03 18:47:44 +05301959 " max tx = %d", regMax, localPowerConstraint,
1960 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07001961
1962 if (pMac->lim.gLimCurrentBssUapsd)
1963 {
1964 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301965 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
1966 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07001967
1968 // resetting the dynamic uapsd mask
1969 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
1970 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
1971 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001972
1973 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
1974
1975 // Initialize 11h Enable Flag
1976 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
1977 {
1978 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001979 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 psessionEntry->lim11hEnable = val;
1981 }
1982 else
1983 psessionEntry->lim11hEnable = 0;
1984
1985 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
1986 pMac->lim.gLimIbssCoalescingHappened = false;
1987
Jeff Johnsone7245742012-09-05 17:12:55 -07001988 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
1989 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
1990 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001991
Abhishek Singh57aebef2014-02-03 18:47:44 +05301992 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
1993 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
1994 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
1995 psessionEntry->currentOperChannel,
1996 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07001997
1998 /* Indicate whether spectrum management is enabled*/
1999 psessionEntry->spectrumMgtEnabled =
2000 pSmeJoinReq->spectrumMgtIndicator;
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05302001 PELOG1(limLog(pMac,LOG1,FL("SessionId:%d MLM_JOIN_REQ is posted to MLM"
2002 "SM"),pMlmJoinReq->sessionId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002003 /* Issue LIM_MLM_JOIN_REQ to MLM */
2004 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
2005 return;
2006
2007 }
2008 else
2009 {
2010 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05302011 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
2012 "in state %X"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002013 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
2014 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2015 psessionEntry = NULL;
2016 goto end;
2017
2018 }
2019
2020end:
2021 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
2022
2023 if(pSmeJoinReq)
2024 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302025 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002026 pSmeJoinReq = NULL;
2027 if (NULL != psessionEntry)
2028 {
2029 psessionEntry->pLimJoinReq = NULL;
2030 }
2031 }
2032
2033 if(retCode != eSIR_SME_SUCCESS)
2034 {
2035 if(NULL != psessionEntry)
2036 {
2037 peDeleteSession(pMac,psessionEntry);
2038 psessionEntry = NULL;
2039 }
2040 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05302041 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
2042 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002043 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
2044} /*** end __limProcessSmeJoinReq() ***/
2045
2046
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002047#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08002048tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07002049{
2050 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302051 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002052 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2054 maxTxPower = txPower;
2055 else if (txPower < MIN_TX_PWR_CAP)
2056 maxTxPower = MIN_TX_PWR_CAP;
2057 else
2058 maxTxPower = MAX_TX_PWR_CAP;
2059
2060 return (maxTxPower);
2061}
2062#endif
2063
Jeff Johnson295189b2012-06-20 16:38:30 -07002064/**
2065 * __limProcessSmeReassocReq()
2066 *
2067 *FUNCTION:
2068 * This function is called to process SME_REASSOC_REQ message
2069 * from HDD or upper layer application.
2070 *
2071 *LOGIC:
2072 *
2073 *ASSUMPTIONS:
2074 *
2075 *NOTE:
2076 *
2077 * @param pMac Pointer to Global MAC structure
2078 * @param *pMsgBuf A pointer to the SME message buffer
2079 * @return None
2080 */
2081
2082static void
2083__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2084{
2085 tANI_U16 caps;
2086 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002087 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002088 tLimMlmReassocReq *pMlmReassocReq;
2089 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2090 tpPESession psessionEntry = NULL;
2091 tANI_U8 sessionId;
2092 tANI_U8 smeSessionId;
2093 tANI_U16 transactionId;
2094 tPowerdBm localPowerConstraint = 0, regMax = 0;
2095 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002096 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002097
2098
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002099 PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002100
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002101 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302102 pReassocReq = vos_mem_malloc(nSize);
2103 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 {
2105 // Log error
2106 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302107 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002108
2109 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2110 goto end;
2111 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302112 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002113 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2114 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2115 (!limIsSmeJoinReqValid(pMac,
2116 (tpSirSmeJoinReq) pReassocReq)))
2117 {
2118 /// Received invalid eWNI_SME_REASSOC_REQ
2119 // Log the event
2120 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002121 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002122
2123 retCode = eSIR_SME_INVALID_PARAMETERS;
2124 goto end;
2125 }
2126
2127 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2128 {
2129 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002130 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002131 retCode = eSIR_SME_INVALID_PARAMETERS;
2132 goto end;
2133 }
2134
2135#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2136 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2137#endif //FEATURE_WLAN_DIAG_SUPPORT
2138 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2139
2140 /* Store the reassoc handle in the session Table.. 23rd sep review */
2141 psessionEntry->pLimReAssocReq = pReassocReq;
2142
2143 /**
2144 * Reassociate request is expected
2145 * in link established state only.
2146 */
2147
2148 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2149 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002150#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002151 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2152 {
2153 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002154 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002155 psessionEntry->peSessionId);
2156
2157 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302158 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2160 {
2161 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2162 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002163 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002164 retCode = eSIR_SME_INVALID_PARAMETERS;
2165 goto end;
2166 }
2167
2168 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2169 return;
2170 }
2171#endif
2172 /// Should not have received eWNI_SME_REASSOC_REQ
2173 // Log the event
2174 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002175 FL("received unexpected SME_REASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 psessionEntry->limSmeState);
2177 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2178
2179 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2180 goto end;
2181 }
2182
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302183 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2185 sizeof(tSirMacAddr));
2186
2187 psessionEntry->limReassocChannelId =
2188 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2189
Jeff Johnsone7245742012-09-05 17:12:55 -07002190 psessionEntry->reAssocHtSupportedChannelWidthSet =
2191 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2192 psessionEntry->reAssocHtRecommendedTxWidthSet =
2193 psessionEntry->reAssocHtSupportedChannelWidthSet;
2194 psessionEntry->reAssocHtSecondaryChannelOffset =
2195 psessionEntry->pLimReAssocReq->cbMode;
2196
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 psessionEntry->limReassocBssCaps =
2198 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2200 localPowerConstraint = regMax;
2201 limExtractApCapability( pMac,
2202 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2203 limGetIElenFromBssDescription(
2204 &psessionEntry->pLimReAssocReq->bssDescription),
2205 &psessionEntry->limReassocBssQosCaps,
2206 &psessionEntry->limReassocBssPropCap,
2207 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002208 , &localPowerConstraint,
2209 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002210 );
2211
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302212 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002213#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302214 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2215 "= %d, max tx = %d", regMax, localPowerConstraint,
2216 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002217#endif
2218 {
2219 #if 0
2220 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2221 &cfgLen) != eSIR_SUCCESS)
2222 {
2223 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002224 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 }
2226 #endif//TO SUPPORT BT-AMP
2227
2228 /* Copy the SSID from sessio entry to local variable */
2229 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302230 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002231 psessionEntry->ssId.ssId,
2232 psessionEntry->ssId.length);
2233 #endif
2234 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302235 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2237
2238 }
2239
2240 if (pMac->lim.gLimCurrentBssUapsd)
2241 {
2242 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302243 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2244 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 }
2246
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302247 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2248 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 {
2250 // Log error
2251 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302252 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002253
2254 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2255 goto end;
2256 }
2257
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302258 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 psessionEntry->limReAssocbssId,
2260 sizeof(tSirMacAddr));
2261
2262 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2263 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2264 != eSIR_SUCCESS)
2265 {
2266 /**
2267 * Could not get ReassocFailureTimeout value
2268 * from CFG. Log error.
2269 */
2270 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002271 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002272 }
2273
2274 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2275 {
2276 /**
2277 * Could not get Capabilities value
2278 * from CFG. Log error.
2279 */
2280 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002281 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002282 }
2283 pMlmReassocReq->capabilityInfo = caps;
2284
2285 /* Update PE sessionId*/
2286 pMlmReassocReq->sessionId = sessionId;
2287
2288 /* If telescopic beaconing is enabled, set listen interval to
2289 WNI_CFG_TELE_BCN_MAX_LI */
2290 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2291 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002292 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002293
2294 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2295
2296 if(teleBcnEn)
2297 {
2298 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2299 eSIR_SUCCESS)
2300 {
2301 /**
2302 * Could not get ListenInterval value
2303 * from CFG. Log error.
2304 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002305 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002306 }
2307 }
2308 else
2309 {
2310 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2311 {
2312 /**
2313 * Could not get ListenInterval value
2314 * from CFG. Log error.
2315 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002316 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002317 }
2318 }
2319
2320 /* Delete all BA sessions before Re-Assoc.
2321 * BA frames are class 3 frames and the session
2322 * is lost upon disassociation and reassociation.
2323 */
2324
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07002325 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS);
Jeff Johnson295189b2012-06-20 16:38:30 -07002326
2327 pMlmReassocReq->listenInterval = (tANI_U16) val;
2328
2329 /* Indicate whether spectrum management is enabled*/
2330 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2331
2332 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2333 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2334
Jeff Johnsone7245742012-09-05 17:12:55 -07002335 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002336
2337 limPostMlmMessage(pMac,
2338 LIM_MLM_REASSOC_REQ,
2339 (tANI_U32 *) pMlmReassocReq);
2340 return;
2341
2342end:
2343 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302344 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002345
2346 if (psessionEntry)
2347 {
2348 // error occurred after we determined the session so extract
2349 // session and transaction info from there
2350 smeSessionId = psessionEntry->smeSessionId;
2351 transactionId = psessionEntry->transactionId;
2352 }
2353 else
2354 {
2355 // error occurred before or during the time we determined the session
2356 // so extract the session and transaction info from the message
2357 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2358 }
2359
2360 /// Send Reassoc failure response to host
2361 /// (note psessionEntry may be NULL, but that's OK)
2362 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2363 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2364 psessionEntry, smeSessionId, transactionId);
2365
2366} /*** end __limProcessSmeReassocReq() ***/
2367
2368
2369tANI_BOOLEAN sendDisassocFrame = 1;
2370/**
2371 * __limProcessSmeDisassocReq()
2372 *
2373 *FUNCTION:
2374 * This function is called to process SME_DISASSOC_REQ message
2375 * from HDD or upper layer application.
2376 *
2377 *LOGIC:
2378 *
2379 *ASSUMPTIONS:
2380 *
2381 *NOTE:
2382 *
2383 * @param pMac Pointer to Global MAC structure
2384 * @param *pMsgBuf A pointer to the SME message buffer
2385 * @return None
2386 */
2387
2388static void
2389__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2390{
2391 tANI_U16 disassocTrigger, reasonCode;
2392 tLimMlmDisassocReq *pMlmDisassocReq;
2393 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002394 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002395 tSirSmeDisassocReq smeDisassocReq;
2396 tpPESession psessionEntry = NULL;
2397 tANI_U8 sessionId;
2398 tANI_U8 smesessionId;
2399 tANI_U16 smetransactionId;
2400
Jeff Johnson295189b2012-06-20 16:38:30 -07002401
Jeff Johnson43971f52012-07-17 12:26:56 -07002402 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002403 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002404 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002405 return;
2406 }
2407
Jeff Johnson43971f52012-07-17 12:26:56 -07002408 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002409
Jeff Johnson43971f52012-07-17 12:26:56 -07002410 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002411
Jeff Johnson43971f52012-07-17 12:26:56 -07002412 if ( (eSIR_FAILURE == status) ||
2413 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002414 {
2415 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002416 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002417
2418 if (pMac->lim.gLimRspReqd)
2419 {
2420 pMac->lim.gLimRspReqd = false;
2421
2422 retCode = eSIR_SME_INVALID_PARAMETERS;
2423 disassocTrigger = eLIM_HOST_DISASSOC;
2424 goto sendDisassoc;
2425 }
2426
2427 return;
2428 }
2429
Jeff Johnson295189b2012-06-20 16:38:30 -07002430 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2431 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302432 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2433 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002434 retCode = eSIR_SME_INVALID_PARAMETERS;
2435 disassocTrigger = eLIM_HOST_DISASSOC;
2436 goto sendDisassoc;
2437
2438 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302439 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2440 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2441 smesessionId,psessionEntry->limSystemRole,
2442 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2443 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002444
2445#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2446 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2447#endif //FEATURE_WLAN_DIAG_SUPPORT
2448
2449 /* Update SME session Id and SME transaction ID*/
2450
2451 psessionEntry->smeSessionId = smesessionId;
2452 psessionEntry->transactionId = smetransactionId;
2453
2454 switch (psessionEntry->limSystemRole)
2455 {
2456 case eLIM_STA_ROLE:
2457 case eLIM_BT_AMP_STA_ROLE:
2458 switch (psessionEntry->limSmeState)
2459 {
2460 case eLIM_SME_ASSOCIATED_STATE:
2461 case eLIM_SME_LINK_EST_STATE:
2462 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2463 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002464#ifdef FEATURE_WLAN_TDLS
2465 /* Delete all TDLS peers connected before leaving BSS*/
2466 limDeleteTDLSPeers(pMac, psessionEntry);
2467#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002468 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302469 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2470 "limSmeState: %d "),psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002471 break;
2472
2473 case eLIM_SME_WT_DEAUTH_STATE:
2474 /* PE shall still process the DISASSOC_REQ and proceed with
2475 * link tear down even if it had already sent a DEAUTH_IND to
2476 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2477 * its been set when PE entered WT_DEAUTH_STATE.
2478 */
2479 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002480 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302481 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2482 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002483 break;
2484
2485 case eLIM_SME_WT_DISASSOC_STATE:
2486 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2487 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2488 * PE can continue processing DISASSOC_REQ and send the response instead
2489 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2490 * for disassoc frame.
2491 *
2492 * It will send a disassoc, which is ok. However, we can use the global flag
2493 * sendDisassoc to not send disassoc frame.
2494 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302495 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2496 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002497 break;
2498
2499 case eLIM_SME_JOIN_FAILURE_STATE: {
2500 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302501 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2502 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 if (pMac->lim.gLimRspReqd) {
2504 retCode = eSIR_SME_SUCCESS;
2505 disassocTrigger = eLIM_HOST_DISASSOC;
2506 goto sendDisassoc;
2507 }
2508 }break;
2509 default:
2510 /**
2511 * STA is not currently associated.
2512 * Log error and send response to host
2513 */
2514 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002515 FL("received unexpected SME_DISASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002516 psessionEntry->limSmeState);
2517 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2518
2519 if (pMac->lim.gLimRspReqd)
2520 {
2521 if (psessionEntry->limSmeState !=
2522 eLIM_SME_WT_ASSOC_STATE)
2523 pMac->lim.gLimRspReqd = false;
2524
2525 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2526 disassocTrigger = eLIM_HOST_DISASSOC;
2527 goto sendDisassoc;
2528 }
2529
2530 return;
2531 }
2532
2533 break;
2534
2535 case eLIM_AP_ROLE:
2536 case eLIM_BT_AMP_AP_ROLE:
2537 // Fall through
2538 break;
2539
2540 case eLIM_STA_IN_IBSS_ROLE:
2541 default: // eLIM_UNKNOWN_ROLE
2542 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002543 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 psessionEntry->limSystemRole);
2545
2546 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2547 disassocTrigger = eLIM_HOST_DISASSOC;
2548 goto sendDisassoc;
2549 } // end switch (pMac->lim.gLimSystemRole)
2550
2551 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2552 {
2553 /// Disassociation is triggered by Link Monitoring
Abhishek Singhcd09b562013-12-24 16:02:20 +05302554 limLog(pMac, LOG1, FL("**** Lost link with AP ****"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2556 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2557 }
2558 else
2559 {
2560 disassocTrigger = eLIM_HOST_DISASSOC;
2561 reasonCode = smeDisassocReq.reasonCode;
2562 }
2563
2564 if (smeDisassocReq.doNotSendOverTheAir)
2565 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302566 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002567 sendDisassocFrame = 0;
2568 }
2569 // Trigger Disassociation frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302570
2571 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2572 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002573 {
2574 // Log error
2575 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302576 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002577
2578 return;
2579 }
2580
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302581 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002582 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2583 sizeof(tSirMacAddr));
2584
2585 pMlmDisassocReq->reasonCode = reasonCode;
2586 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2587
2588 /* Update PE session ID*/
2589 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002590
2591 limPostMlmMessage(pMac,
2592 LIM_MLM_DISASSOC_REQ,
2593 (tANI_U32 *) pMlmDisassocReq);
2594 return;
2595
2596sendDisassoc:
2597 if (psessionEntry)
2598 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2599 retCode,
2600 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002601 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002602 else
2603 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2604 retCode,
2605 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002606 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002607
2608
2609} /*** end __limProcessSmeDisassocReq() ***/
2610
2611
2612/** -----------------------------------------------------------------
2613 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2614
2615 This function is called to process SME_DISASSOC_CNF message
2616 from HDD or upper layer application.
2617
2618 \param pMac - global mac structure
2619 \param pStaDs - station dph hash node
2620 \return none
2621 \sa
2622 ----------------------------------------------------------------- */
2623static void
2624__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2625{
2626 tSirSmeDisassocCnf smeDisassocCnf;
2627 tANI_U16 aid;
2628 tpDphHashNode pStaDs;
2629 tSirRetStatus status = eSIR_SUCCESS;
2630 tpPESession psessionEntry;
2631 tANI_U8 sessionId;
2632
2633
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002634 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002635
2636 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2637
2638 if (status == eSIR_FAILURE)
2639 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002640 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002641 return;
2642 }
2643
2644 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2645 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002646 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002647 return;
2648 }
2649
2650 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2651 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302652 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002653 return;
2654 }
2655
2656#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2657 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2658 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2659 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2660 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2661#endif //FEATURE_WLAN_DIAG_SUPPORT
2662
2663 switch (psessionEntry->limSystemRole)
2664 {
2665 case eLIM_STA_ROLE:
2666 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2667 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2668 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2669 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2670 {
2671 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002672 FL("received unexp SME_DISASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002673 psessionEntry->limSmeState);
2674 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2675 return;
2676 }
2677 break;
2678
2679 case eLIM_AP_ROLE:
2680 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002681 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002682
2683 case eLIM_STA_IN_IBSS_ROLE:
2684 default: // eLIM_UNKNOWN_ROLE
2685 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002686 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002687 psessionEntry->limSystemRole);
2688
2689 return;
2690 }
2691
2692
2693 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2694 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002695 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002696 )
2697 {
2698 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2699 if (pStaDs == NULL)
2700 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302701 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2702 "does not have context, addr= "MAC_ADDRESS_STR),
2703 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002704 return;
2705 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002706 /* Delete FT session if there exists one */
2707 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002708 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002709
2710 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 }
2712
2713 return;
2714}
2715
2716
2717/**
2718 * __limProcessSmeDeauthReq()
2719 *
2720 *FUNCTION:
2721 * This function is called to process SME_DEAUTH_REQ message
2722 * from HDD or upper layer application.
2723 *
2724 *LOGIC:
2725 *
2726 *ASSUMPTIONS:
2727 *
2728 *NOTE:
2729 *
2730 * @param pMac Pointer to Global MAC structure
2731 * @param *pMsgBuf A pointer to the SME message buffer
2732 * @return None
2733 */
2734
2735static void
2736__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2737{
2738 tANI_U16 deauthTrigger, reasonCode;
2739 tLimMlmDeauthReq *pMlmDeauthReq;
2740 tSirSmeDeauthReq smeDeauthReq;
2741 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2742 tSirRetStatus status = eSIR_SUCCESS;
2743 tpPESession psessionEntry;
2744 tANI_U8 sessionId; //PE sessionId
2745 tANI_U8 smesessionId;
2746 tANI_U16 smetransactionId;
2747
Jeff Johnson295189b2012-06-20 16:38:30 -07002748
2749 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002750 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2751
2752 //We need to get a session first but we don't even know if the message is correct.
2753 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2754 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002755 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002756 retCode = eSIR_SME_INVALID_PARAMETERS;
2757 deauthTrigger = eLIM_HOST_DEAUTH;
2758 goto sendDeauth;
2759
2760 }
2761
2762 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2763 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002764 PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002765 if (pMac->lim.gLimRspReqd)
2766 {
2767 pMac->lim.gLimRspReqd = false;
2768
2769 retCode = eSIR_SME_INVALID_PARAMETERS;
2770 deauthTrigger = eLIM_HOST_DEAUTH;
2771 goto sendDeauth;
2772 }
2773
2774 return;
2775 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302776 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2777 "Systemrole %d with reasoncode %u in limSmestate %d from "
2778 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2779 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2780 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002781#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2782 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2783#endif //FEATURE_WLAN_DIAG_SUPPORT
2784
2785 /* Update SME session ID and Transaction ID */
2786 psessionEntry->smeSessionId = smesessionId;
2787 psessionEntry->transactionId = smetransactionId;
2788
2789
2790 switch (psessionEntry->limSystemRole)
2791 {
2792 case eLIM_STA_ROLE:
2793 case eLIM_BT_AMP_STA_ROLE:
2794
2795 switch (psessionEntry->limSmeState)
2796 {
2797 case eLIM_SME_ASSOCIATED_STATE:
2798 case eLIM_SME_LINK_EST_STATE:
2799 case eLIM_SME_WT_ASSOC_STATE:
2800 case eLIM_SME_JOIN_FAILURE_STATE:
2801 case eLIM_SME_IDLE_STATE:
2802 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2803 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002804 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002805
2806 // Send Deauthentication request to MLM below
2807
2808 break;
2809
2810 default:
2811 /**
2812 * STA is not in a state to deauthenticate with
2813 * peer. Log error and send response to host.
2814 */
2815 limLog(pMac, LOGE,
Abhishek Singhcd09b562013-12-24 16:02:20 +05302816 FL("received unexp SME_DEAUTH_REQ in state %X"),
2817 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002818 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2819
2820 if (pMac->lim.gLimRspReqd)
2821 {
2822 pMac->lim.gLimRspReqd = false;
2823
2824 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2825 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08002826 /**
2827 *here we received deauth request from AP so sme state is
2828 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
2829 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
2830 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
2831 so the below condition captures the state where delSta
2832 not done and firmware still in connected state.
2833 */
2834 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
2835 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
2836 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
2837 {
2838 retCode = eSIR_SME_DEAUTH_STATUS;
2839 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002840 goto sendDeauth;
2841 }
2842
2843 return;
2844 }
2845
2846 break;
2847
2848 case eLIM_STA_IN_IBSS_ROLE:
2849
2850 return;
2851
2852 case eLIM_AP_ROLE:
2853 // Fall through
2854
2855 break;
2856
2857 default:
2858 limLog(pMac, LOGE,
Abhishek Singhcd09b562013-12-24 16:02:20 +05302859 FL("received unexpected SME_DEAUTH_REQ for role %X"),
2860 psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07002861
2862 return;
2863 } // end switch (pMac->lim.gLimSystemRole)
2864
2865 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
2866 {
2867 /// Deauthentication is triggered by Link Monitoring
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002868 PELOG1(limLog(pMac, LOG1, FL("**** Lost link with AP ****"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002869 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
2870 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
2871 }
2872 else
2873 {
2874 deauthTrigger = eLIM_HOST_DEAUTH;
2875 reasonCode = smeDeauthReq.reasonCode;
2876 }
2877
2878 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302879 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
2880 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002881 {
2882 // Log error
2883 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302884 FL("call to AllocateMemory failed for mlmDeauthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002885
2886 return;
2887 }
2888
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302889 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002890 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
2891 sizeof(tSirMacAddr));
2892
2893 pMlmDeauthReq->reasonCode = reasonCode;
2894 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07002895
2896 /* Update PE session Id*/
2897 pMlmDeauthReq->sessionId = sessionId;
2898
2899 limPostMlmMessage(pMac,
2900 LIM_MLM_DEAUTH_REQ,
2901 (tANI_U32 *) pMlmDeauthReq);
2902 return;
2903
2904sendDeauth:
2905 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
2906 retCode,
2907 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002908 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002909 smesessionId, smetransactionId);
2910} /*** end __limProcessSmeDeauthReq() ***/
2911
2912
2913
2914/**
2915 * __limProcessSmeSetContextReq()
2916 *
2917 *FUNCTION:
2918 * This function is called to process SME_SETCONTEXT_REQ message
2919 * from HDD or upper layer application.
2920 *
2921 *LOGIC:
2922 *
2923 *ASSUMPTIONS:
2924 *
2925 *NOTE:
2926 *
2927 * @param pMac Pointer to Global MAC structure
2928 * @param *pMsgBuf A pointer to the SME message buffer
2929 * @return None
2930 */
2931
2932static void
2933__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2934{
2935 tpSirSmeSetContextReq pSetContextReq;
2936 tLimMlmSetKeysReq *pMlmSetKeysReq;
2937 tpPESession psessionEntry;
2938 tANI_U8 sessionId; //PE sessionID
2939 tANI_U8 smesessionId;
2940 tANI_U16 smetransactionId;
2941
2942
2943 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002944 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07002945
2946
2947 if(pMsgBuf == NULL)
2948 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002949 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002950 return;
2951 }
2952
2953 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302954
2955 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
2956 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002957 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302958 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002959 return;
2960 }
2961
2962 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2963 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
2964 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002965 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002966 goto end;
2967 }
2968
2969 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2970 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002971 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 -07002972 limSendSmeSetContextRsp(pMac,
2973 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002974 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002975 eSIR_SME_INVALID_PARAMETERS,NULL,
2976 smesessionId,smetransactionId);
2977
2978 goto end;
2979 }
2980
2981
2982 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
2983 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002984 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002985 limSendSmeSetContextRsp(pMac,
2986 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002987 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002988 eSIR_SME_INVALID_PARAMETERS,NULL,
2989 smesessionId,smetransactionId);
2990
2991 goto end;
2992 }
2993
2994#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2995 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
2996#endif //FEATURE_WLAN_DIAG_SUPPORT
2997
2998
2999 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
3000 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3001 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3002 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3003 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3004 {
3005 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303006 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
3007 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003008 {
3009 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303010 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003011 goto end;
3012 }
3013
3014 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
3015 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
3016 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3017 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003018 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003019 goto end;
3020 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303021 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003022 (tANI_U8 *) &pSetContextReq->peerMacAddr,
3023 sizeof(tSirMacAddr));
3024
Jeff Johnson295189b2012-06-20 16:38:30 -07003025
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303026 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07003027 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
3028 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
3029
3030 pMlmSetKeysReq->sessionId = sessionId;
3031#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3032 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003033 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07003034#endif
3035
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
3037 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
3038 {
3039 if(pSetContextReq->keyMaterial.key[0].keyLength)
3040 {
3041 tANI_U8 keyId;
3042 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303043 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07003044 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
3045 }
3046 else {
3047 tANI_U32 i;
3048 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3049 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303050 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003051 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3052 }
3053 }
3054 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003055
3056 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 }
3058 else
3059 {
3060 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003061 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003062 psessionEntry->limSystemRole,
3063 psessionEntry->limSmeState);
3064 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3065
3066 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003067 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003068 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3069 smesessionId,
3070 smetransactionId);
3071 }
3072
3073end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303074 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003075 return;
3076} /*** end __limProcessSmeSetContextReq() ***/
3077
3078/**
3079 * __limProcessSmeRemoveKeyReq()
3080 *
3081 *FUNCTION:
3082 * This function is called to process SME_REMOVEKEY_REQ message
3083 * from HDD or upper layer application.
3084 *
3085 *LOGIC:
3086 *
3087 *ASSUMPTIONS:
3088 *
3089 *NOTE:
3090 *
3091 * @param pMac Pointer to Global MAC structure
3092 * @param *pMsgBuf A pointer to the SME message buffer
3093 * @return None
3094 */
3095
3096static void
3097__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3098{
3099 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3100 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3101 tpPESession psessionEntry;
3102 tANI_U8 sessionId; //PE sessionID
3103 tANI_U8 smesessionId;
3104 tANI_U16 smetransactionId;
3105
3106 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003107 FL("received REMOVEKEY_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003108
3109 if(pMsgBuf == NULL)
3110 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003111 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003112 return;
3113 }
3114
3115
3116 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3117
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303118 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3119 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003120 {
3121 //Log error
3122 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303123 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003124
3125 return;
3126 }
3127
3128 if ((limRemoveKeyReqSerDes(pMac,
3129 pRemoveKeyReq,
3130 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3131 {
3132 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003133 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003134
3135 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3136
3137 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3138 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003139 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003140 //goto end;
3141 }
3142
3143 limSendSmeRemoveKeyRsp(pMac,
3144 pRemoveKeyReq->peerMacAddr,
3145 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3146 smesessionId,smetransactionId);
3147
3148 goto end;
3149 }
3150
3151 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3152 {
3153 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003154 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003155 limSendSmeRemoveKeyRsp(pMac,
3156 pRemoveKeyReq->peerMacAddr,
3157 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3158 smesessionId, smetransactionId);
3159 goto end;
3160 }
3161
3162
3163 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3164 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3165 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3166 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3167 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3168 {
3169 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303170 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3171 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003172 {
3173 // Log error
3174 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303175 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003176
3177 goto end;
3178 }
3179
3180 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3181 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3182 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3183 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3184
3185 /* Update PE session Id */
3186 pMlmRemoveKeyReq->sessionId = sessionId;
3187
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303188 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003189 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3190 sizeof(tSirMacAddr));
3191
3192
3193 limPostMlmMessage(pMac,
3194 LIM_MLM_REMOVEKEY_REQ,
3195 (tANI_U32 *) pMlmRemoveKeyReq);
3196 }
3197 else
3198 {
3199 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003200 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003201 psessionEntry->limSystemRole,
3202 psessionEntry->limSmeState);
3203 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3204
3205 limSendSmeRemoveKeyRsp(pMac,
3206 pRemoveKeyReq->peerMacAddr,
3207 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3208 smesessionId,smetransactionId);
3209 }
3210
3211end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303212 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003213} /*** end __limProcessSmeRemoveKeyReq() ***/
3214
Jeff Johnson295189b2012-06-20 16:38:30 -07003215void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3216{
3217 tSirMsgQ mmhMsg;
3218 tpSmeGetScanChnRsp pSirSmeRsp;
3219 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303220 tANI_U8 sessionId;
3221 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003222
3223 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3224 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003225 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003226 pMac->lim.scanChnInfo.numChnInfo);
3227 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3228 }
3229
3230 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003231 FL("Sending message %s with number of channels %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003232 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);)
3233
3234 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303235 pSirSmeRsp = vos_mem_malloc(len);
3236 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003237 {
3238 /// Buffer not available. Log error
3239 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303240 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003241
3242 return;
3243 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303244 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003245
Jeff Johnson295189b2012-06-20 16:38:30 -07003246 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3247 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303248
3249 if (pMac->fScanOffload)
3250 {
3251 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3252 pSirSmeRsp->sessionId = sessionId;
3253 }
3254 else
3255 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003256
3257 if(pMac->lim.scanChnInfo.numChnInfo)
3258 {
3259 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303260 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3261 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003262 }
3263 //Clear the list
3264 limRessetScanChannelInfo(pMac);
3265
3266 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3267 mmhMsg.bodyptr = pSirSmeRsp;
3268 mmhMsg.bodyval = 0;
3269
3270 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003271 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003272 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3273}
3274
3275
Jeff Johnson295189b2012-06-20 16:38:30 -07003276void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3277{
3278 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3279 tpDphHashNode pStaDs = NULL;
3280 tpPESession psessionEntry = NULL;
3281 tSap_Event sapEvent;
3282 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3283 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3284 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3285 tANI_U8 assocId = 0;
3286 tANI_U8 staCount = 0;
3287
3288 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3289 {
3290 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003291 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003292 goto limAssocStaEnd;
3293 }
3294
3295 switch (getAssocSTAsReq.modId)
3296 {
3297/**
3298 case VOS_MODULE_ID_HAL:
3299 wdaPostCtrlMsg( pMac, &msgQ );
3300 return;
3301
3302 case VOS_MODULE_ID_TL:
3303 Post msg TL
3304 return;
3305*/
3306 case VOS_MODULE_ID_PE:
3307 default:
3308 break;
3309 }
3310
Jeff Johnson1250df42012-12-10 14:31:52 -08003311 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003312 // Find PE session Entry
3313 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3314 {
3315 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003316 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003317 goto limAssocStaEnd;
3318 }
3319
3320 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3321 {
3322 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003323 FL("Received unexpected message in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303324 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003325 goto limAssocStaEnd;
3326 }
3327
3328 // Retrieve values obtained in the request message
3329 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3330 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3331
3332 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3333 {
3334 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3335
3336 if (NULL == pStaDs)
3337 continue;
3338
3339 if (pStaDs->valid)
3340 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303341 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3342 (tANI_U8 *)&pStaDs->staAddr,
3343 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003344 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3345 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3346
Kiet Lamb1233192013-11-28 13:38:20 +05303347 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003348 (tANI_U8 *)&pStaDs->supportedRates,
3349 sizeof(tSirSupportedRates));
3350 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3351 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3352 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3353
Jeff Johnson295189b2012-06-20 16:38:30 -07003354 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003355 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3356 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003357 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3358 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3359
3360 pAssocStasTemp++;
3361 staCount++;
3362 }
3363 }
3364
3365limAssocStaEnd:
3366 // Call hdd callback with sap event to send the list of associated stations from PE
3367 if (pSapEventCallback != NULL)
3368 {
3369 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3370 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3371 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3372 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3373 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3374 }
3375}
3376
3377
3378/**
3379 * limProcessSmeGetWPSPBCSessions
3380 *
3381 *FUNCTION:
3382 * This function is called when query the WPS PBC overlap message is received
3383 *
3384 *LOGIC:
3385 * This function parses get WPS PBC overlap information message and call callback to pass
3386 * WPS PBC overlap information back to hdd.
3387 *ASSUMPTIONS:
3388 *
3389 *
3390 *NOTE:
3391 *
3392 * @param pMac Pointer to Global MAC structure
3393 * @param pMsgBuf A pointer to WPS PBC overlap query message
3394*
3395 * @return None
3396 */
3397void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3398{
3399 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3400 tpPESession psessionEntry = NULL;
3401 tSap_Event sapEvent;
3402 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3403 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3404 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3405
3406 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3407
3408 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3409 {
3410 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003411 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 goto limGetWPSPBCSessionsEnd;
3413 }
3414
Jeff Johnson1250df42012-12-10 14:31:52 -08003415 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003416 // Find PE session Entry
3417 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3418 {
3419 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003420 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003421 goto limGetWPSPBCSessionsEnd;
3422 }
3423
3424 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3425 {
3426 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003427 FL("Received unexpected message in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003428 psessionEntry->limSystemRole);
3429 goto limGetWPSPBCSessionsEnd;
3430 }
3431
Jeff Johnson1250df42012-12-10 14:31:52 -08003432 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003433 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3434 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3435
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303436 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003437 { //This is GetWpsSession call
3438
3439 limGetWPSPBCSessions(pMac,
3440 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3441 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3442 }
3443 else
3444 {
3445 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3446 /* don't have to inform the HDD/Host */
3447 return;
3448 }
3449
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003450 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003451 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3452
3453 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3454
3455limGetWPSPBCSessionsEnd:
3456 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
3457 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
3458}
3459
Jeff Johnson295189b2012-06-20 16:38:30 -07003460
3461
3462/**
3463 * __limCounterMeasures()
3464 *
3465 * FUNCTION:
3466 * This function is called to "implement" MIC counter measure
3467 * and is *temporary* only
3468 *
3469 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3470 * we don't do the proper STA disassoc sequence since the
3471 * BSS will be stoped anyway
3472 *
3473 *ASSUMPTIONS:
3474 *
3475 *NOTE:
3476 *
3477 * @param pMac Pointer to Global MAC structure
3478 * @return None
3479 */
3480
3481static void
3482__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3483{
3484 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3485 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
3486 || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
3487
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003488 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003489
Jeff Johnson295189b2012-06-20 16:38:30 -07003490};
3491
3492
Jeff Johnson295189b2012-06-20 16:38:30 -07003493void
3494limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3495{
3496 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3497 tpPESession psessionEntry;
3498 tANI_U8 sessionId; //PE sessionId
3499
3500 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3501 {
3502 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003503 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003504 return;
3505 }
3506
3507 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3508 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003509 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003510 return;
3511 }
3512
3513 if ( tkipCntrMeasReq.bEnable )
3514 {
3515 __limCounterMeasures( pMac, psessionEntry );
3516 }
3517
3518 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3519}
Jeff Johnson295189b2012-06-20 16:38:30 -07003520
3521
3522static void
3523__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3524{
3525 tSirSmeStopBssReq stopBssReq;
3526 tSirRetStatus status;
3527 tLimSmeStates prevState;
3528 tANI_U8 sessionId; //PE sessionId
3529 tpPESession psessionEntry;
3530 tANI_U8 smesessionId;
3531 tANI_U16 smetransactionId;
3532
3533 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3534
3535
3536
3537 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3538 !limIsSmeStopBssReqValid(pMsgBuf))
3539 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003540 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003541 /// Send Stop BSS response to host
3542 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3543 return;
3544 }
3545
3546
3547 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3548 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003549 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003550 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3551 return;
3552 }
3553
3554#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3555 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3556#endif //FEATURE_WLAN_DIAG_SUPPORT
3557
3558
3559 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3560 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3561 {
3562 /**
3563 * Should not have received STOP_BSS_REQ in states
3564 * other than 'normal' state or on STA in Infrastructure
3565 * mode. Log error and return response to host.
3566 */
3567 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003568 FL("received unexpected SME_STOP_BSS_REQ in state %X, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003569 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3570 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3571 /// Send Stop BSS response to host
3572 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3573 return;
3574 }
3575
Jeff Johnson295189b2012-06-20 16:38:30 -07003576 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3577 {
3578 limWPSPBCClose(pMac, psessionEntry);
3579 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003580 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003581
3582 prevState = psessionEntry->limSmeState;
3583
3584 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003585 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003586
3587 /* Update SME session Id and Transaction Id */
3588 psessionEntry->smeSessionId = smesessionId;
3589 psessionEntry->transactionId = smetransactionId;
3590
3591 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame */
3592 if ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) && (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3593 {
3594 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3595 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3596 // Send disassoc all stations associated thru TKIP
3597 __limCounterMeasures(pMac,psessionEntry);
3598 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303599 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003600 }
3601
3602 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3603 pMac->lim.gLimIbssCoalescingHappened = false;
3604
3605 /* send a delBss to HAL and wait for a response */
3606 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3607
3608 if (status != eSIR_SUCCESS)
3609 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003610 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003611 psessionEntry->limSmeState= prevState;
3612
Jeff Johnsone7245742012-09-05 17:12:55 -07003613 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003614
3615 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3616 }
3617}
3618
3619
3620/**--------------------------------------------------------------
3621\fn __limProcessSmeStopBssReq
3622
3623\brief Wrapper for the function __limHandleSmeStopBssRequest
3624 This message will be defered until softmac come out of
3625 scan mode. Message should be handled even if we have
3626 detected radar in the current operating channel.
3627\param pMac
3628\param pMsg
3629
3630\return TRUE - If we consumed the buffer
3631 FALSE - If have defered the message.
3632 ---------------------------------------------------------------*/
3633static tANI_BOOLEAN
3634__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3635{
3636 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3637 {
3638 /**
3639 * If message defered, buffer is not consumed yet.
3640 * So return false
3641 */
3642 return eANI_BOOLEAN_FALSE;
3643 }
3644 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3645 return eANI_BOOLEAN_TRUE;
3646} /*** end __limProcessSmeStopBssReq() ***/
3647
3648
3649void limProcessSmeDelBssRsp(
3650 tpAniSirGlobal pMac,
3651 tANI_U32 body,tpPESession psessionEntry)
3652{
3653
3654 (void) body;
3655 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3656 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003657 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003658 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3659 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003660 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3661 return;
3662}
3663
3664
Jeff Johnson295189b2012-06-20 16:38:30 -07003665/**---------------------------------------------------------------
3666\fn __limProcessSmeAssocCnfNew
3667\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3668\ in BTAMP AP.
3669\
3670\param pMac
3671\param msgType - message type
3672\param pMsgBuf - a pointer to the SME message buffer
3673\return None
3674------------------------------------------------------------------*/
3675
3676 void
3677__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3678{
3679 tSirSmeAssocCnf assocCnf;
3680 tpDphHashNode pStaDs = NULL;
3681 tpPESession psessionEntry= NULL;
3682 tANI_U8 sessionId;
3683
3684
3685 if(pMsgBuf == NULL)
3686 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003687 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 goto end;
3689 }
3690
3691 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3692 !__limIsSmeAssocCnfValid(&assocCnf))
3693 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003694 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003695 goto end;
3696 }
3697
3698 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3699 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003700 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003701 goto end;
3702 }
3703
3704 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3705 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3706 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003707 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303708 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003709 goto end;
3710 }
3711
3712 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3713
3714 if (pStaDs == NULL)
3715 {
3716 limLog(pMac, LOG1,
3717 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
3718 msgType, assocCnf.aid);
3719 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3720
3721 /*
3722 ** send a DISASSOC_IND message to WSM to make sure
3723 ** the state in WSM and LIM is the same
3724 **/
3725 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3726 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3727 goto end;
3728 }
3729 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303730 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003731 (tANI_U8 *) assocCnf.peerMacAddr,
3732 sizeof(tSirMacAddr)) ) ||
3733 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3734 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3735 (msgType != eWNI_SME_ASSOC_CNF)) ||
3736 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003737 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003738 {
3739 limLog(pMac, LOG1,
3740 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
3741 msgType, assocCnf.aid);
3742 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3743 goto end;
3744 }
3745
3746 /*
3747 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3748 ** has been received
3749 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003750 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003751 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3752
3753 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3754 {
3755 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3756 * when it had received Assoc Request frame. Now, PE just needs to send
3757 * Association Response frame to the requesting BTAMP-STA.
3758 */
3759 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003760 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003761 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3762 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3763 goto end;
3764 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3765 else
3766 {
3767 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3768 /*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*/
3769 if(!pStaDs->mlmStaContext.updateContext)
3770 pStaDs->mlmStaContext.updateContext = 1;
3771 limRejectAssociation(pMac, pStaDs->staAddr,
3772 pStaDs->mlmStaContext.subType,
3773 true, pStaDs->mlmStaContext.authType,
3774 pStaDs->assocId, true,
3775 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003776 }
3777
3778end:
3779 if((psessionEntry != NULL) && (pStaDs != NULL))
3780 {
3781 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3782 {
3783 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3784 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303785 vos_mem_free(((tpSirAssocReq)
3786 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07003787 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
3788 }
3789
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303790 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003791 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
3792 }
3793 }
3794
3795} /*** end __limProcessSmeAssocCnfNew() ***/
3796
3797
Jeff Johnson295189b2012-06-20 16:38:30 -07003798
3799
3800static void
3801__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3802{
3803 tpDphHashNode pStaDs;
3804 tSirMacAddr peerMac;
3805 tpSirAddtsReq pSirAddts;
3806 tANI_U32 timeout;
3807 tpPESession psessionEntry;
3808 tANI_U8 sessionId; //PE sessionId
3809 tANI_U8 smesessionId;
3810 tANI_U16 smetransactionId;
3811
3812
3813 if(pMsgBuf == NULL)
3814 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003815 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003816 return;
3817 }
3818
3819 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3820
3821 pSirAddts = (tpSirAddtsReq) pMsgBuf;
3822
3823 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
3824 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003825 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003826 return;
3827 }
3828#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3829 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
3830#endif //FEATURE_WLAN_DIAG_SUPPORT
3831
3832
3833
3834 /* if sta
3835 * - verify assoc state
3836 * - send addts request to ap
3837 * - wait for addts response from ap
3838 * if ap, just ignore with error log
3839 */
3840 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003841 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003842 pSirAddts->req.tspec.tsinfo.traffic.tsid,
3843 pSirAddts->req.tspec.tsinfo.traffic.userPrio);)
3844
3845 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
3846 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003847 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003848 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3849 smesessionId,smetransactionId);
3850 return;
3851 }
3852
3853 //Ignore the request if STA is in 11B mode.
3854 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
3855 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003856 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003857 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3858 smesessionId,smetransactionId);
3859 return;
3860 }
3861
3862
3863 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3864
3865 if(pStaDs == NULL)
3866 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003867 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003868 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3869 smesessionId,smetransactionId);
3870 return;
3871 }
3872
3873 if ((! pStaDs->valid) ||
3874 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
3875 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003876 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003877 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3878 smesessionId,smetransactionId);
3879 return;
3880 }
3881
3882 pSirAddts->req.wsmTspecPresent = 0;
3883 pSirAddts->req.wmeTspecPresent = 0;
3884 pSirAddts->req.lleTspecPresent = 0;
3885
3886 if ((pStaDs->wsmEnabled) &&
3887 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
3888 pSirAddts->req.wsmTspecPresent = 1;
3889 else if (pStaDs->wmeEnabled)
3890 pSirAddts->req.wmeTspecPresent = 1;
3891 else if (pStaDs->lleEnabled)
3892 pSirAddts->req.lleTspecPresent = 1;
3893 else
3894 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003895 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003896 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3897 smesessionId,smetransactionId);
3898 return;
3899 }
3900
3901 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
3902 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
3903 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003904 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07003905 psessionEntry->limSmeState);
3906 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3907 smesessionId,smetransactionId);
3908 return;
3909 }
3910
3911 if (pMac->lim.gLimAddtsSent)
3912 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003913 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07003914 pMac->lim.gLimAddtsReq.req.dialogToken,
3915 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
3916 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
3917 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3918 smesessionId,smetransactionId);
3919 return;
3920 }
3921
3922 #if 0
3923 val = sizeof(tSirMacAddr);
3924 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
3925 {
3926 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003927 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003928 return;
3929 }
3930 #endif
3931 sirCopyMacAddr(peerMac,psessionEntry->bssId);
3932
3933 // save the addts request
3934 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303935 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07003936
3937 // ship out the message now
3938 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
3939 psessionEntry);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003940 PELOG1(limLog(pMac, LOG1, "Sent ADDTS request");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003941
3942 // start a timer to wait for the response
3943 if (pSirAddts->timeout)
3944 timeout = pSirAddts->timeout;
3945 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
3946 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003947 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003948 WNI_CFG_ADDTS_RSP_TIMEOUT);
3949 return;
3950 }
3951
3952 timeout = SYS_MS_TO_TICKS(timeout);
3953 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
3954 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003955 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003956 return;
3957 }
3958 pMac->lim.gLimAddtsRspTimerCount++;
3959 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
3960 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
3961 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003962 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003963 return;
3964 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003965 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003966
3967 //add the sessionId to the timer object
3968 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
3969 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
3970 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003971 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003972 return;
3973 }
3974 return;
3975}
3976
3977
3978static void
3979__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3980{
3981 tSirMacAddr peerMacAddr;
3982 tANI_U8 ac;
3983 tSirMacTSInfo *pTsinfo;
3984 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
3985 tpDphHashNode pStaDs = NULL;
3986 tpPESession psessionEntry;
3987 tANI_U8 sessionId;
3988 tANI_U32 status = eSIR_SUCCESS;
3989 tANI_U8 smesessionId;
3990 tANI_U16 smetransactionId;
3991
3992 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3993
3994 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
3995 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003996 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003997 status = eSIR_FAILURE;
3998 goto end;
3999 }
4000#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4001 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
4002#endif //FEATURE_WLAN_DIAG_SUPPORT
4003
4004
4005 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
4006 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004007 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004008 status = eSIR_FAILURE;
4009 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
4010 return;
4011 }
4012
Arif Hussaina7c8e412013-11-20 11:06:42 -08004013 PELOG1(limLog(pMac, LOG1, FL("Sent DELTS request to station with "
4014 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
4015 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004016
4017 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
4018 psessionEntry);
4019
4020 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
4021
4022 /* We've successfully send DELTS frame to AP. Update the
4023 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
4024 * is no longer trigger enabled or delivery enabled
4025 */
4026 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
4027
4028 /* We're deleting the TSPEC, so this particular AC is no longer
4029 * admitted. PE needs to downgrade the EDCA
4030 * parameters(for the AC for which TS is being deleted) to the
4031 * next best AC for which ACM is not enabled, and send the
4032 * updated values to HAL.
4033 */
4034 ac = upToAc(pTsinfo->traffic.userPrio);
4035
4036 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4037 {
4038 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4039 }
4040 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4041 {
4042 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4043 }
4044 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4045 {
4046 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4047 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4048 }
4049
4050 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4051
4052 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4053 if (pStaDs != NULL)
4054 {
4055 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4056 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4057 else
4058 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4059 status = eSIR_SUCCESS;
4060 }
4061 else
4062 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004063 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004064 status = eSIR_FAILURE;
4065 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004066#ifdef FEATURE_WLAN_ESE
4067#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004068 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4069#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004070 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004071#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004072#endif
4073
4074 // send an sme response back
4075 end:
4076 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4077}
4078
4079
4080void
4081limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4082{
4083 //fetch the sessionEntry based on the sessionId
4084 tpPESession psessionEntry;
4085 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4086 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004087 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004088 return;
4089 }
4090
4091 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4092 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004093 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004094 pMac->lim.gLimAddtsSent = false;
4095 return;
4096 }
4097
4098 if (! pMac->lim.gLimAddtsSent)
4099 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004100 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004101 return;
4102 }
4103
4104 if (param != pMac->lim.gLimAddtsRspTimerCount)
4105 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004106 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 param, pMac->lim.gLimAddtsRspTimerCount);
4108 return;
4109 }
4110
4111 // this a real response timeout
4112 pMac->lim.gLimAddtsSent = false;
4113 pMac->lim.gLimAddtsRspTimerCount++;
4114
4115 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4116 psessionEntry->smeSessionId, psessionEntry->transactionId);
4117}
4118
4119
4120/**
4121 * __limProcessSmeStatsRequest()
4122 *
4123 *FUNCTION:
4124 *
4125 *
4126 *NOTE:
4127 *
4128 * @param pMac Pointer to Global MAC structure
4129 * @param *pMsgBuf A pointer to the SME message buffer
4130 * @return None
4131 */
4132static void
4133__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4134{
4135 tpAniGetStatsReq pStatsReq;
4136 tSirMsgQ msgQ;
4137 tpPESession psessionEntry;
4138 tANI_U8 sessionId;
4139
4140
4141 if(pMsgBuf == NULL)
4142 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004143 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004144 return;
4145 }
4146
4147 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4148
4149 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4150 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004151 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304152 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004153 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004154 return;
4155 }
4156
4157
4158
4159 switch(pStatsReq->msgType)
4160 {
4161 //Add Lim stats here. and send reqsponse.
4162
4163 //HAL maintained Stats.
4164 case eWNI_SME_STA_STAT_REQ:
4165 msgQ.type = WDA_STA_STAT_REQ;
4166 break;
4167 case eWNI_SME_AGGR_STAT_REQ:
4168 msgQ.type = WDA_AGGR_STAT_REQ;
4169 break;
4170 case eWNI_SME_GLOBAL_STAT_REQ:
4171 msgQ.type = WDA_GLOBAL_STAT_REQ;
4172 break;
4173 case eWNI_SME_STAT_SUMM_REQ:
4174 msgQ.type = WDA_STAT_SUMM_REQ;
4175 break;
4176 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004177 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304178 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004179 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004180 return;
4181 }
4182
Jeff Johnson295189b2012-06-20 16:38:30 -07004183 msgQ.reserved = 0;
4184 msgQ.bodyptr = pMsgBuf;
4185 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004186 if(NULL == psessionEntry)
4187 {
4188 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4189 }
4190 else
4191 {
4192 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4193 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004194 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004195 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304196 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004197 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004198 return;
4199 }
4200
4201 return;
4202}
4203
4204
4205/**
4206 * __limProcessSmeGetStatisticsRequest()
4207 *
4208 *FUNCTION:
4209 *
4210 *
4211 *NOTE:
4212 *
4213 * @param pMac Pointer to Global MAC structure
4214 * @param *pMsgBuf A pointer to the SME message buffer
4215 * @return None
4216 */
4217static void
4218__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4219{
4220 tpAniGetPEStatsReq pPEStatsReq;
4221 tSirMsgQ msgQ;
4222
4223 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4224
4225 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4226
4227 msgQ.type = WDA_GET_STATISTICS_REQ;
4228
Jeff Johnson295189b2012-06-20 16:38:30 -07004229 msgQ.reserved = 0;
4230 msgQ.bodyptr = pMsgBuf;
4231 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004232 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004233
4234 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304235 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004236 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004237 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004238 return;
4239 }
4240
4241 return;
4242}
4243
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004244#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004245/**
4246 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4247 *
4248 *NOTE:
4249 *
4250 * @param pMac Pointer to Global MAC structure
4251 * @param *pMsgBuf A pointer to the SME message buffer
4252 * @return None
4253 */
4254static void
4255__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4256{
4257 tSirMsgQ msgQ;
4258
4259 msgQ.type = WDA_TSM_STATS_REQ;
4260 msgQ.reserved = 0;
4261 msgQ.bodyptr = pMsgBuf;
4262 msgQ.bodyval = 0;
4263 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4264
4265 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4266 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004267 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004268 limLog(pMac, LOGP, "Unable to forward request");
4269 return;
4270 }
4271}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004272#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004273
4274
Jeff Johnson295189b2012-06-20 16:38:30 -07004275
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004276#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004277/**
4278 * __limProcessSmeGetRoamRssiRequest()
4279 *
4280 *FUNCTION:
4281 *
4282 *
4283 *NOTE:
4284 *
4285 * @param pMac Pointer to Global MAC structure
4286 * @param *pMsgBuf A pointer to the SME message buffer
4287 * @return None
4288 */
4289static void
4290__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4291{
4292 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4293 tSirMsgQ msgQ;
4294
4295 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4296 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4297
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004298 msgQ.reserved = 0;
4299 msgQ.bodyptr = pMsgBuf;
4300 msgQ.bodyval = 0;
4301 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4302
4303 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304304 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004305 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004306 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004307 return;
4308 }
4309
4310 return;
4311}
4312#endif
4313
4314
Jeff Johnson295189b2012-06-20 16:38:30 -07004315static void
4316__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4317{
4318 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4319 tpPESession psessionEntry;
4320 tANI_U8 sessionId; //PE sessionID
4321
4322 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004323 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004324
4325 if(pMsgBuf == NULL)
4326 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004327 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004328 return;
4329 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004330
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304331 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4332 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004333 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304334 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004335 return;
4336 }
4337
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004338 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004339 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004340 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004341 goto end;
4342 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004343
Jeff Johnson295189b2012-06-20 16:38:30 -07004344 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4345 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004346 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004347 goto end;
4348 }
4349
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304350 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004351
Jeff Johnson295189b2012-06-20 16:38:30 -07004352 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004353 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004354
4355end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304356 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004357 return;
4358} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4359
4360static void
4361__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4362{
4363 tpSirUpdateParams pUpdateParams;
4364 tpPESession psessionEntry;
4365
4366 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004367 FL("received HIDE_SSID message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004368
4369 if(pMsgBuf == NULL)
4370 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004371 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004372 return;
4373 }
4374
4375 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4376
4377 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4378 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004379 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004380 pUpdateParams->sessionId);
4381 return;
4382 }
4383
4384 /* Update the session entry */
4385 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4386
4387 /* Update beacon */
4388 schSetFixedBeaconFields(pMac, psessionEntry);
4389 limSendBeaconInd(pMac, psessionEntry);
4390
4391 return;
4392} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4393
4394static void
4395__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4396{
4397 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4398 tpPESession psessionEntry;
4399 tANI_U8 sessionId; //PE sessionID
4400
4401 if(pMsgBuf == NULL)
4402 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004403 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 return;
4405 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304406
4407 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4408 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004409 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304410 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004411 return;
4412 }
4413
4414 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4415 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004416 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004417 goto end;
4418 }
4419
4420 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4421 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004422 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004423 goto end;
4424 }
4425
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304426 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4427 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004428
4429 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4430
4431 psessionEntry->pLimStartBssReq->privacy = 1;
4432 psessionEntry->privacy = 1;
4433
4434 schSetFixedBeaconFields(pMac, psessionEntry);
4435 limSendBeaconInd(pMac, psessionEntry);
4436
4437end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304438 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004439 return;
4440} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4441
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004442/*
4443Update the beacon Interval dynamically if beaconInterval is different in MCC
4444*/
4445static void
4446__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4447{
4448 tpSirChangeBIParams pChangeBIParams;
4449 tpPESession psessionEntry;
4450 tANI_U8 sessionId = 0;
4451 tUpdateBeaconParams beaconParams;
4452
4453 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004454 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004455
4456 if(pMsgBuf == NULL)
4457 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004458 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004459 return;
4460 }
4461
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304462 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004463 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4464
4465 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4466 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004467 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004468 return;
4469 }
4470
4471 /*Update sessionEntry Beacon Interval*/
4472 if(psessionEntry->beaconParams.beaconInterval !=
4473 pChangeBIParams->beaconInterval )
4474 {
4475 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4476 }
4477
4478 /*Update sch beaconInterval*/
4479 if(pMac->sch.schObject.gSchBeaconInterval !=
4480 pChangeBIParams->beaconInterval )
4481 {
4482 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4483
4484 PELOG1(limLog(pMac, LOG1,
4485 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4486
4487 /* Update beacon */
4488 schSetFixedBeaconFields(pMac, psessionEntry);
4489
Sunil Ravib96f7b52013-05-22 21:40:05 -07004490 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004491 //Set change in beacon Interval
4492 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004493 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004494 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4495 }
4496
4497 return;
4498} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4499
Jeff Johnson295189b2012-06-20 16:38:30 -07004500
4501
4502/** -------------------------------------------------------------
4503\fn limProcessSmeDelBaPeerInd
4504\brief handles indication message from HDD to send delete BA request
4505\param tpAniSirGlobal pMac
4506\param tANI_U32 pMsgBuf
4507\return None
4508-------------------------------------------------------------*/
4509void
4510limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4511{
4512 tANI_U16 assocId =0;
4513 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4514 tpDphHashNode pSta;
4515 tpPESession psessionEntry;
4516 tANI_U8 sessionId;
4517
4518
4519
4520 if(NULL == pSmeDelBAPeerInd)
4521 return;
4522
4523 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4524 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004525 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004526 return;
4527 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004528 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004529 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4530
4531 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4532 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4533 pSta,
4534 pSmeDelBAPeerInd->baDirection,
4535 pSmeDelBAPeerInd->baTID,
4536 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4537 {
4538 limLog( pMac, LOGW,
4539 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4540 if (pSta)
4541 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4542 }
4543}
4544
4545// --------------------------------------------------------------------
4546/**
4547 * __limProcessReportMessage
4548 *
4549 * FUNCTION: Processes the next received Radio Resource Management message
4550 *
4551 * LOGIC:
4552 *
4553 * ASSUMPTIONS:
4554 *
4555 * NOTE:
4556 *
4557 * @param None
4558 * @return None
4559 */
4560
4561void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4562{
4563#ifdef WLAN_FEATURE_VOWIFI
4564 switch (pMsg->type)
4565 {
4566 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4567 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4568 break;
4569 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4570 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004571#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004572 tpSirBeaconReportXmitInd pBcnReport=NULL;
4573 tpPESession psessionEntry=NULL;
4574 tANI_U8 sessionId;
4575
4576 if(pMsg->bodyptr == NULL)
4577 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004578 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004579 return;
4580 }
4581 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4582 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4583 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004584 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 return;
4586 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004587 if (psessionEntry->isESEconnection)
4588 eseProcessBeaconReportXmit( pMac, pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004589 else
4590#endif
4591 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4592 }
4593 break;
4594 }
4595#endif
4596}
4597
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004598#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI)
Jeff Johnson295189b2012-06-20 16:38:30 -07004599// --------------------------------------------------------------------
4600/**
4601 * limSendSetMaxTxPowerReq
4602 *
4603 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4604 *
4605 * LOGIC:
4606 *
4607 * ASSUMPTIONS:
4608 *
4609 * NOTE:
4610 *
4611 * @param txPower txPower to be set.
4612 * @param pSessionEntry session entry.
4613 * @return None
4614 */
4615tSirRetStatus
4616limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4617{
4618 tpMaxTxPowerParams pMaxTxParams = NULL;
4619 tSirRetStatus retCode = eSIR_SUCCESS;
4620 tSirMsgQ msgQ;
4621
4622 if( pSessionEntry == NULL )
4623 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004624 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004625 return eSIR_FAILURE;
4626 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304627
4628 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4629 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004630 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004631 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004632 return eSIR_MEM_ALLOC_FAILED;
4633
4634 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004635#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004636 PELOG1(limLog( pMac, LOG1, "%s:%d: Allocated memory for pMaxTxParams...will be freed in other module", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004637#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004638 if( pMaxTxParams == NULL )
4639 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004640 limLog( pMac, LOGE, "%s:%d: pMaxTxParams is NULL", __func__, __LINE__);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004641 return eSIR_FAILURE;
4642 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004643 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304644 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4645 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004646
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004647 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4648 msgQ.bodyptr = pMaxTxParams;
4649 msgQ.bodyval = 0;
4650 PELOG1(limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));)
4651 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
4652 retCode = wdaPostCtrlMsg(pMac, &msgQ);
4653 if (eSIR_SUCCESS != retCode)
4654 {
4655 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304656 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004657 }
4658 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004659}
4660#endif
4661
4662/**
4663 * __limProcessSmeAddStaSelfReq()
4664 *
4665 *FUNCTION:
4666 * This function is called to process SME_ADD_STA_SELF_REQ message
4667 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4668 *
4669 *LOGIC:
4670 *
4671 *ASSUMPTIONS:
4672 *
4673 *NOTE:
4674 *
4675 * @param pMac Pointer to Global MAC structure
4676 * @param *pMsgBuf A pointer to the SME message buffer
4677 * @return None
4678 */
4679
4680static void
4681__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4682{
4683 tSirMsgQ msg;
4684 tpAddStaSelfParams pAddStaSelfParams;
4685 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
4686
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304687 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
4688 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004689 {
4690 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
4691 return;
4692 }
4693
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304694 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07004695 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004696 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
4697 msg.reserved = 0;
4698 msg.bodyptr = pAddStaSelfParams;
4699 msg.bodyval = 0;
4700
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004701 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004702 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004703
4704 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4705 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004706 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004707 }
4708 return;
4709} /*** end __limProcessAddStaSelfReq() ***/
4710
4711
4712/**
4713 * __limProcessSmeDelStaSelfReq()
4714 *
4715 *FUNCTION:
4716 * This function is called to process SME_DEL_STA_SELF_REQ message
4717 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
4718 *
4719 *LOGIC:
4720 *
4721 *ASSUMPTIONS:
4722 *
4723 *NOTE:
4724 *
4725 * @param pMac Pointer to Global MAC structure
4726 * @param *pMsgBuf A pointer to the SME message buffer
4727 * @return None
4728 */
4729
4730static void
4731__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4732{
4733 tSirMsgQ msg;
4734 tpDelStaSelfParams pDelStaSelfParams;
4735 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
4736
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304737 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
4738 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004739 {
4740 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
4741 return;
4742 }
4743
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304744 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004745
4746 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
4747 msg.reserved = 0;
4748 msg.bodyptr = pDelStaSelfParams;
4749 msg.bodyval = 0;
4750
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004751 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004752 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004753
4754 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4755 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004756 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004757 }
4758 return;
4759} /*** end __limProcessSmeDelStaSelfReq() ***/
4760
4761
Jeff Johnson295189b2012-06-20 16:38:30 -07004762/**
4763 * __limProcessSmeRegisterMgmtFrameReq()
4764 *
4765 *FUNCTION:
4766 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
4767 * from SME. It Register this information within PE.
4768 *
4769 *LOGIC:
4770 *
4771 *ASSUMPTIONS:
4772 *
4773 *NOTE:
4774 *
4775 * @param pMac Pointer to Global MAC structure
4776 * @param *pMsgBuf A pointer to the SME message buffer
4777 * @return None
4778 */
4779static void
4780__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4781{
4782 VOS_STATUS vosStatus;
4783 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
4784 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004785 tANI_BOOLEAN match = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004786 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004787 FL("registerFrame %d, frameType %d, matchLen %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07004788 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004789
Jeff Johnsond13512a2012-07-17 11:42:19 -07004790 /* First check whether entry exists already*/
4791
4792 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4793 (vos_list_node_t**)&pLimMgmtRegistration);
4794
4795 while(pLimMgmtRegistration != NULL)
4796 {
4797 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
4798 {
4799 if(pSmeReq->matchLen)
4800 {
4801 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
4802 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304803 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07004804 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
4805 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004806 /* found match! */
4807 match = VOS_TRUE;
4808 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004809 }
4810 }
4811 }
4812 else
4813 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004814 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07004815 match = VOS_TRUE;
4816 break;
4817 }
4818 }
4819 vosStatus = vos_list_peek_next (
4820 &pMac->lim.gLimMgmtFrameRegistratinQueue,
4821 (vos_list_node_t*) pLimMgmtRegistration,
4822 (vos_list_node_t**) &pNext );
4823
4824 pLimMgmtRegistration = pNext;
4825 pNext = NULL;
4826
4827 }
4828
4829 if (match)
4830 {
4831 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4832 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304833 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07004834 }
4835
Jeff Johnson295189b2012-06-20 16:38:30 -07004836 if(pSmeReq->registerFrame)
4837 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304838 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
4839 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07004840 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304841 vos_mem_set((void*)pLimMgmtRegistration,
4842 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004843 pLimMgmtRegistration->frameType = pSmeReq->frameType;
4844 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
4845 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
4846 if(pSmeReq->matchLen)
4847 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304848 vos_mem_copy(pLimMgmtRegistration->matchData,
4849 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07004850 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004851 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4852 &pLimMgmtRegistration->node);
4853 }
4854 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004855
4856 return;
4857} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08004858
4859static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08004860__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08004861{
4862 tpP2pPsParams pMsgNoA;
4863 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08004864
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304865 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
4866 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08004867 {
4868 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004869 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08004870 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004871 }
4872
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304873 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08004874 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
4875 pMsgNoA->opp_ps = 0;
4876 pMsgNoA->ctWindow = 0;
4877 pMsgNoA->duration = 0;
4878 pMsgNoA->interval = 0;
4879 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08004880
Vinay Malekal62757362012-12-17 12:15:51 -08004881 /* Below params used for Single Shot NOA - so assign proper values */
4882 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08004883 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08004884
Viral Modid86bde22012-12-10 13:09:21 -08004885 /* Start Insert NOA timer
4886 * 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 -08004887 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
4888 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08004889 */
4890 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
4891 == TX_TIMER_ERROR)
4892 {
4893 /// Could not activate Insert NOA timer.
4894 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004895 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08004896
4897 // send the scan response back with status failure and do not even call insert NOA
4898 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304899 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08004900 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004901 }
4902
Viral Modid440e682013-03-06 02:25:31 -08004903 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
4904
Viral Modid86bde22012-12-10 13:09:21 -08004905 msg.type = WDA_SET_P2P_GO_NOA_REQ;
4906 msg.reserved = 0;
4907 msg.bodyptr = pMsgNoA;
4908 msg.bodyval = 0;
4909
4910 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4911 {
4912 /* 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 -07004913 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08004914 /* Deactivate the NOA timer in failure case */
4915 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
4916 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004917 }
Viral Modid440e682013-03-06 02:25:31 -08004918 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08004919
Viral Modid440e682013-03-06 02:25:31 -08004920error:
4921 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
4922 * worrying about the NOA
4923 */
4924 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
4925 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08004926 return FALSE;
4927
4928}
4929
Viral Modid440e682013-03-06 02:25:31 -08004930static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4931{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004932 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08004933 pMac->lim.gDeferMsgTypeForNOA = msgType;
4934 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
4935}
4936
4937static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4938{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004939 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08004940 pMac->lim.gDeferMsgTypeForNOA = 0;
4941 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
4942 {
4943 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304944 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004945 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4946 }
4947}
4948
4949static
4950tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4951{
4952 tANI_U32 noaDuration = 0;
4953
4954 switch (msgType)
4955 {
4956 case eWNI_SME_SCAN_REQ:
4957 {
4958 tANI_U32 val;
4959 tANI_U8 i;
4960 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
4961 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
4962 {
4963 /*
4964 * Could not get max channel value
4965 * from CFG. Log error.
4966 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004967 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08004968
4969 /* use a default value of 110ms */
4970 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
4971 }
4972
4973 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
4974 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
4975
4976 if (limActiveScanAllowed(pMac, channelNum)) {
4977 /* Use min + max channel time to calculate the total duration of scan */
4978 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
4979 } else {
4980 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
4981 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
4982 */
4983 noaDuration += val;
4984 }
4985 }
4986
4987 /* Adding an overhead of 20ms to account for the scan messaging delays */
4988 noaDuration += SCAN_MESSAGING_OVERHEAD;
4989 noaDuration *= CONV_MS_TO_US;
4990
4991 break;
4992 }
4993
4994 case eWNI_SME_OEM_DATA_REQ:
4995 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
4996 break;
4997
4998 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
4999 {
5000 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
5001 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
5002 break;
5003 }
5004
5005 case eWNI_SME_JOIN_REQ:
5006 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
5007 break;
5008
5009 default:
5010 noaDuration = 0;
5011 break;
5012
5013 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005014 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08005015 return noaDuration;
5016}
5017
5018void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5019{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305020 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08005021
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005022 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005023 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
5024 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
5025 {
5026 switch (pMac->lim.gDeferMsgTypeForNOA)
5027 {
5028 case eWNI_SME_SCAN_REQ:
5029 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5030 break;
5031 case eWNI_SME_OEM_DATA_REQ:
5032 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5033 break;
5034 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305035 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5036 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
5037 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
5038 */
5039 if (FALSE == bufConsumed)
5040 {
5041 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5042 }
Viral Modid440e682013-03-06 02:25:31 -08005043 break;
5044 case eWNI_SME_JOIN_REQ:
5045 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5046 break;
5047 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005048 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005049 break;
5050 }
5051 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5052 }
5053 else
5054 {
5055 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005056 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005057 }
5058}
Jeff Johnson295189b2012-06-20 16:38:30 -07005059
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005060#ifdef FEATURE_WLAN_TDLS_INTERNAL
5061/*
5062 * Process Discovery request recieved from SME and transmit to AP.
5063 */
5064static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
5065 tANI_U32 *pMsgBuf)
5066{
5067 /* get all discovery request parameters */
5068 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
5069 tpPESession psessionEntry;
5070 tANI_U8 sessionId;
5071
5072 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005073 ("Discovery Req Recieved")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005074
5075 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
5076 == NULL)
5077 {
5078 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005079 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005080 disReq->sessionId);
5081 goto lim_tdls_dis_start_error;
5082 }
5083
5084 /* check if we are in proper state to work as TDLS client */
5085 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5086 {
5087 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005088 "dis req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005089 psessionEntry->limSystemRole);
5090 goto lim_tdls_dis_start_error;
5091 }
5092
5093 /*
5094 * if we are still good, go ahead and check if we are in proper state to
5095 * do TDLS discovery procedure.
5096 */
5097 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5098 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5099 {
5100
5101 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005102 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005103 goto lim_tdls_dis_start_error;
5104 }
5105
5106 /*
5107 * if we are still good, go ahead and transmit TDLS discovery request,
5108 * and save Dis Req info for future reference.
5109 */
5110
5111#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
5112 /*
5113 * send message to HAL to set RXP filters to receieve frame on
5114 * direct link..
5115 */
5116 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
5117 // psessionEntry->bssId) ;
5118#endif
5119
5120 /* save dis request message for matching dialog token */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305121 vos_mem_copy((tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
5122 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005123
5124 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005125 "Transmit Discovery Request Frame") ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005126 /* format TDLS discovery request frame and transmit it */
5127 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
5128 psessionEntry) ;
5129
5130 /* prepare for response */
5131 pMac->lim.gLimTdlsDisStaCount = 0 ;
5132 pMac->lim.gLimTdlsDisResultList = NULL ;
5133
5134 /*
5135 * start TDLS discovery request timer to wait for discovery responses
5136 * from all TDLS enabled clients in BSS.
5137 */
5138
5139 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005140 ("Start Discovery request Timeout Timer")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005141 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
5142 eLIM_TDLS_DISCOVERY_RSP_WAIT));
5143
5144 /* assign appropriate sessionId to the timer object */
5145 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
5146 psessionEntry->peSessionId;
5147
5148 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
5149 != TX_SUCCESS)
5150 {
5151 limLog(pMac, LOGP, FL("TDLS discovery response timer \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005152 activation failed!"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005153 goto lim_tdls_dis_start_error;
5154 }
5155 /*
5156 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
5157 * back to SME
5158 */
5159 return (eSIR_SUCCESS) ;
5160lim_tdls_dis_start_error:
5161 /* in error case, PE has to sent the response SME immediately with error code */
5162 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
5163 eWNI_SME_TDLS_DISCOVERY_START_RSP);
5164 return eSIR_FAILURE;
5165}
5166/*
5167 * Process link start request recieved from SME and transmit to AP.
5168 */
5169eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5170{
5171 /* get all discovery request parameters */
5172 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
5173 tLimTdlsLinkSetupInfo *linkSetupInfo;
5174 //tLimTdlsLinkSetupPeer *setupPeer;
5175 tpPESession psessionEntry;
5176 tANI_U8 sessionId;
5177 eHalStatus status;
5178
5179 if((psessionEntry = peFindSessionByBssid(pMac,
5180 setupReq->bssid, &sessionId)) == NULL)
5181 {
5182 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005183 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005184 setupReq->sessionId);
5185 goto lim_tdls_link_start_error;
5186 }
5187
5188 /* check if we are in proper state to work as TDLS client */
5189 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5190 {
5191 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005192 "TDLS link setup req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005193 psessionEntry->limSystemRole);
5194 goto lim_tdls_link_start_error;
5195 }
5196
5197 /*
5198 * if we are still good, go ahead and check if we are in proper state to
5199 * do TDLS setup procedure.
5200 */
5201 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5202 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5203 {
5204 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005205 state (%d)", pMac->lim.gLimSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005206 goto lim_tdls_link_start_error;
5207 }
5208
5209 /*
5210 * Now, go ahead and transmit TDLS discovery request, and save setup Req
5211 * info for future reference.
5212 */
5213 /* create node for Link setup */
5214 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
5215 //setupPeer = NULL ;
5216
5217 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
5218 setupReq->peerMac, psessionEntry) ;
5219 if(eHAL_STATUS_SUCCESS == status)
5220 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5221 TDLS setup cnf TX complete is successful. */
5222 return eSIR_SUCCESS;
5223#if 0
5224
5225 /*
5226 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005227 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005228 * free this memory if any timeout is happen in link setup procedure
5229 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305230 setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
5231 if ( NULL == setupPeer )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005232 {
5233 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005234 FL( "Unable to allocate memory during ADD_STA" ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005235 VOS_ASSERT(0) ;
5236 return eSIR_MEM_ALLOC_FAILED;
5237 }
5238 setupPeer->dialog = setupReq->dialog ;
5239 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
5240 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
5241 /* TDLS_sessionize: remember sessionId for future */
5242 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
5243 setupPeer->tdls_bIsResponder = 1;
5244
5245 /*
5246 * we only populate peer MAC, so it can assit us to find the
5247 * TDLS peer after response/or after response timeout
5248 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305249 vos_mem_copy(setupPeer->peerMac, setupReq->peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005250 sizeof(tSirMacAddr)) ;
5251 /* format TDLS discovery request frame and transmit it */
5252 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
5253 setupReq->dialog, psessionEntry, NULL, 0) ;
5254
5255 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
5256 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
5257 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
5258 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
5259 /* update setup peer list */
5260 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
5261 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
5262 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5263 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
5264 return eSIR_SUCCESS ;
5265#endif
5266lim_tdls_link_start_error:
5267 /* in case of error, return immediately to SME */
5268 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
5269 eWNI_SME_TDLS_LINK_START_RSP);
5270 return eSIR_FAILURE ;
5271}
5272
5273/*
5274 * Process link teardown request recieved from SME and transmit to AP.
5275 */
5276eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5277{
5278 /* get all discovery request parameters */
5279 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
5280 tLimTdlsLinkSetupPeer *setupPeer;
5281 tpPESession psessionEntry;
5282 tANI_U8 sessionId;
5283
5284 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
5285 {
5286 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005287 "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005288 goto lim_tdls_teardown_req_error;
5289 }
5290
5291 /* check if we are in proper state to work as TDLS client */
5292 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5293 {
5294 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005295 "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005296 goto lim_tdls_teardown_req_error;
5297 }
5298
5299 /*
5300 * if we are still good, go ahead and check if we are in proper state to
5301 * do TDLS setup procedure.
5302 */
5303 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5304 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5305 {
5306 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005307 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005308 goto lim_tdls_teardown_req_error;
5309 }
5310
5311 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Arif Hussain24bafea2013-11-15 15:10:03 -08005312 "Teardown for peer = " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(teardownReq->peerMac));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005313 /*
5314 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5315 * info for future reference.
5316 */
5317 /* Verify if this link is setup */
5318 setupPeer = NULL ;
5319 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5320 if(NULL == setupPeer)
5321 {
5322 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005323 ("invalid Peer on teardown ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005324 goto lim_tdls_teardown_req_error;
5325 }
5326
5327
5328 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5329 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5330 /* TDLS_sessionize: check sessionId in case */
5331 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5332 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005333 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005334 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5335 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5336 }
5337
5338 /* format TDLS teardown request frame and transmit it */
5339 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5340 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5341 {
5342 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005343 ("couldn't send teardown frame ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005344 goto lim_tdls_teardown_req_error;
5345 }
5346 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5347 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5348 return eSIR_SUCCESS;
5349lim_tdls_teardown_req_error:
5350 /* in case of error, return immediately to SME */
5351 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5352 eWNI_SME_TDLS_TEARDOWN_RSP);
5353 return eSIR_FAILURE;
5354}
5355
5356
5357#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005358
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305359static void
5360__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5361{
5362 tpSirResetAPCapsChange pResetCapsChange;
5363 tpPESession psessionEntry;
5364 tANI_U8 sessionId = 0;
5365 if (pMsgBuf == NULL)
5366 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005367 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305368 return;
5369 }
5370
5371 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5372 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5373 if (psessionEntry == NULL)
5374 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005375 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305376 return;
5377 }
5378
5379 psessionEntry->limSentCapsChangeNtf = false;
5380 return;
5381}
5382
Jeff Johnson295189b2012-06-20 16:38:30 -07005383/**
5384 * limProcessSmeReqMessages()
5385 *
5386 *FUNCTION:
5387 * This function is called by limProcessMessageQueue(). This
5388 * function processes SME request messages from HDD or upper layer
5389 * application.
5390 *
5391 *LOGIC:
5392 *
5393 *ASSUMPTIONS:
5394 *
5395 *NOTE:
5396 *
5397 * @param pMac Pointer to Global MAC structure
5398 * @param msgType Indicates the SME message type
5399 * @param *pMsgBuf A pointer to the SME message buffer
5400 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5401 * FALSE - if pMsgBuf is not to be freed.
5402 */
5403
5404tANI_BOOLEAN
5405limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5406{
5407 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5408 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005409 tpSirSmeScanReq pScanReq;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005410 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 -07005411 limMsgStr(pMsg->type), pMsg->type,
5412 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5413 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5414
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005415 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005416 /* Special handling of some SME Req msgs where we have an existing GO session and
5417 * want to insert NOA before processing those msgs. These msgs will be processed later when
5418 * start event happens
5419 */
5420 switch (pMsg->type)
5421 {
5422 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005423 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005424
5425 /* If scan is disabled return from here
5426 */
5427 if (pMac->lim.fScanDisabled)
5428 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005429 if (pMsg->type == eWNI_SME_SCAN_REQ)
5430 {
5431 limSendSmeScanRsp(pMac,
5432 offsetof(tSirSmeScanRsp,bssDescription[0]),
5433 eSIR_SME_INVALID_PARAMETERS,
5434 pScanReq->sessionId,
5435 pScanReq->transactionId);
5436
5437 bufConsumed = TRUE;
5438 }
5439 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5440 {
5441 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5442 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5443 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5444
5445 /*
5446 * limRemainOnChnRsp will free the buffer this change is to
5447 * avoid "double free"
5448 */
5449 bufConsumed = FALSE;
5450 }
5451
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305452 limLog(pMac, LOGE,
5453 FL("Error: Scan Disabled."
5454 " Return with error status for SME Message %s(%d)"),
5455 limMsgStr(pMsg->type), pMsg->type);
5456
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005457 return bufConsumed;
5458 }
5459 /*
5460 * Do not add BREAK here
5461 */
5462 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005463 case eWNI_SME_JOIN_REQ:
5464 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5465 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5466 {
5467 tANI_U32 noaDuration;
5468 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
5469 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf);
5470 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5471 return bufConsumed;
5472 }
5473 }
5474 /* If no insert NOA required then execute the code below */
5475
Jeff Johnson295189b2012-06-20 16:38:30 -07005476 switch (pMsg->type)
5477 {
5478 case eWNI_SME_START_REQ:
5479 __limProcessSmeStartReq(pMac, pMsgBuf);
5480 break;
5481
5482 case eWNI_SME_SYS_READY_IND:
5483 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5484 break;
5485
Jeff Johnson295189b2012-06-20 16:38:30 -07005486 case eWNI_SME_START_BSS_REQ:
5487 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5488 break;
5489
5490 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005491 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005492 break;
5493
Jeff Johnsone7245742012-09-05 17:12:55 -07005494#ifdef FEATURE_OEM_DATA_SUPPORT
5495 case eWNI_SME_OEM_DATA_REQ:
5496 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005497 break;
5498#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005499 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5500 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5501 break;
5502
5503 case eWNI_SME_UPDATE_NOA:
5504 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5505 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305506 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5507 __limProcessClearDfsChannelList(pMac, pMsg);
5508 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005509 case eWNI_SME_JOIN_REQ:
5510 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005511 break;
5512
5513 case eWNI_SME_AUTH_REQ:
5514 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5515
5516 break;
5517
5518 case eWNI_SME_REASSOC_REQ:
5519 __limProcessSmeReassocReq(pMac, pMsgBuf);
5520
5521 break;
5522
5523 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5524 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5525
5526 break;
5527
5528 case eWNI_SME_DISASSOC_REQ:
5529 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5530
5531 break;
5532
5533 case eWNI_SME_DISASSOC_CNF:
5534 case eWNI_SME_DEAUTH_CNF:
5535 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5536
5537 break;
5538
5539 case eWNI_SME_DEAUTH_REQ:
5540 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5541
5542 break;
5543
Jeff Johnson295189b2012-06-20 16:38:30 -07005544
5545
5546 case eWNI_SME_SETCONTEXT_REQ:
5547 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5548
5549 break;
5550
5551 case eWNI_SME_REMOVEKEY_REQ:
5552 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5553
5554 break;
5555
5556 case eWNI_SME_STOP_BSS_REQ:
5557 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5558 break;
5559
5560 case eWNI_SME_ASSOC_CNF:
5561 case eWNI_SME_REASSOC_CNF:
5562 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005563 PELOG1(limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005564 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005565 PELOG1(limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005566 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5567 break;
5568
5569 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005570 PELOG1(limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005571 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5572 break;
5573
5574 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005575 PELOG1(limLog(pMac, LOG1, FL("Received DELTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005576 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5577 break;
5578
5579 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005580 PELOG1(limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005581 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5582 break;
5583
5584 case eWNI_SME_STA_STAT_REQ:
5585 case eWNI_SME_AGGR_STAT_REQ:
5586 case eWNI_SME_GLOBAL_STAT_REQ:
5587 case eWNI_SME_STAT_SUMM_REQ:
5588 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5589 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5590 bufConsumed = FALSE;
5591 break;
5592 case eWNI_SME_GET_STATISTICS_REQ:
5593 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5594 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5595 bufConsumed = FALSE;
5596 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005597#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005598 case eWNI_SME_GET_ROAM_RSSI_REQ:
5599 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5600 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5601 bufConsumed = FALSE;
5602 break;
5603#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005604#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005605 case eWNI_SME_GET_TSM_STATS_REQ:
5606 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5607 bufConsumed = FALSE;
5608 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005609#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005610 case eWNI_SME_DEL_BA_PEER_IND:
5611 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5612 break;
5613 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5614 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5615 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005616 case eWNI_SME_GET_ASSOC_STAS_REQ:
5617 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5618 break;
5619 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5620 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5621 break;
5622
5623 case eWNI_SME_HIDE_SSID_REQ:
5624 __limProcessSmeHideSSID(pMac, pMsgBuf);
5625 break;
5626 case eWNI_SME_UPDATE_APWPSIE_REQ:
5627 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5628 break;
5629 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5630 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5631 break;
5632
5633 case eWNI_SME_SET_APWPARSNIEs_REQ:
5634 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5635 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005636
5637 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5638 //Update the beaconInterval
5639 __limProcessSmeChangeBI(pMac, pMsgBuf );
5640 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005641
5642#if defined WLAN_FEATURE_VOWIFI
5643 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5644 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5645 __limProcessReportMessage(pMac, pMsg);
5646 break;
5647#endif
5648
5649#if defined WLAN_FEATURE_VOWIFI_11R
5650 case eWNI_SME_FT_PRE_AUTH_REQ:
5651 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5652 break;
5653 case eWNI_SME_FT_UPDATE_KEY:
5654 limProcessFTUpdateKey(pMac, pMsgBuf);
5655 break;
5656
5657 case eWNI_SME_FT_AGGR_QOS_REQ:
5658 limProcessFTAggrQosReq(pMac, pMsgBuf);
5659 break;
5660#endif
5661
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005662#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
5663 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07005664 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5665 break;
5666#endif
5667 case eWNI_SME_ADD_STA_SELF_REQ:
5668 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5669 break;
5670 case eWNI_SME_DEL_STA_SELF_REQ:
5671 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5672 break;
5673
Jeff Johnson295189b2012-06-20 16:38:30 -07005674 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5675 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5676 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005677#ifdef FEATURE_WLAN_TDLS
5678 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5679 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5680 break;
5681 case eWNI_SME_TDLS_ADD_STA_REQ:
5682 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5683 break;
5684 case eWNI_SME_TDLS_DEL_STA_REQ:
5685 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5686 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305687 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5688 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5689 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005690#endif
5691#ifdef FEATURE_WLAN_TDLS_INTERNAL
5692 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
5693 limProcessSmeDisStartReq(pMac, pMsgBuf);
5694 break ;
5695 case eWNI_SME_TDLS_LINK_START_REQ:
5696 limProcessSmeLinkStartReq(pMac, pMsgBuf);
5697 break ;
5698 case eWNI_SME_TDLS_TEARDOWN_REQ:
5699 limProcessSmeTeardownReq(pMac, pMsgBuf);
5700 break ;
5701#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305702 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5703 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5704 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005705
schang86c22c42013-03-13 18:41:24 -07005706 case eWNI_SME_SET_TX_POWER_REQ:
5707 limSendSetTxPowerReq(pMac, pMsgBuf);
5708 break ;
5709
Jeff Johnson295189b2012-06-20 16:38:30 -07005710 default:
5711 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5712 pMsg->bodyptr = NULL;
5713 break;
5714 } // switch (msgType)
5715
5716 return bufConsumed;
5717} /*** end limProcessSmeReqMessages() ***/