blob: cc0e813433dd664db48a52757c09bedc1205a98b [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 );
Jeff Johnsone7245742012-09-05 17:12:55 -07001955 limExtractApCapability( pMac,
1956 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
1957 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
1958 &psessionEntry->limCurrentBssQosCaps,
1959 &psessionEntry->limCurrentBssPropCap,
1960 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07001961 , &localPowerConstraint,
1962 psessionEntry
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05301963 );
1964 /* If power constraint is zero then update it with Region max.
1965 MaxTxpower will be the MIN of regmax and power constraint */
1966 if( localPowerConstraint == 0 )
1967 {
1968 localPowerConstraint = regMax;
1969 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001970#ifdef FEATURE_WLAN_ESE
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001971 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07001972#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301973 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001974#endif
Sandeep Puligilla4ce02592014-04-22 09:05:57 +05301975 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1976 "Regulatory max = %d, local power constraint = %d,"
Abhishek Singh57aebef2014-02-03 18:47:44 +05301977 " max tx = %d", regMax, localPowerConstraint,
1978 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07001979
1980 if (pMac->lim.gLimCurrentBssUapsd)
1981 {
1982 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301983 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
1984 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07001985
1986 // resetting the dynamic uapsd mask
1987 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
1988 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
1989 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001990
1991 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
1992
1993 // Initialize 11h Enable Flag
1994 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
1995 {
1996 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001997 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001998 psessionEntry->lim11hEnable = val;
1999 }
2000 else
2001 psessionEntry->lim11hEnable = 0;
2002
2003 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
2004 pMac->lim.gLimIbssCoalescingHappened = false;
2005
Jeff Johnsone7245742012-09-05 17:12:55 -07002006 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2007 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
2008 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002009
Abhishek Singh57aebef2014-02-03 18:47:44 +05302010 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
2011 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
2012 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
2013 psessionEntry->currentOperChannel,
2014 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002015
2016 /* Indicate whether spectrum management is enabled*/
2017 psessionEntry->spectrumMgtEnabled =
2018 pSmeJoinReq->spectrumMgtIndicator;
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302019
2020 /* Enable the spectrum management if this is a DFS channel */
2021 if (psessionEntry->countryInfoPresent &&
2022 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2023 {
2024 psessionEntry->spectrumMgtEnabled = TRUE;
2025 }
2026
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05302027 PELOG1(limLog(pMac,LOG1,FL("SessionId:%d MLM_JOIN_REQ is posted to MLM"
2028 "SM"),pMlmJoinReq->sessionId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002029 /* Issue LIM_MLM_JOIN_REQ to MLM */
2030 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
2031 return;
2032
2033 }
2034 else
2035 {
2036 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05302037 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
2038 "in state %X"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002039 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
2040 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2041 psessionEntry = NULL;
2042 goto end;
2043
2044 }
2045
2046end:
2047 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
2048
2049 if(pSmeJoinReq)
2050 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302051 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002052 pSmeJoinReq = NULL;
2053 if (NULL != psessionEntry)
2054 {
2055 psessionEntry->pLimJoinReq = NULL;
2056 }
2057 }
2058
2059 if(retCode != eSIR_SME_SUCCESS)
2060 {
2061 if(NULL != psessionEntry)
2062 {
2063 peDeleteSession(pMac,psessionEntry);
2064 psessionEntry = NULL;
2065 }
2066 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05302067 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
2068 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002069 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
2070} /*** end __limProcessSmeJoinReq() ***/
2071
2072
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002073#ifdef FEATURE_WLAN_ESE
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08002074tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07002075{
2076 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302077 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002078 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2080 maxTxPower = txPower;
2081 else if (txPower < MIN_TX_PWR_CAP)
2082 maxTxPower = MIN_TX_PWR_CAP;
2083 else
2084 maxTxPower = MAX_TX_PWR_CAP;
2085
2086 return (maxTxPower);
2087}
2088#endif
2089
Jeff Johnson295189b2012-06-20 16:38:30 -07002090/**
2091 * __limProcessSmeReassocReq()
2092 *
2093 *FUNCTION:
2094 * This function is called to process SME_REASSOC_REQ message
2095 * from HDD or upper layer application.
2096 *
2097 *LOGIC:
2098 *
2099 *ASSUMPTIONS:
2100 *
2101 *NOTE:
2102 *
2103 * @param pMac Pointer to Global MAC structure
2104 * @param *pMsgBuf A pointer to the SME message buffer
2105 * @return None
2106 */
2107
2108static void
2109__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2110{
2111 tANI_U16 caps;
2112 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002113 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 tLimMlmReassocReq *pMlmReassocReq;
2115 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2116 tpPESession psessionEntry = NULL;
2117 tANI_U8 sessionId;
2118 tANI_U8 smeSessionId;
2119 tANI_U16 transactionId;
2120 tPowerdBm localPowerConstraint = 0, regMax = 0;
2121 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002122 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002123
2124
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002125 PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002126
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002127 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302128 pReassocReq = vos_mem_malloc(nSize);
2129 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002130 {
2131 // Log error
2132 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302133 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002134
2135 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2136 goto end;
2137 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302138 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002139 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2140 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2141 (!limIsSmeJoinReqValid(pMac,
2142 (tpSirSmeJoinReq) pReassocReq)))
2143 {
2144 /// Received invalid eWNI_SME_REASSOC_REQ
2145 // Log the event
2146 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002147 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002148
2149 retCode = eSIR_SME_INVALID_PARAMETERS;
2150 goto end;
2151 }
2152
2153 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2154 {
2155 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002156 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002157 retCode = eSIR_SME_INVALID_PARAMETERS;
2158 goto end;
2159 }
2160
2161#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2162 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2163#endif //FEATURE_WLAN_DIAG_SUPPORT
2164 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2165
2166 /* Store the reassoc handle in the session Table.. 23rd sep review */
2167 psessionEntry->pLimReAssocReq = pReassocReq;
Padma, Santhosh Kumar0d25d102014-07-17 15:08:48 +05302168 psessionEntry->dot11mode = pReassocReq->dot11mode;
2169 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(pReassocReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002170
2171 /**
2172 * Reassociate request is expected
2173 * in link established state only.
2174 */
2175
2176 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2177 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002178#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_ESE) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2180 {
2181 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002182 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002183 psessionEntry->peSessionId);
2184
2185 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302186 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002187 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2188 {
2189 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2190 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002191 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 retCode = eSIR_SME_INVALID_PARAMETERS;
2193 goto end;
2194 }
2195
2196 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2197 return;
2198 }
2199#endif
2200 /// Should not have received eWNI_SME_REASSOC_REQ
2201 // Log the event
2202 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002203 FL("received unexpected SME_REASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002204 psessionEntry->limSmeState);
2205 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2206
2207 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2208 goto end;
2209 }
2210
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302211 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2213 sizeof(tSirMacAddr));
2214
2215 psessionEntry->limReassocChannelId =
2216 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2217
Jeff Johnsone7245742012-09-05 17:12:55 -07002218 psessionEntry->reAssocHtSupportedChannelWidthSet =
2219 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2220 psessionEntry->reAssocHtRecommendedTxWidthSet =
2221 psessionEntry->reAssocHtSupportedChannelWidthSet;
2222 psessionEntry->reAssocHtSecondaryChannelOffset =
2223 psessionEntry->pLimReAssocReq->cbMode;
2224
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 psessionEntry->limReassocBssCaps =
2226 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002227 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2228 localPowerConstraint = regMax;
2229 limExtractApCapability( pMac,
2230 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2231 limGetIElenFromBssDescription(
2232 &psessionEntry->pLimReAssocReq->bssDescription),
2233 &psessionEntry->limReassocBssQosCaps,
2234 &psessionEntry->limReassocBssPropCap,
2235 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002236 , &localPowerConstraint,
2237 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002238 );
2239
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302240 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002241#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302242 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2243 "= %d, max tx = %d", regMax, localPowerConstraint,
2244 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002245#endif
2246 {
2247 #if 0
2248 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2249 &cfgLen) != eSIR_SUCCESS)
2250 {
2251 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002252 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002253 }
2254 #endif//TO SUPPORT BT-AMP
2255
2256 /* Copy the SSID from sessio entry to local variable */
2257 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302258 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 psessionEntry->ssId.ssId,
2260 psessionEntry->ssId.length);
2261 #endif
2262 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302263 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002264 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2265
2266 }
2267
2268 if (pMac->lim.gLimCurrentBssUapsd)
2269 {
2270 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302271 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2272 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002273 }
2274
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302275 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2276 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002277 {
2278 // Log error
2279 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302280 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002281
2282 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2283 goto end;
2284 }
2285
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302286 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002287 psessionEntry->limReAssocbssId,
2288 sizeof(tSirMacAddr));
2289
2290 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2291 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2292 != eSIR_SUCCESS)
2293 {
2294 /**
2295 * Could not get ReassocFailureTimeout value
2296 * from CFG. Log error.
2297 */
2298 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002299 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002300 }
2301
2302 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2303 {
2304 /**
2305 * Could not get Capabilities value
2306 * from CFG. Log error.
2307 */
2308 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002309 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 }
2311 pMlmReassocReq->capabilityInfo = caps;
2312
2313 /* Update PE sessionId*/
2314 pMlmReassocReq->sessionId = sessionId;
2315
2316 /* If telescopic beaconing is enabled, set listen interval to
2317 WNI_CFG_TELE_BCN_MAX_LI */
2318 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2319 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002320 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002321
2322 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2323
2324 if(teleBcnEn)
2325 {
2326 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2327 eSIR_SUCCESS)
2328 {
2329 /**
2330 * Could not get ListenInterval value
2331 * from CFG. Log error.
2332 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002333 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002334 }
2335 }
2336 else
2337 {
2338 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2339 {
2340 /**
2341 * Could not get ListenInterval value
2342 * from CFG. Log error.
2343 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002344 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 }
2346 }
2347
2348 /* Delete all BA sessions before Re-Assoc.
2349 * BA frames are class 3 frames and the session
2350 * is lost upon disassociation and reassociation.
2351 */
2352
Ganesh Kondabattini01f75c92014-07-07 19:27:41 +05302353 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS,
2354 eSIR_MAC_UNSPEC_FAILURE_REASON);
Jeff Johnson295189b2012-06-20 16:38:30 -07002355
2356 pMlmReassocReq->listenInterval = (tANI_U16) val;
2357
2358 /* Indicate whether spectrum management is enabled*/
2359 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2360
Rajesh Babu Prathipati043149f2014-06-06 13:33:45 +05302361 /* Enable the spectrum management if this is a DFS channel */
2362 if (psessionEntry->countryInfoPresent &&
2363 limIsconnectedOnDFSChannel(psessionEntry->currentOperChannel))
2364 {
2365 psessionEntry->spectrumMgtEnabled = TRUE;
2366 }
2367
Jeff Johnson295189b2012-06-20 16:38:30 -07002368 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2369 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2370
Jeff Johnsone7245742012-09-05 17:12:55 -07002371 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002372
2373 limPostMlmMessage(pMac,
2374 LIM_MLM_REASSOC_REQ,
2375 (tANI_U32 *) pMlmReassocReq);
2376 return;
2377
2378end:
2379 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302380 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002381
2382 if (psessionEntry)
2383 {
2384 // error occurred after we determined the session so extract
2385 // session and transaction info from there
2386 smeSessionId = psessionEntry->smeSessionId;
2387 transactionId = psessionEntry->transactionId;
2388 }
2389 else
2390 {
2391 // error occurred before or during the time we determined the session
2392 // so extract the session and transaction info from the message
2393 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2394 }
2395
2396 /// Send Reassoc failure response to host
2397 /// (note psessionEntry may be NULL, but that's OK)
2398 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2399 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2400 psessionEntry, smeSessionId, transactionId);
2401
2402} /*** end __limProcessSmeReassocReq() ***/
2403
2404
2405tANI_BOOLEAN sendDisassocFrame = 1;
2406/**
2407 * __limProcessSmeDisassocReq()
2408 *
2409 *FUNCTION:
2410 * This function is called to process SME_DISASSOC_REQ message
2411 * from HDD or upper layer application.
2412 *
2413 *LOGIC:
2414 *
2415 *ASSUMPTIONS:
2416 *
2417 *NOTE:
2418 *
2419 * @param pMac Pointer to Global MAC structure
2420 * @param *pMsgBuf A pointer to the SME message buffer
2421 * @return None
2422 */
2423
2424static void
2425__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2426{
2427 tANI_U16 disassocTrigger, reasonCode;
2428 tLimMlmDisassocReq *pMlmDisassocReq;
2429 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002430 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002431 tSirSmeDisassocReq smeDisassocReq;
2432 tpPESession psessionEntry = NULL;
2433 tANI_U8 sessionId;
2434 tANI_U8 smesessionId;
2435 tANI_U16 smetransactionId;
2436
Jeff Johnson295189b2012-06-20 16:38:30 -07002437
Jeff Johnson43971f52012-07-17 12:26:56 -07002438 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002439 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002440 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002441 return;
2442 }
2443
Jeff Johnson43971f52012-07-17 12:26:56 -07002444 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002445
Jeff Johnson43971f52012-07-17 12:26:56 -07002446 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002447
Jeff Johnson43971f52012-07-17 12:26:56 -07002448 if ( (eSIR_FAILURE == status) ||
2449 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002450 {
2451 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002452 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002453
2454 if (pMac->lim.gLimRspReqd)
2455 {
2456 pMac->lim.gLimRspReqd = false;
2457
2458 retCode = eSIR_SME_INVALID_PARAMETERS;
2459 disassocTrigger = eLIM_HOST_DISASSOC;
2460 goto sendDisassoc;
2461 }
2462
2463 return;
2464 }
2465
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2467 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302468 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2469 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002470 retCode = eSIR_SME_INVALID_PARAMETERS;
2471 disassocTrigger = eLIM_HOST_DISASSOC;
2472 goto sendDisassoc;
2473
2474 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302475 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2476 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2477 smesessionId,psessionEntry->limSystemRole,
2478 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2479 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002480
2481#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2482 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2483#endif //FEATURE_WLAN_DIAG_SUPPORT
2484
2485 /* Update SME session Id and SME transaction ID*/
2486
2487 psessionEntry->smeSessionId = smesessionId;
2488 psessionEntry->transactionId = smetransactionId;
2489
2490 switch (psessionEntry->limSystemRole)
2491 {
2492 case eLIM_STA_ROLE:
2493 case eLIM_BT_AMP_STA_ROLE:
2494 switch (psessionEntry->limSmeState)
2495 {
2496 case eLIM_SME_ASSOCIATED_STATE:
2497 case eLIM_SME_LINK_EST_STATE:
2498 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2499 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002500#ifdef FEATURE_WLAN_TDLS
2501 /* Delete all TDLS peers connected before leaving BSS*/
2502 limDeleteTDLSPeers(pMac, psessionEntry);
2503#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002504 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302505 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2506 "limSmeState: %d "),psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002507 break;
2508
2509 case eLIM_SME_WT_DEAUTH_STATE:
2510 /* PE shall still process the DISASSOC_REQ and proceed with
2511 * link tear down even if it had already sent a DEAUTH_IND to
2512 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2513 * its been set when PE entered WT_DEAUTH_STATE.
2514 */
2515 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002516 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302517 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2518 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002519 break;
2520
2521 case eLIM_SME_WT_DISASSOC_STATE:
2522 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2523 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2524 * PE can continue processing DISASSOC_REQ and send the response instead
2525 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2526 * for disassoc frame.
2527 *
2528 * It will send a disassoc, which is ok. However, we can use the global flag
2529 * sendDisassoc to not send disassoc frame.
2530 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302531 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2532 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002533 break;
2534
2535 case eLIM_SME_JOIN_FAILURE_STATE: {
2536 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302537 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2538 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002539 if (pMac->lim.gLimRspReqd) {
2540 retCode = eSIR_SME_SUCCESS;
2541 disassocTrigger = eLIM_HOST_DISASSOC;
2542 goto sendDisassoc;
2543 }
2544 }break;
2545 default:
2546 /**
2547 * STA is not currently associated.
2548 * Log error and send response to host
2549 */
2550 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002551 FL("received unexpected SME_DISASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002552 psessionEntry->limSmeState);
2553 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2554
2555 if (pMac->lim.gLimRspReqd)
2556 {
2557 if (psessionEntry->limSmeState !=
2558 eLIM_SME_WT_ASSOC_STATE)
2559 pMac->lim.gLimRspReqd = false;
2560
2561 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2562 disassocTrigger = eLIM_HOST_DISASSOC;
2563 goto sendDisassoc;
2564 }
2565
2566 return;
2567 }
2568
2569 break;
2570
2571 case eLIM_AP_ROLE:
2572 case eLIM_BT_AMP_AP_ROLE:
2573 // Fall through
2574 break;
2575
2576 case eLIM_STA_IN_IBSS_ROLE:
2577 default: // eLIM_UNKNOWN_ROLE
2578 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002579 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002580 psessionEntry->limSystemRole);
2581
2582 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2583 disassocTrigger = eLIM_HOST_DISASSOC;
2584 goto sendDisassoc;
2585 } // end switch (pMac->lim.gLimSystemRole)
2586
2587 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2588 {
2589 /// Disassociation is triggered by Link Monitoring
Abhishek Singhcd09b562013-12-24 16:02:20 +05302590 limLog(pMac, LOG1, FL("**** Lost link with AP ****"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2592 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2593 }
2594 else
2595 {
2596 disassocTrigger = eLIM_HOST_DISASSOC;
2597 reasonCode = smeDisassocReq.reasonCode;
2598 }
2599
2600 if (smeDisassocReq.doNotSendOverTheAir)
2601 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302602 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002603 sendDisassocFrame = 0;
2604 }
2605 // Trigger Disassociation frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302606
2607 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2608 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002609 {
2610 // Log error
2611 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302612 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002613
2614 return;
2615 }
2616
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302617 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002618 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2619 sizeof(tSirMacAddr));
2620
2621 pMlmDisassocReq->reasonCode = reasonCode;
2622 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2623
2624 /* Update PE session ID*/
2625 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002626
2627 limPostMlmMessage(pMac,
2628 LIM_MLM_DISASSOC_REQ,
2629 (tANI_U32 *) pMlmDisassocReq);
2630 return;
2631
2632sendDisassoc:
2633 if (psessionEntry)
2634 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2635 retCode,
2636 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002637 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002638 else
2639 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2640 retCode,
2641 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002642 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002643
2644
2645} /*** end __limProcessSmeDisassocReq() ***/
2646
2647
2648/** -----------------------------------------------------------------
2649 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2650
2651 This function is called to process SME_DISASSOC_CNF message
2652 from HDD or upper layer application.
2653
2654 \param pMac - global mac structure
2655 \param pStaDs - station dph hash node
2656 \return none
2657 \sa
2658 ----------------------------------------------------------------- */
2659static void
2660__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2661{
2662 tSirSmeDisassocCnf smeDisassocCnf;
2663 tANI_U16 aid;
2664 tpDphHashNode pStaDs;
2665 tSirRetStatus status = eSIR_SUCCESS;
2666 tpPESession psessionEntry;
2667 tANI_U8 sessionId;
2668
2669
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002670 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002671
2672 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2673
2674 if (status == eSIR_FAILURE)
2675 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002676 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002677 return;
2678 }
2679
2680 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2681 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002682 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002683 return;
2684 }
2685
2686 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2687 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302688 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002689 return;
2690 }
2691
2692#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2693 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2694 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2695 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2696 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2697#endif //FEATURE_WLAN_DIAG_SUPPORT
2698
2699 switch (psessionEntry->limSystemRole)
2700 {
2701 case eLIM_STA_ROLE:
2702 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2703 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2704 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2705 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2706 {
2707 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002708 FL("received unexp SME_DISASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 psessionEntry->limSmeState);
2710 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2711 return;
2712 }
2713 break;
2714
2715 case eLIM_AP_ROLE:
2716 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002717 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002718
2719 case eLIM_STA_IN_IBSS_ROLE:
2720 default: // eLIM_UNKNOWN_ROLE
2721 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002722 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002723 psessionEntry->limSystemRole);
2724
2725 return;
2726 }
2727
2728
2729 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2730 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002731 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002732 )
2733 {
2734 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2735 if (pStaDs == NULL)
2736 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302737 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2738 "does not have context, addr= "MAC_ADDRESS_STR),
2739 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002740 return;
2741 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002742 /* Delete FT session if there exists one */
2743 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002744 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002745
2746 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002747 }
2748
2749 return;
2750}
2751
2752
2753/**
2754 * __limProcessSmeDeauthReq()
2755 *
2756 *FUNCTION:
2757 * This function is called to process SME_DEAUTH_REQ message
2758 * from HDD or upper layer application.
2759 *
2760 *LOGIC:
2761 *
2762 *ASSUMPTIONS:
2763 *
2764 *NOTE:
2765 *
2766 * @param pMac Pointer to Global MAC structure
2767 * @param *pMsgBuf A pointer to the SME message buffer
2768 * @return None
2769 */
2770
2771static void
2772__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2773{
2774 tANI_U16 deauthTrigger, reasonCode;
2775 tLimMlmDeauthReq *pMlmDeauthReq;
2776 tSirSmeDeauthReq smeDeauthReq;
2777 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2778 tSirRetStatus status = eSIR_SUCCESS;
2779 tpPESession psessionEntry;
2780 tANI_U8 sessionId; //PE sessionId
2781 tANI_U8 smesessionId;
2782 tANI_U16 smetransactionId;
2783
Jeff Johnson295189b2012-06-20 16:38:30 -07002784
2785 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002786 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2787
2788 //We need to get a session first but we don't even know if the message is correct.
2789 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2790 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002791 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002792 retCode = eSIR_SME_INVALID_PARAMETERS;
2793 deauthTrigger = eLIM_HOST_DEAUTH;
2794 goto sendDeauth;
2795
2796 }
2797
2798 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2799 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002800 PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002801 if (pMac->lim.gLimRspReqd)
2802 {
2803 pMac->lim.gLimRspReqd = false;
2804
2805 retCode = eSIR_SME_INVALID_PARAMETERS;
2806 deauthTrigger = eLIM_HOST_DEAUTH;
2807 goto sendDeauth;
2808 }
2809
2810 return;
2811 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302812 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2813 "Systemrole %d with reasoncode %u in limSmestate %d from "
2814 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2815 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2816 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002817#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2818 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2819#endif //FEATURE_WLAN_DIAG_SUPPORT
2820
2821 /* Update SME session ID and Transaction ID */
2822 psessionEntry->smeSessionId = smesessionId;
2823 psessionEntry->transactionId = smetransactionId;
2824
2825
2826 switch (psessionEntry->limSystemRole)
2827 {
2828 case eLIM_STA_ROLE:
2829 case eLIM_BT_AMP_STA_ROLE:
2830
2831 switch (psessionEntry->limSmeState)
2832 {
2833 case eLIM_SME_ASSOCIATED_STATE:
2834 case eLIM_SME_LINK_EST_STATE:
2835 case eLIM_SME_WT_ASSOC_STATE:
2836 case eLIM_SME_JOIN_FAILURE_STATE:
2837 case eLIM_SME_IDLE_STATE:
2838 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2839 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002840 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002841
2842 // Send Deauthentication request to MLM below
2843
2844 break;
Sachin Ahujaa100dcc2014-07-03 14:30:18 +05302845 case eLIM_SME_WT_DEAUTH_STATE:
2846 /*
2847 * PE Recieved a Deauth frame. Normally it gets
2848 * DEAUTH_CNF but it received DEAUTH_REQ. Which
2849 * means host is also trying to disconnect.
2850 * PE can continue processing DEAUTH_REQ and send
2851 * the response instead of failing the request.
2852 * SME will anyway ignore DEAUTH_IND that was sent
2853 * for deauth frame.
2854 */
2855 limLog(pMac, LOG1, FL("Rcvd SME_DEAUTH_REQ while in "
2856 "SME_WT_DEAUTH_STATE. "));
2857 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002858 default:
2859 /**
2860 * STA is not in a state to deauthenticate with
2861 * peer. Log error and send response to host.
2862 */
2863 limLog(pMac, LOGE,
Abhishek Singhcd09b562013-12-24 16:02:20 +05302864 FL("received unexp SME_DEAUTH_REQ in state %X"),
2865 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002866 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2867
2868 if (pMac->lim.gLimRspReqd)
2869 {
2870 pMac->lim.gLimRspReqd = false;
2871
2872 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2873 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08002874 /**
2875 *here we received deauth request from AP so sme state is
2876 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
2877 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
2878 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
2879 so the below condition captures the state where delSta
2880 not done and firmware still in connected state.
2881 */
2882 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
2883 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
2884 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
2885 {
2886 retCode = eSIR_SME_DEAUTH_STATUS;
2887 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002888 goto sendDeauth;
2889 }
2890
2891 return;
2892 }
2893
2894 break;
2895
2896 case eLIM_STA_IN_IBSS_ROLE:
2897
2898 return;
2899
2900 case eLIM_AP_ROLE:
2901 // Fall through
2902
2903 break;
2904
2905 default:
2906 limLog(pMac, LOGE,
Abhishek Singhcd09b562013-12-24 16:02:20 +05302907 FL("received unexpected SME_DEAUTH_REQ for role %X"),
2908 psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07002909
2910 return;
2911 } // end switch (pMac->lim.gLimSystemRole)
2912
2913 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
2914 {
2915 /// Deauthentication is triggered by Link Monitoring
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002916 PELOG1(limLog(pMac, LOG1, FL("**** Lost link with AP ****"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002917 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
2918 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
2919 }
2920 else
2921 {
2922 deauthTrigger = eLIM_HOST_DEAUTH;
2923 reasonCode = smeDeauthReq.reasonCode;
2924 }
2925
2926 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302927 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
2928 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002929 {
2930 // Log error
2931 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302932 FL("call to AllocateMemory failed for mlmDeauthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002933
2934 return;
2935 }
2936
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302937 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
2939 sizeof(tSirMacAddr));
2940
2941 pMlmDeauthReq->reasonCode = reasonCode;
2942 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07002943
2944 /* Update PE session Id*/
2945 pMlmDeauthReq->sessionId = sessionId;
2946
2947 limPostMlmMessage(pMac,
2948 LIM_MLM_DEAUTH_REQ,
2949 (tANI_U32 *) pMlmDeauthReq);
2950 return;
2951
2952sendDeauth:
2953 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
2954 retCode,
2955 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002956 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002957 smesessionId, smetransactionId);
2958} /*** end __limProcessSmeDeauthReq() ***/
2959
2960
2961
2962/**
2963 * __limProcessSmeSetContextReq()
2964 *
2965 *FUNCTION:
2966 * This function is called to process SME_SETCONTEXT_REQ message
2967 * from HDD or upper layer application.
2968 *
2969 *LOGIC:
2970 *
2971 *ASSUMPTIONS:
2972 *
2973 *NOTE:
2974 *
2975 * @param pMac Pointer to Global MAC structure
2976 * @param *pMsgBuf A pointer to the SME message buffer
2977 * @return None
2978 */
2979
2980static void
2981__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2982{
2983 tpSirSmeSetContextReq pSetContextReq;
2984 tLimMlmSetKeysReq *pMlmSetKeysReq;
2985 tpPESession psessionEntry;
2986 tANI_U8 sessionId; //PE sessionID
2987 tANI_U8 smesessionId;
2988 tANI_U16 smetransactionId;
2989
2990
2991 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002992 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07002993
2994
2995 if(pMsgBuf == NULL)
2996 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002997 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002998 return;
2999 }
3000
3001 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303002
3003 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
3004 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003005 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303006 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003007 return;
3008 }
3009
3010 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3011 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
3012 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003013 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003014 goto end;
3015 }
3016
3017 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3018 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003019 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 -07003020 limSendSmeSetContextRsp(pMac,
3021 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003022 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003023 eSIR_SME_INVALID_PARAMETERS,NULL,
3024 smesessionId,smetransactionId);
3025
3026 goto end;
3027 }
3028
3029
3030 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
3031 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003032 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003033 limSendSmeSetContextRsp(pMac,
3034 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003035 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003036 eSIR_SME_INVALID_PARAMETERS,NULL,
3037 smesessionId,smetransactionId);
3038
3039 goto end;
3040 }
3041
3042#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3043 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
3044#endif //FEATURE_WLAN_DIAG_SUPPORT
3045
3046
3047 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
3048 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3049 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3050 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3051 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3052 {
3053 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303054 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
3055 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003056 {
3057 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303058 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003059 goto end;
3060 }
3061
3062 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
3063 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
3064 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
3065 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003066 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003067 goto end;
3068 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303069 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003070 (tANI_U8 *) &pSetContextReq->peerMacAddr,
3071 sizeof(tSirMacAddr));
3072
Jeff Johnson295189b2012-06-20 16:38:30 -07003073
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303074 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07003075 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
3076 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
3077
3078 pMlmSetKeysReq->sessionId = sessionId;
3079#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
3080 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003081 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07003082#endif
3083
Jeff Johnson295189b2012-06-20 16:38:30 -07003084 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
3085 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
3086 {
3087 if(pSetContextReq->keyMaterial.key[0].keyLength)
3088 {
3089 tANI_U8 keyId;
3090 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303091 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07003092 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
3093 }
3094 else {
3095 tANI_U32 i;
3096 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3097 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303098 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003099 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3100 }
3101 }
3102 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003103
3104 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003105 }
3106 else
3107 {
3108 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003109 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003110 psessionEntry->limSystemRole,
3111 psessionEntry->limSmeState);
3112 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3113
3114 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003115 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003116 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3117 smesessionId,
3118 smetransactionId);
3119 }
3120
3121end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303122 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003123 return;
3124} /*** end __limProcessSmeSetContextReq() ***/
3125
3126/**
3127 * __limProcessSmeRemoveKeyReq()
3128 *
3129 *FUNCTION:
3130 * This function is called to process SME_REMOVEKEY_REQ message
3131 * from HDD or upper layer application.
3132 *
3133 *LOGIC:
3134 *
3135 *ASSUMPTIONS:
3136 *
3137 *NOTE:
3138 *
3139 * @param pMac Pointer to Global MAC structure
3140 * @param *pMsgBuf A pointer to the SME message buffer
3141 * @return None
3142 */
3143
3144static void
3145__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3146{
3147 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3148 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3149 tpPESession psessionEntry;
3150 tANI_U8 sessionId; //PE sessionID
3151 tANI_U8 smesessionId;
3152 tANI_U16 smetransactionId;
3153
3154 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003155 FL("received REMOVEKEY_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003156
3157 if(pMsgBuf == NULL)
3158 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003159 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003160 return;
3161 }
3162
3163
3164 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3165
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303166 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3167 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003168 {
3169 //Log error
3170 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303171 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003172
3173 return;
3174 }
3175
3176 if ((limRemoveKeyReqSerDes(pMac,
3177 pRemoveKeyReq,
3178 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3179 {
3180 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003181 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003182
3183 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3184
3185 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3186 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003187 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003188 //goto end;
3189 }
3190
3191 limSendSmeRemoveKeyRsp(pMac,
3192 pRemoveKeyReq->peerMacAddr,
3193 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3194 smesessionId,smetransactionId);
3195
3196 goto end;
3197 }
3198
3199 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3200 {
3201 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003202 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003203 limSendSmeRemoveKeyRsp(pMac,
3204 pRemoveKeyReq->peerMacAddr,
3205 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3206 smesessionId, smetransactionId);
3207 goto end;
3208 }
3209
3210
3211 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3212 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3213 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3214 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3215 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3216 {
3217 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303218 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3219 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003220 {
3221 // Log error
3222 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303223 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003224
3225 goto end;
3226 }
3227
3228 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3229 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3230 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3231 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3232
3233 /* Update PE session Id */
3234 pMlmRemoveKeyReq->sessionId = sessionId;
3235
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303236 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003237 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3238 sizeof(tSirMacAddr));
3239
3240
3241 limPostMlmMessage(pMac,
3242 LIM_MLM_REMOVEKEY_REQ,
3243 (tANI_U32 *) pMlmRemoveKeyReq);
3244 }
3245 else
3246 {
3247 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003248 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003249 psessionEntry->limSystemRole,
3250 psessionEntry->limSmeState);
3251 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3252
3253 limSendSmeRemoveKeyRsp(pMac,
3254 pRemoveKeyReq->peerMacAddr,
3255 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3256 smesessionId,smetransactionId);
3257 }
3258
3259end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303260 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003261} /*** end __limProcessSmeRemoveKeyReq() ***/
3262
Jeff Johnson295189b2012-06-20 16:38:30 -07003263void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3264{
3265 tSirMsgQ mmhMsg;
3266 tpSmeGetScanChnRsp pSirSmeRsp;
3267 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303268 tANI_U8 sessionId;
3269 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003270
3271 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3272 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003273 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003274 pMac->lim.scanChnInfo.numChnInfo);
3275 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3276 }
3277
3278 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003279 FL("Sending message %s with number of channels %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003280 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);)
3281
3282 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303283 pSirSmeRsp = vos_mem_malloc(len);
3284 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003285 {
3286 /// Buffer not available. Log error
3287 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303288 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003289
3290 return;
3291 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303292 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003293
Jeff Johnson295189b2012-06-20 16:38:30 -07003294 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3295 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303296
3297 if (pMac->fScanOffload)
3298 {
3299 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3300 pSirSmeRsp->sessionId = sessionId;
3301 }
3302 else
3303 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003304
3305 if(pMac->lim.scanChnInfo.numChnInfo)
3306 {
3307 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303308 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3309 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 }
3311 //Clear the list
3312 limRessetScanChannelInfo(pMac);
3313
3314 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3315 mmhMsg.bodyptr = pSirSmeRsp;
3316 mmhMsg.bodyval = 0;
3317
3318 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003319 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003320 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3321}
3322
3323
Jeff Johnson295189b2012-06-20 16:38:30 -07003324void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3325{
3326 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3327 tpDphHashNode pStaDs = NULL;
3328 tpPESession psessionEntry = NULL;
3329 tSap_Event sapEvent;
3330 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3331 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3332 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3333 tANI_U8 assocId = 0;
3334 tANI_U8 staCount = 0;
3335
3336 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3337 {
3338 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003339 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003340 goto limAssocStaEnd;
3341 }
3342
3343 switch (getAssocSTAsReq.modId)
3344 {
3345/**
3346 case VOS_MODULE_ID_HAL:
3347 wdaPostCtrlMsg( pMac, &msgQ );
3348 return;
3349
3350 case VOS_MODULE_ID_TL:
3351 Post msg TL
3352 return;
3353*/
3354 case VOS_MODULE_ID_PE:
3355 default:
3356 break;
3357 }
3358
Jeff Johnson1250df42012-12-10 14:31:52 -08003359 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003360 // Find PE session Entry
3361 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3362 {
3363 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003364 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003365 goto limAssocStaEnd;
3366 }
3367
3368 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3369 {
3370 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003371 FL("Received unexpected message in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303372 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003373 goto limAssocStaEnd;
3374 }
3375
3376 // Retrieve values obtained in the request message
3377 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3378 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3379
3380 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3381 {
3382 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3383
3384 if (NULL == pStaDs)
3385 continue;
3386
3387 if (pStaDs->valid)
3388 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303389 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3390 (tANI_U8 *)&pStaDs->staAddr,
3391 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003392 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3393 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3394
Kiet Lamb1233192013-11-28 13:38:20 +05303395 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003396 (tANI_U8 *)&pStaDs->supportedRates,
3397 sizeof(tSirSupportedRates));
3398 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3399 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3400 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3401
Jeff Johnson295189b2012-06-20 16:38:30 -07003402 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003403 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3404 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003405 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3406 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3407
3408 pAssocStasTemp++;
3409 staCount++;
3410 }
3411 }
3412
3413limAssocStaEnd:
3414 // Call hdd callback with sap event to send the list of associated stations from PE
3415 if (pSapEventCallback != NULL)
3416 {
3417 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3418 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3419 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3420 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3421 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3422 }
3423}
3424
3425
3426/**
3427 * limProcessSmeGetWPSPBCSessions
3428 *
3429 *FUNCTION:
3430 * This function is called when query the WPS PBC overlap message is received
3431 *
3432 *LOGIC:
3433 * This function parses get WPS PBC overlap information message and call callback to pass
3434 * WPS PBC overlap information back to hdd.
3435 *ASSUMPTIONS:
3436 *
3437 *
3438 *NOTE:
3439 *
3440 * @param pMac Pointer to Global MAC structure
3441 * @param pMsgBuf A pointer to WPS PBC overlap query message
3442*
3443 * @return None
3444 */
3445void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3446{
3447 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3448 tpPESession psessionEntry = NULL;
3449 tSap_Event sapEvent;
3450 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3451 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3452 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3453
3454 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3455
3456 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3457 {
3458 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003459 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003460 goto limGetWPSPBCSessionsEnd;
3461 }
3462
Jeff Johnson1250df42012-12-10 14:31:52 -08003463 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003464 // Find PE session Entry
3465 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3466 {
3467 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003468 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003469 goto limGetWPSPBCSessionsEnd;
3470 }
3471
3472 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3473 {
3474 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003475 FL("Received unexpected message in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003476 psessionEntry->limSystemRole);
3477 goto limGetWPSPBCSessionsEnd;
3478 }
3479
Jeff Johnson1250df42012-12-10 14:31:52 -08003480 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003481 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3482 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3483
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303484 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003485 { //This is GetWpsSession call
3486
3487 limGetWPSPBCSessions(pMac,
3488 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3489 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3490 }
3491 else
3492 {
3493 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3494 /* don't have to inform the HDD/Host */
3495 return;
3496 }
3497
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003498 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003499 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3500
3501 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3502
3503limGetWPSPBCSessionsEnd:
3504 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
3505 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
3506}
3507
Jeff Johnson295189b2012-06-20 16:38:30 -07003508
3509
3510/**
3511 * __limCounterMeasures()
3512 *
3513 * FUNCTION:
3514 * This function is called to "implement" MIC counter measure
3515 * and is *temporary* only
3516 *
3517 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3518 * we don't do the proper STA disassoc sequence since the
3519 * BSS will be stoped anyway
3520 *
3521 *ASSUMPTIONS:
3522 *
3523 *NOTE:
3524 *
3525 * @param pMac Pointer to Global MAC structure
3526 * @return None
3527 */
3528
3529static void
3530__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3531{
3532 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3533 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
3534 || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
3535
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003536 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003537
Jeff Johnson295189b2012-06-20 16:38:30 -07003538};
3539
3540
Jeff Johnson295189b2012-06-20 16:38:30 -07003541void
3542limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3543{
3544 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3545 tpPESession psessionEntry;
3546 tANI_U8 sessionId; //PE sessionId
3547
3548 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3549 {
3550 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003551 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003552 return;
3553 }
3554
3555 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3556 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003557 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003558 return;
3559 }
3560
3561 if ( tkipCntrMeasReq.bEnable )
3562 {
3563 __limCounterMeasures( pMac, psessionEntry );
3564 }
3565
3566 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3567}
Jeff Johnson295189b2012-06-20 16:38:30 -07003568
3569
3570static void
3571__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3572{
3573 tSirSmeStopBssReq stopBssReq;
3574 tSirRetStatus status;
3575 tLimSmeStates prevState;
3576 tANI_U8 sessionId; //PE sessionId
3577 tpPESession psessionEntry;
3578 tANI_U8 smesessionId;
3579 tANI_U16 smetransactionId;
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303580 tANI_U8 i = 0;
3581 tpDphHashNode pStaDs = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07003582
3583 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3584
3585
3586
3587 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3588 !limIsSmeStopBssReqValid(pMsgBuf))
3589 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003590 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003591 /// Send Stop BSS response to host
3592 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3593 return;
3594 }
3595
3596
3597 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3598 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003599 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003600 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3601 return;
3602 }
3603
3604#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3605 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3606#endif //FEATURE_WLAN_DIAG_SUPPORT
3607
3608
3609 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3610 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3611 {
3612 /**
3613 * Should not have received STOP_BSS_REQ in states
3614 * other than 'normal' state or on STA in Infrastructure
3615 * mode. Log error and return response to host.
3616 */
3617 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003618 FL("received unexpected SME_STOP_BSS_REQ in state %X, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003619 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3620 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3621 /// Send Stop BSS response to host
3622 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3623 return;
3624 }
3625
Jeff Johnson295189b2012-06-20 16:38:30 -07003626 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3627 {
3628 limWPSPBCClose(pMac, psessionEntry);
3629 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003630 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003631
3632 prevState = psessionEntry->limSmeState;
3633
3634 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003635 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003636
3637 /* Update SME session Id and Transaction Id */
3638 psessionEntry->smeSessionId = smesessionId;
3639 psessionEntry->transactionId = smetransactionId;
3640
3641 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame */
3642 if ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) && (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3643 {
3644 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3645 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3646 // Send disassoc all stations associated thru TKIP
3647 __limCounterMeasures(pMac,psessionEntry);
3648 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303649 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003650 }
3651
3652 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3653 pMac->lim.gLimIbssCoalescingHappened = false;
3654
Sachin Ahuja51c08e62014-03-26 19:21:29 +05303655 for(i = 1 ; i < pMac->lim.gLimAssocStaLimit ; i++)
3656 {
3657 pStaDs = dphGetHashEntry(pMac, i, &psessionEntry->dph.dphHashTable);
3658 if (NULL == pStaDs)
3659 continue;
3660 status = limDelSta(pMac, pStaDs, false, psessionEntry) ;
3661 if(eSIR_SUCCESS == status)
3662 {
3663 limDeleteDphHashEntry(pMac, pStaDs->staAddr, pStaDs->assocId, psessionEntry) ;
3664 limReleasePeerIdx(pMac, pStaDs->assocId, psessionEntry) ;
3665 }
3666 else
3667 {
3668 limLog(pMac, LOGE, FL("limDelSta failed with Status : %d"), status);
3669 VOS_ASSERT(0) ;
3670 }
3671 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003672 /* send a delBss to HAL and wait for a response */
3673 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3674
3675 if (status != eSIR_SUCCESS)
3676 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003677 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003678 psessionEntry->limSmeState= prevState;
3679
Jeff Johnsone7245742012-09-05 17:12:55 -07003680 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003681
3682 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3683 }
3684}
3685
3686
3687/**--------------------------------------------------------------
3688\fn __limProcessSmeStopBssReq
3689
3690\brief Wrapper for the function __limHandleSmeStopBssRequest
3691 This message will be defered until softmac come out of
3692 scan mode. Message should be handled even if we have
3693 detected radar in the current operating channel.
3694\param pMac
3695\param pMsg
3696
3697\return TRUE - If we consumed the buffer
3698 FALSE - If have defered the message.
3699 ---------------------------------------------------------------*/
3700static tANI_BOOLEAN
3701__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3702{
3703 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3704 {
3705 /**
3706 * If message defered, buffer is not consumed yet.
3707 * So return false
3708 */
3709 return eANI_BOOLEAN_FALSE;
3710 }
3711 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3712 return eANI_BOOLEAN_TRUE;
3713} /*** end __limProcessSmeStopBssReq() ***/
3714
3715
3716void limProcessSmeDelBssRsp(
3717 tpAniSirGlobal pMac,
3718 tANI_U32 body,tpPESession psessionEntry)
3719{
3720
3721 (void) body;
3722 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3723 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003724 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003725 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3726 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003727 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3728 return;
3729}
3730
3731
Jeff Johnson295189b2012-06-20 16:38:30 -07003732/**---------------------------------------------------------------
3733\fn __limProcessSmeAssocCnfNew
3734\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3735\ in BTAMP AP.
3736\
3737\param pMac
3738\param msgType - message type
3739\param pMsgBuf - a pointer to the SME message buffer
3740\return None
3741------------------------------------------------------------------*/
3742
3743 void
3744__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3745{
3746 tSirSmeAssocCnf assocCnf;
3747 tpDphHashNode pStaDs = NULL;
3748 tpPESession psessionEntry= NULL;
3749 tANI_U8 sessionId;
3750
3751
3752 if(pMsgBuf == NULL)
3753 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003754 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003755 goto end;
3756 }
3757
3758 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3759 !__limIsSmeAssocCnfValid(&assocCnf))
3760 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003761 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003762 goto end;
3763 }
3764
3765 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3766 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003767 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003768 goto end;
3769 }
3770
3771 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3772 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3773 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003774 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303775 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003776 goto end;
3777 }
3778
3779 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3780
3781 if (pStaDs == NULL)
3782 {
3783 limLog(pMac, LOG1,
3784 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
3785 msgType, assocCnf.aid);
3786 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3787
3788 /*
3789 ** send a DISASSOC_IND message to WSM to make sure
3790 ** the state in WSM and LIM is the same
3791 **/
3792 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3793 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3794 goto end;
3795 }
3796 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303797 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003798 (tANI_U8 *) assocCnf.peerMacAddr,
3799 sizeof(tSirMacAddr)) ) ||
3800 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3801 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3802 (msgType != eWNI_SME_ASSOC_CNF)) ||
3803 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003804 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003805 {
3806 limLog(pMac, LOG1,
3807 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
3808 msgType, assocCnf.aid);
3809 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3810 goto end;
3811 }
3812
3813 /*
3814 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3815 ** has been received
3816 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003817 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003818 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3819
3820 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3821 {
3822 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3823 * when it had received Assoc Request frame. Now, PE just needs to send
3824 * Association Response frame to the requesting BTAMP-STA.
3825 */
3826 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003827 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003828 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3829 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3830 goto end;
3831 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3832 else
3833 {
3834 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3835 /*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*/
3836 if(!pStaDs->mlmStaContext.updateContext)
3837 pStaDs->mlmStaContext.updateContext = 1;
3838 limRejectAssociation(pMac, pStaDs->staAddr,
3839 pStaDs->mlmStaContext.subType,
3840 true, pStaDs->mlmStaContext.authType,
3841 pStaDs->assocId, true,
3842 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003843 }
3844
3845end:
3846 if((psessionEntry != NULL) && (pStaDs != NULL))
3847 {
3848 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3849 {
3850 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3851 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303852 vos_mem_free(((tpSirAssocReq)
3853 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07003854 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
3855 }
3856
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303857 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003858 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
3859 }
3860 }
3861
3862} /*** end __limProcessSmeAssocCnfNew() ***/
3863
3864
Jeff Johnson295189b2012-06-20 16:38:30 -07003865
3866
3867static void
3868__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3869{
3870 tpDphHashNode pStaDs;
3871 tSirMacAddr peerMac;
3872 tpSirAddtsReq pSirAddts;
3873 tANI_U32 timeout;
3874 tpPESession psessionEntry;
3875 tANI_U8 sessionId; //PE sessionId
3876 tANI_U8 smesessionId;
3877 tANI_U16 smetransactionId;
3878
3879
3880 if(pMsgBuf == NULL)
3881 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003882 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003883 return;
3884 }
3885
3886 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3887
3888 pSirAddts = (tpSirAddtsReq) pMsgBuf;
3889
3890 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
3891 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003892 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003893 return;
3894 }
3895#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3896 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
3897#endif //FEATURE_WLAN_DIAG_SUPPORT
3898
3899
3900
3901 /* if sta
3902 * - verify assoc state
3903 * - send addts request to ap
3904 * - wait for addts response from ap
3905 * if ap, just ignore with error log
3906 */
3907 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003908 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003909 pSirAddts->req.tspec.tsinfo.traffic.tsid,
3910 pSirAddts->req.tspec.tsinfo.traffic.userPrio);)
3911
3912 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
3913 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003914 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003915 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3916 smesessionId,smetransactionId);
3917 return;
3918 }
3919
3920 //Ignore the request if STA is in 11B mode.
3921 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
3922 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003923 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003924 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3925 smesessionId,smetransactionId);
3926 return;
3927 }
3928
3929
3930 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3931
3932 if(pStaDs == NULL)
3933 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003934 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003935 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3936 smesessionId,smetransactionId);
3937 return;
3938 }
3939
3940 if ((! pStaDs->valid) ||
3941 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
3942 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003943 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003944 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3945 smesessionId,smetransactionId);
3946 return;
3947 }
3948
3949 pSirAddts->req.wsmTspecPresent = 0;
3950 pSirAddts->req.wmeTspecPresent = 0;
3951 pSirAddts->req.lleTspecPresent = 0;
3952
3953 if ((pStaDs->wsmEnabled) &&
3954 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
3955 pSirAddts->req.wsmTspecPresent = 1;
3956 else if (pStaDs->wmeEnabled)
3957 pSirAddts->req.wmeTspecPresent = 1;
3958 else if (pStaDs->lleEnabled)
3959 pSirAddts->req.lleTspecPresent = 1;
3960 else
3961 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003962 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003963 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3964 smesessionId,smetransactionId);
3965 return;
3966 }
3967
3968 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
3969 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
3970 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003971 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07003972 psessionEntry->limSmeState);
3973 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3974 smesessionId,smetransactionId);
3975 return;
3976 }
3977
3978 if (pMac->lim.gLimAddtsSent)
3979 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003980 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07003981 pMac->lim.gLimAddtsReq.req.dialogToken,
3982 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
3983 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
3984 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3985 smesessionId,smetransactionId);
3986 return;
3987 }
3988
3989 #if 0
3990 val = sizeof(tSirMacAddr);
3991 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
3992 {
3993 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003994 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003995 return;
3996 }
3997 #endif
3998 sirCopyMacAddr(peerMac,psessionEntry->bssId);
3999
4000 // save the addts request
4001 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304002 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07004003
4004 // ship out the message now
4005 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
4006 psessionEntry);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004007 PELOG1(limLog(pMac, LOG1, "Sent ADDTS request");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004008
4009 // start a timer to wait for the response
4010 if (pSirAddts->timeout)
4011 timeout = pSirAddts->timeout;
4012 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
4013 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004014 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004015 WNI_CFG_ADDTS_RSP_TIMEOUT);
4016 return;
4017 }
4018
4019 timeout = SYS_MS_TO_TICKS(timeout);
4020 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
4021 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004022 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004023 return;
4024 }
4025 pMac->lim.gLimAddtsRspTimerCount++;
4026 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
4027 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
4028 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004029 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004030 return;
4031 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004032 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07004033
4034 //add the sessionId to the timer object
4035 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
4036 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
4037 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004038 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004039 return;
4040 }
4041 return;
4042}
4043
4044
4045static void
4046__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4047{
4048 tSirMacAddr peerMacAddr;
4049 tANI_U8 ac;
4050 tSirMacTSInfo *pTsinfo;
4051 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
4052 tpDphHashNode pStaDs = NULL;
4053 tpPESession psessionEntry;
4054 tANI_U8 sessionId;
4055 tANI_U32 status = eSIR_SUCCESS;
4056 tANI_U8 smesessionId;
4057 tANI_U16 smetransactionId;
4058
4059 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4060
4061 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
4062 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004063 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004064 status = eSIR_FAILURE;
4065 goto end;
4066 }
4067#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4068 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
4069#endif //FEATURE_WLAN_DIAG_SUPPORT
4070
4071
4072 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
4073 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004074 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004075 status = eSIR_FAILURE;
4076 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
4077 return;
4078 }
4079
Arif Hussaina7c8e412013-11-20 11:06:42 -08004080 PELOG1(limLog(pMac, LOG1, FL("Sent DELTS request to station with "
4081 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
4082 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004083
4084 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
4085 psessionEntry);
4086
4087 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
4088
4089 /* We've successfully send DELTS frame to AP. Update the
4090 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
4091 * is no longer trigger enabled or delivery enabled
4092 */
4093 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
4094
4095 /* We're deleting the TSPEC, so this particular AC is no longer
4096 * admitted. PE needs to downgrade the EDCA
4097 * parameters(for the AC for which TS is being deleted) to the
4098 * next best AC for which ACM is not enabled, and send the
4099 * updated values to HAL.
4100 */
4101 ac = upToAc(pTsinfo->traffic.userPrio);
4102
4103 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4104 {
4105 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4106 }
4107 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4108 {
4109 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4110 }
4111 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4112 {
4113 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4114 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4115 }
4116
4117 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4118
4119 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4120 if (pStaDs != NULL)
4121 {
4122 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4123 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4124 else
4125 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4126 status = eSIR_SUCCESS;
4127 }
4128 else
4129 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004130 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004131 status = eSIR_FAILURE;
4132 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004133#ifdef FEATURE_WLAN_ESE
4134#ifdef FEATURE_WLAN_ESE_UPLOAD
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004135 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4136#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004137 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004138#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004139#endif
4140
4141 // send an sme response back
4142 end:
4143 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4144}
4145
4146
4147void
4148limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4149{
4150 //fetch the sessionEntry based on the sessionId
4151 tpPESession psessionEntry;
4152 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4153 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004154 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004155 return;
4156 }
4157
4158 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4159 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004160 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004161 pMac->lim.gLimAddtsSent = false;
4162 return;
4163 }
4164
4165 if (! pMac->lim.gLimAddtsSent)
4166 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004167 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004168 return;
4169 }
4170
4171 if (param != pMac->lim.gLimAddtsRspTimerCount)
4172 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004173 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004174 param, pMac->lim.gLimAddtsRspTimerCount);
4175 return;
4176 }
4177
4178 // this a real response timeout
4179 pMac->lim.gLimAddtsSent = false;
4180 pMac->lim.gLimAddtsRspTimerCount++;
4181
4182 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4183 psessionEntry->smeSessionId, psessionEntry->transactionId);
4184}
4185
4186
4187/**
4188 * __limProcessSmeStatsRequest()
4189 *
4190 *FUNCTION:
4191 *
4192 *
4193 *NOTE:
4194 *
4195 * @param pMac Pointer to Global MAC structure
4196 * @param *pMsgBuf A pointer to the SME message buffer
4197 * @return None
4198 */
4199static void
4200__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4201{
4202 tpAniGetStatsReq pStatsReq;
4203 tSirMsgQ msgQ;
4204 tpPESession psessionEntry;
4205 tANI_U8 sessionId;
4206
4207
4208 if(pMsgBuf == NULL)
4209 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004210 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004211 return;
4212 }
4213
4214 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4215
4216 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4217 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004218 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304219 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004220 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004221 return;
4222 }
4223
4224
4225
4226 switch(pStatsReq->msgType)
4227 {
4228 //Add Lim stats here. and send reqsponse.
4229
4230 //HAL maintained Stats.
4231 case eWNI_SME_STA_STAT_REQ:
4232 msgQ.type = WDA_STA_STAT_REQ;
4233 break;
4234 case eWNI_SME_AGGR_STAT_REQ:
4235 msgQ.type = WDA_AGGR_STAT_REQ;
4236 break;
4237 case eWNI_SME_GLOBAL_STAT_REQ:
4238 msgQ.type = WDA_GLOBAL_STAT_REQ;
4239 break;
4240 case eWNI_SME_STAT_SUMM_REQ:
4241 msgQ.type = WDA_STAT_SUMM_REQ;
4242 break;
4243 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004244 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304245 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004246 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004247 return;
4248 }
4249
Jeff Johnson295189b2012-06-20 16:38:30 -07004250 msgQ.reserved = 0;
4251 msgQ.bodyptr = pMsgBuf;
4252 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004253 if(NULL == psessionEntry)
4254 {
4255 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4256 }
4257 else
4258 {
4259 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4260 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004262 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304263 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004264 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004265 return;
4266 }
4267
4268 return;
4269}
4270
4271
4272/**
4273 * __limProcessSmeGetStatisticsRequest()
4274 *
4275 *FUNCTION:
4276 *
4277 *
4278 *NOTE:
4279 *
4280 * @param pMac Pointer to Global MAC structure
4281 * @param *pMsgBuf A pointer to the SME message buffer
4282 * @return None
4283 */
4284static void
4285__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4286{
4287 tpAniGetPEStatsReq pPEStatsReq;
4288 tSirMsgQ msgQ;
4289
4290 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4291
4292 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4293
4294 msgQ.type = WDA_GET_STATISTICS_REQ;
4295
Jeff Johnson295189b2012-06-20 16:38:30 -07004296 msgQ.reserved = 0;
4297 msgQ.bodyptr = pMsgBuf;
4298 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004299 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004300
4301 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304302 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004303 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004304 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004305 return;
4306 }
4307
4308 return;
4309}
4310
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004311#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004312/**
4313 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4314 *
4315 *NOTE:
4316 *
4317 * @param pMac Pointer to Global MAC structure
4318 * @param *pMsgBuf A pointer to the SME message buffer
4319 * @return None
4320 */
4321static void
4322__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4323{
4324 tSirMsgQ msgQ;
4325
4326 msgQ.type = WDA_TSM_STATS_REQ;
4327 msgQ.reserved = 0;
4328 msgQ.bodyptr = pMsgBuf;
4329 msgQ.bodyval = 0;
4330 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4331
4332 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4333 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004334 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004335 limLog(pMac, LOGP, "Unable to forward request");
4336 return;
4337 }
4338}
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004339#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004340
4341
Jeff Johnson295189b2012-06-20 16:38:30 -07004342
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004343#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004344/**
4345 * __limProcessSmeGetRoamRssiRequest()
4346 *
4347 *FUNCTION:
4348 *
4349 *
4350 *NOTE:
4351 *
4352 * @param pMac Pointer to Global MAC structure
4353 * @param *pMsgBuf A pointer to the SME message buffer
4354 * @return None
4355 */
4356static void
4357__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4358{
4359 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4360 tSirMsgQ msgQ;
4361
4362 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4363 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4364
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004365 msgQ.reserved = 0;
4366 msgQ.bodyptr = pMsgBuf;
4367 msgQ.bodyval = 0;
4368 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4369
4370 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304371 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004372 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004373 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004374 return;
4375 }
4376
4377 return;
4378}
4379#endif
4380
4381
Jeff Johnson295189b2012-06-20 16:38:30 -07004382static void
4383__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4384{
4385 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4386 tpPESession psessionEntry;
4387 tANI_U8 sessionId; //PE sessionID
4388
4389 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004390 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004391
4392 if(pMsgBuf == NULL)
4393 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004394 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004395 return;
4396 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004397
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304398 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4399 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004400 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304401 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004402 return;
4403 }
4404
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004405 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004406 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004407 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004408 goto end;
4409 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004410
Jeff Johnson295189b2012-06-20 16:38:30 -07004411 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4412 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004413 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004414 goto end;
4415 }
4416
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304417 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004418
Jeff Johnson295189b2012-06-20 16:38:30 -07004419 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004420 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004421
4422end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304423 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004424 return;
4425} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4426
4427static void
4428__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4429{
4430 tpSirUpdateParams pUpdateParams;
4431 tpPESession psessionEntry;
4432
4433 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004434 FL("received HIDE_SSID message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004435
4436 if(pMsgBuf == NULL)
4437 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004438 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004439 return;
4440 }
4441
4442 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4443
4444 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4445 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004446 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004447 pUpdateParams->sessionId);
4448 return;
4449 }
4450
4451 /* Update the session entry */
4452 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4453
4454 /* Update beacon */
4455 schSetFixedBeaconFields(pMac, psessionEntry);
4456 limSendBeaconInd(pMac, psessionEntry);
4457
4458 return;
4459} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4460
4461static void
4462__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4463{
4464 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4465 tpPESession psessionEntry;
4466 tANI_U8 sessionId; //PE sessionID
4467
4468 if(pMsgBuf == NULL)
4469 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004470 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004471 return;
4472 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304473
4474 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4475 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004476 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304477 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004478 return;
4479 }
4480
4481 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4482 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004483 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004484 goto end;
4485 }
4486
4487 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4488 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004489 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004490 goto end;
4491 }
4492
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304493 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4494 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004495
4496 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4497
4498 psessionEntry->pLimStartBssReq->privacy = 1;
4499 psessionEntry->privacy = 1;
4500
4501 schSetFixedBeaconFields(pMac, psessionEntry);
4502 limSendBeaconInd(pMac, psessionEntry);
4503
4504end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304505 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004506 return;
4507} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4508
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004509/*
4510Update the beacon Interval dynamically if beaconInterval is different in MCC
4511*/
4512static void
4513__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4514{
4515 tpSirChangeBIParams pChangeBIParams;
4516 tpPESession psessionEntry;
4517 tANI_U8 sessionId = 0;
4518 tUpdateBeaconParams beaconParams;
4519
4520 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004521 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004522
4523 if(pMsgBuf == NULL)
4524 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004525 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004526 return;
4527 }
4528
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304529 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004530 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4531
4532 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4533 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004534 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004535 return;
4536 }
4537
4538 /*Update sessionEntry Beacon Interval*/
4539 if(psessionEntry->beaconParams.beaconInterval !=
4540 pChangeBIParams->beaconInterval )
4541 {
4542 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4543 }
4544
4545 /*Update sch beaconInterval*/
4546 if(pMac->sch.schObject.gSchBeaconInterval !=
4547 pChangeBIParams->beaconInterval )
4548 {
4549 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4550
4551 PELOG1(limLog(pMac, LOG1,
4552 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4553
4554 /* Update beacon */
4555 schSetFixedBeaconFields(pMac, psessionEntry);
4556
Sunil Ravib96f7b52013-05-22 21:40:05 -07004557 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004558 //Set change in beacon Interval
4559 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004560 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004561 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4562 }
4563
4564 return;
4565} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4566
Jeff Johnson295189b2012-06-20 16:38:30 -07004567
4568
4569/** -------------------------------------------------------------
4570\fn limProcessSmeDelBaPeerInd
4571\brief handles indication message from HDD to send delete BA request
4572\param tpAniSirGlobal pMac
4573\param tANI_U32 pMsgBuf
4574\return None
4575-------------------------------------------------------------*/
4576void
4577limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4578{
4579 tANI_U16 assocId =0;
4580 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4581 tpDphHashNode pSta;
4582 tpPESession psessionEntry;
4583 tANI_U8 sessionId;
4584
4585
4586
4587 if(NULL == pSmeDelBAPeerInd)
4588 return;
4589
4590 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4591 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004592 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004593 return;
4594 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004595 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004596 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4597
4598 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4599 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4600 pSta,
4601 pSmeDelBAPeerInd->baDirection,
4602 pSmeDelBAPeerInd->baTID,
4603 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4604 {
4605 limLog( pMac, LOGW,
4606 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4607 if (pSta)
4608 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4609 }
4610}
4611
4612// --------------------------------------------------------------------
4613/**
4614 * __limProcessReportMessage
4615 *
4616 * FUNCTION: Processes the next received Radio Resource Management message
4617 *
4618 * LOGIC:
4619 *
4620 * ASSUMPTIONS:
4621 *
4622 * NOTE:
4623 *
4624 * @param None
4625 * @return None
4626 */
4627
4628void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4629{
4630#ifdef WLAN_FEATURE_VOWIFI
4631 switch (pMsg->type)
4632 {
4633 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4634 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4635 break;
4636 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4637 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004638#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004639 tpSirBeaconReportXmitInd pBcnReport=NULL;
4640 tpPESession psessionEntry=NULL;
4641 tANI_U8 sessionId;
4642
4643 if(pMsg->bodyptr == NULL)
4644 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004645 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004646 return;
4647 }
4648 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4649 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4650 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004651 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004652 return;
4653 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004654 if (psessionEntry->isESEconnection)
4655 eseProcessBeaconReportXmit( pMac, pMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07004656 else
4657#endif
4658 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4659 }
4660 break;
4661 }
4662#endif
4663}
4664
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004665#if defined(FEATURE_WLAN_ESE) || defined(WLAN_FEATURE_VOWIFI)
Jeff Johnson295189b2012-06-20 16:38:30 -07004666// --------------------------------------------------------------------
4667/**
4668 * limSendSetMaxTxPowerReq
4669 *
4670 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4671 *
4672 * LOGIC:
4673 *
4674 * ASSUMPTIONS:
4675 *
4676 * NOTE:
4677 *
4678 * @param txPower txPower to be set.
4679 * @param pSessionEntry session entry.
4680 * @return None
4681 */
4682tSirRetStatus
4683limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4684{
4685 tpMaxTxPowerParams pMaxTxParams = NULL;
4686 tSirRetStatus retCode = eSIR_SUCCESS;
4687 tSirMsgQ msgQ;
4688
4689 if( pSessionEntry == NULL )
4690 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004691 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004692 return eSIR_FAILURE;
4693 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304694
4695 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4696 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004697 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004698 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004699 return eSIR_MEM_ALLOC_FAILED;
4700
4701 }
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08004702#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_ESE)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004703 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 -07004704#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004705 if( pMaxTxParams == NULL )
4706 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004707 limLog( pMac, LOGE, "%s:%d: pMaxTxParams is NULL", __func__, __LINE__);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004708 return eSIR_FAILURE;
4709 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004710 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304711 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4712 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004713
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004714 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4715 msgQ.bodyptr = pMaxTxParams;
4716 msgQ.bodyval = 0;
4717 PELOG1(limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));)
4718 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
4719 retCode = wdaPostCtrlMsg(pMac, &msgQ);
4720 if (eSIR_SUCCESS != retCode)
4721 {
4722 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304723 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004724 }
4725 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004726}
4727#endif
4728
4729/**
4730 * __limProcessSmeAddStaSelfReq()
4731 *
4732 *FUNCTION:
4733 * This function is called to process SME_ADD_STA_SELF_REQ message
4734 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4735 *
4736 *LOGIC:
4737 *
4738 *ASSUMPTIONS:
4739 *
4740 *NOTE:
4741 *
4742 * @param pMac Pointer to Global MAC structure
4743 * @param *pMsgBuf A pointer to the SME message buffer
4744 * @return None
4745 */
4746
4747static void
4748__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4749{
4750 tSirMsgQ msg;
4751 tpAddStaSelfParams pAddStaSelfParams;
4752 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
4753
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304754 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
4755 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004756 {
4757 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
4758 return;
4759 }
4760
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304761 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07004762 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004763 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
4764 msg.reserved = 0;
4765 msg.bodyptr = pAddStaSelfParams;
4766 msg.bodyval = 0;
4767
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004768 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004769 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004770
4771 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4772 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004773 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004774 }
4775 return;
4776} /*** end __limProcessAddStaSelfReq() ***/
4777
4778
4779/**
4780 * __limProcessSmeDelStaSelfReq()
4781 *
4782 *FUNCTION:
4783 * This function is called to process SME_DEL_STA_SELF_REQ message
4784 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
4785 *
4786 *LOGIC:
4787 *
4788 *ASSUMPTIONS:
4789 *
4790 *NOTE:
4791 *
4792 * @param pMac Pointer to Global MAC structure
4793 * @param *pMsgBuf A pointer to the SME message buffer
4794 * @return None
4795 */
4796
4797static void
4798__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4799{
4800 tSirMsgQ msg;
4801 tpDelStaSelfParams pDelStaSelfParams;
4802 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
4803
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304804 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
4805 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004806 {
4807 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
4808 return;
4809 }
4810
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304811 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004812
4813 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
4814 msg.reserved = 0;
4815 msg.bodyptr = pDelStaSelfParams;
4816 msg.bodyval = 0;
4817
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004818 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004819 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004820
4821 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4822 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004823 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004824 }
4825 return;
4826} /*** end __limProcessSmeDelStaSelfReq() ***/
4827
4828
Jeff Johnson295189b2012-06-20 16:38:30 -07004829/**
4830 * __limProcessSmeRegisterMgmtFrameReq()
4831 *
4832 *FUNCTION:
4833 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
4834 * from SME. It Register this information within PE.
4835 *
4836 *LOGIC:
4837 *
4838 *ASSUMPTIONS:
4839 *
4840 *NOTE:
4841 *
4842 * @param pMac Pointer to Global MAC structure
4843 * @param *pMsgBuf A pointer to the SME message buffer
4844 * @return None
4845 */
4846static void
4847__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4848{
4849 VOS_STATUS vosStatus;
4850 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
4851 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004852 tANI_BOOLEAN match = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004853 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004854 FL("registerFrame %d, frameType %d, matchLen %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07004855 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004856
Jeff Johnsond13512a2012-07-17 11:42:19 -07004857 /* First check whether entry exists already*/
4858
4859 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4860 (vos_list_node_t**)&pLimMgmtRegistration);
4861
4862 while(pLimMgmtRegistration != NULL)
4863 {
4864 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
4865 {
4866 if(pSmeReq->matchLen)
4867 {
4868 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
4869 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304870 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07004871 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
4872 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004873 /* found match! */
4874 match = VOS_TRUE;
4875 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004876 }
4877 }
4878 }
4879 else
4880 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004881 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07004882 match = VOS_TRUE;
4883 break;
4884 }
4885 }
4886 vosStatus = vos_list_peek_next (
4887 &pMac->lim.gLimMgmtFrameRegistratinQueue,
4888 (vos_list_node_t*) pLimMgmtRegistration,
4889 (vos_list_node_t**) &pNext );
4890
4891 pLimMgmtRegistration = pNext;
4892 pNext = NULL;
4893
4894 }
4895
4896 if (match)
4897 {
4898 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4899 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304900 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07004901 }
4902
Jeff Johnson295189b2012-06-20 16:38:30 -07004903 if(pSmeReq->registerFrame)
4904 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304905 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
4906 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07004907 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304908 vos_mem_set((void*)pLimMgmtRegistration,
4909 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004910 pLimMgmtRegistration->frameType = pSmeReq->frameType;
4911 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
4912 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
4913 if(pSmeReq->matchLen)
4914 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304915 vos_mem_copy(pLimMgmtRegistration->matchData,
4916 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07004917 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004918 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4919 &pLimMgmtRegistration->node);
4920 }
4921 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004922
4923 return;
4924} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08004925
4926static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08004927__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08004928{
4929 tpP2pPsParams pMsgNoA;
4930 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08004931
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304932 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
4933 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08004934 {
4935 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004936 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08004937 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004938 }
4939
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304940 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08004941 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
4942 pMsgNoA->opp_ps = 0;
4943 pMsgNoA->ctWindow = 0;
4944 pMsgNoA->duration = 0;
4945 pMsgNoA->interval = 0;
4946 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08004947
Vinay Malekal62757362012-12-17 12:15:51 -08004948 /* Below params used for Single Shot NOA - so assign proper values */
4949 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08004950 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08004951
Viral Modid86bde22012-12-10 13:09:21 -08004952 /* Start Insert NOA timer
4953 * 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 -08004954 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
4955 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08004956 */
4957 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
4958 == TX_TIMER_ERROR)
4959 {
4960 /// Could not activate Insert NOA timer.
4961 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004962 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08004963
4964 // send the scan response back with status failure and do not even call insert NOA
4965 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304966 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08004967 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004968 }
4969
Viral Modid440e682013-03-06 02:25:31 -08004970 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
4971
Viral Modid86bde22012-12-10 13:09:21 -08004972 msg.type = WDA_SET_P2P_GO_NOA_REQ;
4973 msg.reserved = 0;
4974 msg.bodyptr = pMsgNoA;
4975 msg.bodyval = 0;
4976
4977 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4978 {
4979 /* 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 -07004980 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08004981 /* Deactivate the NOA timer in failure case */
4982 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
4983 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004984 }
Viral Modid440e682013-03-06 02:25:31 -08004985 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08004986
Viral Modid440e682013-03-06 02:25:31 -08004987error:
4988 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
4989 * worrying about the NOA
4990 */
4991 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
4992 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08004993 return FALSE;
4994
4995}
4996
Viral Modid440e682013-03-06 02:25:31 -08004997static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4998{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004999 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08005000 pMac->lim.gDeferMsgTypeForNOA = msgType;
5001 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
5002}
5003
5004static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5005{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005006 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08005007 pMac->lim.gDeferMsgTypeForNOA = 0;
5008 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
5009 {
5010 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305011 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005012 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5013 }
5014}
5015
5016static
5017tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
5018{
5019 tANI_U32 noaDuration = 0;
5020
5021 switch (msgType)
5022 {
5023 case eWNI_SME_SCAN_REQ:
5024 {
5025 tANI_U32 val;
5026 tANI_U8 i;
5027 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
5028 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
5029 {
5030 /*
5031 * Could not get max channel value
5032 * from CFG. Log error.
5033 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005034 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08005035
5036 /* use a default value of 110ms */
5037 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
5038 }
5039
5040 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
5041 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
5042
5043 if (limActiveScanAllowed(pMac, channelNum)) {
5044 /* Use min + max channel time to calculate the total duration of scan */
5045 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
5046 } else {
5047 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
5048 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
5049 */
5050 noaDuration += val;
5051 }
5052 }
5053
5054 /* Adding an overhead of 20ms to account for the scan messaging delays */
5055 noaDuration += SCAN_MESSAGING_OVERHEAD;
5056 noaDuration *= CONV_MS_TO_US;
5057
5058 break;
5059 }
5060
5061 case eWNI_SME_OEM_DATA_REQ:
5062 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
5063 break;
5064
5065 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5066 {
5067 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
5068 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
5069 break;
5070 }
5071
5072 case eWNI_SME_JOIN_REQ:
5073 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
5074 break;
5075
5076 default:
5077 noaDuration = 0;
5078 break;
5079
5080 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005081 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08005082 return noaDuration;
5083}
5084
5085void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
5086{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305087 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08005088
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005089 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005090 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
5091 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
5092 {
5093 switch (pMac->lim.gDeferMsgTypeForNOA)
5094 {
5095 case eWNI_SME_SCAN_REQ:
5096 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5097 break;
5098 case eWNI_SME_OEM_DATA_REQ:
5099 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5100 break;
5101 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05305102 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5103 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
5104 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
5105 */
5106 if (FALSE == bufConsumed)
5107 {
5108 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5109 }
Viral Modid440e682013-03-06 02:25:31 -08005110 break;
5111 case eWNI_SME_JOIN_REQ:
5112 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5113 break;
5114 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005115 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005116 break;
5117 }
5118 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5119 }
5120 else
5121 {
5122 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005123 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005124 }
5125}
Jeff Johnson295189b2012-06-20 16:38:30 -07005126
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005127#ifdef FEATURE_WLAN_TDLS_INTERNAL
5128/*
5129 * Process Discovery request recieved from SME and transmit to AP.
5130 */
5131static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
5132 tANI_U32 *pMsgBuf)
5133{
5134 /* get all discovery request parameters */
5135 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
5136 tpPESession psessionEntry;
5137 tANI_U8 sessionId;
5138
5139 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005140 ("Discovery Req Recieved")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005141
5142 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
5143 == NULL)
5144 {
5145 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005146 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005147 disReq->sessionId);
5148 goto lim_tdls_dis_start_error;
5149 }
5150
5151 /* check if we are in proper state to work as TDLS client */
5152 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5153 {
5154 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005155 "dis req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005156 psessionEntry->limSystemRole);
5157 goto lim_tdls_dis_start_error;
5158 }
5159
5160 /*
5161 * if we are still good, go ahead and check if we are in proper state to
5162 * do TDLS discovery procedure.
5163 */
5164 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5165 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5166 {
5167
5168 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005169 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005170 goto lim_tdls_dis_start_error;
5171 }
5172
5173 /*
5174 * if we are still good, go ahead and transmit TDLS discovery request,
5175 * and save Dis Req info for future reference.
5176 */
5177
5178#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
5179 /*
5180 * send message to HAL to set RXP filters to receieve frame on
5181 * direct link..
5182 */
5183 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
5184 // psessionEntry->bssId) ;
5185#endif
5186
5187 /* save dis request message for matching dialog token */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305188 vos_mem_copy((tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
5189 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005190
5191 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005192 "Transmit Discovery Request Frame") ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005193 /* format TDLS discovery request frame and transmit it */
5194 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
5195 psessionEntry) ;
5196
5197 /* prepare for response */
5198 pMac->lim.gLimTdlsDisStaCount = 0 ;
5199 pMac->lim.gLimTdlsDisResultList = NULL ;
5200
5201 /*
5202 * start TDLS discovery request timer to wait for discovery responses
5203 * from all TDLS enabled clients in BSS.
5204 */
5205
5206 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005207 ("Start Discovery request Timeout Timer")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005208 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
5209 eLIM_TDLS_DISCOVERY_RSP_WAIT));
5210
5211 /* assign appropriate sessionId to the timer object */
5212 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
5213 psessionEntry->peSessionId;
5214
5215 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
5216 != TX_SUCCESS)
5217 {
5218 limLog(pMac, LOGP, FL("TDLS discovery response timer \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005219 activation failed!"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005220 goto lim_tdls_dis_start_error;
5221 }
5222 /*
5223 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
5224 * back to SME
5225 */
5226 return (eSIR_SUCCESS) ;
5227lim_tdls_dis_start_error:
5228 /* in error case, PE has to sent the response SME immediately with error code */
5229 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
5230 eWNI_SME_TDLS_DISCOVERY_START_RSP);
5231 return eSIR_FAILURE;
5232}
5233/*
5234 * Process link start request recieved from SME and transmit to AP.
5235 */
5236eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5237{
5238 /* get all discovery request parameters */
5239 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
5240 tLimTdlsLinkSetupInfo *linkSetupInfo;
5241 //tLimTdlsLinkSetupPeer *setupPeer;
5242 tpPESession psessionEntry;
5243 tANI_U8 sessionId;
5244 eHalStatus status;
5245
5246 if((psessionEntry = peFindSessionByBssid(pMac,
5247 setupReq->bssid, &sessionId)) == NULL)
5248 {
5249 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005250 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005251 setupReq->sessionId);
5252 goto lim_tdls_link_start_error;
5253 }
5254
5255 /* check if we are in proper state to work as TDLS client */
5256 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5257 {
5258 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005259 "TDLS link setup req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005260 psessionEntry->limSystemRole);
5261 goto lim_tdls_link_start_error;
5262 }
5263
5264 /*
5265 * if we are still good, go ahead and check if we are in proper state to
5266 * do TDLS setup procedure.
5267 */
5268 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5269 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5270 {
5271 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005272 state (%d)", pMac->lim.gLimSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005273 goto lim_tdls_link_start_error;
5274 }
5275
5276 /*
5277 * Now, go ahead and transmit TDLS discovery request, and save setup Req
5278 * info for future reference.
5279 */
5280 /* create node for Link setup */
5281 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
5282 //setupPeer = NULL ;
5283
5284 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
5285 setupReq->peerMac, psessionEntry) ;
5286 if(eHAL_STATUS_SUCCESS == status)
5287 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5288 TDLS setup cnf TX complete is successful. */
5289 return eSIR_SUCCESS;
5290#if 0
5291
5292 /*
5293 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005294 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005295 * free this memory if any timeout is happen in link setup procedure
5296 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305297 setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
5298 if ( NULL == setupPeer )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005299 {
5300 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005301 FL( "Unable to allocate memory during ADD_STA" ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005302 VOS_ASSERT(0) ;
5303 return eSIR_MEM_ALLOC_FAILED;
5304 }
5305 setupPeer->dialog = setupReq->dialog ;
5306 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
5307 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
5308 /* TDLS_sessionize: remember sessionId for future */
5309 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
5310 setupPeer->tdls_bIsResponder = 1;
5311
5312 /*
5313 * we only populate peer MAC, so it can assit us to find the
5314 * TDLS peer after response/or after response timeout
5315 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305316 vos_mem_copy(setupPeer->peerMac, setupReq->peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005317 sizeof(tSirMacAddr)) ;
5318 /* format TDLS discovery request frame and transmit it */
5319 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
5320 setupReq->dialog, psessionEntry, NULL, 0) ;
5321
5322 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
5323 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
5324 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
5325 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
5326 /* update setup peer list */
5327 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
5328 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
5329 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5330 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
5331 return eSIR_SUCCESS ;
5332#endif
5333lim_tdls_link_start_error:
5334 /* in case of error, return immediately to SME */
5335 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
5336 eWNI_SME_TDLS_LINK_START_RSP);
5337 return eSIR_FAILURE ;
5338}
5339
5340/*
5341 * Process link teardown request recieved from SME and transmit to AP.
5342 */
5343eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5344{
5345 /* get all discovery request parameters */
5346 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
5347 tLimTdlsLinkSetupPeer *setupPeer;
5348 tpPESession psessionEntry;
5349 tANI_U8 sessionId;
5350
5351 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
5352 {
5353 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005354 "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005355 goto lim_tdls_teardown_req_error;
5356 }
5357
5358 /* check if we are in proper state to work as TDLS client */
5359 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5360 {
5361 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005362 "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005363 goto lim_tdls_teardown_req_error;
5364 }
5365
5366 /*
5367 * if we are still good, go ahead and check if we are in proper state to
5368 * do TDLS setup procedure.
5369 */
5370 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5371 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5372 {
5373 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005374 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005375 goto lim_tdls_teardown_req_error;
5376 }
5377
5378 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Arif Hussain24bafea2013-11-15 15:10:03 -08005379 "Teardown for peer = " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(teardownReq->peerMac));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005380 /*
5381 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5382 * info for future reference.
5383 */
5384 /* Verify if this link is setup */
5385 setupPeer = NULL ;
5386 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5387 if(NULL == setupPeer)
5388 {
5389 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005390 ("invalid Peer on teardown ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005391 goto lim_tdls_teardown_req_error;
5392 }
5393
5394
5395 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5396 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5397 /* TDLS_sessionize: check sessionId in case */
5398 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5399 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005400 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005401 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5402 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5403 }
5404
5405 /* format TDLS teardown request frame and transmit it */
5406 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5407 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5408 {
5409 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005410 ("couldn't send teardown frame ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005411 goto lim_tdls_teardown_req_error;
5412 }
5413 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5414 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5415 return eSIR_SUCCESS;
5416lim_tdls_teardown_req_error:
5417 /* in case of error, return immediately to SME */
5418 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5419 eWNI_SME_TDLS_TEARDOWN_RSP);
5420 return eSIR_FAILURE;
5421}
5422
5423
5424#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005425
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305426static void
5427__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5428{
5429 tpSirResetAPCapsChange pResetCapsChange;
5430 tpPESession psessionEntry;
5431 tANI_U8 sessionId = 0;
5432 if (pMsgBuf == NULL)
5433 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005434 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305435 return;
5436 }
5437
5438 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5439 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5440 if (psessionEntry == NULL)
5441 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005442 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305443 return;
5444 }
5445
5446 psessionEntry->limSentCapsChangeNtf = false;
5447 return;
5448}
5449
Jeff Johnson295189b2012-06-20 16:38:30 -07005450/**
5451 * limProcessSmeReqMessages()
5452 *
5453 *FUNCTION:
5454 * This function is called by limProcessMessageQueue(). This
5455 * function processes SME request messages from HDD or upper layer
5456 * application.
5457 *
5458 *LOGIC:
5459 *
5460 *ASSUMPTIONS:
5461 *
5462 *NOTE:
5463 *
5464 * @param pMac Pointer to Global MAC structure
5465 * @param msgType Indicates the SME message type
5466 * @param *pMsgBuf A pointer to the SME message buffer
5467 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5468 * FALSE - if pMsgBuf is not to be freed.
5469 */
5470
5471tANI_BOOLEAN
5472limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5473{
5474 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5475 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005476 tpSirSmeScanReq pScanReq;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005477 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 -07005478 limMsgStr(pMsg->type), pMsg->type,
5479 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5480 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5481
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005482 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005483 /* Special handling of some SME Req msgs where we have an existing GO session and
5484 * want to insert NOA before processing those msgs. These msgs will be processed later when
5485 * start event happens
5486 */
5487 switch (pMsg->type)
5488 {
5489 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005490 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005491
5492 /* If scan is disabled return from here
5493 */
5494 if (pMac->lim.fScanDisabled)
5495 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005496 if (pMsg->type == eWNI_SME_SCAN_REQ)
5497 {
5498 limSendSmeScanRsp(pMac,
5499 offsetof(tSirSmeScanRsp,bssDescription[0]),
5500 eSIR_SME_INVALID_PARAMETERS,
5501 pScanReq->sessionId,
5502 pScanReq->transactionId);
5503
5504 bufConsumed = TRUE;
5505 }
5506 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5507 {
5508 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5509 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5510 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5511
5512 /*
5513 * limRemainOnChnRsp will free the buffer this change is to
5514 * avoid "double free"
5515 */
5516 bufConsumed = FALSE;
5517 }
5518
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305519 limLog(pMac, LOGE,
5520 FL("Error: Scan Disabled."
5521 " Return with error status for SME Message %s(%d)"),
5522 limMsgStr(pMsg->type), pMsg->type);
5523
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005524 return bufConsumed;
5525 }
5526 /*
5527 * Do not add BREAK here
5528 */
5529 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005530 case eWNI_SME_JOIN_REQ:
5531 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5532 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5533 {
5534 tANI_U32 noaDuration;
5535 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
5536 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf);
5537 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5538 return bufConsumed;
5539 }
5540 }
5541 /* If no insert NOA required then execute the code below */
5542
Jeff Johnson295189b2012-06-20 16:38:30 -07005543 switch (pMsg->type)
5544 {
5545 case eWNI_SME_START_REQ:
5546 __limProcessSmeStartReq(pMac, pMsgBuf);
5547 break;
5548
5549 case eWNI_SME_SYS_READY_IND:
5550 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5551 break;
5552
Jeff Johnson295189b2012-06-20 16:38:30 -07005553 case eWNI_SME_START_BSS_REQ:
5554 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5555 break;
5556
5557 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005558 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005559 break;
5560
Jeff Johnsone7245742012-09-05 17:12:55 -07005561#ifdef FEATURE_OEM_DATA_SUPPORT
5562 case eWNI_SME_OEM_DATA_REQ:
5563 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005564 break;
5565#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005566 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5567 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5568 break;
5569
5570 case eWNI_SME_UPDATE_NOA:
5571 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5572 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305573 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5574 __limProcessClearDfsChannelList(pMac, pMsg);
5575 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005576 case eWNI_SME_JOIN_REQ:
5577 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005578 break;
5579
5580 case eWNI_SME_AUTH_REQ:
5581 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5582
5583 break;
5584
5585 case eWNI_SME_REASSOC_REQ:
5586 __limProcessSmeReassocReq(pMac, pMsgBuf);
5587
5588 break;
5589
5590 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5591 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5592
5593 break;
5594
5595 case eWNI_SME_DISASSOC_REQ:
5596 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5597
5598 break;
5599
5600 case eWNI_SME_DISASSOC_CNF:
5601 case eWNI_SME_DEAUTH_CNF:
5602 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5603
5604 break;
5605
5606 case eWNI_SME_DEAUTH_REQ:
5607 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5608
5609 break;
5610
Jeff Johnson295189b2012-06-20 16:38:30 -07005611
5612
5613 case eWNI_SME_SETCONTEXT_REQ:
5614 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5615
5616 break;
5617
5618 case eWNI_SME_REMOVEKEY_REQ:
5619 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5620
5621 break;
5622
5623 case eWNI_SME_STOP_BSS_REQ:
5624 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5625 break;
5626
5627 case eWNI_SME_ASSOC_CNF:
5628 case eWNI_SME_REASSOC_CNF:
5629 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005630 PELOG1(limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005631 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005632 PELOG1(limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005633 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5634 break;
5635
5636 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005637 PELOG1(limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005638 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5639 break;
5640
5641 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005642 PELOG1(limLog(pMac, LOG1, FL("Received DELTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005643 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5644 break;
5645
5646 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005647 PELOG1(limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005648 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5649 break;
5650
5651 case eWNI_SME_STA_STAT_REQ:
5652 case eWNI_SME_AGGR_STAT_REQ:
5653 case eWNI_SME_GLOBAL_STAT_REQ:
5654 case eWNI_SME_STAT_SUMM_REQ:
5655 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5656 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5657 bufConsumed = FALSE;
5658 break;
5659 case eWNI_SME_GET_STATISTICS_REQ:
5660 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5661 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5662 bufConsumed = FALSE;
5663 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005664#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005665 case eWNI_SME_GET_ROAM_RSSI_REQ:
5666 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5667 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5668 bufConsumed = FALSE;
5669 break;
5670#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005671#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005672 case eWNI_SME_GET_TSM_STATS_REQ:
5673 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5674 bufConsumed = FALSE;
5675 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005676#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005677 case eWNI_SME_DEL_BA_PEER_IND:
5678 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5679 break;
5680 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5681 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5682 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005683 case eWNI_SME_GET_ASSOC_STAS_REQ:
5684 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5685 break;
5686 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5687 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5688 break;
5689
5690 case eWNI_SME_HIDE_SSID_REQ:
5691 __limProcessSmeHideSSID(pMac, pMsgBuf);
5692 break;
5693 case eWNI_SME_UPDATE_APWPSIE_REQ:
5694 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5695 break;
5696 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5697 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5698 break;
5699
5700 case eWNI_SME_SET_APWPARSNIEs_REQ:
5701 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5702 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005703
5704 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5705 //Update the beaconInterval
5706 __limProcessSmeChangeBI(pMac, pMsgBuf );
5707 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005708
5709#if defined WLAN_FEATURE_VOWIFI
5710 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5711 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5712 __limProcessReportMessage(pMac, pMsg);
5713 break;
5714#endif
5715
5716#if defined WLAN_FEATURE_VOWIFI_11R
5717 case eWNI_SME_FT_PRE_AUTH_REQ:
5718 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5719 break;
5720 case eWNI_SME_FT_UPDATE_KEY:
5721 limProcessFTUpdateKey(pMac, pMsgBuf);
5722 break;
5723
5724 case eWNI_SME_FT_AGGR_QOS_REQ:
5725 limProcessFTAggrQosReq(pMac, pMsgBuf);
5726 break;
5727#endif
5728
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08005729#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
5730 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07005731 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5732 break;
5733#endif
5734 case eWNI_SME_ADD_STA_SELF_REQ:
5735 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5736 break;
5737 case eWNI_SME_DEL_STA_SELF_REQ:
5738 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5739 break;
5740
Jeff Johnson295189b2012-06-20 16:38:30 -07005741 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5742 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5743 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005744#ifdef FEATURE_WLAN_TDLS
5745 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5746 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5747 break;
5748 case eWNI_SME_TDLS_ADD_STA_REQ:
5749 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5750 break;
5751 case eWNI_SME_TDLS_DEL_STA_REQ:
5752 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5753 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305754 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5755 limProcesSmeTdlsLinkEstablishReq(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() ***/