blob: 714baf707ae410b9e1df3314c9b19c7c84d630d2 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080026 */
Kiet Lam842dad02014-02-18 18:44:02 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080031/*
Jeff Johnson295189b2012-06-20 16:38:30 -070032 * This file limProcessSmeReqMessages.cc contains the code
33 * for processing SME request messages.
34 * Author: Chandra Modumudi
35 * Date: 02/11/02
36 * History:-
37 * Date Modified by Modification Information
38 * --------------------------------------------------------------------
39 *
40 */
41
42#include "palTypes.h"
43#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070044#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070045#include "cfgApi.h"
46#include "sirApi.h"
47#include "schApi.h"
48#include "utilsApi.h"
49#include "limTypes.h"
50#include "limUtils.h"
51#include "limAssocUtils.h"
52#include "limSecurityUtils.h"
53#include "limSerDesUtils.h"
54#include "limSmeReqUtils.h"
55#include "limIbssPeerMgmt.h"
56#include "limAdmitControl.h"
57#include "dphHashTable.h"
58#include "limSendMessages.h"
59#include "limApi.h"
60#include "wmmApsd.h"
61
Jeff Johnson295189b2012-06-20 16:38:30 -070062#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070063
64#if defined WLAN_FEATURE_VOWIFI
65#include "rrmApi.h"
66#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080067#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
68#include "eseApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070069#endif
70
71#if defined WLAN_FEATURE_VOWIFI_11R
72#include <limFT.h>
73#endif
74
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080075#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -070076/* These are the min/max tx power (non virtual rates) range
77 supported by prima hardware */
Sandeep Puligilla33ccf332013-12-19 16:06:42 +053078#define MIN_TX_PWR_CAP 8
79#define MAX_TX_PWR_CAP 22
Jeff Johnson295189b2012-06-20 16:38:30 -070080
81#endif
82
Viral Modid86bde22012-12-10 13:09:21 -080083/* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK
84 * in case of P2P Client and starting actual scanning with init scan req/rsp plus in case of concurrency,
Sunil Ravi24fd3aa2013-01-21 22:12:06 -080085 * taking care of sending null data and receiving ACK to/from AP/Also SetChannel with calibration is taking
86 * around 7ms .
Viral Modid86bde22012-12-10 13:09:21 -080087 */
Viral Modid440e682013-03-06 02:25:31 -080088#define SCAN_MESSAGING_OVERHEAD 20 // in msecs
89#define JOIN_NOA_DURATION 2000 // in msecs
90#define OEM_DATA_NOA_DURATION 60 // in msecs
91#define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 // in msecs
Jeff Johnson295189b2012-06-20 16:38:30 -070092
Gopichand Nakkala096a1052012-12-21 07:05:34 -080093#define CONV_MS_TO_US 1024 //conversion factor from ms to us
94
Jeff Johnson295189b2012-06-20 16:38:30 -070095// SME REQ processing function templates
96static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *);
97static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *);
98static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
Viral Modid440e682013-03-06 02:25:31 -080099static void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *);
Jeff Johnson295189b2012-06-20 16:38:30 -0700100static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *);
101static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *);
102static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *);
103static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *);
104static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *);
105static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *);
106static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
107
Jeff Johnson295189b2012-06-20 16:38:30 -0700108void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *);
109
Jeff Johnson295189b2012-06-20 16:38:30 -0700110extern void peRegisterTLHandle(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700111
Jeff Johnson295189b2012-06-20 16:38:30 -0700112
Jeff Johnson295189b2012-06-20 16:38:30 -0700113#ifdef BACKGROUND_SCAN_ENABLED
114
115// start the background scan timers if it hasn't already started
116static void
117__limBackgroundScanInitiate(tpAniSirGlobal pMac)
118{
119 if (pMac->lim.gLimBackgroundScanStarted)
120 return;
121
122 //make sure timer is created first
123 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
124 {
125 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -0700126 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700127 if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700128 limLog(pMac, LOGP, FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700129 pMac->lim.gLimBackgroundScanStarted = true;
130 pMac->lim.gLimBackgroundScanChannelId = 0;
131 }
132}
133
134#endif // BACKGROUND_SCAN_ENABLED
Jeff Johnson295189b2012-06-20 16:38:30 -0700135
136// determine if a fresh scan request must be issued or not
137/*
138* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
139* If one of the sessions is not in one of the above states, then PE does not do fresh scan
140* If no session exists (scanning very first time), then PE will always do fresh scan if SME
141* asks it to do that.
142*/
143static tANI_U8
144__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
145{
146
147 tANI_U8 validState = TRUE;
148 int i;
149
150 if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
151 {
152 return FALSE;
153 }
154 for(i =0; i < pMac->lim.maxBssId; i++)
155 {
156
157 if(pMac->lim.gpSession[i].valid == TRUE)
158 {
159 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
160 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
161 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
162
163 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
164 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
165 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
166 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700167 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
168 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
169 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
170 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700171 ))
172 {
173 validState = FALSE;
174 break;
175 }
176
177 }
178 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530179 limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700180
181 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
182 return TRUE;
183
184 return FALSE;
185}
186
Jeff Johnson295189b2012-06-20 16:38:30 -0700187
188
189/**
190 * __limIsSmeAssocCnfValid()
191 *
192 *FUNCTION:
193 * This function is called by limProcessLmmMessages() upon
194 * receiving SME_ASSOC_CNF.
195 *
196 *LOGIC:
197 * Message validity checks are performed in this function
198 *
199 *ASSUMPTIONS:
200 *
201 *NOTE:
202 *
203 * @param pMeasReq Pointer to Received ASSOC_CNF message
204 * @return true When received SME_ASSOC_CNF is formatted
205 * correctly
206 * false otherwise
207 */
208
209inline static tANI_U8
210__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
211{
212 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
213 return false;
214 else
215 return true;
216} /*** end __limIsSmeAssocCnfValid() ***/
217
218
219/**
220 * __limGetSmeJoinReqSizeForAlloc()
221 *
222 *FUNCTION:
223 * This function is called in various places to get IE length
224 * from tSirBssDescription structure
225 * number being scanned.
226 *
227 *PARAMS:
228 *
229 *LOGIC:
230 *
231 *ASSUMPTIONS:
232 * NA
233 *
234 *NOTE:
235 * NA
236 *
237 * @param pBssDescr
238 * @return Total IE length
239 */
240
241static tANI_U16
242__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
243{
244 tANI_U16 len = 0;
245
246 if (!pBuf)
247 return len;
248
249 pBuf += sizeof(tANI_U16);
250 len = limGetU16( pBuf );
251 return (len + sizeof( tANI_U16 ));
252} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
253
254
255/**----------------------------------------------------------------
256\fn __limIsDeferedMsgForLearn
257
258\brief Has role only if 11h is enabled. Not used on STA side.
259 Defers the message if SME is in learn state and brings
260 the LIM back to normal mode.
261
262\param pMac
263\param pMsg - Pointer to message posted from SME to LIM.
264\return TRUE - If defered
265 FALSE - Otherwise
266------------------------------------------------------------------*/
267static tANI_BOOLEAN
268__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
269{
270 if (limIsSystemInScanState(pMac))
271 {
272 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
273 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700274 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700275 return eANI_BOOLEAN_FALSE;
276 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700277 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700278 pMsg->type);)
279
280 /** Send finish scan req to HAL only if LIM is not waiting for any response
281 * from HAL like init scan rsp, start scan rsp etc.
282 */
283 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
284 {
285 //Set the resume channel to Any valid channel (invalid).
286 //This will instruct HAL to set it to any previous valid channel.
287 peSetResumeChannel(pMac, 0, 0);
288 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
289 }
290
291 return eANI_BOOLEAN_TRUE;
292 }
293 return eANI_BOOLEAN_FALSE;
294}
295
296/**----------------------------------------------------------------
297\fn __limIsDeferedMsgForRadar
298
299\brief Has role only if 11h is enabled. Not used on STA side.
300 Defers the message if radar is detected.
301
302\param pMac
303\param pMsg - Pointer to message posted from SME to LIM.
304\return TRUE - If defered
305 FALSE - Otherwise
306------------------------------------------------------------------*/
307static tANI_BOOLEAN
308__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
309{
310 /** fRadarDetCurOperChan will be set only if we detect radar in current
311 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700312 //TODO: Need to take care radar detection.
313 //if (LIM_IS_RADAR_DETECTED(pMac))
314 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 {
316 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
317 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700318 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 return eANI_BOOLEAN_FALSE;
320 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700321 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 pMsg->type);)
323 return eANI_BOOLEAN_TRUE;
324 }
325 return eANI_BOOLEAN_FALSE;
326}
327
328
329/**
330 * __limProcessSmeStartReq()
331 *
332 *FUNCTION:
333 * This function is called to process SME_START_REQ message
334 * from HDD or upper layer application.
335 *
336 *LOGIC:
337 *
338 *ASSUMPTIONS:
339 *
340 *NOTE:
341 *
342 * @param pMac Pointer to Global MAC structure
343 * @param *pMsgBuf A pointer to the SME message buffer
344 * @return None
345 */
346
347static void
348__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
349{
350 tSirResultCodes retCode = eSIR_SME_SUCCESS;
351 tANI_U8 smesessionId;
352 tANI_U16 smetransactionId;
353
354
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700355 PELOG1(limLog(pMac, LOG1, FL("Received START_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700356
357 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
358
359 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
360 {
361 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
362
Jeff Johnsone7245742012-09-05 17:12:55 -0700363 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700364
365 /// By default do not return after first scan match
366 pMac->lim.gLimReturnAfterFirstMatch = 0;
367
368 /// Initialize MLM state machine
369 limInitMlm(pMac);
370
371 /// By default return unique scan results
372 pMac->lim.gLimReturnUniqueResults = true;
373 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700374#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
375 pMac->lim.gLimSmeLfrScanResultLength = 0;
376#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700377
Jeff Johnson295189b2012-06-20 16:38:30 -0700378 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
379 {
380 /*
381 * Need to indicate new BSSs found during background scanning to
382 * host. Update this parameter at CFG
383 */
384 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
385 != eSIR_SUCCESS)
386 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700387 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
389 }
390 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700391 }
392 else
393 {
394 /**
395 * Should not have received eWNI_SME_START_REQ in states
396 * other than OFFLINE. Return response to host and
397 * log error
398 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700399 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
401 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
402 }
403 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
404} /*** end __limProcessSmeStartReq() ***/
405
406
407/** -------------------------------------------------------------
408\fn __limProcessSmeSysReadyInd
409\brief handles the notification from HDD. PE just forwards this message to HAL.
410\param tpAniSirGlobal pMac
411\param tANI_U32* pMsgBuf
412\return TRUE-Posting to HAL failed, so PE will consume the buffer.
413\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
414 -------------------------------------------------------------*/
415static tANI_BOOLEAN
416__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
417{
418 tSirMsgQ msg;
419
420 msg.type = WDA_SYS_READY_IND;
421 msg.reserved = 0;
422 msg.bodyptr = pMsgBuf;
423 msg.bodyval = 0;
424
Jeff Johnson92751692013-03-06 16:00:33 -0800425 if (pMac->gDriverType != eDRIVER_TYPE_MFG)
Jeff Johnson295189b2012-06-20 16:38:30 -0700426 {
Jeff Johnson92751692013-03-06 16:00:33 -0800427 peRegisterTLHandle(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700428 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700429 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700430 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700431
Jeff Johnson92751692013-03-06 16:00:33 -0800432 if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
Jeff Johnson295189b2012-06-20 16:38:30 -0700433 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700434 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700435 return eANI_BOOLEAN_TRUE;
436 }
437 return eANI_BOOLEAN_FALSE;
438}
439
Jeff Johnsone7245742012-09-05 17:12:55 -0700440#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700441
Jeff Johnsone7245742012-09-05 17:12:55 -0700442tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
443{
444 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
445 {
446 switch(secondaryChanOffset)
447 {
448 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
449 return primarychanNum;
450 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
451 return primarychanNum + 2;
452 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
453 return primarychanNum - 2;
454 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
455 return primarychanNum + 6;
456 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
457 return primarychanNum + 2;
458 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
459 return primarychanNum - 2;
460 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
461 return primarychanNum - 6;
462 default :
463 return eSIR_CFG_INVALID_ID;
464 }
465 }
466 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
467 {
468 switch(secondaryChanOffset)
469 {
470 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
471 return primarychanNum + 2;
472 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
473 return primarychanNum - 2;
474 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
475 return primarychanNum;
476 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
477 return primarychanNum + 2;
478 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
479 return primarychanNum - 2;
480 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
481 return primarychanNum + 2;
482 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
483 return primarychanNum - 2;
484 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
485 return primarychanNum + 2;
486 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
487 return primarychanNum - 2;
488 default :
489 return eSIR_CFG_INVALID_ID;
490 }
491 }
492 return primarychanNum;
493}
494
495#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700496/**
497 * __limHandleSmeStartBssRequest()
498 *
499 *FUNCTION:
500 * This function is called to process SME_START_BSS_REQ message
501 * from HDD or upper layer application.
502 *
503 *LOGIC:
504 *
505 *ASSUMPTIONS:
506 *
507 *NOTE:
508 *
509 * @param pMac Pointer to Global MAC structure
510 * @param *pMsgBuf A pointer to the SME message buffer
511 * @return None
512 */
513
514static void
515__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
516{
517 tANI_U16 size;
518 tANI_U32 val = 0;
519 tSirRetStatus retStatus;
520 tSirMacChanNum channelNumber;
Jeff Johnsonace91102013-04-05 08:03:18 -0700521 tLimMlmStartReq *pMlmStartReq = NULL;
522 tpSirSmeStartBssReq pSmeStartBssReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 tSirResultCodes retCode = eSIR_SME_SUCCESS;
524 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700525 tANI_U8 sessionId;
526 tpPESession psessionEntry = NULL;
527 tANI_U8 smesessionId;
528 tANI_U16 smetransactionId;
529
530#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
531 //Since the session is not created yet, sending NULL. The response should have the correct state.
532 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
533#endif //FEATURE_WLAN_DIAG_SUPPORT
534
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700535 PELOG1(limLog(pMac, LOG1, FL("Received START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700536
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530537 /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */
Jeff Johnson295189b2012-06-20 16:38:30 -0700538 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
539 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
540 {
541 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
542
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530543 pSmeStartBssReq = vos_mem_malloc(size);
544 if ( NULL == pSmeStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530546 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pMac->lim.gpLimStartBssReq"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700547 /// Send failure response to host
548 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
549 goto end;
550 }
551
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530552 vos_mem_set((void *)pSmeStartBssReq, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700553
554 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
555 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
556 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700557 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 retCode = eSIR_SME_INVALID_PARAMETERS;
559 goto free;
560 }
561#if 0
562 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700563 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700564 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
565#endif
566
567 /* This is the place where PE is going to create a session.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530568 * If session is not existed, then create a new session */
Jeff Johnson295189b2012-06-20 16:38:30 -0700569 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
570 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700571 limLog(pMac, LOGW, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700572 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
573 psessionEntry = NULL;
574 goto free;
575 }
576 else
577 {
578 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
579 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700580 limLog(pMac, LOGW, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
582 goto free;
583 }
584
585 }
586
587 /* Store the session related parameters in newly created session */
588 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
589
590 /* Store PE sessionId in session Table */
591 psessionEntry->peSessionId = sessionId;
592
593 /* Store SME session Id in sessionTable */
594 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
595
596 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
597
598 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
599
600 /* Copy SSID to session table */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530601 vos_mem_copy( (tANI_U8 *)&psessionEntry->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700602 (tANI_U8 *)&pSmeStartBssReq->ssId,
603 (pSmeStartBssReq->ssId.length + 1));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530604
Jeff Johnson295189b2012-06-20 16:38:30 -0700605 psessionEntry->bssType = pSmeStartBssReq->bssType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530606
Jeff Johnson295189b2012-06-20 16:38:30 -0700607 psessionEntry->nwType = pSmeStartBssReq->nwType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530608
Jeff Johnson295189b2012-06-20 16:38:30 -0700609 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
610
611 /* Store the channel number in session Table */
612 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
613
614 /*Store Persona */
615 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700616 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 psessionEntry->pePersona);
618
619 /*Update the phymode*/
620 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
621
622 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
623 psessionEntry->currentOperChannel );
624 /* Store the dot 11 mode in to the session Table*/
625
626 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700627 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
628#ifdef WLAN_FEATURE_11AC
629 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700630 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
631 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700632#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800633
634 psessionEntry->txLdpcIniFeatureEnabled =
635 pSmeStartBssReq->txLdpcIniFeatureEnabled;
636
Chet Lanctot8cecea22014-02-11 19:09:36 -0800637#ifdef WLAN_FEATURE_11W
638 psessionEntry->limRmfEnabled = pSmeStartBssReq->pmfCapable ? 1 : 0;
639 limLog(pMac, LOG1, FL("Session RMF enabled: %d"), psessionEntry->limRmfEnabled);
640#endif
641
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530642 vos_mem_copy((void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700643 (void*)&pSmeStartBssReq->operationalRateSet,
644 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530645 vos_mem_copy((void*)&psessionEntry->extRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700646 (void*)&pSmeStartBssReq->extendedRateSet,
647 sizeof(tSirMacRateSet));
648
649 switch(pSmeStartBssReq->bssType)
650 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700651 case eSIR_INFRA_AP_MODE:
652 psessionEntry->limSystemRole = eLIM_AP_ROLE;
653 psessionEntry->privacy = pSmeStartBssReq->privacy;
654 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
655 psessionEntry->authType = pSmeStartBssReq->authType;
656 /* Store the DTIM period */
657 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
658 /*Enable/disable UAPSD*/
659 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
660 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
661 {
662 psessionEntry->proxyProbeRspEn = 0;
663 }
664 else
665 {
666 /* To detect PBC overlap in SAP WPS mode, Host handles
667 * Probe Requests.
668 */
669 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
670 {
671 psessionEntry->proxyProbeRspEn = 1;
672 }
673 else
674 {
675 psessionEntry->proxyProbeRspEn = 0;
676 }
677 }
678 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
679 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
krunal soni45b9eb62014-03-26 12:54:25 -0700680 limGetShortSlotFromPhyMode(pMac, psessionEntry,
681 psessionEntry->gLimPhyMode,
682 &psessionEntry->shortSlotTimeSupported);
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700684 case eSIR_IBSS_MODE:
685 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
krunal soni45b9eb62014-03-26 12:54:25 -0700686 limGetShortSlotFromPhyMode(pMac, psessionEntry,
687 psessionEntry->gLimPhyMode,
688 &psessionEntry->shortSlotTimeSupported);
Abhishek Singhd5c31272014-03-07 14:46:50 +0530689 /* In WPA-NONE case we wont get the privacy bit in ibss config
690 * from supplicant, but we are updating WNI_CFG_PRIVACY_ENABLED
691 * on basis of Encryption type in csrRoamSetBssConfigCfg. So
692 * get the privacy info from WNI_CFG_PRIVACY_ENABLED
693 */
694 if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &val)
695 != eSIR_SUCCESS)
696 limLog(pMac, LOGE, FL("cfg get WNI_CFG_PRIVACY_ENABLED"
697 " failed"));
698 psessionEntry->privacy =(tANI_U8) val;
krunal sonie9002db2013-11-25 14:24:17 -0800699 psessionEntry->isCoalesingInIBSSAllowed =
700 pSmeStartBssReq->isCoalesingInIBSSAllowed;
Jeff Johnson295189b2012-06-20 16:38:30 -0700701 break;
702
703 case eSIR_BTAMP_AP_MODE:
704 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
705 break;
706
707 case eSIR_BTAMP_STA_MODE:
708 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
709 break;
710
711 /* There is one more mode called auto mode. which is used no where */
712
713 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
714
715
716 default:
717 //not used anywhere...used in scan function
718 break;
719 }
720
721 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
722 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700723 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 )
725 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530726 psessionEntry->parsedAssocReq = vos_mem_malloc(
727 psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq));
728 if ( NULL == psessionEntry->parsedAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700729 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530730 limLog(pMac, LOGW, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700731 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
732 goto free;
733 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530734 vos_mem_set(psessionEntry->parsedAssocReq,
735 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)),
736 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 }
738
739 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
740 if (pSmeStartBssReq->channelId)
741 {
742 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700743 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
744 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
745 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700746 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700747 FL("cbMode %u"), pSmeStartBssReq->cbMode);
748#ifdef WLAN_FEATURE_11AC
749 if(psessionEntry->vhtCapability)
750 {
751 tANI_U32 centerChan;
752 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700753
Jeff Johnsone7245742012-09-05 17:12:55 -0700754 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
755 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700757 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700758 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700759 }
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530760
Abhishek Singh921926b2014-02-13 17:21:01 +0530761 if(channelNumber <= RF_CHAN_14 &&
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530762 chanWidth != eHT_CHANNEL_WIDTH_20MHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -0700763 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530764 chanWidth = eHT_CHANNEL_WIDTH_20MHZ;
Abhishek Singh921926b2014-02-13 17:21:01 +0530765 limLog(pMac, LOG1, FL("Setting chanWidth to 20Mhz for"
766 " channel %d"),channelNumber);
Jeff Johnson295189b2012-06-20 16:38:30 -0700767 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700768
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530769 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ ||
770 chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
Abhishek Singh921926b2014-02-13 17:21:01 +0530771 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530772 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
773 WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
774 != eSIR_SUCCESS)
775 {
776 limLog(pMac, LOGP, FL("could not set "
777 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
778 retCode = eSIR_LOGP_EXCEPTION;
779 goto free;
780 }
781 }
782 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
783 {
784 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
785 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
786 != eSIR_SUCCESS)
787 {
788 limLog(pMac, LOGP, FL("could not set "
789 " WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
790 retCode = eSIR_LOGP_EXCEPTION;
791 goto free;
792 }
793
794 centerChan = limGetCenterChannel( pMac, channelNumber,
795 pSmeStartBssReq->cbMode,
796 WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
Jeff Johnsone7245742012-09-05 17:12:55 -0700797 if(centerChan != eSIR_CFG_INVALID_ID)
798 {
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530799 limLog(pMac, LOGW, FL("***Center Channel for "
800 "80MHZ channel width = %d"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700801 psessionEntry->apCenterChan = centerChan;
Abhishek Singh921926b2014-02-13 17:21:01 +0530802 if (cfgSetInt(pMac,
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530803 WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
804 centerChan) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -0700805 {
Abhishek Singh921926b2014-02-13 17:21:01 +0530806 limLog(pMac, LOGP, FL("could not set "
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530807 "WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700808 retCode = eSIR_LOGP_EXCEPTION;
809 goto free;
810 }
811 }
812 }
813
Abhishek Singhb92f70c2014-04-28 12:13:08 +0530814 /* All the translation is done by now for gVhtChannelWidth
815 * from .ini file to the actual values as defined in spec.
816 * So, grabing the spec value which is
817 * updated in .dat file by the above logic */
818 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
819 &chanWidth) != eSIR_SUCCESS)
820 {
821 limLog(pMac, LOGP,
822 FL("Unable to retrieve Channel Width from CFG"));
823 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700824 /*For Sta+p2p-Go concurrency
825 vhtTxChannelWidthSet is used for storing p2p-GO channel width
826 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
827 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
828 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700829 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700830 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700831 }
832 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
833#endif
834 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700835 else
836 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700837 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700838 retCode = eSIR_SME_INVALID_PARAMETERS;
839 goto free;
840 }
841
842 // Delete pre-auth list if any
843 limDeletePreAuthList(pMac);
844
845 // Delete IBSS peer BSSdescription list if any
846 //limIbssDelete(pMac); sep 26 review
847
848
849
850#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
851 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 limInitMlm(pMac);
853#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700854
Jeff Johnsone7245742012-09-05 17:12:55 -0700855 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700856
Jeff Johnson295189b2012-06-20 16:38:30 -0700857 /* keep the RSN/WPA IE information in PE Session Entry
858 * later will be using this to check when received (Re)Assoc req
859 * */
860 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
861
Jeff Johnson295189b2012-06-20 16:38:30 -0700862
Jeff Johnson295189b2012-06-20 16:38:30 -0700863 //Taken care for only softAP case rest need to be done
864 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
865 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
866 /*each byte will have the following info
867 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
868 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530869 vos_mem_copy( (void *) &psessionEntry->cfgProtection,
Jeff Johnson295189b2012-06-20 16:38:30 -0700870 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700871 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
873 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700874
875 // Prepare and Issue LIM_MLM_START_REQ to MLM
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530876 pMlmStartReq = vos_mem_malloc(sizeof(tLimMlmStartReq));
877 if ( NULL == pMlmStartReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530879 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
881 goto free;
882 }
883
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530884 vos_mem_set((void *) pMlmStartReq, sizeof(tLimMlmStartReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700885
886 /* Copy SSID to the MLM start structure */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530887 vos_mem_copy( (tANI_U8 *) &pMlmStartReq->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 (tANI_U8 *) &pSmeStartBssReq->ssId,
889 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
891 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700892
893
894 pMlmStartReq->bssType = psessionEntry->bssType;
895
896 /* Fill PE session Id from the session Table */
897 pMlmStartReq->sessionId = psessionEntry->peSessionId;
898
899 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700900 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700901 )
902 {
903 //len = sizeof(tSirMacAddr);
904 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
905 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700906 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700907
908 /* Copy the BSSId from sessionTable to mlmStartReq struct */
909 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
910 }
911
912 else // ibss mode
913 {
914 pMac->lim.gLimIbssCoalescingHappened = false;
915
916 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
917 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700918 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700919 retCode = eSIR_LOGP_EXCEPTION;
920 goto free;
921 }
922
923 if(!autoGenBssId)
924 {
925 // We're not auto generating BSSID. Instead, get it from session entry
926 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
927
928 if(pMlmStartReq->bssId[0] & 0x01)
929 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700930 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700931 autoGenBssId = TRUE;
932 }
933 }
934
935 if( autoGenBssId )
936 { //if BSSID is not any uc id. then use locally generated BSSID.
937 //Autogenerate the BSSID
938 limGetRandomBssid( pMac, pMlmStartReq->bssId);
939 pMlmStartReq->bssId[0]= 0x02;
940
941 /* Copy randomly generated BSSID to the session Table */
942 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
943 }
944 }
945 /* store the channel num in mlmstart req structure */
946 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
947 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
948 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
949
Jeff Johnson295189b2012-06-20 16:38:30 -0700950 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
951 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
952 pMlmStartReq->wps_state = psessionEntry->wps_state;
953
954 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700955 {
956 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700957 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700958 pMlmStartReq->dtimPeriod = (tANI_U8)val;
959 }
960
961 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700962 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700963 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
964
965 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700966 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700967 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
968
969 //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 +0530970 vos_mem_copy((void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700971 sizeof(tSirMacRateSet));
972
Jeff Johnson295189b2012-06-20 16:38:30 -0700973 // Now populate the 11n related parameters
974 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700975 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 //
977 // FIXME_GEN4 - Determine the appropriate defaults...
978 //
979 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
980 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700981 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700982
983 /* sep26 review */
984 psessionEntry->limRFBand = limGetRFBand(channelNumber);
985
986 // Initialize 11h Enable Flag
987 psessionEntry->lim11hEnable = 0;
988 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
989 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
990 {
991 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700992 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700993 psessionEntry->lim11hEnable = val;
994 }
995
996 if (!psessionEntry->lim11hEnable)
997 {
998 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700999 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001000 }
1001
Jeff Johnson295189b2012-06-20 16:38:30 -07001002 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
1003 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001004 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001005
1006 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
1007 return;
1008 }
1009 else
1010 {
1011
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001012 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001013 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
1014 goto end;
1015 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
1016
1017free:
Jeff Johnsonace91102013-04-05 08:03:18 -07001018 if ((psessionEntry != NULL) &&
1019 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
1020 {
1021 psessionEntry->pLimStartBssReq = NULL;
1022 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301023 vos_mem_free( pSmeStartBssReq);
1024 vos_mem_free( pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001025
1026end:
1027
1028 /* This routine should return the sme sessionId and SME transaction Id */
1029 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1030
1031 if(NULL != psessionEntry)
1032 {
1033 peDeleteSession(pMac,psessionEntry);
1034 psessionEntry = NULL;
1035 }
1036 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
1037} /*** end __limHandleSmeStartBssRequest() ***/
1038
1039
1040/**--------------------------------------------------------------
1041\fn __limProcessSmeStartBssReq
1042
1043\brief Wrapper for the function __limHandleSmeStartBssRequest
1044 This message will be defered until softmac come out of
1045 scan mode or if we have detected radar on the current
1046 operating channel.
1047\param pMac
1048\param pMsg
1049
1050\return TRUE - If we consumed the buffer
1051 FALSE - If have defered the message.
1052 ---------------------------------------------------------------*/
1053static tANI_BOOLEAN
1054__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1055{
1056 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1057 __limIsDeferedMsgForRadar(pMac, pMsg))
1058 {
1059 /**
1060 * If message defered, buffer is not consumed yet.
1061 * So return false
1062 */
1063 return eANI_BOOLEAN_FALSE;
1064 }
1065
1066 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1067 return eANI_BOOLEAN_TRUE;
1068}
1069
1070
1071/**
1072 * limGetRandomBssid()
1073 *
1074 * FUNCTION:This function is called to process generate the random number for bssid
1075 * This function is called to process SME_SCAN_REQ message
1076 * from HDD or upper layer application.
1077 *
1078 * LOGIC:
1079 *
1080 * ASSUMPTIONS:
1081 *
1082 * NOTE:
1083 * 1. geneartes the unique random number for bssid in ibss
1084 *
1085 * @param pMac Pointer to Global MAC structure
1086 * @param *data Pointer to bssid buffer
1087 * @return None
1088 */
1089void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1090{
1091 tANI_U32 random[2] ;
1092 random[0] = tx_time_get();
1093 random[0] |= (random[0] << 15) ;
1094 random[1] = random[0] >> 1;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301095 vos_mem_copy( data, (tANI_U8*)random, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001096}
1097
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301098static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
1099 tpSirSmeScanReq pScanReq)
1100{
1101 tSirScanOffloadReq *pScanOffloadReq;
1102 tANI_U8 *p;
1103 tSirMsgQ msg;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301104 tANI_U16 i, len;
1105 tSirRetStatus rc = eSIR_SUCCESS;
1106
1107 /* The tSirScanOffloadReq will reserve the space for first channel,
1108 so allocate the memory for (numChannels - 1) and uIEFieldLen */
1109 len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
1110 pScanReq->uIEFieldLen;
1111
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301112 pScanOffloadReq = vos_mem_malloc(len);
1113 if ( NULL == pScanOffloadReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301114 {
1115 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301116 FL("AllocateMemory failed for pScanOffloadReq"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301117 return eHAL_STATUS_FAILURE;
1118 }
1119
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301120 vos_mem_set( (tANI_U8 *) pScanOffloadReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301121
1122 msg.type = WDA_START_SCAN_OFFLOAD_REQ;
1123 msg.bodyptr = pScanOffloadReq;
1124 msg.bodyval = 0;
1125
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301126 vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301127 (tANI_U8*) pScanReq->bssId,
1128 sizeof(tSirMacAddr));
1129
1130 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
1131 {
1132 limLog(pMac, LOGE,
1133 FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
Kiet Lamb1233192013-11-28 13:38:20 +05301134 vos_mem_free (pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301135 return eHAL_STATUS_FAILURE;
1136 }
1137
1138 pScanOffloadReq->numSsid = pScanReq->numSsid;
1139 for (i = 0; i < pScanOffloadReq->numSsid; i++)
1140 {
1141 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301142 vos_mem_copy((tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301143 (tANI_U8 *) pScanReq->ssId[i].ssId,
1144 pScanOffloadReq->ssId[i].length);
1145 }
1146
1147 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301148 vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301149 (tANI_U8 *) pScanReq->selfMacAddr,
1150 sizeof(tSirMacAddr));
1151 pScanOffloadReq->bssType = pScanReq->bssType;
1152 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1153 pScanOffloadReq->scanType = pScanReq->scanType;
1154 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1155 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1156 pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
1157 pScanOffloadReq->sessionId = pScanReq->sessionId;
1158 pScanOffloadReq->channelList.numChannels =
1159 pScanReq->channelList.numChannels;
1160 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1161 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1162 p[i] = pScanReq->channelList.channelNumber[i];
1163
1164 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1165 pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301166 vos_mem_copy((tANI_U8 *) p + i,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301167 (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
1168 pScanOffloadReq->uIEFieldLen);
1169
1170 rc = wdaPostCtrlMsg(pMac, &msg);
1171 if (rc != eSIR_SUCCESS)
1172 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001173 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301174 vos_mem_free(pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301175 return eHAL_STATUS_FAILURE;
1176 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301177 limLog(pMac, LOG1, FL("Processed Offload Scan Request Successfully"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301178
1179 return eHAL_STATUS_SUCCESS;
1180}
Jeff Johnson295189b2012-06-20 16:38:30 -07001181
1182/**
1183 * __limProcessSmeScanReq()
1184 *
1185 *FUNCTION:
1186 * This function is called to process SME_SCAN_REQ message
1187 * from HDD or upper layer application.
1188 *
1189 *LOGIC:
1190 *
1191 *ASSUMPTIONS:
1192 *
1193 *NOTE:
1194 * 1. Periodic scanning should be requesting to return unique
1195 * scan results.
1196 *
1197 * @param pMac Pointer to Global MAC structure
1198 * @param *pMsgBuf A pointer to the SME message buffer
1199 * @return None
1200 */
1201
Viral Modid440e682013-03-06 02:25:31 -08001202static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001203__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1204{
1205 tANI_U32 len;
1206 tLimMlmScanReq *pMlmScanReq;
1207 tpSirSmeScanReq pScanReq;
1208 tANI_U8 i = 0;
1209
1210#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1211 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1212#endif //FEATURE_WLAN_DIAG_SUPPORT
1213
1214 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301215 limLog(pMac, LOG1,FL("SME SCAN REQ numChan %d min %d max %d IELen %d"
1216 "first %d fresh %d unique %d type %s (%d)"
1217 " mode %s (%d)rsp %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001218 pScanReq->channelList.numChannels,
1219 pScanReq->minChannelTime,
1220 pScanReq->maxChannelTime,
1221 pScanReq->uIEFieldLen,
1222 pScanReq->returnAfterFirstMatch,
1223 pScanReq->returnFreshResults,
1224 pScanReq->returnUniqueResults,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301225 lim_ScanTypetoString(pScanReq->scanType),
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001226 pScanReq->scanType,
Sushant Kaushike0d2cce2014-04-10 14:36:07 +05301227 lim_BackgroundScanModetoString(pScanReq->backgroundScanMode),
1228 pScanReq->backgroundScanMode, pMac->lim.gLimRspReqd ? 1 : 0);
Viral Modid86bde22012-12-10 13:09:21 -08001229
1230 /* Since scan req always requires a response, we will overwrite response required here.
1231 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1232 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1233 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1234 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1235 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1236 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1237 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1238 * the global flag gLimRspReqd to TRUE here.
1239 */
1240 pMac->lim.gLimRspReqd = TRUE;
1241
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301242 /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001243 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1244
1245 /* This routine should return the sme sessionId and SME transaction Id */
1246
1247 if (!limIsSmeScanReqValid(pMac, pScanReq))
1248 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301249 limLog(pMac, LOGE, FL("Received SME_SCAN_REQ with invalid parameters"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001250
1251 if (pMac->lim.gLimRspReqd)
1252 {
1253 pMac->lim.gLimRspReqd = false;
1254
1255 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1256
1257 } // if (pMac->lim.gLimRspReqd)
1258
1259 return;
1260 }
1261
1262 //if scan is disabled then return as invalid scan request.
1263 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1264 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1265 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301266 limLog(pMac, LOGE, FL("SCAN is disabled or SCAN in power save"
1267 " is disabled and system is in power save."));
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001268 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001269 return;
1270 }
1271
1272
1273 /**
1274 * If scan request is received in idle, joinFailed
1275 * states or in link established state (in STA role)
1276 * or in normal state (in STA-in-IBSS/AP role) with
1277 * 'return fresh scan results' request from HDD or
1278 * it is periodic background scanning request,
1279 * trigger fresh scan request to MLM
1280 */
1281 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1282 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301283 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1284 {
1285 // Discard previously cached scan results
1286 limReInitScanResults(pMac);
1287 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001288
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301289 pMac->lim.gLim24Band11dScanDone = 0;
1290 pMac->lim.gLim50Band11dScanDone = 0;
1291 pMac->lim.gLimReturnAfterFirstMatch =
1292 pScanReq->returnAfterFirstMatch;
1293 pMac->lim.gLimBackgroundScanMode =
1294 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001295
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301296 pMac->lim.gLimReturnUniqueResults =
1297 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1298 /* De-activate Heartbeat timers for connected sessions while
1299 * scan is in progress if the system is in Active mode *
1300 * AND it is not a ROAMING ("background") scan */
1301 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1302 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1303 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1304 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1305 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001306 for(i=0;i<pMac->lim.maxBssId;i++)
1307 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301308 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1309 (pMac->lim.gpSession[i].valid == TRUE) &&
1310 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1311 {
1312 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1313 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001314 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301315 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001316
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301317 if (pMac->fScanOffload)
1318 {
1319 if (eHAL_STATUS_SUCCESS !=
1320 limSendHalStartScanOffloadReq(pMac, pScanReq))
1321 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301322 limLog(pMac, LOGE, FL("Couldn't send Offload scan request"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301323 limSendSmeScanRsp(pMac,
1324 offsetof(tSirSmeScanRsp, bssDescription[0]),
1325 eSIR_SME_INVALID_PARAMETERS,
1326 pScanReq->sessionId,
1327 pScanReq->transactionId);
1328 return;
1329 }
1330 }
1331 else
1332 {
1333
1334 /*Change Global SME state */
1335 /* Store the previous SME state */
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301336 limLog(pMac, LOG1, FL("Non Offload SCAN request "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301337 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1338 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1339 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1340
1341 if (pScanReq->channelList.numChannels == 0)
1342 {
1343 tANI_U32 cfg_len;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301344
1345 limLog(pMac, LOG1,
1346 FL("Scan all channels as Number of channels is 0"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301347 // Scan all channels
1348 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1350 pScanReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301351 pMlmScanReq = vos_mem_malloc(len);
1352 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301353 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301354 // Log error
1355 limLog(pMac, LOGP,
1356 FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001357
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301358 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301359 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001360
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301361 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301362 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001363
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301364 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1365 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001366 pMlmScanReq->channelList.channelNumber,
1367 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301368 {
1369 /**
1370 * Could not get Valid channel list from CFG.
1371 * Log error.
1372 */
1373 limLog(pMac, LOGP,
1374 FL("could not retrieve Valid channel list"));
1375 }
1376 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
1377 }
1378 else
1379 {
1380 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1381 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1382 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001383
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301384 pMlmScanReq = vos_mem_malloc(len);
1385 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301386 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301387 // Log error
1388 limLog(pMac, LOGP,
1389 FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001390
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301391 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301392 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001393
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301394 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301395 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301396 pMlmScanReq->channelList.numChannels =
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301397 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001398
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301399 vos_mem_copy( pMlmScanReq->channelList.channelNumber,
1400 pScanReq->channelList.channelNumber,
1401 pScanReq->channelList.numChannels);
1402 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001403
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301404 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1405 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1406 if(pScanReq->uIEFieldLen)
1407 {
1408 vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1409 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1410 pScanReq->uIEFieldLen);
1411 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001412
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301413 pMlmScanReq->bssType = pScanReq->bssType;
1414 vos_mem_copy( pMlmScanReq->bssId,
1415 pScanReq->bssId,
1416 sizeof(tSirMacAddr));
1417 pMlmScanReq->numSsid = pScanReq->numSsid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001418
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301419 i = 0;
1420 while (i < pMlmScanReq->numSsid)
1421 {
1422 vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001423 (tANI_U8 *) &pScanReq->ssId[i],
1424 pScanReq->ssId[i].length + 1);
1425
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301426 i++;
1427 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001428
Jeff Johnson295189b2012-06-20 16:38:30 -07001429
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301430 pMlmScanReq->scanType = pScanReq->scanType;
1431 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
1432 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1433 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1434 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1435 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
1436 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1437 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001438
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301439 //Store the smeSessionID and transaction ID for later use.
1440 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1441 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001442
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301443 // Issue LIM_MLM_SCAN_REQ to MLM
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301444 limLog(pMac, LOG1, FL("Issue Scan request command to MLM "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301445 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1446 }
1447 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001448
1449 else
1450 {
1451 /// In all other cases return 'cached' scan results
1452 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1453 {
1454 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1455
1456 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001457#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1458 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001459 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001460 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1461 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1462 {
1463 limSendSmeLfrScanRsp(pMac, scanRspLen,
1464 eSIR_SME_SUCCESS,
1465 pScanReq->sessionId,
1466 pScanReq->transactionId);
1467 }
1468 else
1469 {
1470 scanRspLen = sizeof(tSirSmeScanRsp) +
1471 pMac->lim.gLimSmeLfrScanResultLength -
1472 sizeof(tSirBssDescription);
1473 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1474 pScanReq->sessionId, pScanReq->transactionId);
1475 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001476 }
1477 else
1478 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001479#endif
1480 if (pMac->lim.gLimSmeScanResultLength == 0)
1481 {
1482 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1483 pScanReq->sessionId, pScanReq->transactionId);
1484 }
1485 else
1486 {
1487 scanRspLen = sizeof(tSirSmeScanRsp) +
1488 pMac->lim.gLimSmeScanResultLength -
1489 sizeof(tSirBssDescription);
1490 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1491 pScanReq->sessionId, pScanReq->transactionId);
1492 }
1493#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001494 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001495#endif
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301496 limLog(pMac, LOG1, FL("Cached scan results are returned "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001497
1498 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1499 {
1500 // Discard previously cached scan results
1501 limReInitScanResults(pMac);
1502 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001503#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1504 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1505 {
1506 // Discard previously cached scan results
1507 limReInitLfrScanResults(pMac);
1508 }
1509#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001510
1511 } // if (pMac->lim.gLimRspReqd)
1512 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1513
Jeff Johnson295189b2012-06-20 16:38:30 -07001514#ifdef BACKGROUND_SCAN_ENABLED
1515 // start background scans if needed
1516 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1517 __limBackgroundScanInitiate(pMac);
1518#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001519
1520} /*** end __limProcessSmeScanReq() ***/
1521
Jeff Johnsone7245742012-09-05 17:12:55 -07001522#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001523
Jeff Johnsone7245742012-09-05 17:12:55 -07001524static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1525{
1526 tpSirOemDataReq pOemDataReq;
1527 tLimMlmOemDataReq* pMlmOemDataReq;
1528
1529 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1530
1531 //post the lim mlm message now
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301532 pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq));
1533 if ( NULL == pMlmOemDataReq )
Jeff Johnsone7245742012-09-05 17:12:55 -07001534 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301535 limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001536 return;
1537 }
1538
1539 //Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301540 vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001541
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301542 vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr,
1543 sizeof(tSirMacAddr));
1544 vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq,
1545 OEM_DATA_REQ_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001546
1547 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1548 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1549
1550 return;
1551
1552} /*** end __limProcessSmeOemDataReq() ***/
1553
1554#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001555
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301556/**
1557 * __limProcessClearDfsChannelList()
1558 *
1559 *FUNCTION:
1560 *Clear DFS channel list when country is changed/aquired.
1561.*This message is sent from SME.
1562 *
1563 *LOGIC:
1564 *
1565 *ASSUMPTIONS:
1566 *
1567 *NOTE:
1568 *
1569 * @param pMac Pointer to Global MAC structure
1570 * @param *pMsgBuf A pointer to the SME message buffer
1571 * @return None
1572 */
1573static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1574 tpSirMsgQ pMsg)
1575{
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301576 vos_mem_set( &pMac->lim.dfschannelList,
1577 sizeof(tSirDFSChannelList), 0);
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301578}
Jeff Johnson295189b2012-06-20 16:38:30 -07001579
1580/**
1581 * __limProcessSmeJoinReq()
1582 *
1583 *FUNCTION:
1584 * This function is called to process SME_JOIN_REQ message
1585 * from HDD or upper layer application.
1586 *
1587 *LOGIC:
1588 *
1589 *ASSUMPTIONS:
1590 *
1591 *NOTE:
1592 *
1593 * @param pMac Pointer to Global MAC structure
1594 * @param *pMsgBuf A pointer to the SME message buffer
1595 * @return None
1596 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001597static void
1598__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1599{
1600 // tANI_U8 *pBuf;
1601 //tANI_U32 len;
1602// tSirMacAddr currentBssId;
1603 tpSirSmeJoinReq pSmeJoinReq = NULL;
1604 tLimMlmJoinReq *pMlmJoinReq;
1605 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1606 tANI_U32 val = 0;
1607 tANI_U16 nSize;
1608 tANI_U8 sessionId;
1609 tpPESession psessionEntry = NULL;
1610 tANI_U8 smesessionId;
1611 tANI_U16 smetransactionId;
1612 tPowerdBm localPowerConstraint = 0, regMax = 0;
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301613 tANI_U16 ieLen;
1614 v_U8_t *vendorIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001615
1616#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1617 //Not sending any session, since it is not created yet. The response whould have correct state.
1618 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1619#endif //FEATURE_WLAN_DIAG_SUPPORT
1620
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001621 PELOG1(limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001622
1623#ifdef WLAN_FEATURE_VOWIFI
1624 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1625 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1626 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1627 * like not honoring power constraint on 1st association after driver loading. */
1628 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001629 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001630 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1631 val = 0;
1632#endif /* WLAN_FEATURE_VOWIFI */
1633
1634 /**
1635 * Expect Join request in idle state.
1636 * Reassociate request is expected in link established state.
1637 */
1638
1639 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1640 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1641 {
1642 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301643
1644 pSmeJoinReq = vos_mem_malloc(nSize);
1645 if ( NULL == pSmeJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001646 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301647 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1648 "pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001649 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1650 goto end;
1651 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301652 (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001653
Jeff Johnson295189b2012-06-20 16:38:30 -07001654 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1655 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1656 {
1657 /// Received invalid eWNI_SME_JOIN_REQ
1658 // Log the event
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301659 limLog(pMac, LOGW, FL("SessionId:%d Received SME_JOIN_REQ with"
1660 "invalid data"),pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 retCode = eSIR_SME_INVALID_PARAMETERS;
1662 goto end;
1663 }
1664
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301665 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23
Jeff Johnson295189b2012-06-20 16:38:30 -07001666
1667 /* check for the existence of start BSS session */
1668#ifdef FIXME_GEN6
1669 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1670 {
1671 if(peValidateBtJoinRequest(pMac)!= TRUE)
1672 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301673 limLog(pMac, LOGW, FL("SessionId:%d Start Bss session"
1674 "not present::SME_JOIN_REQ in unexpected state"),
1675 pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001676 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1677 psessionEntry = NULL;
1678 goto end;
1679 }
1680 }
1681
1682#endif
1683
1684
1685 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1686 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301687 limLog(pMac, LOGE, FL("Session(%d) Already exists for BSSID: "
1688 MAC_ADDRESS_STR" in limSmeState = %X"),sessionId,
1689 MAC_ADDR_ARRAY(pSmeJoinReq->bssDescription.bssId),
1690 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001691
1692 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1693 {
1694 // Received eWNI_SME_JOIN_REQ for same
1695 // BSS as currently associated.
1696 // Log the event and send success
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301697 PELOGW(limLog(pMac, LOGW, FL("SessionId:%d Received"
1698 "SME_JOIN_REQ for currently joined BSS"),sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001699 /// Send Join success response to host
Deepthi Gowrif3e27252013-12-11 20:50:01 +05301700 retCode = eSIR_SME_ALREADY_JOINED_A_BSS;
1701 psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001702 goto end;
1703 }
1704 else
1705 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301706 PELOGE(limLog(pMac, LOGE, FL("SME_JOIN_REQ not for"
1707 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001708 retCode = eSIR_SME_REFUSED;
1709 psessionEntry = NULL;
1710 goto end;
1711 }
1712 }
1713 else /* Session Entry does not exist for given BSSId */
1714 {
1715 /* Try to Create a new session */
1716 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1717 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001718 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001719 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1720 goto end;
1721 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301722 else
1723 limLog(pMac,LOG1,FL("SessionId:%d New session created"),
1724 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001726 handleHTCapabilityandHTInfo(pMac, psessionEntry);
krunal soni5afa96c2013-09-06 22:19:02 -07001727 psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
Jeff Johnsone7245742012-09-05 17:12:55 -07001728
Jeff Johnson295189b2012-06-20 16:38:30 -07001729 /* Store Session related parameters */
1730 /* Store PE session Id in session Table */
1731 psessionEntry->peSessionId = sessionId;
1732
1733 /* store the smejoin req handle in session table */
1734 psessionEntry->pLimJoinReq = pSmeJoinReq;
1735
1736 /* Store SME session Id in sessionTable */
1737 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1738
1739 /* Store SME transaction Id in session Table */
1740 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1741
1742 /* Store beaconInterval */
1743 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1744
1745 /* Copying of bssId is already done, while creating session */
1746 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1747 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1748 psessionEntry->bssType = pSmeJoinReq->bsstype;
1749
1750 psessionEntry->statypeForBss = STA_ENTRY_PEER;
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301751 psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled;
1752 psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001753
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301754 /* Store vendor specfic IE for CISCO AP */
1755 ieLen = (pSmeJoinReq->bssDescription.length +
1756 sizeof( pSmeJoinReq->bssDescription.length ) -
1757 GET_FIELD_OFFSET( tSirBssDescription, ieFields ));
1758
1759 vendorIE = limGetVendorIEOuiPtr(pMac, SIR_MAC_CISCO_OUI,
1760 SIR_MAC_CISCO_OUI_SIZE,
1761 ((tANI_U8 *)&pSmeJoinReq->bssDescription.ieFields) , ieLen);
1762
1763 if ( NULL != vendorIE )
1764 {
1765 limLog(pMac, LOGE,
1766 FL("DUT is trying to connect to Cisco AP"));
1767 psessionEntry->isCiscoVendorAP = TRUE;
1768 }
1769 else
1770 {
1771 psessionEntry->isCiscoVendorAP = FALSE;
1772 }
1773
Jeff Johnson295189b2012-06-20 16:38:30 -07001774 /* Copy the dot 11 mode in to the session table */
1775
1776 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1777 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001778#ifdef WLAN_FEATURE_11AC
1779 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001780 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001781 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001782 if (psessionEntry->vhtCapability )
1783 {
1784 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1785
1786 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001787 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001788 psessionEntry->txBFIniFeatureEnabled);
1789
1790 if( psessionEntry->txBFIniFeatureEnabled )
1791 {
1792 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1793 != eSIR_SUCCESS)
1794 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301795 limLog(pMac, LOGP, FL("could not set "
1796 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001797 retCode = eSIR_LOGP_EXCEPTION;
1798 goto end;
1799 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001800 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301801 "***__limProcessSmeJoinReq: txBFCsnValue=%d****",
1802 pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001803
1804 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001805 != eSIR_SUCCESS)
1806 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301807 limLog(pMac, LOGP, FL("could not set "
1808 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001809 retCode = eSIR_LOGP_EXCEPTION;
1810 goto end;
1811 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301812
1813 if ( FALSE == pMac->isMuBfsessionexist )
1814 psessionEntry->txMuBformee = pSmeJoinReq->txMuBformee;
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001815 }
Abhishek Singh6d5d29c2014-07-03 14:25:22 +05301816
1817 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1818 "SmeJoinReq:txMuBformee=%d psessionEntry: txMuBformee = %d",
1819 pSmeJoinReq->txMuBformee, psessionEntry->txMuBformee);
1820
1821 if(cfgSetInt(pMac, WNI_CFG_VHT_MU_BEAMFORMEE_CAP, psessionEntry->txMuBformee)
1822 != eSIR_SUCCESS)
1823 {
1824 limLog(pMac, LOGE, FL("could not set "
1825 "WNI_CFG_VHT_MU_BEAMFORMEE_CAP at CFG"));
1826 retCode = eSIR_LOGP_EXCEPTION;
1827 goto end;
1828 }
1829
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001830 }
1831
Jeff Johnsone7245742012-09-05 17:12:55 -07001832#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001833
1834 /*Phy mode*/
1835 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1836
1837 /* Copy The channel Id to the session Table */
1838 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001839 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1840 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1841 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001842
Chet Lanctot186b5732013-03-18 10:26:30 -07001843 /* Record if management frames need to be protected */
1844#ifdef WLAN_FEATURE_11W
1845 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1846 {
1847 psessionEntry->limRmfEnabled = 1;
1848 }
1849 else
1850 {
1851 psessionEntry->limRmfEnabled = 0;
1852 }
1853#endif
1854
krunal soni8d13b092013-07-19 13:23:29 -07001855#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1856 psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi;
1857#endif
1858
Jeff Johnson295189b2012-06-20 16:38:30 -07001859 /*Store Persona */
1860 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1861 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301862 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona,
1863 pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001864
1865 /* Copy the SSID from smejoinreq to session entry */
1866 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301867 vos_mem_copy( psessionEntry->ssId.ssId,
1868 pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length);
1869
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001870 // Determin 11r or ESE connection based on input from SME
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301871 // which inturn is dependent on the profile the user wants to connect
1872 // to, So input is coming from supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07001873#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301874 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001875#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001876#ifdef FEATURE_WLAN_ESE
1877 psessionEntry->isESEconnection = pSmeJoinReq->isESEconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001878#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001879#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301880 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001881#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301882
Jeff Johnson43971f52012-07-17 12:26:56 -07001883#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301884 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
Jeff Johnson43971f52012-07-17 12:26:56 -07001885#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301886 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001887
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301888 if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001889 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301890 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1891 }
1892 else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1893 {
1894 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1895 }
1896 else
1897 {
1898 /* Throw an error and return and make sure to delete the session.*/
Abhishek Singh57aebef2014-02-03 18:47:44 +05301899 limLog(pMac, LOGE, FL("received SME_JOIN_REQ with invalid"
1900 " bss type %d"), psessionEntry->bssType);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301901 retCode = eSIR_SME_INVALID_PARAMETERS;
1902 goto end;
1903 }
1904
1905 if (pSmeJoinReq->addIEScan.length)
1906 {
1907 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan,
Jeff Johnson295189b2012-06-20 16:38:30 -07001908 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
1909 }
1910
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301911 if (pSmeJoinReq->addIEAssoc.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07001912 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301913 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc,
Jeff Johnson295189b2012-06-20 16:38:30 -07001914 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
1915 }
1916
Jeff Johnson295189b2012-06-20 16:38:30 -07001917 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301918 pMlmJoinReq = vos_mem_malloc(val);
1919 if ( NULL == pMlmJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301921 limLog(pMac, LOGP, FL("call to AllocateMemory "
1922 "failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001923 return;
1924 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301925 (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001926
1927 /* PE SessionId is stored as a part of JoinReq*/
1928 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
1929
1930 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
1931 != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001932 limLog(pMac, LOGP, FL("could not retrieve JoinFailureTimer value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001933
1934 /* copy operational rate from psessionEntry*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301935 vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001936 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301937 vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 sizeof(tSirMacRateSet));
1939 //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 +05301940 vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001941 sizeof(tSirMacRateSet));
1942
1943 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
1944
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
1946
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301947 vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001948 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
1949 psessionEntry->pLimJoinReq->bssDescription.length + 2);
1950
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07001952 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001953
Jeff Johnsone7245742012-09-05 17:12:55 -07001954 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05301955 localPowerConstraint = regMax;
Jeff Johnsone7245742012-09-05 17:12:55 -07001956 limExtractApCapability( pMac,
1957 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
1958 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
1959 &psessionEntry->limCurrentBssQosCaps,
1960 &psessionEntry->limCurrentBssPropCap,
1961 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07001962 , &localPowerConstraint,
1963 psessionEntry
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05301964 );
Sandeep Puligillaa9eb9ad2014-05-27 14:42:50 +05301965
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001966#ifdef FEATURE_WLAN_ESE
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001967 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07001968#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301969 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001970#endif
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05301971 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1972 "Regulatory max = %d, local power constraint = %d,"
Abhishek Singh57aebef2014-02-03 18:47:44 +05301973 " max tx = %d", regMax, localPowerConstraint,
1974 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07001975
1976 if (pMac->lim.gLimCurrentBssUapsd)
1977 {
1978 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301979 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
1980 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07001981
1982 // resetting the dynamic uapsd mask
1983 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
1984 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
1985 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001986
1987 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
1988
1989 // Initialize 11h Enable Flag
1990 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
1991 {
1992 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001993 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001994 psessionEntry->lim11hEnable = val;
1995 }
1996 else
1997 psessionEntry->lim11hEnable = 0;
1998
1999 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
2000 pMac->lim.gLimIbssCoalescingHappened = false;
2001
Jeff Johnsone7245742012-09-05 17:12:55 -07002002 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2003 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
2004 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002005
Abhishek Singh57aebef2014-02-03 18:47:44 +05302006 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
2007 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
2008 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
2009 psessionEntry->currentOperChannel,
2010 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002011
2012 /* Indicate whether spectrum management is enabled*/
2013 psessionEntry->spectrumMgtEnabled =
2014 pSmeJoinReq->spectrumMgtIndicator;
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302015
2016 /* Enable the spectrum management if this is a DFS channel */
2017 if (psessionEntry->countryInfoPresent &&
2018 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2019 {
2020 psessionEntry->spectrumMgtEnabled = TRUE;
2021 }
2022
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05302023 PELOG1(limLog(pMac,LOG1,FL("SessionId:%d MLM_JOIN_REQ is posted to MLM"
2024 "SM"),pMlmJoinReq->sessionId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 /* Issue LIM_MLM_JOIN_REQ to MLM */
2026 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
2027 return;
2028
2029 }
2030 else
2031 {
2032 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05302033 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
2034 "in state %X"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002035 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
2036 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2037 psessionEntry = NULL;
2038 goto end;
2039
2040 }
2041
2042end:
2043 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
2044
2045 if(pSmeJoinReq)
2046 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302047 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002048 pSmeJoinReq = NULL;
2049 if (NULL != psessionEntry)
2050 {
2051 psessionEntry->pLimJoinReq = NULL;
2052 }
2053 }
2054
2055 if(retCode != eSIR_SME_SUCCESS)
2056 {
2057 if(NULL != psessionEntry)
2058 {
2059 peDeleteSession(pMac,psessionEntry);
2060 psessionEntry = NULL;
2061 }
2062 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05302063 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
2064 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002065 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
2066} /*** end __limProcessSmeJoinReq() ***/
2067
2068
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002069#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08002070tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07002071{
2072 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302073 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002074 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07002075 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2076 maxTxPower = txPower;
2077 else if (txPower < MIN_TX_PWR_CAP)
2078 maxTxPower = MIN_TX_PWR_CAP;
2079 else
2080 maxTxPower = MAX_TX_PWR_CAP;
2081
2082 return (maxTxPower);
2083}
2084#endif
2085
Jeff Johnson295189b2012-06-20 16:38:30 -07002086/**
2087 * __limProcessSmeReassocReq()
2088 *
2089 *FUNCTION:
2090 * This function is called to process SME_REASSOC_REQ message
2091 * from HDD or upper layer application.
2092 *
2093 *LOGIC:
2094 *
2095 *ASSUMPTIONS:
2096 *
2097 *NOTE:
2098 *
2099 * @param pMac Pointer to Global MAC structure
2100 * @param *pMsgBuf A pointer to the SME message buffer
2101 * @return None
2102 */
2103
2104static void
2105__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2106{
2107 tANI_U16 caps;
2108 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002109 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 tLimMlmReassocReq *pMlmReassocReq;
2111 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2112 tpPESession psessionEntry = NULL;
2113 tANI_U8 sessionId;
2114 tANI_U8 smeSessionId;
2115 tANI_U16 transactionId;
2116 tPowerdBm localPowerConstraint = 0, regMax = 0;
2117 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002118 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002119
2120
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002121 PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002122
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002123 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302124 pReassocReq = vos_mem_malloc(nSize);
2125 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 {
2127 // Log error
2128 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302129 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002130
2131 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2132 goto end;
2133 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302134 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002135 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2136 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2137 (!limIsSmeJoinReqValid(pMac,
2138 (tpSirSmeJoinReq) pReassocReq)))
2139 {
2140 /// Received invalid eWNI_SME_REASSOC_REQ
2141 // Log the event
2142 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002143 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002144
2145 retCode = eSIR_SME_INVALID_PARAMETERS;
2146 goto end;
2147 }
2148
2149 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2150 {
2151 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002152 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 retCode = eSIR_SME_INVALID_PARAMETERS;
2154 goto end;
2155 }
2156
2157#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2158 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2159#endif //FEATURE_WLAN_DIAG_SUPPORT
2160 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2161
2162 /* Store the reassoc handle in the session Table.. 23rd sep review */
2163 psessionEntry->pLimReAssocReq = pReassocReq;
Padma, Santhosh Kumar0d25d102014-07-17 15:08:48 +05302164 psessionEntry->dot11mode = pReassocReq->dot11mode;
2165 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(pReassocReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002166
2167 /**
2168 * Reassociate request is expected
2169 * in link established state only.
2170 */
2171
2172 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2173 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002174#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2176 {
2177 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002178 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 psessionEntry->peSessionId);
2180
2181 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302182 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2184 {
2185 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2186 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002187 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 retCode = eSIR_SME_INVALID_PARAMETERS;
2189 goto end;
2190 }
2191
2192 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2193 return;
2194 }
2195#endif
2196 /// Should not have received eWNI_SME_REASSOC_REQ
2197 // Log the event
2198 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002199 FL("received unexpected SME_REASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002200 psessionEntry->limSmeState);
2201 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2202
2203 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2204 goto end;
2205 }
2206
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302207 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002208 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2209 sizeof(tSirMacAddr));
2210
2211 psessionEntry->limReassocChannelId =
2212 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2213
Jeff Johnsone7245742012-09-05 17:12:55 -07002214 psessionEntry->reAssocHtSupportedChannelWidthSet =
2215 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2216 psessionEntry->reAssocHtRecommendedTxWidthSet =
2217 psessionEntry->reAssocHtSupportedChannelWidthSet;
2218 psessionEntry->reAssocHtSecondaryChannelOffset =
2219 psessionEntry->pLimReAssocReq->cbMode;
2220
Jeff Johnson295189b2012-06-20 16:38:30 -07002221 psessionEntry->limReassocBssCaps =
2222 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002223 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2224 localPowerConstraint = regMax;
2225 limExtractApCapability( pMac,
2226 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2227 limGetIElenFromBssDescription(
2228 &psessionEntry->pLimReAssocReq->bssDescription),
2229 &psessionEntry->limReassocBssQosCaps,
2230 &psessionEntry->limReassocBssPropCap,
2231 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002232 , &localPowerConstraint,
2233 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002234 );
2235
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302236 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002237#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302238 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2239 "= %d, max tx = %d", regMax, localPowerConstraint,
2240 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002241#endif
2242 {
2243 #if 0
2244 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2245 &cfgLen) != eSIR_SUCCESS)
2246 {
2247 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002248 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 }
2250 #endif//TO SUPPORT BT-AMP
2251
2252 /* Copy the SSID from sessio entry to local variable */
2253 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302254 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002255 psessionEntry->ssId.ssId,
2256 psessionEntry->ssId.length);
2257 #endif
2258 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302259 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2261
2262 }
2263
2264 if (pMac->lim.gLimCurrentBssUapsd)
2265 {
2266 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302267 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2268 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 }
2270
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302271 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2272 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 {
2274 // Log error
2275 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302276 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002277
2278 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2279 goto end;
2280 }
2281
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302282 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002283 psessionEntry->limReAssocbssId,
2284 sizeof(tSirMacAddr));
2285
2286 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2287 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2288 != eSIR_SUCCESS)
2289 {
2290 /**
2291 * Could not get ReassocFailureTimeout value
2292 * from CFG. Log error.
2293 */
2294 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002295 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002296 }
2297
2298 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2299 {
2300 /**
2301 * Could not get Capabilities value
2302 * from CFG. Log error.
2303 */
2304 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002305 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002306 }
2307 pMlmReassocReq->capabilityInfo = caps;
2308
2309 /* Update PE sessionId*/
2310 pMlmReassocReq->sessionId = sessionId;
2311
2312 /* If telescopic beaconing is enabled, set listen interval to
2313 WNI_CFG_TELE_BCN_MAX_LI */
2314 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2315 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002316 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002317
2318 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2319
2320 if(teleBcnEn)
2321 {
2322 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2323 eSIR_SUCCESS)
2324 {
2325 /**
2326 * Could not get ListenInterval value
2327 * from CFG. Log error.
2328 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002329 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002330 }
2331 }
2332 else
2333 {
2334 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2335 {
2336 /**
2337 * Could not get ListenInterval value
2338 * from CFG. Log error.
2339 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002340 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002341 }
2342 }
2343
2344 /* Delete all BA sessions before Re-Assoc.
2345 * BA frames are class 3 frames and the session
2346 * is lost upon disassociation and reassociation.
2347 */
2348
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05302349 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS,
2350 eSIR_MAC_UNSPEC_FAILURE_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002351
2352 pMlmReassocReq->listenInterval = (tANI_U16) val;
2353
2354 /* Indicate whether spectrum management is enabled*/
2355 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2356
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302357 /* Enable the spectrum management if this is a DFS channel */
2358 if (psessionEntry->countryInfoPresent &&
2359 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2360 {
2361 psessionEntry->spectrumMgtEnabled = TRUE;
2362 }
2363
Jeff Johnson295189b2012-06-20 16:38:30 -07002364 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2365 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2366
Jeff Johnsone7245742012-09-05 17:12:55 -07002367 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002368
2369 limPostMlmMessage(pMac,
2370 LIM_MLM_REASSOC_REQ,
2371 (tANI_U32 *) pMlmReassocReq);
2372 return;
2373
2374end:
2375 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302376 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002377
2378 if (psessionEntry)
2379 {
2380 // error occurred after we determined the session so extract
2381 // session and transaction info from there
2382 smeSessionId = psessionEntry->smeSessionId;
2383 transactionId = psessionEntry->transactionId;
2384 }
2385 else
2386 {
2387 // error occurred before or during the time we determined the session
2388 // so extract the session and transaction info from the message
2389 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2390 }
2391
2392 /// Send Reassoc failure response to host
2393 /// (note psessionEntry may be NULL, but that's OK)
2394 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2395 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2396 psessionEntry, smeSessionId, transactionId);
2397
2398} /*** end __limProcessSmeReassocReq() ***/
2399
2400
2401tANI_BOOLEAN sendDisassocFrame = 1;
2402/**
2403 * __limProcessSmeDisassocReq()
2404 *
2405 *FUNCTION:
2406 * This function is called to process SME_DISASSOC_REQ message
2407 * from HDD or upper layer application.
2408 *
2409 *LOGIC:
2410 *
2411 *ASSUMPTIONS:
2412 *
2413 *NOTE:
2414 *
2415 * @param pMac Pointer to Global MAC structure
2416 * @param *pMsgBuf A pointer to the SME message buffer
2417 * @return None
2418 */
2419
2420static void
2421__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2422{
2423 tANI_U16 disassocTrigger, reasonCode;
2424 tLimMlmDisassocReq *pMlmDisassocReq;
2425 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002426 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002427 tSirSmeDisassocReq smeDisassocReq;
2428 tpPESession psessionEntry = NULL;
2429 tANI_U8 sessionId;
2430 tANI_U8 smesessionId;
2431 tANI_U16 smetransactionId;
2432
Jeff Johnson295189b2012-06-20 16:38:30 -07002433
Jeff Johnson43971f52012-07-17 12:26:56 -07002434 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002435 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002436 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002437 return;
2438 }
2439
Jeff Johnson43971f52012-07-17 12:26:56 -07002440 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002441
Jeff Johnson43971f52012-07-17 12:26:56 -07002442 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002443
Jeff Johnson43971f52012-07-17 12:26:56 -07002444 if ( (eSIR_FAILURE == status) ||
2445 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002446 {
2447 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002448 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002449
2450 if (pMac->lim.gLimRspReqd)
2451 {
2452 pMac->lim.gLimRspReqd = false;
2453
2454 retCode = eSIR_SME_INVALID_PARAMETERS;
2455 disassocTrigger = eLIM_HOST_DISASSOC;
2456 goto sendDisassoc;
2457 }
2458
2459 return;
2460 }
2461
Jeff Johnson295189b2012-06-20 16:38:30 -07002462 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2463 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302464 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2465 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 retCode = eSIR_SME_INVALID_PARAMETERS;
2467 disassocTrigger = eLIM_HOST_DISASSOC;
2468 goto sendDisassoc;
2469
2470 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302471 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2472 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2473 smesessionId,psessionEntry->limSystemRole,
2474 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2475 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002476
2477#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2478 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2479#endif //FEATURE_WLAN_DIAG_SUPPORT
2480
2481 /* Update SME session Id and SME transaction ID*/
2482
2483 psessionEntry->smeSessionId = smesessionId;
2484 psessionEntry->transactionId = smetransactionId;
2485
2486 switch (psessionEntry->limSystemRole)
2487 {
2488 case eLIM_STA_ROLE:
2489 case eLIM_BT_AMP_STA_ROLE:
2490 switch (psessionEntry->limSmeState)
2491 {
2492 case eLIM_SME_ASSOCIATED_STATE:
2493 case eLIM_SME_LINK_EST_STATE:
2494 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2495 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002496#ifdef FEATURE_WLAN_TDLS
2497 /* Delete all TDLS peers connected before leaving BSS*/
2498 limDeleteTDLSPeers(pMac, psessionEntry);
2499#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002500 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302501 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2502 "limSmeState: %d "),psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 break;
2504
2505 case eLIM_SME_WT_DEAUTH_STATE:
2506 /* PE shall still process the DISASSOC_REQ and proceed with
2507 * link tear down even if it had already sent a DEAUTH_IND to
2508 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2509 * its been set when PE entered WT_DEAUTH_STATE.
2510 */
2511 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002512 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302513 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2514 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002515 break;
2516
2517 case eLIM_SME_WT_DISASSOC_STATE:
2518 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2519 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2520 * PE can continue processing DISASSOC_REQ and send the response instead
2521 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2522 * for disassoc frame.
2523 *
2524 * It will send a disassoc, which is ok. However, we can use the global flag
2525 * sendDisassoc to not send disassoc frame.
2526 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302527 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2528 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002529 break;
2530
2531 case eLIM_SME_JOIN_FAILURE_STATE: {
2532 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302533 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2534 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002535 if (pMac->lim.gLimRspReqd) {
2536 retCode = eSIR_SME_SUCCESS;
2537 disassocTrigger = eLIM_HOST_DISASSOC;
2538 goto sendDisassoc;
2539 }
2540 }break;
2541 default:
2542 /**
2543 * STA is not currently associated.
2544 * Log error and send response to host
2545 */
2546 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002547 FL("received unexpected SME_DISASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002548 psessionEntry->limSmeState);
2549 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2550
2551 if (pMac->lim.gLimRspReqd)
2552 {
2553 if (psessionEntry->limSmeState !=
2554 eLIM_SME_WT_ASSOC_STATE)
2555 pMac->lim.gLimRspReqd = false;
2556
2557 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2558 disassocTrigger = eLIM_HOST_DISASSOC;
2559 goto sendDisassoc;
2560 }
2561
2562 return;
2563 }
2564
2565 break;
2566
2567 case eLIM_AP_ROLE:
2568 case eLIM_BT_AMP_AP_ROLE:
2569 // Fall through
2570 break;
2571
2572 case eLIM_STA_IN_IBSS_ROLE:
2573 default: // eLIM_UNKNOWN_ROLE
2574 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002575 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002576 psessionEntry->limSystemRole);
2577
2578 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2579 disassocTrigger = eLIM_HOST_DISASSOC;
2580 goto sendDisassoc;
2581 } // end switch (pMac->lim.gLimSystemRole)
2582
2583 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2584 {
2585 /// Disassociation is triggered by Link Monitoring
Abhishek Singhcd09b562013-12-24 16:02:20 +05302586 limLog(pMac, LOG1, FL("**** Lost link with AP ****"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002587 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2588 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2589 }
2590 else
2591 {
2592 disassocTrigger = eLIM_HOST_DISASSOC;
2593 reasonCode = smeDisassocReq.reasonCode;
2594 }
2595
2596 if (smeDisassocReq.doNotSendOverTheAir)
2597 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302598 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002599 sendDisassocFrame = 0;
2600 }
2601 // Trigger Disassociation frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302602
2603 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2604 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002605 {
2606 // Log error
2607 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302608 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002609
2610 return;
2611 }
2612
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302613 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002614 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2615 sizeof(tSirMacAddr));
2616
2617 pMlmDisassocReq->reasonCode = reasonCode;
2618 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2619
2620 /* Update PE session ID*/
2621 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002622
2623 limPostMlmMessage(pMac,
2624 LIM_MLM_DISASSOC_REQ,
2625 (tANI_U32 *) pMlmDisassocReq);
2626 return;
2627
2628sendDisassoc:
2629 if (psessionEntry)
2630 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2631 retCode,
2632 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002633 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002634 else
2635 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2636 retCode,
2637 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002638 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002639
2640
2641} /*** end __limProcessSmeDisassocReq() ***/
2642
2643
2644/** -----------------------------------------------------------------
2645 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2646
2647 This function is called to process SME_DISASSOC_CNF message
2648 from HDD or upper layer application.
2649
2650 \param pMac - global mac structure
2651 \param pStaDs - station dph hash node
2652 \return none
2653 \sa
2654 ----------------------------------------------------------------- */
2655static void
2656__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2657{
2658 tSirSmeDisassocCnf smeDisassocCnf;
2659 tANI_U16 aid;
2660 tpDphHashNode pStaDs;
2661 tSirRetStatus status = eSIR_SUCCESS;
2662 tpPESession psessionEntry;
2663 tANI_U8 sessionId;
2664
2665
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002666 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002667
2668 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2669
2670 if (status == eSIR_FAILURE)
2671 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002672 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002673 return;
2674 }
2675
2676 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2677 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002678 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002679 return;
2680 }
2681
2682 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2683 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302684 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002685 return;
2686 }
2687
2688#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2689 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2690 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2691 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2692 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2693#endif //FEATURE_WLAN_DIAG_SUPPORT
2694
2695 switch (psessionEntry->limSystemRole)
2696 {
2697 case eLIM_STA_ROLE:
2698 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2699 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2700 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2701 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2702 {
2703 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002704 FL("received unexp SME_DISASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002705 psessionEntry->limSmeState);
2706 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2707 return;
2708 }
2709 break;
2710
2711 case eLIM_AP_ROLE:
2712 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002713 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002714
2715 case eLIM_STA_IN_IBSS_ROLE:
2716 default: // eLIM_UNKNOWN_ROLE
2717 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002718 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002719 psessionEntry->limSystemRole);
2720
2721 return;
2722 }
2723
2724
2725 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2726 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002727 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002728 )
2729 {
2730 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2731 if (pStaDs == NULL)
2732 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302733 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2734 "does not have context, addr= "MAC_ADDRESS_STR),
2735 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002736 return;
2737 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002738 /* Delete FT session if there exists one */
2739 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002740 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002741
2742 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002743 }
2744
2745 return;
2746}
2747
2748
2749/**
2750 * __limProcessSmeDeauthReq()
2751 *
2752 *FUNCTION:
2753 * This function is called to process SME_DEAUTH_REQ message
2754 * from HDD or upper layer application.
2755 *
2756 *LOGIC:
2757 *
2758 *ASSUMPTIONS:
2759 *
2760 *NOTE:
2761 *
2762 * @param pMac Pointer to Global MAC structure
2763 * @param *pMsgBuf A pointer to the SME message buffer
2764 * @return None
2765 */
2766
2767static void
2768__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2769{
2770 tANI_U16 deauthTrigger, reasonCode;
2771 tLimMlmDeauthReq *pMlmDeauthReq;
2772 tSirSmeDeauthReq smeDeauthReq;
2773 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2774 tSirRetStatus status = eSIR_SUCCESS;
2775 tpPESession psessionEntry;
2776 tANI_U8 sessionId; //PE sessionId
2777 tANI_U8 smesessionId;
2778 tANI_U16 smetransactionId;
2779
Jeff Johnson295189b2012-06-20 16:38:30 -07002780
2781 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002782 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2783
2784 //We need to get a session first but we don't even know if the message is correct.
2785 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2786 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002787 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002788 retCode = eSIR_SME_INVALID_PARAMETERS;
2789 deauthTrigger = eLIM_HOST_DEAUTH;
2790 goto sendDeauth;
2791
2792 }
2793
2794 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2795 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002796 PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002797 if (pMac->lim.gLimRspReqd)
2798 {
2799 pMac->lim.gLimRspReqd = false;
2800
2801 retCode = eSIR_SME_INVALID_PARAMETERS;
2802 deauthTrigger = eLIM_HOST_DEAUTH;
2803 goto sendDeauth;
2804 }
2805
2806 return;
2807 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302808 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2809 "Systemrole %d with reasoncode %u in limSmestate %d from "
2810 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2811 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2812 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002813#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2814 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2815#endif //FEATURE_WLAN_DIAG_SUPPORT
2816
2817 /* Update SME session ID and Transaction ID */
2818 psessionEntry->smeSessionId = smesessionId;
2819 psessionEntry->transactionId = smetransactionId;
2820
2821
2822 switch (psessionEntry->limSystemRole)
2823 {
2824 case eLIM_STA_ROLE:
2825 case eLIM_BT_AMP_STA_ROLE:
2826
2827 switch (psessionEntry->limSmeState)
2828 {
2829 case eLIM_SME_ASSOCIATED_STATE:
2830 case eLIM_SME_LINK_EST_STATE:
2831 case eLIM_SME_WT_ASSOC_STATE:
2832 case eLIM_SME_JOIN_FAILURE_STATE:
2833 case eLIM_SME_IDLE_STATE:
2834 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2835 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002836 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002837
2838 // Send Deauthentication request to MLM below
2839
2840 break;
Sachin Ahujaa100dcc2014-07-03 14:30:18 +05302841 case eLIM_SME_WT_DEAUTH_STATE:
2842 /*
2843 * PE Recieved a Deauth frame. Normally it gets
2844 * DEAUTH_CNF but it received DEAUTH_REQ. Which
2845 * means host is also trying to disconnect.
2846 * PE can continue processing DEAUTH_REQ and send
2847 * the response instead of failing the request.
2848 * SME will anyway ignore DEAUTH_IND that was sent
2849 * for deauth frame.
2850 */
2851 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
2852 "SME_WT_DEAUTH_STATE. "));
2853 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002854 default:
2855 /**
2856 * STA is not in a state to deauthenticate with
2857 * peer. Log error and send response to host.
2858 */
2859 limLog(pMac, LOGE,
Abhishek Singhcd09b562013-12-24 16:02:20 +05302860 FL("received unexp SME_DEAUTH_REQ in state %X"),
2861 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002862 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2863
2864 if (pMac->lim.gLimRspReqd)
2865 {
2866 pMac->lim.gLimRspReqd = false;
2867
2868 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2869 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08002870 /**
2871 *here we received deauth request from AP so sme state is
2872 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
2873 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
2874 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
2875 so the below condition captures the state where delSta
2876 not done and firmware still in connected state.
2877 */
2878 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
2879 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
2880 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
2881 {
2882 retCode = eSIR_SME_DEAUTH_STATUS;
2883 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 goto sendDeauth;
2885 }
2886
2887 return;
2888 }
2889
2890 break;
2891
2892 case eLIM_STA_IN_IBSS_ROLE:
2893
2894 return;
2895
2896 case eLIM_AP_ROLE:
2897 // Fall through
2898
2899 break;
2900
2901 default:
2902 limLog(pMac, LOGE,
Abhishek Singhcd09b562013-12-24 16:02:20 +05302903 FL("received unexpected SME_DEAUTH_REQ for role %X"),
2904 psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07002905
2906 return;
2907 } // end switch (pMac->lim.gLimSystemRole)
2908
2909 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
2910 {
2911 /// Deauthentication is triggered by Link Monitoring
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002912 PELOG1(limLog(pMac, LOG1, FL("**** Lost link with AP ****"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002913 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
2914 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
2915 }
2916 else
2917 {
2918 deauthTrigger = eLIM_HOST_DEAUTH;
2919 reasonCode = smeDeauthReq.reasonCode;
2920 }
2921
2922 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302923 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
2924 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002925 {
2926 // Log error
2927 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302928 FL("call to AllocateMemory failed for mlmDeauthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002929
2930 return;
2931 }
2932
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302933 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002934 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
2935 sizeof(tSirMacAddr));
2936
2937 pMlmDeauthReq->reasonCode = reasonCode;
2938 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07002939
2940 /* Update PE session Id*/
2941 pMlmDeauthReq->sessionId = sessionId;
2942
2943 limPostMlmMessage(pMac,
2944 LIM_MLM_DEAUTH_REQ,
2945 (tANI_U32 *) pMlmDeauthReq);
2946 return;
2947
2948sendDeauth:
2949 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
2950 retCode,
2951 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002952 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002953 smesessionId, smetransactionId);
2954} /*** end __limProcessSmeDeauthReq() ***/
2955
2956
2957
2958/**
2959 * __limProcessSmeSetContextReq()
2960 *
2961 *FUNCTION:
2962 * This function is called to process SME_SETCONTEXT_REQ message
2963 * from HDD or upper layer application.
2964 *
2965 *LOGIC:
2966 *
2967 *ASSUMPTIONS:
2968 *
2969 *NOTE:
2970 *
2971 * @param pMac Pointer to Global MAC structure
2972 * @param *pMsgBuf A pointer to the SME message buffer
2973 * @return None
2974 */
2975
2976static void
2977__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2978{
2979 tpSirSmeSetContextReq pSetContextReq;
2980 tLimMlmSetKeysReq *pMlmSetKeysReq;
2981 tpPESession psessionEntry;
2982 tANI_U8 sessionId; //PE sessionID
2983 tANI_U8 smesessionId;
2984 tANI_U16 smetransactionId;
2985
2986
2987 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002988 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07002989
2990
2991 if(pMsgBuf == NULL)
2992 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002993 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002994 return;
2995 }
2996
2997 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302998
2999 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
3000 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003001 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303002 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003003 return;
3004 }
3005
3006 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3007 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
3008 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003009 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003010 goto end;
3011 }
3012
3013 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3014 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003015 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 -07003016 limSendSmeSetContextRsp(pMac,
3017 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003018 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003019 eSIR_SME_INVALID_PARAMETERS,NULL,
3020 smesessionId,smetransactionId);
3021
3022 goto end;
3023 }
3024
3025
3026 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
3027 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003028 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003029 limSendSmeSetContextRsp(pMac,
3030 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003031 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003032 eSIR_SME_INVALID_PARAMETERS,NULL,
3033 smesessionId,smetransactionId);
3034
3035 goto end;
3036 }
3037
3038#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3039 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
3040#endif //FEATURE_WLAN_DIAG_SUPPORT
3041
3042
3043 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
3044 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3045 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3046 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3047 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3048 {
3049 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303050 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
3051 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003052 {
3053 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303054 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003055 goto end;
3056 }
3057
3058 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
3059 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
3060 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3061 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003062 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003063 goto end;
3064 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303065 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003066 (tANI_U8 *) &pSetContextReq->peerMacAddr,
3067 sizeof(tSirMacAddr));
3068
Jeff Johnson295189b2012-06-20 16:38:30 -07003069
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303070 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07003071 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
3072 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
3073
3074 pMlmSetKeysReq->sessionId = sessionId;
3075#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3076 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003077 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07003078#endif
3079
Jeff Johnson295189b2012-06-20 16:38:30 -07003080 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
3081 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
3082 {
3083 if(pSetContextReq->keyMaterial.key[0].keyLength)
3084 {
3085 tANI_U8 keyId;
3086 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303087 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07003088 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
3089 }
3090 else {
3091 tANI_U32 i;
3092 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3093 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303094 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003095 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3096 }
3097 }
3098 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003099
3100 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003101 }
3102 else
3103 {
3104 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003105 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003106 psessionEntry->limSystemRole,
3107 psessionEntry->limSmeState);
3108 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3109
3110 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003111 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003112 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3113 smesessionId,
3114 smetransactionId);
3115 }
3116
3117end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303118 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003119 return;
3120} /*** end __limProcessSmeSetContextReq() ***/
3121
3122/**
3123 * __limProcessSmeRemoveKeyReq()
3124 *
3125 *FUNCTION:
3126 * This function is called to process SME_REMOVEKEY_REQ message
3127 * from HDD or upper layer application.
3128 *
3129 *LOGIC:
3130 *
3131 *ASSUMPTIONS:
3132 *
3133 *NOTE:
3134 *
3135 * @param pMac Pointer to Global MAC structure
3136 * @param *pMsgBuf A pointer to the SME message buffer
3137 * @return None
3138 */
3139
3140static void
3141__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3142{
3143 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3144 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3145 tpPESession psessionEntry;
3146 tANI_U8 sessionId; //PE sessionID
3147 tANI_U8 smesessionId;
3148 tANI_U16 smetransactionId;
3149
3150 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003151 FL("received REMOVEKEY_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003152
3153 if(pMsgBuf == NULL)
3154 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003155 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003156 return;
3157 }
3158
3159
3160 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3161
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303162 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3163 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003164 {
3165 //Log error
3166 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303167 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003168
3169 return;
3170 }
3171
3172 if ((limRemoveKeyReqSerDes(pMac,
3173 pRemoveKeyReq,
3174 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3175 {
3176 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003177 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003178
3179 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3180
3181 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3182 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003183 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003184 //goto end;
3185 }
3186
3187 limSendSmeRemoveKeyRsp(pMac,
3188 pRemoveKeyReq->peerMacAddr,
3189 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3190 smesessionId,smetransactionId);
3191
3192 goto end;
3193 }
3194
3195 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3196 {
3197 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003198 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003199 limSendSmeRemoveKeyRsp(pMac,
3200 pRemoveKeyReq->peerMacAddr,
3201 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3202 smesessionId, smetransactionId);
3203 goto end;
3204 }
3205
3206
3207 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3208 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3209 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3210 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3211 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3212 {
3213 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303214 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3215 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003216 {
3217 // Log error
3218 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303219 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003220
3221 goto end;
3222 }
3223
3224 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3225 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3226 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3227 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3228
3229 /* Update PE session Id */
3230 pMlmRemoveKeyReq->sessionId = sessionId;
3231
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303232 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003233 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3234 sizeof(tSirMacAddr));
3235
3236
3237 limPostMlmMessage(pMac,
3238 LIM_MLM_REMOVEKEY_REQ,
3239 (tANI_U32 *) pMlmRemoveKeyReq);
3240 }
3241 else
3242 {
3243 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003244 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003245 psessionEntry->limSystemRole,
3246 psessionEntry->limSmeState);
3247 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3248
3249 limSendSmeRemoveKeyRsp(pMac,
3250 pRemoveKeyReq->peerMacAddr,
3251 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3252 smesessionId,smetransactionId);
3253 }
3254
3255end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303256 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003257} /*** end __limProcessSmeRemoveKeyReq() ***/
3258
Jeff Johnson295189b2012-06-20 16:38:30 -07003259void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3260{
3261 tSirMsgQ mmhMsg;
3262 tpSmeGetScanChnRsp pSirSmeRsp;
3263 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303264 tANI_U8 sessionId;
3265 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003266
3267 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3268 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003269 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 pMac->lim.scanChnInfo.numChnInfo);
3271 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3272 }
3273
3274 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003275 FL("Sending message %s with number of channels %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003276 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);)
3277
3278 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303279 pSirSmeRsp = vos_mem_malloc(len);
3280 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003281 {
3282 /// Buffer not available. Log error
3283 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303284 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003285
3286 return;
3287 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303288 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003289
Jeff Johnson295189b2012-06-20 16:38:30 -07003290 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3291 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303292
3293 if (pMac->fScanOffload)
3294 {
3295 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3296 pSirSmeRsp->sessionId = sessionId;
3297 }
3298 else
3299 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003300
3301 if(pMac->lim.scanChnInfo.numChnInfo)
3302 {
3303 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303304 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3305 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 }
3307 //Clear the list
3308 limRessetScanChannelInfo(pMac);
3309
3310 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3311 mmhMsg.bodyptr = pSirSmeRsp;
3312 mmhMsg.bodyval = 0;
3313
3314 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003315 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003316 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3317}
3318
3319
Jeff Johnson295189b2012-06-20 16:38:30 -07003320void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3321{
3322 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3323 tpDphHashNode pStaDs = NULL;
3324 tpPESession psessionEntry = NULL;
3325 tSap_Event sapEvent;
3326 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3327 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3328 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3329 tANI_U8 assocId = 0;
3330 tANI_U8 staCount = 0;
3331
3332 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3333 {
3334 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003335 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003336 goto limAssocStaEnd;
3337 }
3338
3339 switch (getAssocSTAsReq.modId)
3340 {
3341/**
3342 case VOS_MODULE_ID_HAL:
3343 wdaPostCtrlMsg( pMac, &msgQ );
3344 return;
3345
3346 case VOS_MODULE_ID_TL:
3347 Post msg TL
3348 return;
3349*/
3350 case VOS_MODULE_ID_PE:
3351 default:
3352 break;
3353 }
3354
Jeff Johnson1250df42012-12-10 14:31:52 -08003355 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003356 // Find PE session Entry
3357 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3358 {
3359 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003360 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003361 goto limAssocStaEnd;
3362 }
3363
3364 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3365 {
3366 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003367 FL("Received unexpected message in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303368 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003369 goto limAssocStaEnd;
3370 }
3371
3372 // Retrieve values obtained in the request message
3373 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3374 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3375
3376 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3377 {
3378 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3379
3380 if (NULL == pStaDs)
3381 continue;
3382
3383 if (pStaDs->valid)
3384 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303385 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3386 (tANI_U8 *)&pStaDs->staAddr,
3387 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003388 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3389 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3390
Kiet Lamb1233192013-11-28 13:38:20 +05303391 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003392 (tANI_U8 *)&pStaDs->supportedRates,
3393 sizeof(tSirSupportedRates));
3394 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3395 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3396 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3397
Jeff Johnson295189b2012-06-20 16:38:30 -07003398 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003399 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3400 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003401 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3402 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3403
3404 pAssocStasTemp++;
3405 staCount++;
3406 }
3407 }
3408
3409limAssocStaEnd:
3410 // Call hdd callback with sap event to send the list of associated stations from PE
3411 if (pSapEventCallback != NULL)
3412 {
3413 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3414 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3415 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3416 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3417 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3418 }
3419}
3420
3421
3422/**
3423 * limProcessSmeGetWPSPBCSessions
3424 *
3425 *FUNCTION:
3426 * This function is called when query the WPS PBC overlap message is received
3427 *
3428 *LOGIC:
3429 * This function parses get WPS PBC overlap information message and call callback to pass
3430 * WPS PBC overlap information back to hdd.
3431 *ASSUMPTIONS:
3432 *
3433 *
3434 *NOTE:
3435 *
3436 * @param pMac Pointer to Global MAC structure
3437 * @param pMsgBuf A pointer to WPS PBC overlap query message
3438*
3439 * @return None
3440 */
3441void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3442{
3443 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3444 tpPESession psessionEntry = NULL;
3445 tSap_Event sapEvent;
3446 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3447 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3448 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3449
3450 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3451
3452 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3453 {
3454 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003455 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003456 goto limGetWPSPBCSessionsEnd;
3457 }
3458
Jeff Johnson1250df42012-12-10 14:31:52 -08003459 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003460 // Find PE session Entry
3461 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3462 {
3463 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003464 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003465 goto limGetWPSPBCSessionsEnd;
3466 }
3467
3468 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3469 {
3470 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003471 FL("Received unexpected message in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003472 psessionEntry->limSystemRole);
3473 goto limGetWPSPBCSessionsEnd;
3474 }
3475
Jeff Johnson1250df42012-12-10 14:31:52 -08003476 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003477 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3478 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3479
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303480 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003481 { //This is GetWpsSession call
3482
3483 limGetWPSPBCSessions(pMac,
3484 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3485 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3486 }
3487 else
3488 {
3489 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3490 /* don't have to inform the HDD/Host */
3491 return;
3492 }
3493
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003494 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003495 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3496
3497 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3498
3499limGetWPSPBCSessionsEnd:
3500 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
3501 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
3502}
3503
Jeff Johnson295189b2012-06-20 16:38:30 -07003504
3505
3506/**
3507 * __limCounterMeasures()
3508 *
3509 * FUNCTION:
3510 * This function is called to "implement" MIC counter measure
3511 * and is *temporary* only
3512 *
3513 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3514 * we don't do the proper STA disassoc sequence since the
3515 * BSS will be stoped anyway
3516 *
3517 *ASSUMPTIONS:
3518 *
3519 *NOTE:
3520 *
3521 * @param pMac Pointer to Global MAC structure
3522 * @return None
3523 */
3524
3525static void
3526__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3527{
3528 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3529 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
3530 || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
3531
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003532 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003533
Jeff Johnson295189b2012-06-20 16:38:30 -07003534};
3535
3536
Jeff Johnson295189b2012-06-20 16:38:30 -07003537void
3538limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3539{
3540 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3541 tpPESession psessionEntry;
3542 tANI_U8 sessionId; //PE sessionId
3543
3544 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3545 {
3546 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003547 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003548 return;
3549 }
3550
3551 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3552 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003553 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003554 return;
3555 }
3556
3557 if ( tkipCntrMeasReq.bEnable )
3558 {
3559 __limCounterMeasures( pMac, psessionEntry );
3560 }
3561
3562 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3563}
Jeff Johnson295189b2012-06-20 16:38:30 -07003564
3565
3566static void
3567__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3568{
3569 tSirSmeStopBssReq stopBssReq;
3570 tSirRetStatus status;
3571 tLimSmeStates prevState;
3572 tANI_U8 sessionId; //PE sessionId
3573 tpPESession psessionEntry;
3574 tANI_U8 smesessionId;
3575 tANI_U16 smetransactionId;
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303576 tANI_U8 i = 0;
3577 tpDphHashNode pStaDs = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003578
3579 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3580
3581
3582
3583 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3584 !limIsSmeStopBssReqValid(pMsgBuf))
3585 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003586 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003587 /// Send Stop BSS response to host
3588 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3589 return;
3590 }
3591
3592
3593 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3594 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003595 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003596 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3597 return;
3598 }
3599
3600#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3601 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3602#endif //FEATURE_WLAN_DIAG_SUPPORT
3603
3604
3605 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3606 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3607 {
3608 /**
3609 * Should not have received STOP_BSS_REQ in states
3610 * other than 'normal' state or on STA in Infrastructure
3611 * mode. Log error and return response to host.
3612 */
3613 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003614 FL("received unexpected SME_STOP_BSS_REQ in state %X, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003615 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3616 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3617 /// Send Stop BSS response to host
3618 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3619 return;
3620 }
3621
Jeff Johnson295189b2012-06-20 16:38:30 -07003622 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3623 {
3624 limWPSPBCClose(pMac, psessionEntry);
3625 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003626 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003627
3628 prevState = psessionEntry->limSmeState;
3629
3630 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003631 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003632
3633 /* Update SME session Id and Transaction Id */
3634 psessionEntry->smeSessionId = smesessionId;
3635 psessionEntry->transactionId = smetransactionId;
3636
3637 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame */
3638 if ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) && (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3639 {
3640 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3641 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3642 // Send disassoc all stations associated thru TKIP
3643 __limCounterMeasures(pMac,psessionEntry);
3644 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303645 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003646 }
3647
3648 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3649 pMac->lim.gLimIbssCoalescingHappened = false;
3650
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303651 for(i = 1 ; i < pMac->lim.gLimAssocStaLimit ; i++)
3652 {
3653 pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable);
3654 if (NULL == pStaDs)
3655 continue;
3656 status = limDelSta(pMac, pStaDs, false, psessionEntry) ;
3657 if(eSIR_SUCCESS == status)
3658 {
3659 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ;
3660 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ;
3661 }
3662 else
3663 {
3664 limLog(pMac, LOGE, FL("limDelSta failed with Status : %d"), status);
3665 VOS_ASSERT(0) ;
3666 }
3667 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003668 /* send a delBss to HAL and wait for a response */
3669 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3670
3671 if (status != eSIR_SUCCESS)
3672 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003673 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003674 psessionEntry->limSmeState= prevState;
3675
Jeff Johnsone7245742012-09-05 17:12:55 -07003676 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003677
3678 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3679 }
3680}
3681
3682
3683/**--------------------------------------------------------------
3684\fn __limProcessSmeStopBssReq
3685
3686\brief Wrapper for the function __limHandleSmeStopBssRequest
3687 This message will be defered until softmac come out of
3688 scan mode. Message should be handled even if we have
3689 detected radar in the current operating channel.
3690\param pMac
3691\param pMsg
3692
3693\return TRUE - If we consumed the buffer
3694 FALSE - If have defered the message.
3695 ---------------------------------------------------------------*/
3696static tANI_BOOLEAN
3697__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3698{
3699 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3700 {
3701 /**
3702 * If message defered, buffer is not consumed yet.
3703 * So return false
3704 */
3705 return eANI_BOOLEAN_FALSE;
3706 }
3707 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3708 return eANI_BOOLEAN_TRUE;
3709} /*** end __limProcessSmeStopBssReq() ***/
3710
3711
3712void limProcessSmeDelBssRsp(
3713 tpAniSirGlobal pMac,
3714 tANI_U32 body,tpPESession psessionEntry)
3715{
3716
3717 (void) body;
3718 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3719 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003720 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003721 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3722 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003723 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3724 return;
3725}
3726
3727
Jeff Johnson295189b2012-06-20 16:38:30 -07003728/**---------------------------------------------------------------
3729\fn __limProcessSmeAssocCnfNew
3730\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3731\ in BTAMP AP.
3732\
3733\param pMac
3734\param msgType - message type
3735\param pMsgBuf - a pointer to the SME message buffer
3736\return None
3737------------------------------------------------------------------*/
3738
3739 void
3740__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3741{
3742 tSirSmeAssocCnf assocCnf;
3743 tpDphHashNode pStaDs = NULL;
3744 tpPESession psessionEntry= NULL;
3745 tANI_U8 sessionId;
3746
3747
3748 if(pMsgBuf == NULL)
3749 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003750 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003751 goto end;
3752 }
3753
3754 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3755 !__limIsSmeAssocCnfValid(&assocCnf))
3756 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003757 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003758 goto end;
3759 }
3760
3761 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3762 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003763 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003764 goto end;
3765 }
3766
3767 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3768 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3769 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003770 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303771 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003772 goto end;
3773 }
3774
3775 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3776
3777 if (pStaDs == NULL)
3778 {
3779 limLog(pMac, LOG1,
3780 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
3781 msgType, assocCnf.aid);
3782 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3783
3784 /*
3785 ** send a DISASSOC_IND message to WSM to make sure
3786 ** the state in WSM and LIM is the same
3787 **/
3788 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3789 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3790 goto end;
3791 }
3792 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303793 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003794 (tANI_U8 *) assocCnf.peerMacAddr,
3795 sizeof(tSirMacAddr)) ) ||
3796 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3797 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3798 (msgType != eWNI_SME_ASSOC_CNF)) ||
3799 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003800 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003801 {
3802 limLog(pMac, LOG1,
3803 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
3804 msgType, assocCnf.aid);
3805 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3806 goto end;
3807 }
3808
3809 /*
3810 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3811 ** has been received
3812 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003813 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003814 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3815
3816 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3817 {
3818 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3819 * when it had received Assoc Request frame. Now, PE just needs to send
3820 * Association Response frame to the requesting BTAMP-STA.
3821 */
3822 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003823 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003824 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3825 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3826 goto end;
3827 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3828 else
3829 {
3830 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3831 /*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*/
3832 if(!pStaDs->mlmStaContext.updateContext)
3833 pStaDs->mlmStaContext.updateContext = 1;
3834 limRejectAssociation(pMac, pStaDs->staAddr,
3835 pStaDs->mlmStaContext.subType,
3836 true, pStaDs->mlmStaContext.authType,
3837 pStaDs->assocId, true,
3838 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003839 }
3840
3841end:
3842 if((psessionEntry != NULL) && (pStaDs != NULL))
3843 {
3844 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3845 {
3846 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3847 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303848 vos_mem_free(((tpSirAssocReq)
3849 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07003850 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
3851 }
3852
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303853 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003854 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
3855 }
3856 }
3857
3858} /*** end __limProcessSmeAssocCnfNew() ***/
3859
3860
Jeff Johnson295189b2012-06-20 16:38:30 -07003861
3862
3863static void
3864__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3865{
3866 tpDphHashNode pStaDs;
3867 tSirMacAddr peerMac;
3868 tpSirAddtsReq pSirAddts;
3869 tANI_U32 timeout;
3870 tpPESession psessionEntry;
3871 tANI_U8 sessionId; //PE sessionId
3872 tANI_U8 smesessionId;
3873 tANI_U16 smetransactionId;
3874
3875
3876 if(pMsgBuf == NULL)
3877 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003878 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003879 return;
3880 }
3881
3882 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3883
3884 pSirAddts = (tpSirAddtsReq) pMsgBuf;
3885
3886 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
3887 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003888 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003889 return;
3890 }
3891#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3892 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
3893#endif //FEATURE_WLAN_DIAG_SUPPORT
3894
3895
3896
3897 /* if sta
3898 * - verify assoc state
3899 * - send addts request to ap
3900 * - wait for addts response from ap
3901 * if ap, just ignore with error log
3902 */
3903 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003904 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003905 pSirAddts->req.tspec.tsinfo.traffic.tsid,
3906 pSirAddts->req.tspec.tsinfo.traffic.userPrio);)
3907
3908 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
3909 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003910 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003911 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3912 smesessionId,smetransactionId);
3913 return;
3914 }
3915
3916 //Ignore the request if STA is in 11B mode.
3917 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
3918 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003919 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003920 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3921 smesessionId,smetransactionId);
3922 return;
3923 }
3924
3925
3926 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3927
3928 if(pStaDs == NULL)
3929 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003930 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003931 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3932 smesessionId,smetransactionId);
3933 return;
3934 }
3935
3936 if ((! pStaDs->valid) ||
3937 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
3938 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003939 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003940 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3941 smesessionId,smetransactionId);
3942 return;
3943 }
3944
3945 pSirAddts->req.wsmTspecPresent = 0;
3946 pSirAddts->req.wmeTspecPresent = 0;
3947 pSirAddts->req.lleTspecPresent = 0;
3948
3949 if ((pStaDs->wsmEnabled) &&
3950 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
3951 pSirAddts->req.wsmTspecPresent = 1;
3952 else if (pStaDs->wmeEnabled)
3953 pSirAddts->req.wmeTspecPresent = 1;
3954 else if (pStaDs->lleEnabled)
3955 pSirAddts->req.lleTspecPresent = 1;
3956 else
3957 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003958 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003959 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3960 smesessionId,smetransactionId);
3961 return;
3962 }
3963
3964 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
3965 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
3966 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003967 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07003968 psessionEntry->limSmeState);
3969 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3970 smesessionId,smetransactionId);
3971 return;
3972 }
3973
3974 if (pMac->lim.gLimAddtsSent)
3975 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003976 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07003977 pMac->lim.gLimAddtsReq.req.dialogToken,
3978 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
3979 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
3980 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3981 smesessionId,smetransactionId);
3982 return;
3983 }
3984
3985 #if 0
3986 val = sizeof(tSirMacAddr);
3987 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
3988 {
3989 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003990 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003991 return;
3992 }
3993 #endif
3994 sirCopyMacAddr(peerMac,psessionEntry->bssId);
3995
3996 // save the addts request
3997 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303998 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07003999
4000 // ship out the message now
4001 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
4002 psessionEntry);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004003 PELOG1(limLog(pMac, LOG1, "Sent ADDTS request");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004004
4005 // start a timer to wait for the response
4006 if (pSirAddts->timeout)
4007 timeout = pSirAddts->timeout;
4008 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
4009 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004010 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004011 WNI_CFG_ADDTS_RSP_TIMEOUT);
4012 return;
4013 }
4014
4015 timeout = SYS_MS_TO_TICKS(timeout);
4016 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
4017 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004018 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004019 return;
4020 }
4021 pMac->lim.gLimAddtsRspTimerCount++;
4022 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
4023 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
4024 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004025 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004026 return;
4027 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004028 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07004029
4030 //add the sessionId to the timer object
4031 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
4032 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
4033 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004034 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004035 return;
4036 }
4037 return;
4038}
4039
4040
4041static void
4042__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4043{
4044 tSirMacAddr peerMacAddr;
4045 tANI_U8 ac;
4046 tSirMacTSInfo *pTsinfo;
4047 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
4048 tpDphHashNode pStaDs = NULL;
4049 tpPESession psessionEntry;
4050 tANI_U8 sessionId;
4051 tANI_U32 status = eSIR_SUCCESS;
4052 tANI_U8 smesessionId;
4053 tANI_U16 smetransactionId;
4054
4055 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4056
4057 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
4058 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004059 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004060 status = eSIR_FAILURE;
4061 goto end;
4062 }
4063#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4064 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
4065#endif //FEATURE_WLAN_DIAG_SUPPORT
4066
4067
4068 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
4069 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004070 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004071 status = eSIR_FAILURE;
4072 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
4073 return;
4074 }
4075
Arif Hussaina7c8e412013-11-20 11:06:42 -08004076 PELOG1(limLog(pMac, LOG1, FL("Sent DELTS request to station with "
4077 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
4078 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004079
4080 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
4081 psessionEntry);
4082
4083 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
4084
4085 /* We've successfully send DELTS frame to AP. Update the
4086 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
4087 * is no longer trigger enabled or delivery enabled
4088 */
4089 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
4090
4091 /* We're deleting the TSPEC, so this particular AC is no longer
4092 * admitted. PE needs to downgrade the EDCA
4093 * parameters(for the AC for which TS is being deleted) to the
4094 * next best AC for which ACM is not enabled, and send the
4095 * updated values to HAL.
4096 */
4097 ac = upToAc(pTsinfo->traffic.userPrio);
4098
4099 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4100 {
4101 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4102 }
4103 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4104 {
4105 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4106 }
4107 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4108 {
4109 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4110 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4111 }
4112
4113 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4114
4115 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4116 if (pStaDs != NULL)
4117 {
4118 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4119 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4120 else
4121 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4122 status = eSIR_SUCCESS;
4123 }
4124 else
4125 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004126 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004127 status = eSIR_FAILURE;
4128 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004129#ifdef FEATURE_WLAN_ESE
4130#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004131 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4132#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004133 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004134#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004135#endif
4136
4137 // send an sme response back
4138 end:
4139 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4140}
4141
4142
4143void
4144limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4145{
4146 //fetch the sessionEntry based on the sessionId
4147 tpPESession psessionEntry;
4148 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4149 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004150 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004151 return;
4152 }
4153
4154 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4155 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004156 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004157 pMac->lim.gLimAddtsSent = false;
4158 return;
4159 }
4160
4161 if (! pMac->lim.gLimAddtsSent)
4162 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004163 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004164 return;
4165 }
4166
4167 if (param != pMac->lim.gLimAddtsRspTimerCount)
4168 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004169 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004170 param, pMac->lim.gLimAddtsRspTimerCount);
4171 return;
4172 }
4173
4174 // this a real response timeout
4175 pMac->lim.gLimAddtsSent = false;
4176 pMac->lim.gLimAddtsRspTimerCount++;
4177
4178 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4179 psessionEntry->smeSessionId, psessionEntry->transactionId);
4180}
4181
4182
4183/**
4184 * __limProcessSmeStatsRequest()
4185 *
4186 *FUNCTION:
4187 *
4188 *
4189 *NOTE:
4190 *
4191 * @param pMac Pointer to Global MAC structure
4192 * @param *pMsgBuf A pointer to the SME message buffer
4193 * @return None
4194 */
4195static void
4196__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4197{
4198 tpAniGetStatsReq pStatsReq;
4199 tSirMsgQ msgQ;
4200 tpPESession psessionEntry;
4201 tANI_U8 sessionId;
4202
4203
4204 if(pMsgBuf == NULL)
4205 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004206 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004207 return;
4208 }
4209
4210 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4211
4212 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4213 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004214 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304215 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004216 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004217 return;
4218 }
4219
4220
4221
4222 switch(pStatsReq->msgType)
4223 {
4224 //Add Lim stats here. and send reqsponse.
4225
4226 //HAL maintained Stats.
4227 case eWNI_SME_STA_STAT_REQ:
4228 msgQ.type = WDA_STA_STAT_REQ;
4229 break;
4230 case eWNI_SME_AGGR_STAT_REQ:
4231 msgQ.type = WDA_AGGR_STAT_REQ;
4232 break;
4233 case eWNI_SME_GLOBAL_STAT_REQ:
4234 msgQ.type = WDA_GLOBAL_STAT_REQ;
4235 break;
4236 case eWNI_SME_STAT_SUMM_REQ:
4237 msgQ.type = WDA_STAT_SUMM_REQ;
4238 break;
4239 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004240 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304241 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004242 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004243 return;
4244 }
4245
Jeff Johnson295189b2012-06-20 16:38:30 -07004246 msgQ.reserved = 0;
4247 msgQ.bodyptr = pMsgBuf;
4248 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004249 if(NULL == psessionEntry)
4250 {
4251 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4252 }
4253 else
4254 {
4255 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4256 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004257 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004258 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304259 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004260 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 return;
4262 }
4263
4264 return;
4265}
4266
4267
4268/**
4269 * __limProcessSmeGetStatisticsRequest()
4270 *
4271 *FUNCTION:
4272 *
4273 *
4274 *NOTE:
4275 *
4276 * @param pMac Pointer to Global MAC structure
4277 * @param *pMsgBuf A pointer to the SME message buffer
4278 * @return None
4279 */
4280static void
4281__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4282{
4283 tpAniGetPEStatsReq pPEStatsReq;
4284 tSirMsgQ msgQ;
4285
4286 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4287
4288 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4289
4290 msgQ.type = WDA_GET_STATISTICS_REQ;
4291
Jeff Johnson295189b2012-06-20 16:38:30 -07004292 msgQ.reserved = 0;
4293 msgQ.bodyptr = pMsgBuf;
4294 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004295 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004296
4297 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304298 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004299 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004300 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004301 return;
4302 }
4303
4304 return;
4305}
4306
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004307#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004308/**
4309 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4310 *
4311 *NOTE:
4312 *
4313 * @param pMac Pointer to Global MAC structure
4314 * @param *pMsgBuf A pointer to the SME message buffer
4315 * @return None
4316 */
4317static void
4318__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4319{
4320 tSirMsgQ msgQ;
4321
4322 msgQ.type = WDA_TSM_STATS_REQ;
4323 msgQ.reserved = 0;
4324 msgQ.bodyptr = pMsgBuf;
4325 msgQ.bodyval = 0;
4326 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4327
4328 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4329 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004330 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004331 limLog(pMac, LOGP, "Unable to forward request");
4332 return;
4333 }
4334}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004335#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004336
4337
Jeff Johnson295189b2012-06-20 16:38:30 -07004338
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004339#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004340/**
4341 * __limProcessSmeGetRoamRssiRequest()
4342 *
4343 *FUNCTION:
4344 *
4345 *
4346 *NOTE:
4347 *
4348 * @param pMac Pointer to Global MAC structure
4349 * @param *pMsgBuf A pointer to the SME message buffer
4350 * @return None
4351 */
4352static void
4353__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4354{
4355 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4356 tSirMsgQ msgQ;
4357
4358 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4359 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4360
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004361 msgQ.reserved = 0;
4362 msgQ.bodyptr = pMsgBuf;
4363 msgQ.bodyval = 0;
4364 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4365
4366 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304367 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004368 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004369 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004370 return;
4371 }
4372
4373 return;
4374}
4375#endif
4376
4377
Jeff Johnson295189b2012-06-20 16:38:30 -07004378static void
4379__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4380{
4381 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4382 tpPESession psessionEntry;
4383 tANI_U8 sessionId; //PE sessionID
4384
4385 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004386 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004387
4388 if(pMsgBuf == NULL)
4389 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004390 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004391 return;
4392 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004393
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304394 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4395 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004396 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304397 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004398 return;
4399 }
4400
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004401 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004402 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004403 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004404 goto end;
4405 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004406
Jeff Johnson295189b2012-06-20 16:38:30 -07004407 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4408 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004409 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004410 goto end;
4411 }
4412
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304413 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004414
Jeff Johnson295189b2012-06-20 16:38:30 -07004415 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004416 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004417
4418end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304419 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004420 return;
4421} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4422
4423static void
4424__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4425{
4426 tpSirUpdateParams pUpdateParams;
4427 tpPESession psessionEntry;
4428
4429 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004430 FL("received HIDE_SSID message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004431
4432 if(pMsgBuf == NULL)
4433 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004434 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004435 return;
4436 }
4437
4438 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4439
4440 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4441 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004442 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004443 pUpdateParams->sessionId);
4444 return;
4445 }
4446
4447 /* Update the session entry */
4448 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4449
4450 /* Update beacon */
4451 schSetFixedBeaconFields(pMac, psessionEntry);
4452 limSendBeaconInd(pMac, psessionEntry);
4453
4454 return;
4455} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4456
4457static void
4458__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4459{
4460 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4461 tpPESession psessionEntry;
4462 tANI_U8 sessionId; //PE sessionID
4463
4464 if(pMsgBuf == NULL)
4465 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004466 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004467 return;
4468 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304469
4470 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4471 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004472 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304473 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004474 return;
4475 }
4476
4477 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4478 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004479 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004480 goto end;
4481 }
4482
4483 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4484 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004485 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004486 goto end;
4487 }
4488
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304489 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4490 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004491
4492 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4493
4494 psessionEntry->pLimStartBssReq->privacy = 1;
4495 psessionEntry->privacy = 1;
4496
4497 schSetFixedBeaconFields(pMac, psessionEntry);
4498 limSendBeaconInd(pMac, psessionEntry);
4499
4500end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304501 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004502 return;
4503} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4504
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004505/*
4506Update the beacon Interval dynamically if beaconInterval is different in MCC
4507*/
4508static void
4509__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4510{
4511 tpSirChangeBIParams pChangeBIParams;
4512 tpPESession psessionEntry;
4513 tANI_U8 sessionId = 0;
4514 tUpdateBeaconParams beaconParams;
4515
4516 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004517 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004518
4519 if(pMsgBuf == NULL)
4520 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004521 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004522 return;
4523 }
4524
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304525 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004526 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4527
4528 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4529 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004530 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004531 return;
4532 }
4533
4534 /*Update sessionEntry Beacon Interval*/
4535 if(psessionEntry->beaconParams.beaconInterval !=
4536 pChangeBIParams->beaconInterval )
4537 {
4538 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4539 }
4540
4541 /*Update sch beaconInterval*/
4542 if(pMac->sch.schObject.gSchBeaconInterval !=
4543 pChangeBIParams->beaconInterval )
4544 {
4545 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4546
4547 PELOG1(limLog(pMac, LOG1,
4548 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4549
4550 /* Update beacon */
4551 schSetFixedBeaconFields(pMac, psessionEntry);
4552
Sunil Ravib96f7b52013-05-22 21:40:05 -07004553 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004554 //Set change in beacon Interval
4555 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004556 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004557 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4558 }
4559
4560 return;
4561} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4562
Jeff Johnson295189b2012-06-20 16:38:30 -07004563
4564
4565/** -------------------------------------------------------------
4566\fn limProcessSmeDelBaPeerInd
4567\brief handles indication message from HDD to send delete BA request
4568\param tpAniSirGlobal pMac
4569\param tANI_U32 pMsgBuf
4570\return None
4571-------------------------------------------------------------*/
4572void
4573limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4574{
4575 tANI_U16 assocId =0;
4576 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4577 tpDphHashNode pSta;
4578 tpPESession psessionEntry;
4579 tANI_U8 sessionId;
4580
4581
4582
4583 if(NULL == pSmeDelBAPeerInd)
4584 return;
4585
4586 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4587 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004588 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004589 return;
4590 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004591 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004592 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4593
4594 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4595 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4596 pSta,
4597 pSmeDelBAPeerInd->baDirection,
4598 pSmeDelBAPeerInd->baTID,
4599 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4600 {
4601 limLog( pMac, LOGW,
4602 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4603 if (pSta)
4604 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4605 }
4606}
4607
4608// --------------------------------------------------------------------
4609/**
4610 * __limProcessReportMessage
4611 *
4612 * FUNCTION: Processes the next received Radio Resource Management message
4613 *
4614 * LOGIC:
4615 *
4616 * ASSUMPTIONS:
4617 *
4618 * NOTE:
4619 *
4620 * @param None
4621 * @return None
4622 */
4623
4624void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4625{
4626#ifdef WLAN_FEATURE_VOWIFI
4627 switch (pMsg->type)
4628 {
4629 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4630 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4631 break;
4632 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4633 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004634#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004635 tpSirBeaconReportXmitInd pBcnReport=NULL;
4636 tpPESession psessionEntry=NULL;
4637 tANI_U8 sessionId;
4638
4639 if(pMsg->bodyptr == NULL)
4640 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004641 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004642 return;
4643 }
4644 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4645 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4646 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004647 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004648 return;
4649 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004650 if (psessionEntry->isESEconnection)
4651 eseProcessBeaconReportXmit( pMac, pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004652 else
4653#endif
4654 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4655 }
4656 break;
4657 }
4658#endif
4659}
4660
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004661#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI)
Jeff Johnson295189b2012-06-20 16:38:30 -07004662// --------------------------------------------------------------------
4663/**
4664 * limSendSetMaxTxPowerReq
4665 *
4666 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4667 *
4668 * LOGIC:
4669 *
4670 * ASSUMPTIONS:
4671 *
4672 * NOTE:
4673 *
4674 * @param txPower txPower to be set.
4675 * @param pSessionEntry session entry.
4676 * @return None
4677 */
4678tSirRetStatus
4679limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4680{
4681 tpMaxTxPowerParams pMaxTxParams = NULL;
4682 tSirRetStatus retCode = eSIR_SUCCESS;
4683 tSirMsgQ msgQ;
4684
4685 if( pSessionEntry == NULL )
4686 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004687 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004688 return eSIR_FAILURE;
4689 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304690
4691 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4692 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004693 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004694 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004695 return eSIR_MEM_ALLOC_FAILED;
4696
4697 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004698#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004699 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 -07004700#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004701 if( pMaxTxParams == NULL )
4702 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004703 limLog( pMac, LOGE, "%s:%d: pMaxTxParams is NULL", __func__, __LINE__);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004704 return eSIR_FAILURE;
4705 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004706 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304707 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4708 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004709
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004710 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4711 msgQ.bodyptr = pMaxTxParams;
4712 msgQ.bodyval = 0;
4713 PELOG1(limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));)
4714 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
4715 retCode = wdaPostCtrlMsg(pMac, &msgQ);
4716 if (eSIR_SUCCESS != retCode)
4717 {
4718 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304719 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004720 }
4721 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004722}
4723#endif
4724
4725/**
4726 * __limProcessSmeAddStaSelfReq()
4727 *
4728 *FUNCTION:
4729 * This function is called to process SME_ADD_STA_SELF_REQ message
4730 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4731 *
4732 *LOGIC:
4733 *
4734 *ASSUMPTIONS:
4735 *
4736 *NOTE:
4737 *
4738 * @param pMac Pointer to Global MAC structure
4739 * @param *pMsgBuf A pointer to the SME message buffer
4740 * @return None
4741 */
4742
4743static void
4744__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4745{
4746 tSirMsgQ msg;
4747 tpAddStaSelfParams pAddStaSelfParams;
4748 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
4749
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304750 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
4751 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004752 {
4753 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
4754 return;
4755 }
4756
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304757 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07004758 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004759 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
4760 msg.reserved = 0;
4761 msg.bodyptr = pAddStaSelfParams;
4762 msg.bodyval = 0;
4763
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004764 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004765 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004766
4767 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4768 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004769 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004770 }
4771 return;
4772} /*** end __limProcessAddStaSelfReq() ***/
4773
4774
4775/**
4776 * __limProcessSmeDelStaSelfReq()
4777 *
4778 *FUNCTION:
4779 * This function is called to process SME_DEL_STA_SELF_REQ message
4780 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
4781 *
4782 *LOGIC:
4783 *
4784 *ASSUMPTIONS:
4785 *
4786 *NOTE:
4787 *
4788 * @param pMac Pointer to Global MAC structure
4789 * @param *pMsgBuf A pointer to the SME message buffer
4790 * @return None
4791 */
4792
4793static void
4794__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4795{
4796 tSirMsgQ msg;
4797 tpDelStaSelfParams pDelStaSelfParams;
4798 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
4799
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304800 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
4801 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004802 {
4803 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
4804 return;
4805 }
4806
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304807 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004808
4809 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
4810 msg.reserved = 0;
4811 msg.bodyptr = pDelStaSelfParams;
4812 msg.bodyval = 0;
4813
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004814 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004815 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004816
4817 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4818 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004819 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004820 }
4821 return;
4822} /*** end __limProcessSmeDelStaSelfReq() ***/
4823
4824
Jeff Johnson295189b2012-06-20 16:38:30 -07004825/**
4826 * __limProcessSmeRegisterMgmtFrameReq()
4827 *
4828 *FUNCTION:
4829 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
4830 * from SME. It Register this information within PE.
4831 *
4832 *LOGIC:
4833 *
4834 *ASSUMPTIONS:
4835 *
4836 *NOTE:
4837 *
4838 * @param pMac Pointer to Global MAC structure
4839 * @param *pMsgBuf A pointer to the SME message buffer
4840 * @return None
4841 */
4842static void
4843__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4844{
4845 VOS_STATUS vosStatus;
4846 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
4847 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004848 tANI_BOOLEAN match = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004849 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004850 FL("registerFrame %d, frameType %d, matchLen %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07004851 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004852
Jeff Johnsond13512a2012-07-17 11:42:19 -07004853 /* First check whether entry exists already*/
4854
4855 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4856 (vos_list_node_t**)&pLimMgmtRegistration);
4857
4858 while(pLimMgmtRegistration != NULL)
4859 {
4860 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
4861 {
4862 if(pSmeReq->matchLen)
4863 {
4864 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
4865 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304866 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07004867 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
4868 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004869 /* found match! */
4870 match = VOS_TRUE;
4871 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004872 }
4873 }
4874 }
4875 else
4876 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004877 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07004878 match = VOS_TRUE;
4879 break;
4880 }
4881 }
4882 vosStatus = vos_list_peek_next (
4883 &pMac->lim.gLimMgmtFrameRegistratinQueue,
4884 (vos_list_node_t*) pLimMgmtRegistration,
4885 (vos_list_node_t**) &pNext );
4886
4887 pLimMgmtRegistration = pNext;
4888 pNext = NULL;
4889
4890 }
4891
4892 if (match)
4893 {
4894 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4895 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304896 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07004897 }
4898
Jeff Johnson295189b2012-06-20 16:38:30 -07004899 if(pSmeReq->registerFrame)
4900 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304901 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
4902 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07004903 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304904 vos_mem_set((void*)pLimMgmtRegistration,
4905 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004906 pLimMgmtRegistration->frameType = pSmeReq->frameType;
4907 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
4908 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
4909 if(pSmeReq->matchLen)
4910 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304911 vos_mem_copy(pLimMgmtRegistration->matchData,
4912 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07004913 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004914 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4915 &pLimMgmtRegistration->node);
4916 }
4917 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004918
4919 return;
4920} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08004921
4922static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08004923__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08004924{
4925 tpP2pPsParams pMsgNoA;
4926 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08004927
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304928 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
4929 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08004930 {
4931 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004932 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08004933 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004934 }
4935
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304936 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08004937 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
4938 pMsgNoA->opp_ps = 0;
4939 pMsgNoA->ctWindow = 0;
4940 pMsgNoA->duration = 0;
4941 pMsgNoA->interval = 0;
4942 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08004943
Vinay Malekal62757362012-12-17 12:15:51 -08004944 /* Below params used for Single Shot NOA - so assign proper values */
4945 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08004946 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08004947
Viral Modid86bde22012-12-10 13:09:21 -08004948 /* Start Insert NOA timer
4949 * 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 -08004950 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
4951 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08004952 */
4953 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
4954 == TX_TIMER_ERROR)
4955 {
4956 /// Could not activate Insert NOA timer.
4957 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004958 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08004959
4960 // send the scan response back with status failure and do not even call insert NOA
4961 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304962 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08004963 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004964 }
4965
Viral Modid440e682013-03-06 02:25:31 -08004966 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
4967
Viral Modid86bde22012-12-10 13:09:21 -08004968 msg.type = WDA_SET_P2P_GO_NOA_REQ;
4969 msg.reserved = 0;
4970 msg.bodyptr = pMsgNoA;
4971 msg.bodyval = 0;
4972
4973 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4974 {
4975 /* 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 -07004976 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08004977 /* Deactivate the NOA timer in failure case */
4978 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
4979 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004980 }
Viral Modid440e682013-03-06 02:25:31 -08004981 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08004982
Viral Modid440e682013-03-06 02:25:31 -08004983error:
4984 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
4985 * worrying about the NOA
4986 */
4987 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
4988 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08004989 return FALSE;
4990
4991}
4992
Viral Modid440e682013-03-06 02:25:31 -08004993static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4994{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004995 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08004996 pMac->lim.gDeferMsgTypeForNOA = msgType;
4997 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
4998}
4999
5000static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5001{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005002 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08005003 pMac->lim.gDeferMsgTypeForNOA = 0;
5004 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
5005 {
5006 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305007 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005008 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5009 }
5010}
5011
5012static
5013tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
5014{
5015 tANI_U32 noaDuration = 0;
5016
5017 switch (msgType)
5018 {
5019 case eWNI_SME_SCAN_REQ:
5020 {
5021 tANI_U32 val;
5022 tANI_U8 i;
5023 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
5024 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
5025 {
5026 /*
5027 * Could not get max channel value
5028 * from CFG. Log error.
5029 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005030 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08005031
5032 /* use a default value of 110ms */
5033 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
5034 }
5035
5036 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
5037 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
5038
5039 if (limActiveScanAllowed(pMac, channelNum)) {
5040 /* Use min + max channel time to calculate the total duration of scan */
5041 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
5042 } else {
5043 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
5044 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
5045 */
5046 noaDuration += val;
5047 }
5048 }
5049
5050 /* Adding an overhead of 20ms to account for the scan messaging delays */
5051 noaDuration += SCAN_MESSAGING_OVERHEAD;
5052 noaDuration *= CONV_MS_TO_US;
5053
5054 break;
5055 }
5056
5057 case eWNI_SME_OEM_DATA_REQ:
5058 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
5059 break;
5060
5061 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5062 {
5063 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
5064 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
5065 break;
5066 }
5067
5068 case eWNI_SME_JOIN_REQ:
5069 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
5070 break;
5071
5072 default:
5073 noaDuration = 0;
5074 break;
5075
5076 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005077 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08005078 return noaDuration;
5079}
5080
5081void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5082{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305083 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08005084
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005085 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005086 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
5087 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
5088 {
5089 switch (pMac->lim.gDeferMsgTypeForNOA)
5090 {
5091 case eWNI_SME_SCAN_REQ:
5092 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5093 break;
5094 case eWNI_SME_OEM_DATA_REQ:
5095 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5096 break;
5097 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305098 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5099 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
5100 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
5101 */
5102 if (FALSE == bufConsumed)
5103 {
5104 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5105 }
Viral Modid440e682013-03-06 02:25:31 -08005106 break;
5107 case eWNI_SME_JOIN_REQ:
5108 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5109 break;
5110 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005111 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005112 break;
5113 }
5114 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5115 }
5116 else
5117 {
5118 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005119 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005120 }
5121}
Jeff Johnson295189b2012-06-20 16:38:30 -07005122
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005123#ifdef FEATURE_WLAN_TDLS_INTERNAL
5124/*
5125 * Process Discovery request recieved from SME and transmit to AP.
5126 */
5127static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
5128 tANI_U32 *pMsgBuf)
5129{
5130 /* get all discovery request parameters */
5131 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
5132 tpPESession psessionEntry;
5133 tANI_U8 sessionId;
5134
5135 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005136 ("Discovery Req Recieved")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005137
5138 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
5139 == NULL)
5140 {
5141 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005142 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005143 disReq->sessionId);
5144 goto lim_tdls_dis_start_error;
5145 }
5146
5147 /* check if we are in proper state to work as TDLS client */
5148 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5149 {
5150 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005151 "dis req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005152 psessionEntry->limSystemRole);
5153 goto lim_tdls_dis_start_error;
5154 }
5155
5156 /*
5157 * if we are still good, go ahead and check if we are in proper state to
5158 * do TDLS discovery procedure.
5159 */
5160 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5161 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5162 {
5163
5164 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005165 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005166 goto lim_tdls_dis_start_error;
5167 }
5168
5169 /*
5170 * if we are still good, go ahead and transmit TDLS discovery request,
5171 * and save Dis Req info for future reference.
5172 */
5173
5174#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
5175 /*
5176 * send message to HAL to set RXP filters to receieve frame on
5177 * direct link..
5178 */
5179 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
5180 // psessionEntry->bssId) ;
5181#endif
5182
5183 /* save dis request message for matching dialog token */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305184 vos_mem_copy((tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
5185 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005186
5187 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005188 "Transmit Discovery Request Frame") ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005189 /* format TDLS discovery request frame and transmit it */
5190 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
5191 psessionEntry) ;
5192
5193 /* prepare for response */
5194 pMac->lim.gLimTdlsDisStaCount = 0 ;
5195 pMac->lim.gLimTdlsDisResultList = NULL ;
5196
5197 /*
5198 * start TDLS discovery request timer to wait for discovery responses
5199 * from all TDLS enabled clients in BSS.
5200 */
5201
5202 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005203 ("Start Discovery request Timeout Timer")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005204 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
5205 eLIM_TDLS_DISCOVERY_RSP_WAIT));
5206
5207 /* assign appropriate sessionId to the timer object */
5208 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
5209 psessionEntry->peSessionId;
5210
5211 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
5212 != TX_SUCCESS)
5213 {
5214 limLog(pMac, LOGP, FL("TDLS discovery response timer \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005215 activation failed!"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005216 goto lim_tdls_dis_start_error;
5217 }
5218 /*
5219 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
5220 * back to SME
5221 */
5222 return (eSIR_SUCCESS) ;
5223lim_tdls_dis_start_error:
5224 /* in error case, PE has to sent the response SME immediately with error code */
5225 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
5226 eWNI_SME_TDLS_DISCOVERY_START_RSP);
5227 return eSIR_FAILURE;
5228}
5229/*
5230 * Process link start request recieved from SME and transmit to AP.
5231 */
5232eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5233{
5234 /* get all discovery request parameters */
5235 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
5236 tLimTdlsLinkSetupInfo *linkSetupInfo;
5237 //tLimTdlsLinkSetupPeer *setupPeer;
5238 tpPESession psessionEntry;
5239 tANI_U8 sessionId;
5240 eHalStatus status;
5241
5242 if((psessionEntry = peFindSessionByBssid(pMac,
5243 setupReq->bssid, &sessionId)) == NULL)
5244 {
5245 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005246 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005247 setupReq->sessionId);
5248 goto lim_tdls_link_start_error;
5249 }
5250
5251 /* check if we are in proper state to work as TDLS client */
5252 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5253 {
5254 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005255 "TDLS link setup req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005256 psessionEntry->limSystemRole);
5257 goto lim_tdls_link_start_error;
5258 }
5259
5260 /*
5261 * if we are still good, go ahead and check if we are in proper state to
5262 * do TDLS setup procedure.
5263 */
5264 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5265 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5266 {
5267 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005268 state (%d)", pMac->lim.gLimSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005269 goto lim_tdls_link_start_error;
5270 }
5271
5272 /*
5273 * Now, go ahead and transmit TDLS discovery request, and save setup Req
5274 * info for future reference.
5275 */
5276 /* create node for Link setup */
5277 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
5278 //setupPeer = NULL ;
5279
5280 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
5281 setupReq->peerMac, psessionEntry) ;
5282 if(eHAL_STATUS_SUCCESS == status)
5283 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5284 TDLS setup cnf TX complete is successful. */
5285 return eSIR_SUCCESS;
5286#if 0
5287
5288 /*
5289 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005290 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005291 * free this memory if any timeout is happen in link setup procedure
5292 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305293 setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
5294 if ( NULL == setupPeer )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005295 {
5296 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005297 FL( "Unable to allocate memory during ADD_STA" ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005298 VOS_ASSERT(0) ;
5299 return eSIR_MEM_ALLOC_FAILED;
5300 }
5301 setupPeer->dialog = setupReq->dialog ;
5302 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
5303 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
5304 /* TDLS_sessionize: remember sessionId for future */
5305 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
5306 setupPeer->tdls_bIsResponder = 1;
5307
5308 /*
5309 * we only populate peer MAC, so it can assit us to find the
5310 * TDLS peer after response/or after response timeout
5311 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305312 vos_mem_copy(setupPeer->peerMac, setupReq->peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005313 sizeof(tSirMacAddr)) ;
5314 /* format TDLS discovery request frame and transmit it */
5315 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
5316 setupReq->dialog, psessionEntry, NULL, 0) ;
5317
5318 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
5319 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
5320 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
5321 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
5322 /* update setup peer list */
5323 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
5324 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
5325 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5326 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
5327 return eSIR_SUCCESS ;
5328#endif
5329lim_tdls_link_start_error:
5330 /* in case of error, return immediately to SME */
5331 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
5332 eWNI_SME_TDLS_LINK_START_RSP);
5333 return eSIR_FAILURE ;
5334}
5335
5336/*
5337 * Process link teardown request recieved from SME and transmit to AP.
5338 */
5339eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5340{
5341 /* get all discovery request parameters */
5342 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
5343 tLimTdlsLinkSetupPeer *setupPeer;
5344 tpPESession psessionEntry;
5345 tANI_U8 sessionId;
5346
5347 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
5348 {
5349 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005350 "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005351 goto lim_tdls_teardown_req_error;
5352 }
5353
5354 /* check if we are in proper state to work as TDLS client */
5355 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5356 {
5357 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005358 "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005359 goto lim_tdls_teardown_req_error;
5360 }
5361
5362 /*
5363 * if we are still good, go ahead and check if we are in proper state to
5364 * do TDLS setup procedure.
5365 */
5366 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5367 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5368 {
5369 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005370 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005371 goto lim_tdls_teardown_req_error;
5372 }
5373
5374 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Arif Hussain24bafea2013-11-15 15:10:03 -08005375 "Teardown for peer = " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(teardownReq->peerMac));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005376 /*
5377 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5378 * info for future reference.
5379 */
5380 /* Verify if this link is setup */
5381 setupPeer = NULL ;
5382 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5383 if(NULL == setupPeer)
5384 {
5385 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005386 ("invalid Peer on teardown ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005387 goto lim_tdls_teardown_req_error;
5388 }
5389
5390
5391 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5392 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5393 /* TDLS_sessionize: check sessionId in case */
5394 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5395 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005396 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005397 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5398 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5399 }
5400
5401 /* format TDLS teardown request frame and transmit it */
5402 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5403 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5404 {
5405 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005406 ("couldn't send teardown frame ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005407 goto lim_tdls_teardown_req_error;
5408 }
5409 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5410 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5411 return eSIR_SUCCESS;
5412lim_tdls_teardown_req_error:
5413 /* in case of error, return immediately to SME */
5414 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5415 eWNI_SME_TDLS_TEARDOWN_RSP);
5416 return eSIR_FAILURE;
5417}
5418
5419
5420#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005421
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305422static void
5423__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5424{
5425 tpSirResetAPCapsChange pResetCapsChange;
5426 tpPESession psessionEntry;
5427 tANI_U8 sessionId = 0;
5428 if (pMsgBuf == NULL)
5429 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005430 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305431 return;
5432 }
5433
5434 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5435 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5436 if (psessionEntry == NULL)
5437 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005438 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305439 return;
5440 }
5441
5442 psessionEntry->limSentCapsChangeNtf = false;
5443 return;
5444}
5445
Jeff Johnson295189b2012-06-20 16:38:30 -07005446/**
5447 * limProcessSmeReqMessages()
5448 *
5449 *FUNCTION:
5450 * This function is called by limProcessMessageQueue(). This
5451 * function processes SME request messages from HDD or upper layer
5452 * application.
5453 *
5454 *LOGIC:
5455 *
5456 *ASSUMPTIONS:
5457 *
5458 *NOTE:
5459 *
5460 * @param pMac Pointer to Global MAC structure
5461 * @param msgType Indicates the SME message type
5462 * @param *pMsgBuf A pointer to the SME message buffer
5463 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5464 * FALSE - if pMsgBuf is not to be freed.
5465 */
5466
5467tANI_BOOLEAN
5468limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5469{
5470 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5471 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005472 tpSirSmeScanReq pScanReq;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005473 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 -07005474 limMsgStr(pMsg->type), pMsg->type,
5475 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5476 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5477
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005478 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005479 /* Special handling of some SME Req msgs where we have an existing GO session and
5480 * want to insert NOA before processing those msgs. These msgs will be processed later when
5481 * start event happens
5482 */
5483 switch (pMsg->type)
5484 {
5485 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005486 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005487
5488 /* If scan is disabled return from here
5489 */
5490 if (pMac->lim.fScanDisabled)
5491 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005492 if (pMsg->type == eWNI_SME_SCAN_REQ)
5493 {
5494 limSendSmeScanRsp(pMac,
5495 offsetof(tSirSmeScanRsp,bssDescription[0]),
5496 eSIR_SME_INVALID_PARAMETERS,
5497 pScanReq->sessionId,
5498 pScanReq->transactionId);
5499
5500 bufConsumed = TRUE;
5501 }
5502 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5503 {
5504 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5505 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5506 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5507
5508 /*
5509 * limRemainOnChnRsp will free the buffer this change is to
5510 * avoid "double free"
5511 */
5512 bufConsumed = FALSE;
5513 }
5514
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305515 limLog(pMac, LOGE,
5516 FL("Error: Scan Disabled."
5517 " Return with error status for SME Message %s(%d)"),
5518 limMsgStr(pMsg->type), pMsg->type);
5519
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005520 return bufConsumed;
5521 }
5522 /*
5523 * Do not add BREAK here
5524 */
5525 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005526 case eWNI_SME_JOIN_REQ:
5527 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5528 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5529 {
5530 tANI_U32 noaDuration;
5531 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
5532 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf);
5533 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5534 return bufConsumed;
5535 }
5536 }
5537 /* If no insert NOA required then execute the code below */
5538
Jeff Johnson295189b2012-06-20 16:38:30 -07005539 switch (pMsg->type)
5540 {
5541 case eWNI_SME_START_REQ:
5542 __limProcessSmeStartReq(pMac, pMsgBuf);
5543 break;
5544
5545 case eWNI_SME_SYS_READY_IND:
5546 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5547 break;
5548
Jeff Johnson295189b2012-06-20 16:38:30 -07005549 case eWNI_SME_START_BSS_REQ:
5550 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5551 break;
5552
5553 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005554 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005555 break;
5556
Jeff Johnsone7245742012-09-05 17:12:55 -07005557#ifdef FEATURE_OEM_DATA_SUPPORT
5558 case eWNI_SME_OEM_DATA_REQ:
5559 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005560 break;
5561#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005562 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5563 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5564 break;
5565
5566 case eWNI_SME_UPDATE_NOA:
5567 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5568 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305569 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5570 __limProcessClearDfsChannelList(pMac, pMsg);
5571 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005572 case eWNI_SME_JOIN_REQ:
5573 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005574 break;
5575
5576 case eWNI_SME_AUTH_REQ:
5577 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5578
5579 break;
5580
5581 case eWNI_SME_REASSOC_REQ:
5582 __limProcessSmeReassocReq(pMac, pMsgBuf);
5583
5584 break;
5585
5586 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5587 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5588
5589 break;
5590
5591 case eWNI_SME_DISASSOC_REQ:
5592 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5593
5594 break;
5595
5596 case eWNI_SME_DISASSOC_CNF:
5597 case eWNI_SME_DEAUTH_CNF:
5598 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5599
5600 break;
5601
5602 case eWNI_SME_DEAUTH_REQ:
5603 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5604
5605 break;
5606
Jeff Johnson295189b2012-06-20 16:38:30 -07005607
5608
5609 case eWNI_SME_SETCONTEXT_REQ:
5610 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5611
5612 break;
5613
5614 case eWNI_SME_REMOVEKEY_REQ:
5615 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5616
5617 break;
5618
5619 case eWNI_SME_STOP_BSS_REQ:
5620 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5621 break;
5622
5623 case eWNI_SME_ASSOC_CNF:
5624 case eWNI_SME_REASSOC_CNF:
5625 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005626 PELOG1(limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005627 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005628 PELOG1(limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005629 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5630 break;
5631
5632 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005633 PELOG1(limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005634 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5635 break;
5636
5637 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005638 PELOG1(limLog(pMac, LOG1, FL("Received DELTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005639 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5640 break;
5641
5642 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005643 PELOG1(limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005644 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5645 break;
5646
5647 case eWNI_SME_STA_STAT_REQ:
5648 case eWNI_SME_AGGR_STAT_REQ:
5649 case eWNI_SME_GLOBAL_STAT_REQ:
5650 case eWNI_SME_STAT_SUMM_REQ:
5651 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5652 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5653 bufConsumed = FALSE;
5654 break;
5655 case eWNI_SME_GET_STATISTICS_REQ:
5656 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5657 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5658 bufConsumed = FALSE;
5659 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005660#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005661 case eWNI_SME_GET_ROAM_RSSI_REQ:
5662 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5663 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5664 bufConsumed = FALSE;
5665 break;
5666#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005667#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005668 case eWNI_SME_GET_TSM_STATS_REQ:
5669 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5670 bufConsumed = FALSE;
5671 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005672#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005673 case eWNI_SME_DEL_BA_PEER_IND:
5674 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5675 break;
5676 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5677 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5678 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005679 case eWNI_SME_GET_ASSOC_STAS_REQ:
5680 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5681 break;
5682 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5683 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5684 break;
5685
5686 case eWNI_SME_HIDE_SSID_REQ:
5687 __limProcessSmeHideSSID(pMac, pMsgBuf);
5688 break;
5689 case eWNI_SME_UPDATE_APWPSIE_REQ:
5690 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5691 break;
5692 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5693 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5694 break;
5695
5696 case eWNI_SME_SET_APWPARSNIEs_REQ:
5697 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5698 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005699
5700 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5701 //Update the beaconInterval
5702 __limProcessSmeChangeBI(pMac, pMsgBuf );
5703 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005704
5705#if defined WLAN_FEATURE_VOWIFI
5706 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5707 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5708 __limProcessReportMessage(pMac, pMsg);
5709 break;
5710#endif
5711
5712#if defined WLAN_FEATURE_VOWIFI_11R
5713 case eWNI_SME_FT_PRE_AUTH_REQ:
5714 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5715 break;
5716 case eWNI_SME_FT_UPDATE_KEY:
5717 limProcessFTUpdateKey(pMac, pMsgBuf);
5718 break;
5719
5720 case eWNI_SME_FT_AGGR_QOS_REQ:
5721 limProcessFTAggrQosReq(pMac, pMsgBuf);
5722 break;
5723#endif
5724
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005725#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
5726 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07005727 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5728 break;
5729#endif
5730 case eWNI_SME_ADD_STA_SELF_REQ:
5731 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5732 break;
5733 case eWNI_SME_DEL_STA_SELF_REQ:
5734 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5735 break;
5736
Jeff Johnson295189b2012-06-20 16:38:30 -07005737 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5738 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5739 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005740#ifdef FEATURE_WLAN_TDLS
5741 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5742 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5743 break;
5744 case eWNI_SME_TDLS_ADD_STA_REQ:
5745 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5746 break;
5747 case eWNI_SME_TDLS_DEL_STA_REQ:
5748 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5749 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305750 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5751 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5752 break;
Atul Mittalc0f739f2014-07-31 13:47:47 +05305753// tdlsoffchan
5754 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
5755 limProcesSmeTdlsChanSwitchReq(pMac, pMsgBuf);
5756 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005757#endif
5758#ifdef FEATURE_WLAN_TDLS_INTERNAL
5759 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
5760 limProcessSmeDisStartReq(pMac, pMsgBuf);
5761 break ;
5762 case eWNI_SME_TDLS_LINK_START_REQ:
5763 limProcessSmeLinkStartReq(pMac, pMsgBuf);
5764 break ;
5765 case eWNI_SME_TDLS_TEARDOWN_REQ:
5766 limProcessSmeTeardownReq(pMac, pMsgBuf);
5767 break ;
5768#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305769 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5770 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5771 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005772
schang86c22c42013-03-13 18:41:24 -07005773 case eWNI_SME_SET_TX_POWER_REQ:
5774 limSendSetTxPowerReq(pMac, pMsgBuf);
5775 break ;
5776
Jeff Johnson295189b2012-06-20 16:38:30 -07005777 default:
5778 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5779 pMsg->bodyptr = NULL;
5780 break;
5781 } // switch (msgType)
5782
5783 return bufConsumed;
5784} /*** end limProcessSmeReqMessages() ***/