blob: e2de81daf28f95b07ad25ac0a62de94f150e0ac7 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -080023 * Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
24 * All Rights Reserved.
25 * Qualcomm Atheros Confidential and Proprietary.
Kiet Lam842dad02014-02-18 18:44:02 -080026 *
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080027 */
Kiet Lam842dad02014-02-18 18:44:02 -080028
29
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080030/*
Jeff Johnson295189b2012-06-20 16:38:30 -070031 * This file limProcessSmeReqMessages.cc contains the code
32 * for processing SME request messages.
33 * Author: Chandra Modumudi
34 * Date: 02/11/02
35 * History:-
36 * Date Modified by Modification Information
37 * --------------------------------------------------------------------
38 *
39 */
40
41#include "palTypes.h"
42#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070043#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070044#include "cfgApi.h"
45#include "sirApi.h"
46#include "schApi.h"
47#include "utilsApi.h"
48#include "limTypes.h"
49#include "limUtils.h"
50#include "limAssocUtils.h"
51#include "limSecurityUtils.h"
52#include "limSerDesUtils.h"
53#include "limSmeReqUtils.h"
54#include "limIbssPeerMgmt.h"
55#include "limAdmitControl.h"
56#include "dphHashTable.h"
57#include "limSendMessages.h"
58#include "limApi.h"
59#include "wmmApsd.h"
60
Jeff Johnson295189b2012-06-20 16:38:30 -070061#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070062
63#if defined WLAN_FEATURE_VOWIFI
64#include "rrmApi.h"
65#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070066#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -070067#include "ccxApi.h"
68#endif
69
70#if defined WLAN_FEATURE_VOWIFI_11R
71#include <limFT.h>
72#endif
73
74#ifdef FEATURE_WLAN_CCX
75/* These are the min/max tx power (non virtual rates) range
76 supported by prima hardware */
Sandeep Puligilla33ccf332013-12-19 16:06:42 +053077#define MIN_TX_PWR_CAP 8
78#define MAX_TX_PWR_CAP 22
Jeff Johnson295189b2012-06-20 16:38:30 -070079
80#endif
81
Viral Modid86bde22012-12-10 13:09:21 -080082/* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK
83 * in case of P2P Client and starting actual scanning with init scan req/rsp plus in case of concurrency,
Sunil Ravi24fd3aa2013-01-21 22:12:06 -080084 * taking care of sending null data and receiving ACK to/from AP/Also SetChannel with calibration is taking
85 * around 7ms .
Viral Modid86bde22012-12-10 13:09:21 -080086 */
Viral Modid440e682013-03-06 02:25:31 -080087#define SCAN_MESSAGING_OVERHEAD 20 // in msecs
88#define JOIN_NOA_DURATION 2000 // in msecs
89#define OEM_DATA_NOA_DURATION 60 // in msecs
90#define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 // in msecs
Jeff Johnson295189b2012-06-20 16:38:30 -070091
Gopichand Nakkala096a1052012-12-21 07:05:34 -080092#define CONV_MS_TO_US 1024 //conversion factor from ms to us
93
Jeff Johnson295189b2012-06-20 16:38:30 -070094// SME REQ processing function templates
95static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *);
96static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *);
97static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
Viral Modid440e682013-03-06 02:25:31 -080098static void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *);
Jeff Johnson295189b2012-06-20 16:38:30 -070099static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *);
100static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *);
101static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *);
102static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *);
103static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *);
104static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *);
105static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
106
Jeff Johnson295189b2012-06-20 16:38:30 -0700107void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *);
108
Jeff Johnson295189b2012-06-20 16:38:30 -0700109extern void peRegisterTLHandle(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700110
Jeff Johnson295189b2012-06-20 16:38:30 -0700111
Jeff Johnson295189b2012-06-20 16:38:30 -0700112#ifdef BACKGROUND_SCAN_ENABLED
113
114// start the background scan timers if it hasn't already started
115static void
116__limBackgroundScanInitiate(tpAniSirGlobal pMac)
117{
118 if (pMac->lim.gLimBackgroundScanStarted)
119 return;
120
121 //make sure timer is created first
122 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
123 {
124 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -0700125 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700126 if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700127 limLog(pMac, LOGP, FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700128 pMac->lim.gLimBackgroundScanStarted = true;
129 pMac->lim.gLimBackgroundScanChannelId = 0;
130 }
131}
132
133#endif // BACKGROUND_SCAN_ENABLED
Jeff Johnson295189b2012-06-20 16:38:30 -0700134
135// determine if a fresh scan request must be issued or not
136/*
137* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
138* If one of the sessions is not in one of the above states, then PE does not do fresh scan
139* If no session exists (scanning very first time), then PE will always do fresh scan if SME
140* asks it to do that.
141*/
142static tANI_U8
143__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
144{
145
146 tANI_U8 validState = TRUE;
147 int i;
148
149 if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
150 {
151 return FALSE;
152 }
153 for(i =0; i < pMac->lim.maxBssId; i++)
154 {
155
156 if(pMac->lim.gpSession[i].valid == TRUE)
157 {
158 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
159 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
160 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
161
162 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
163 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
164 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
165 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700166 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
167 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
168 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
169 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700170 ))
171 {
172 validState = FALSE;
173 break;
174 }
175
176 }
177 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530178 limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700179
180 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
181 return TRUE;
182
183 return FALSE;
184}
185
Jeff Johnson295189b2012-06-20 16:38:30 -0700186
187
188/**
189 * __limIsSmeAssocCnfValid()
190 *
191 *FUNCTION:
192 * This function is called by limProcessLmmMessages() upon
193 * receiving SME_ASSOC_CNF.
194 *
195 *LOGIC:
196 * Message validity checks are performed in this function
197 *
198 *ASSUMPTIONS:
199 *
200 *NOTE:
201 *
202 * @param pMeasReq Pointer to Received ASSOC_CNF message
203 * @return true When received SME_ASSOC_CNF is formatted
204 * correctly
205 * false otherwise
206 */
207
208inline static tANI_U8
209__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
210{
211 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
212 return false;
213 else
214 return true;
215} /*** end __limIsSmeAssocCnfValid() ***/
216
217
218/**
219 * __limGetSmeJoinReqSizeForAlloc()
220 *
221 *FUNCTION:
222 * This function is called in various places to get IE length
223 * from tSirBssDescription structure
224 * number being scanned.
225 *
226 *PARAMS:
227 *
228 *LOGIC:
229 *
230 *ASSUMPTIONS:
231 * NA
232 *
233 *NOTE:
234 * NA
235 *
236 * @param pBssDescr
237 * @return Total IE length
238 */
239
240static tANI_U16
241__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
242{
243 tANI_U16 len = 0;
244
245 if (!pBuf)
246 return len;
247
248 pBuf += sizeof(tANI_U16);
249 len = limGetU16( pBuf );
250 return (len + sizeof( tANI_U16 ));
251} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
252
253
254/**----------------------------------------------------------------
255\fn __limIsDeferedMsgForLearn
256
257\brief Has role only if 11h is enabled. Not used on STA side.
258 Defers the message if SME is in learn state and brings
259 the LIM back to normal mode.
260
261\param pMac
262\param pMsg - Pointer to message posted from SME to LIM.
263\return TRUE - If defered
264 FALSE - Otherwise
265------------------------------------------------------------------*/
266static tANI_BOOLEAN
267__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
268{
269 if (limIsSystemInScanState(pMac))
270 {
271 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
272 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700273 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 return eANI_BOOLEAN_FALSE;
275 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700276 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 pMsg->type);)
278
279 /** Send finish scan req to HAL only if LIM is not waiting for any response
280 * from HAL like init scan rsp, start scan rsp etc.
281 */
282 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
283 {
284 //Set the resume channel to Any valid channel (invalid).
285 //This will instruct HAL to set it to any previous valid channel.
286 peSetResumeChannel(pMac, 0, 0);
287 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
288 }
289
290 return eANI_BOOLEAN_TRUE;
291 }
292 return eANI_BOOLEAN_FALSE;
293}
294
295/**----------------------------------------------------------------
296\fn __limIsDeferedMsgForRadar
297
298\brief Has role only if 11h is enabled. Not used on STA side.
299 Defers the message if radar is detected.
300
301\param pMac
302\param pMsg - Pointer to message posted from SME to LIM.
303\return TRUE - If defered
304 FALSE - Otherwise
305------------------------------------------------------------------*/
306static tANI_BOOLEAN
307__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
308{
309 /** fRadarDetCurOperChan will be set only if we detect radar in current
310 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700311 //TODO: Need to take care radar detection.
312 //if (LIM_IS_RADAR_DETECTED(pMac))
313 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700314 {
315 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
316 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700317 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 return eANI_BOOLEAN_FALSE;
319 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700320 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 pMsg->type);)
322 return eANI_BOOLEAN_TRUE;
323 }
324 return eANI_BOOLEAN_FALSE;
325}
326
327
328/**
329 * __limProcessSmeStartReq()
330 *
331 *FUNCTION:
332 * This function is called to process SME_START_REQ message
333 * from HDD or upper layer application.
334 *
335 *LOGIC:
336 *
337 *ASSUMPTIONS:
338 *
339 *NOTE:
340 *
341 * @param pMac Pointer to Global MAC structure
342 * @param *pMsgBuf A pointer to the SME message buffer
343 * @return None
344 */
345
346static void
347__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
348{
349 tSirResultCodes retCode = eSIR_SME_SUCCESS;
350 tANI_U8 smesessionId;
351 tANI_U16 smetransactionId;
352
353
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700354 PELOG1(limLog(pMac, LOG1, FL("Received START_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700355
356 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
357
358 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
359 {
360 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
361
Jeff Johnsone7245742012-09-05 17:12:55 -0700362 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700363
364 /// By default do not return after first scan match
365 pMac->lim.gLimReturnAfterFirstMatch = 0;
366
367 /// Initialize MLM state machine
368 limInitMlm(pMac);
369
370 /// By default return unique scan results
371 pMac->lim.gLimReturnUniqueResults = true;
372 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700373#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
374 pMac->lim.gLimSmeLfrScanResultLength = 0;
375#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700376
Jeff Johnson295189b2012-06-20 16:38:30 -0700377 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
378 {
379 /*
380 * Need to indicate new BSSs found during background scanning to
381 * host. Update this parameter at CFG
382 */
383 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
384 != eSIR_SUCCESS)
385 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700386 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700387 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
388 }
389 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 }
391 else
392 {
393 /**
394 * Should not have received eWNI_SME_START_REQ in states
395 * other than OFFLINE. Return response to host and
396 * log error
397 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700398 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700399 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
400 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
401 }
402 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
403} /*** end __limProcessSmeStartReq() ***/
404
405
406/** -------------------------------------------------------------
407\fn __limProcessSmeSysReadyInd
408\brief handles the notification from HDD. PE just forwards this message to HAL.
409\param tpAniSirGlobal pMac
410\param tANI_U32* pMsgBuf
411\return TRUE-Posting to HAL failed, so PE will consume the buffer.
412\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
413 -------------------------------------------------------------*/
414static tANI_BOOLEAN
415__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
416{
417 tSirMsgQ msg;
418
419 msg.type = WDA_SYS_READY_IND;
420 msg.reserved = 0;
421 msg.bodyptr = pMsgBuf;
422 msg.bodyval = 0;
423
Jeff Johnson92751692013-03-06 16:00:33 -0800424 if (pMac->gDriverType != eDRIVER_TYPE_MFG)
Jeff Johnson295189b2012-06-20 16:38:30 -0700425 {
Jeff Johnson92751692013-03-06 16:00:33 -0800426 peRegisterTLHandle(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700427 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700428 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700429 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700430
Jeff Johnson92751692013-03-06 16:00:33 -0800431 if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700433 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700434 return eANI_BOOLEAN_TRUE;
435 }
436 return eANI_BOOLEAN_FALSE;
437}
438
Jeff Johnsone7245742012-09-05 17:12:55 -0700439#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700440
Jeff Johnsone7245742012-09-05 17:12:55 -0700441tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
442{
443 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
444 {
445 switch(secondaryChanOffset)
446 {
447 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
448 return primarychanNum;
449 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
450 return primarychanNum + 2;
451 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
452 return primarychanNum - 2;
453 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
454 return primarychanNum + 6;
455 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
456 return primarychanNum + 2;
457 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
458 return primarychanNum - 2;
459 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
460 return primarychanNum - 6;
461 default :
462 return eSIR_CFG_INVALID_ID;
463 }
464 }
465 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
466 {
467 switch(secondaryChanOffset)
468 {
469 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
470 return primarychanNum + 2;
471 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
472 return primarychanNum - 2;
473 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
474 return primarychanNum;
475 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
476 return primarychanNum + 2;
477 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
478 return primarychanNum - 2;
479 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
480 return primarychanNum + 2;
481 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
482 return primarychanNum - 2;
483 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
484 return primarychanNum + 2;
485 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
486 return primarychanNum - 2;
487 default :
488 return eSIR_CFG_INVALID_ID;
489 }
490 }
491 return primarychanNum;
492}
493
494#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700495/**
496 * __limHandleSmeStartBssRequest()
497 *
498 *FUNCTION:
499 * This function is called to process SME_START_BSS_REQ message
500 * from HDD or upper layer application.
501 *
502 *LOGIC:
503 *
504 *ASSUMPTIONS:
505 *
506 *NOTE:
507 *
508 * @param pMac Pointer to Global MAC structure
509 * @param *pMsgBuf A pointer to the SME message buffer
510 * @return None
511 */
512
513static void
514__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
515{
516 tANI_U16 size;
517 tANI_U32 val = 0;
518 tSirRetStatus retStatus;
519 tSirMacChanNum channelNumber;
Jeff Johnsonace91102013-04-05 08:03:18 -0700520 tLimMlmStartReq *pMlmStartReq = NULL;
521 tpSirSmeStartBssReq pSmeStartBssReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700522 tSirResultCodes retCode = eSIR_SME_SUCCESS;
523 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700524 tANI_U8 sessionId;
525 tpPESession psessionEntry = NULL;
526 tANI_U8 smesessionId;
527 tANI_U16 smetransactionId;
528
529#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
530 //Since the session is not created yet, sending NULL. The response should have the correct state.
531 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
532#endif //FEATURE_WLAN_DIAG_SUPPORT
533
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700534 PELOG1(limLog(pMac, LOG1, FL("Received START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700535
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530536 /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
538 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
539 {
540 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
541
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530542 pSmeStartBssReq = vos_mem_malloc(size);
543 if ( NULL == pSmeStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700544 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530545 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pMac->lim.gpLimStartBssReq"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700546 /// Send failure response to host
547 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
548 goto end;
549 }
550
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530551 vos_mem_set((void *)pSmeStartBssReq, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700552
553 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
554 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
555 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700556 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 retCode = eSIR_SME_INVALID_PARAMETERS;
558 goto free;
559 }
560#if 0
561 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700562 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700563 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
564#endif
565
566 /* This is the place where PE is going to create a session.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530567 * If session is not existed, then create a new session */
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
569 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700570 limLog(pMac, LOGW, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700571 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
572 psessionEntry = NULL;
573 goto free;
574 }
575 else
576 {
577 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
578 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700579 limLog(pMac, LOGW, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700580 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
581 goto free;
582 }
583
584 }
585
586 /* Store the session related parameters in newly created session */
587 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
588
589 /* Store PE sessionId in session Table */
590 psessionEntry->peSessionId = sessionId;
591
592 /* Store SME session Id in sessionTable */
593 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
594
595 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
596
597 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
598
599 /* Copy SSID to session table */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530600 vos_mem_copy( (tANI_U8 *)&psessionEntry->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 (tANI_U8 *)&pSmeStartBssReq->ssId,
602 (pSmeStartBssReq->ssId.length + 1));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530603
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 psessionEntry->bssType = pSmeStartBssReq->bssType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530605
Jeff Johnson295189b2012-06-20 16:38:30 -0700606 psessionEntry->nwType = pSmeStartBssReq->nwType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530607
Jeff Johnson295189b2012-06-20 16:38:30 -0700608 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
609
610 /* Store the channel number in session Table */
611 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
612
613 /*Store Persona */
614 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700615 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700616 psessionEntry->pePersona);
617
618 /*Update the phymode*/
619 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
620
621 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
622 psessionEntry->currentOperChannel );
623 /* Store the dot 11 mode in to the session Table*/
624
625 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700626 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
627#ifdef WLAN_FEATURE_11AC
628 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700629 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
630 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700631#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800632
633 psessionEntry->txLdpcIniFeatureEnabled =
634 pSmeStartBssReq->txLdpcIniFeatureEnabled;
635
Chet Lanctot8cecea22014-02-11 19:09:36 -0800636#ifdef WLAN_FEATURE_11W
637 psessionEntry->limRmfEnabled = pSmeStartBssReq->pmfCapable ? 1 : 0;
638 limLog(pMac, LOG1, FL("Session RMF enabled: %d"), psessionEntry->limRmfEnabled);
639#endif
640
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530641 vos_mem_copy((void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700642 (void*)&pSmeStartBssReq->operationalRateSet,
643 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530644 vos_mem_copy((void*)&psessionEntry->extRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700645 (void*)&pSmeStartBssReq->extendedRateSet,
646 sizeof(tSirMacRateSet));
647
648 switch(pSmeStartBssReq->bssType)
649 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 case eSIR_INFRA_AP_MODE:
651 psessionEntry->limSystemRole = eLIM_AP_ROLE;
652 psessionEntry->privacy = pSmeStartBssReq->privacy;
653 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
654 psessionEntry->authType = pSmeStartBssReq->authType;
655 /* Store the DTIM period */
656 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
657 /*Enable/disable UAPSD*/
658 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
659 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
660 {
661 psessionEntry->proxyProbeRspEn = 0;
662 }
663 else
664 {
665 /* To detect PBC overlap in SAP WPS mode, Host handles
666 * Probe Requests.
667 */
668 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
669 {
670 psessionEntry->proxyProbeRspEn = 1;
671 }
672 else
673 {
674 psessionEntry->proxyProbeRspEn = 0;
675 }
676 }
677 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
678 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -0700679 psessionEntry->shortSlotTimeSupported = limGetShortSlotFromPhyMode(pMac, psessionEntry, psessionEntry->gLimPhyMode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700681 case eSIR_IBSS_MODE:
682 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Ravi Joshi27216f12013-10-19 17:04:39 -0700683 psessionEntry->shortSlotTimeSupported =
684 limGetShortSlotFromPhyMode(pMac, psessionEntry,
685 psessionEntry->gLimPhyMode);
krunal sonie9002db2013-11-25 14:24:17 -0800686 psessionEntry->isCoalesingInIBSSAllowed =
687 pSmeStartBssReq->isCoalesingInIBSSAllowed;
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 break;
689
690 case eSIR_BTAMP_AP_MODE:
691 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
692 break;
693
694 case eSIR_BTAMP_STA_MODE:
695 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
696 break;
697
698 /* There is one more mode called auto mode. which is used no where */
699
700 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
701
702
703 default:
704 //not used anywhere...used in scan function
705 break;
706 }
707
708 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
709 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700711 )
712 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530713 psessionEntry->parsedAssocReq = vos_mem_malloc(
714 psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq));
715 if ( NULL == psessionEntry->parsedAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700716 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530717 limLog(pMac, LOGW, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700718 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
719 goto free;
720 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530721 vos_mem_set(psessionEntry->parsedAssocReq,
722 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)),
723 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 }
725
726 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
727 if (pSmeStartBssReq->channelId)
728 {
729 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700730 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
731 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
732 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700733 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700734 FL("cbMode %u"), pSmeStartBssReq->cbMode);
735#ifdef WLAN_FEATURE_11AC
736 if(psessionEntry->vhtCapability)
737 {
738 tANI_U32 centerChan;
739 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700740
Jeff Johnsone7245742012-09-05 17:12:55 -0700741 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
742 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700743 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700744 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700745 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700746 }
Abhishek Singh921926b2014-02-13 17:21:01 +0530747 /* Do not set WNI_CFG_VHT_CHANNEL_WIDTH as 80Mhz in 2.4Ghz
748 * band. makes sure vhtTxChannelWidthSet is set to
749 * WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ(0). vhtTxChannelWidthSet
750 * along htSupportedChannelWidthSet decides to use 40/20Mhz.
751 * htSupportedChannelWidthSet will be 1 (40Mhz)
752 * only if 40Mhz ChannelWidth is supported by Firmware.
753 */
754 if(channelNumber <= RF_CHAN_14 &&
755 chanWidth != WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
Jeff Johnsone7245742012-09-05 17:12:55 -0700756 {
Abhishek Singh921926b2014-02-13 17:21:01 +0530757 chanWidth = WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ;
758 limLog(pMac, LOG1, FL("Setting chanWidth to 20Mhz for"
759 " channel %d"),channelNumber);
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700761
Abhishek Singh921926b2014-02-13 17:21:01 +0530762 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
763 {
764 centerChan = limGetCenterChannel(pMac,channelNumber,
765 pSmeStartBssReq->cbMode,WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
Jeff Johnsone7245742012-09-05 17:12:55 -0700766 if(centerChan != eSIR_CFG_INVALID_ID)
767 {
Abhishek Singh921926b2014-02-13 17:21:01 +0530768 limLog(pMac, LOGW, FL("***Center Channel for 80MHZ "
769 "channel width = %d"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700770 psessionEntry->apCenterChan = centerChan;
Abhishek Singh921926b2014-02-13 17:21:01 +0530771 if (cfgSetInt(pMac,
772 WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1,
773 centerChan) != eSIR_SUCCESS)
Jeff Johnsone7245742012-09-05 17:12:55 -0700774 {
Abhishek Singh921926b2014-02-13 17:21:01 +0530775 limLog(pMac, LOGP, FL("could not set "
776 "WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700777 retCode = eSIR_LOGP_EXCEPTION;
778 goto free;
779 }
780 }
781 }
782
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700783 /*For Sta+p2p-Go concurrency
784 vhtTxChannelWidthSet is used for storing p2p-GO channel width
785 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
786 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
787 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700788 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700789 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700790 }
791 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
792#endif
793 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700794 else
795 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700796 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 retCode = eSIR_SME_INVALID_PARAMETERS;
798 goto free;
799 }
800
801 // Delete pre-auth list if any
802 limDeletePreAuthList(pMac);
803
804 // Delete IBSS peer BSSdescription list if any
805 //limIbssDelete(pMac); sep 26 review
806
807
808
809#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
810 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 limInitMlm(pMac);
812#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700813
Jeff Johnsone7245742012-09-05 17:12:55 -0700814 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700815
Jeff Johnson295189b2012-06-20 16:38:30 -0700816 /* keep the RSN/WPA IE information in PE Session Entry
817 * later will be using this to check when received (Re)Assoc req
818 * */
819 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
820
Jeff Johnson295189b2012-06-20 16:38:30 -0700821
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 //Taken care for only softAP case rest need to be done
823 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
824 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
825 /*each byte will have the following info
826 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
827 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530828 vos_mem_copy( (void *) &psessionEntry->cfgProtection,
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700830 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
832 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700833
834 // Prepare and Issue LIM_MLM_START_REQ to MLM
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530835 pMlmStartReq = vos_mem_malloc(sizeof(tLimMlmStartReq));
836 if ( NULL == pMlmStartReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530838 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
840 goto free;
841 }
842
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530843 vos_mem_set((void *) pMlmStartReq, sizeof(tLimMlmStartReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700844
845 /* Copy SSID to the MLM start structure */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530846 vos_mem_copy( (tANI_U8 *) &pMlmStartReq->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 (tANI_U8 *) &pSmeStartBssReq->ssId,
848 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
850 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700851
852
853 pMlmStartReq->bssType = psessionEntry->bssType;
854
855 /* Fill PE session Id from the session Table */
856 pMlmStartReq->sessionId = psessionEntry->peSessionId;
857
858 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 )
861 {
862 //len = sizeof(tSirMacAddr);
863 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
864 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700865 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700866
867 /* Copy the BSSId from sessionTable to mlmStartReq struct */
868 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
869 }
870
871 else // ibss mode
872 {
873 pMac->lim.gLimIbssCoalescingHappened = false;
874
875 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
876 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700877 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 retCode = eSIR_LOGP_EXCEPTION;
879 goto free;
880 }
881
882 if(!autoGenBssId)
883 {
884 // We're not auto generating BSSID. Instead, get it from session entry
885 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
886
887 if(pMlmStartReq->bssId[0] & 0x01)
888 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700889 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 autoGenBssId = TRUE;
891 }
892 }
893
894 if( autoGenBssId )
895 { //if BSSID is not any uc id. then use locally generated BSSID.
896 //Autogenerate the BSSID
897 limGetRandomBssid( pMac, pMlmStartReq->bssId);
898 pMlmStartReq->bssId[0]= 0x02;
899
900 /* Copy randomly generated BSSID to the session Table */
901 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
902 }
903 }
904 /* store the channel num in mlmstart req structure */
905 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
906 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
907 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
908
Jeff Johnson295189b2012-06-20 16:38:30 -0700909 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
910 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
911 pMlmStartReq->wps_state = psessionEntry->wps_state;
912
913 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700914 {
915 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700916 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700917 pMlmStartReq->dtimPeriod = (tANI_U8)val;
918 }
919
920 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700921 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700922 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
923
924 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700925 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700926 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
927
928 //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 +0530929 vos_mem_copy((void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 sizeof(tSirMacRateSet));
931
Jeff Johnson295189b2012-06-20 16:38:30 -0700932 // Now populate the 11n related parameters
933 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700934 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700935 //
936 // FIXME_GEN4 - Determine the appropriate defaults...
937 //
938 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
939 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700940 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700941
942 /* sep26 review */
943 psessionEntry->limRFBand = limGetRFBand(channelNumber);
944
945 // Initialize 11h Enable Flag
946 psessionEntry->lim11hEnable = 0;
947 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
948 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
949 {
950 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700951 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700952 psessionEntry->lim11hEnable = val;
953 }
954
955 if (!psessionEntry->lim11hEnable)
956 {
957 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700958 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700959 }
960
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
962 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700963 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700964
965 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
966 return;
967 }
968 else
969 {
970
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700971 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700972 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
973 goto end;
974 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
975
976free:
Jeff Johnsonace91102013-04-05 08:03:18 -0700977 if ((psessionEntry != NULL) &&
978 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
979 {
980 psessionEntry->pLimStartBssReq = NULL;
981 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530982 vos_mem_free( pSmeStartBssReq);
983 vos_mem_free( pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700984
985end:
986
987 /* This routine should return the sme sessionId and SME transaction Id */
988 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
989
990 if(NULL != psessionEntry)
991 {
992 peDeleteSession(pMac,psessionEntry);
993 psessionEntry = NULL;
994 }
995 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
996} /*** end __limHandleSmeStartBssRequest() ***/
997
998
999/**--------------------------------------------------------------
1000\fn __limProcessSmeStartBssReq
1001
1002\brief Wrapper for the function __limHandleSmeStartBssRequest
1003 This message will be defered until softmac come out of
1004 scan mode or if we have detected radar on the current
1005 operating channel.
1006\param pMac
1007\param pMsg
1008
1009\return TRUE - If we consumed the buffer
1010 FALSE - If have defered the message.
1011 ---------------------------------------------------------------*/
1012static tANI_BOOLEAN
1013__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1014{
1015 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1016 __limIsDeferedMsgForRadar(pMac, pMsg))
1017 {
1018 /**
1019 * If message defered, buffer is not consumed yet.
1020 * So return false
1021 */
1022 return eANI_BOOLEAN_FALSE;
1023 }
1024
1025 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1026 return eANI_BOOLEAN_TRUE;
1027}
1028
1029
1030/**
1031 * limGetRandomBssid()
1032 *
1033 * FUNCTION:This function is called to process generate the random number for bssid
1034 * This function is called to process SME_SCAN_REQ message
1035 * from HDD or upper layer application.
1036 *
1037 * LOGIC:
1038 *
1039 * ASSUMPTIONS:
1040 *
1041 * NOTE:
1042 * 1. geneartes the unique random number for bssid in ibss
1043 *
1044 * @param pMac Pointer to Global MAC structure
1045 * @param *data Pointer to bssid buffer
1046 * @return None
1047 */
1048void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1049{
1050 tANI_U32 random[2] ;
1051 random[0] = tx_time_get();
1052 random[0] |= (random[0] << 15) ;
1053 random[1] = random[0] >> 1;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301054 vos_mem_copy( data, (tANI_U8*)random, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001055}
1056
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301057static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
1058 tpSirSmeScanReq pScanReq)
1059{
1060 tSirScanOffloadReq *pScanOffloadReq;
1061 tANI_U8 *p;
1062 tSirMsgQ msg;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301063 tANI_U16 i, len;
1064 tSirRetStatus rc = eSIR_SUCCESS;
1065
1066 /* The tSirScanOffloadReq will reserve the space for first channel,
1067 so allocate the memory for (numChannels - 1) and uIEFieldLen */
1068 len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
1069 pScanReq->uIEFieldLen;
1070
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301071 pScanOffloadReq = vos_mem_malloc(len);
1072 if ( NULL == pScanOffloadReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301073 {
1074 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301075 FL("AllocateMemory failed for pScanOffloadReq"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301076 return eHAL_STATUS_FAILURE;
1077 }
1078
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301079 vos_mem_set( (tANI_U8 *) pScanOffloadReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301080
1081 msg.type = WDA_START_SCAN_OFFLOAD_REQ;
1082 msg.bodyptr = pScanOffloadReq;
1083 msg.bodyval = 0;
1084
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301085 vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301086 (tANI_U8*) pScanReq->bssId,
1087 sizeof(tSirMacAddr));
1088
1089 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
1090 {
1091 limLog(pMac, LOGE,
1092 FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
Kiet Lamb1233192013-11-28 13:38:20 +05301093 vos_mem_free (pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301094 return eHAL_STATUS_FAILURE;
1095 }
1096
1097 pScanOffloadReq->numSsid = pScanReq->numSsid;
1098 for (i = 0; i < pScanOffloadReq->numSsid; i++)
1099 {
1100 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301101 vos_mem_copy((tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301102 (tANI_U8 *) pScanReq->ssId[i].ssId,
1103 pScanOffloadReq->ssId[i].length);
1104 }
1105
1106 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301107 vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301108 (tANI_U8 *) pScanReq->selfMacAddr,
1109 sizeof(tSirMacAddr));
1110 pScanOffloadReq->bssType = pScanReq->bssType;
1111 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1112 pScanOffloadReq->scanType = pScanReq->scanType;
1113 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1114 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1115 pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
1116 pScanOffloadReq->sessionId = pScanReq->sessionId;
1117 pScanOffloadReq->channelList.numChannels =
1118 pScanReq->channelList.numChannels;
1119 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1120 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1121 p[i] = pScanReq->channelList.channelNumber[i];
1122
1123 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1124 pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301125 vos_mem_copy((tANI_U8 *) p + i,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301126 (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
1127 pScanOffloadReq->uIEFieldLen);
1128
1129 rc = wdaPostCtrlMsg(pMac, &msg);
1130 if (rc != eSIR_SUCCESS)
1131 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001132 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301133 vos_mem_free(pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301134 return eHAL_STATUS_FAILURE;
1135 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301136 limLog(pMac, LOG1, FL("Processed Offload Scan Request Successfully"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301137
1138 return eHAL_STATUS_SUCCESS;
1139}
Jeff Johnson295189b2012-06-20 16:38:30 -07001140
1141/**
1142 * __limProcessSmeScanReq()
1143 *
1144 *FUNCTION:
1145 * This function is called to process SME_SCAN_REQ message
1146 * from HDD or upper layer application.
1147 *
1148 *LOGIC:
1149 *
1150 *ASSUMPTIONS:
1151 *
1152 *NOTE:
1153 * 1. Periodic scanning should be requesting to return unique
1154 * scan results.
1155 *
1156 * @param pMac Pointer to Global MAC structure
1157 * @param *pMsgBuf A pointer to the SME message buffer
1158 * @return None
1159 */
1160
Viral Modid440e682013-03-06 02:25:31 -08001161static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001162__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1163{
1164 tANI_U32 len;
1165 tLimMlmScanReq *pMlmScanReq;
1166 tpSirSmeScanReq pScanReq;
1167 tANI_U8 i = 0;
1168
1169#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1170 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1171#endif //FEATURE_WLAN_DIAG_SUPPORT
1172
1173 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301174 limLog(pMac, LOG1, FL("SME SCAN REQ numChan %d min %d max %d IELen %d first %d fresh %d unique %d type %d mode %d rsp %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001175 pScanReq->channelList.numChannels,
1176 pScanReq->minChannelTime,
1177 pScanReq->maxChannelTime,
1178 pScanReq->uIEFieldLen,
1179 pScanReq->returnAfterFirstMatch,
1180 pScanReq->returnFreshResults,
1181 pScanReq->returnUniqueResults,
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001182 pScanReq->scanType,
1183 pScanReq->backgroundScanMode,
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301184 pMac->lim.gLimRspReqd ? 1 : 0);
Viral Modid86bde22012-12-10 13:09:21 -08001185
1186 /* Since scan req always requires a response, we will overwrite response required here.
1187 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1188 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1189 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1190 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1191 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1192 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1193 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1194 * the global flag gLimRspReqd to TRUE here.
1195 */
1196 pMac->lim.gLimRspReqd = TRUE;
1197
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301198 /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001199 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1200
1201 /* This routine should return the sme sessionId and SME transaction Id */
1202
1203 if (!limIsSmeScanReqValid(pMac, pScanReq))
1204 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301205 limLog(pMac, LOGE, FL("Received SME_SCAN_REQ with invalid parameters"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001206
1207 if (pMac->lim.gLimRspReqd)
1208 {
1209 pMac->lim.gLimRspReqd = false;
1210
1211 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1212
1213 } // if (pMac->lim.gLimRspReqd)
1214
1215 return;
1216 }
1217
1218 //if scan is disabled then return as invalid scan request.
1219 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1220 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1221 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301222 limLog(pMac, LOGE, FL("SCAN is disabled or SCAN in power save"
1223 " is disabled and system is in power save."));
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001224 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001225 return;
1226 }
1227
1228
1229 /**
1230 * If scan request is received in idle, joinFailed
1231 * states or in link established state (in STA role)
1232 * or in normal state (in STA-in-IBSS/AP role) with
1233 * 'return fresh scan results' request from HDD or
1234 * it is periodic background scanning request,
1235 * trigger fresh scan request to MLM
1236 */
1237 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1238 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301239 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1240 {
1241 // Discard previously cached scan results
1242 limReInitScanResults(pMac);
1243 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001244
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301245 pMac->lim.gLim24Band11dScanDone = 0;
1246 pMac->lim.gLim50Band11dScanDone = 0;
1247 pMac->lim.gLimReturnAfterFirstMatch =
1248 pScanReq->returnAfterFirstMatch;
1249 pMac->lim.gLimBackgroundScanMode =
1250 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001251
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301252 pMac->lim.gLimReturnUniqueResults =
1253 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1254 /* De-activate Heartbeat timers for connected sessions while
1255 * scan is in progress if the system is in Active mode *
1256 * AND it is not a ROAMING ("background") scan */
1257 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1258 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1259 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1260 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1261 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001262 for(i=0;i<pMac->lim.maxBssId;i++)
1263 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301264 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1265 (pMac->lim.gpSession[i].valid == TRUE) &&
1266 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1267 {
1268 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1269 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001270 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301271 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001272
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301273 if (pMac->fScanOffload)
1274 {
1275 if (eHAL_STATUS_SUCCESS !=
1276 limSendHalStartScanOffloadReq(pMac, pScanReq))
1277 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301278 limLog(pMac, LOGE, FL("Couldn't send Offload scan request"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301279 limSendSmeScanRsp(pMac,
1280 offsetof(tSirSmeScanRsp, bssDescription[0]),
1281 eSIR_SME_INVALID_PARAMETERS,
1282 pScanReq->sessionId,
1283 pScanReq->transactionId);
1284 return;
1285 }
1286 }
1287 else
1288 {
1289
1290 /*Change Global SME state */
1291 /* Store the previous SME state */
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301292 limLog(pMac, LOG1, FL("Non Offload SCAN request "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301293 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1294 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1295 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1296
1297 if (pScanReq->channelList.numChannels == 0)
1298 {
1299 tANI_U32 cfg_len;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301300
1301 limLog(pMac, LOG1,
1302 FL("Scan all channels as Number of channels is 0"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301303 // Scan all channels
1304 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001305 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1306 pScanReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301307 pMlmScanReq = vos_mem_malloc(len);
1308 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301309 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301310 // Log error
1311 limLog(pMac, LOGP,
1312 FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001313
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301314 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301315 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001316
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301317 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301318 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001319
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301320 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1321 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001322 pMlmScanReq->channelList.channelNumber,
1323 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301324 {
1325 /**
1326 * Could not get Valid channel list from CFG.
1327 * Log error.
1328 */
1329 limLog(pMac, LOGP,
1330 FL("could not retrieve Valid channel list"));
1331 }
1332 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
1333 }
1334 else
1335 {
1336 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1337 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1338 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001339
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301340 pMlmScanReq = vos_mem_malloc(len);
1341 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301342 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301343 // Log error
1344 limLog(pMac, LOGP,
1345 FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001346
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301347 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301348 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001349
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301350 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301351 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301352 pMlmScanReq->channelList.numChannels =
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301353 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001354
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301355 vos_mem_copy( pMlmScanReq->channelList.channelNumber,
1356 pScanReq->channelList.channelNumber,
1357 pScanReq->channelList.numChannels);
1358 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001359
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301360 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1361 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1362 if(pScanReq->uIEFieldLen)
1363 {
1364 vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1365 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1366 pScanReq->uIEFieldLen);
1367 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001368
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301369 pMlmScanReq->bssType = pScanReq->bssType;
1370 vos_mem_copy( pMlmScanReq->bssId,
1371 pScanReq->bssId,
1372 sizeof(tSirMacAddr));
1373 pMlmScanReq->numSsid = pScanReq->numSsid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001374
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301375 i = 0;
1376 while (i < pMlmScanReq->numSsid)
1377 {
1378 vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001379 (tANI_U8 *) &pScanReq->ssId[i],
1380 pScanReq->ssId[i].length + 1);
1381
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301382 i++;
1383 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001384
Jeff Johnson295189b2012-06-20 16:38:30 -07001385
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301386 pMlmScanReq->scanType = pScanReq->scanType;
1387 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
1388 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1389 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1390 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1391 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
1392 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1393 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001394
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301395 //Store the smeSessionID and transaction ID for later use.
1396 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1397 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001398
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301399 // Issue LIM_MLM_SCAN_REQ to MLM
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301400 limLog(pMac, LOG1, FL("Issue Scan request command to MLM "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301401 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1402 }
1403 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001404
1405 else
1406 {
1407 /// In all other cases return 'cached' scan results
1408 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1409 {
1410 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1411
1412 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001413#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1414 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001415 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001416 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1417 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1418 {
1419 limSendSmeLfrScanRsp(pMac, scanRspLen,
1420 eSIR_SME_SUCCESS,
1421 pScanReq->sessionId,
1422 pScanReq->transactionId);
1423 }
1424 else
1425 {
1426 scanRspLen = sizeof(tSirSmeScanRsp) +
1427 pMac->lim.gLimSmeLfrScanResultLength -
1428 sizeof(tSirBssDescription);
1429 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1430 pScanReq->sessionId, pScanReq->transactionId);
1431 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001432 }
1433 else
1434 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001435#endif
1436 if (pMac->lim.gLimSmeScanResultLength == 0)
1437 {
1438 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1439 pScanReq->sessionId, pScanReq->transactionId);
1440 }
1441 else
1442 {
1443 scanRspLen = sizeof(tSirSmeScanRsp) +
1444 pMac->lim.gLimSmeScanResultLength -
1445 sizeof(tSirBssDescription);
1446 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1447 pScanReq->sessionId, pScanReq->transactionId);
1448 }
1449#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001451#endif
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301452 limLog(pMac, LOG1, FL("Cached scan results are returned "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001453
1454 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1455 {
1456 // Discard previously cached scan results
1457 limReInitScanResults(pMac);
1458 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001459#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1460 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1461 {
1462 // Discard previously cached scan results
1463 limReInitLfrScanResults(pMac);
1464 }
1465#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001466
1467 } // if (pMac->lim.gLimRspReqd)
1468 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1469
Jeff Johnson295189b2012-06-20 16:38:30 -07001470#ifdef BACKGROUND_SCAN_ENABLED
1471 // start background scans if needed
1472 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1473 __limBackgroundScanInitiate(pMac);
1474#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001475
1476} /*** end __limProcessSmeScanReq() ***/
1477
Jeff Johnsone7245742012-09-05 17:12:55 -07001478#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001479
Jeff Johnsone7245742012-09-05 17:12:55 -07001480static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1481{
1482 tpSirOemDataReq pOemDataReq;
1483 tLimMlmOemDataReq* pMlmOemDataReq;
1484
1485 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1486
1487 //post the lim mlm message now
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301488 pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq));
1489 if ( NULL == pMlmOemDataReq )
Jeff Johnsone7245742012-09-05 17:12:55 -07001490 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301491 limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001492 return;
1493 }
1494
1495 //Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301496 vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001497
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301498 vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr,
1499 sizeof(tSirMacAddr));
1500 vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq,
1501 OEM_DATA_REQ_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001502
1503 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1504 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1505
1506 return;
1507
1508} /*** end __limProcessSmeOemDataReq() ***/
1509
1510#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001511
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301512/**
1513 * __limProcessClearDfsChannelList()
1514 *
1515 *FUNCTION:
1516 *Clear DFS channel list when country is changed/aquired.
1517.*This message is sent from SME.
1518 *
1519 *LOGIC:
1520 *
1521 *ASSUMPTIONS:
1522 *
1523 *NOTE:
1524 *
1525 * @param pMac Pointer to Global MAC structure
1526 * @param *pMsgBuf A pointer to the SME message buffer
1527 * @return None
1528 */
1529static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1530 tpSirMsgQ pMsg)
1531{
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301532 vos_mem_set( &pMac->lim.dfschannelList,
1533 sizeof(tSirDFSChannelList), 0);
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301534}
Jeff Johnson295189b2012-06-20 16:38:30 -07001535
1536/**
1537 * __limProcessSmeJoinReq()
1538 *
1539 *FUNCTION:
1540 * This function is called to process SME_JOIN_REQ message
1541 * from HDD or upper layer application.
1542 *
1543 *LOGIC:
1544 *
1545 *ASSUMPTIONS:
1546 *
1547 *NOTE:
1548 *
1549 * @param pMac Pointer to Global MAC structure
1550 * @param *pMsgBuf A pointer to the SME message buffer
1551 * @return None
1552 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001553static void
1554__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1555{
1556 // tANI_U8 *pBuf;
1557 //tANI_U32 len;
1558// tSirMacAddr currentBssId;
1559 tpSirSmeJoinReq pSmeJoinReq = NULL;
1560 tLimMlmJoinReq *pMlmJoinReq;
1561 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1562 tANI_U32 val = 0;
1563 tANI_U16 nSize;
1564 tANI_U8 sessionId;
1565 tpPESession psessionEntry = NULL;
1566 tANI_U8 smesessionId;
1567 tANI_U16 smetransactionId;
1568 tPowerdBm localPowerConstraint = 0, regMax = 0;
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301569 tANI_U16 ieLen;
1570 v_U8_t *vendorIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001571
1572#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1573 //Not sending any session, since it is not created yet. The response whould have correct state.
1574 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1575#endif //FEATURE_WLAN_DIAG_SUPPORT
1576
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001577 PELOG1(limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001578
1579#ifdef WLAN_FEATURE_VOWIFI
1580 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1581 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1582 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1583 * like not honoring power constraint on 1st association after driver loading. */
1584 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001585 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1587 val = 0;
1588#endif /* WLAN_FEATURE_VOWIFI */
1589
1590 /**
1591 * Expect Join request in idle state.
1592 * Reassociate request is expected in link established state.
1593 */
1594
1595 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1596 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1597 {
1598 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301599
1600 pSmeJoinReq = vos_mem_malloc(nSize);
1601 if ( NULL == pSmeJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001602 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301603 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1604 "pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001605 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1606 goto end;
1607 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301608 (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001609
Jeff Johnson295189b2012-06-20 16:38:30 -07001610 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1611 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1612 {
1613 /// Received invalid eWNI_SME_JOIN_REQ
1614 // Log the event
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301615 limLog(pMac, LOGW, FL("SessionId:%d Received SME_JOIN_REQ with"
1616 "invalid data"),pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001617 retCode = eSIR_SME_INVALID_PARAMETERS;
1618 goto end;
1619 }
1620
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301621 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23
Jeff Johnson295189b2012-06-20 16:38:30 -07001622
1623 /* check for the existence of start BSS session */
1624#ifdef FIXME_GEN6
1625 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1626 {
1627 if(peValidateBtJoinRequest(pMac)!= TRUE)
1628 {
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301629 limLog(pMac, LOGW, FL("SessionId:%d Start Bss session"
1630 "not present::SME_JOIN_REQ in unexpected state"),
1631 pSmeJoinReq->sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001632 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1633 psessionEntry = NULL;
1634 goto end;
1635 }
1636 }
1637
1638#endif
1639
1640
1641 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1642 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301643 limLog(pMac, LOGE, FL("Session(%d) Already exists for BSSID: "
1644 MAC_ADDRESS_STR" in limSmeState = %X"),sessionId,
1645 MAC_ADDR_ARRAY(pSmeJoinReq->bssDescription.bssId),
1646 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001647
1648 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1649 {
1650 // Received eWNI_SME_JOIN_REQ for same
1651 // BSS as currently associated.
1652 // Log the event and send success
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301653 PELOGW(limLog(pMac, LOGW, FL("SessionId:%d Received"
1654 "SME_JOIN_REQ for currently joined BSS"),sessionId);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001655 /// Send Join success response to host
Deepthi Gowrif3e27252013-12-11 20:50:01 +05301656 retCode = eSIR_SME_ALREADY_JOINED_A_BSS;
1657 psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001658 goto end;
1659 }
1660 else
1661 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301662 PELOGE(limLog(pMac, LOGE, FL("SME_JOIN_REQ not for"
1663 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001664 retCode = eSIR_SME_REFUSED;
1665 psessionEntry = NULL;
1666 goto end;
1667 }
1668 }
1669 else /* Session Entry does not exist for given BSSId */
1670 {
1671 /* Try to Create a new session */
1672 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1673 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001674 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001675 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1676 goto end;
1677 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301678 else
1679 limLog(pMac,LOG1,FL("SessionId:%d New session created"),
1680 sessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001681 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001682 handleHTCapabilityandHTInfo(pMac, psessionEntry);
krunal soni5afa96c2013-09-06 22:19:02 -07001683 psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
Jeff Johnsone7245742012-09-05 17:12:55 -07001684
Jeff Johnson295189b2012-06-20 16:38:30 -07001685 /* Store Session related parameters */
1686 /* Store PE session Id in session Table */
1687 psessionEntry->peSessionId = sessionId;
1688
1689 /* store the smejoin req handle in session table */
1690 psessionEntry->pLimJoinReq = pSmeJoinReq;
1691
1692 /* Store SME session Id in sessionTable */
1693 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1694
1695 /* Store SME transaction Id in session Table */
1696 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1697
1698 /* Store beaconInterval */
1699 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1700
1701 /* Copying of bssId is already done, while creating session */
1702 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1703 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1704 psessionEntry->bssType = pSmeJoinReq->bsstype;
1705
1706 psessionEntry->statypeForBss = STA_ENTRY_PEER;
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301707 psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled;
1708 psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001709
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301710 /* Store vendor specfic IE for CISCO AP */
1711 ieLen = (pSmeJoinReq->bssDescription.length +
1712 sizeof( pSmeJoinReq->bssDescription.length ) -
1713 GET_FIELD_OFFSET( tSirBssDescription, ieFields ));
1714
1715 vendorIE = limGetVendorIEOuiPtr(pMac, SIR_MAC_CISCO_OUI,
1716 SIR_MAC_CISCO_OUI_SIZE,
1717 ((tANI_U8 *)&pSmeJoinReq->bssDescription.ieFields) , ieLen);
1718
1719 if ( NULL != vendorIE )
1720 {
1721 limLog(pMac, LOGE,
1722 FL("DUT is trying to connect to Cisco AP"));
1723 psessionEntry->isCiscoVendorAP = TRUE;
1724 }
1725 else
1726 {
1727 psessionEntry->isCiscoVendorAP = FALSE;
1728 }
1729
Jeff Johnson295189b2012-06-20 16:38:30 -07001730 /* Copy the dot 11 mode in to the session table */
1731
1732 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1733 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001734#ifdef WLAN_FEATURE_11AC
1735 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001736 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001737 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001738 if (psessionEntry->vhtCapability )
1739 {
1740 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1741
1742 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001743 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001744 psessionEntry->txBFIniFeatureEnabled);
1745
1746 if( psessionEntry->txBFIniFeatureEnabled )
1747 {
1748 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1749 != eSIR_SUCCESS)
1750 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301751 limLog(pMac, LOGP, FL("could not set "
1752 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001753 retCode = eSIR_LOGP_EXCEPTION;
1754 goto end;
1755 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001756 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301757 "***__limProcessSmeJoinReq: txBFCsnValue=%d****",
1758 pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001759
1760 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001761 != eSIR_SUCCESS)
1762 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301763 limLog(pMac, LOGP, FL("could not set "
1764 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001765 retCode = eSIR_LOGP_EXCEPTION;
1766 goto end;
1767 }
1768 }
1769 }
1770
Jeff Johnsone7245742012-09-05 17:12:55 -07001771#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001772
1773 /*Phy mode*/
1774 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1775
1776 /* Copy The channel Id to the session Table */
1777 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001778 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1779 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1780 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001781
Chet Lanctot186b5732013-03-18 10:26:30 -07001782 /* Record if management frames need to be protected */
1783#ifdef WLAN_FEATURE_11W
1784 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1785 {
1786 psessionEntry->limRmfEnabled = 1;
1787 }
1788 else
1789 {
1790 psessionEntry->limRmfEnabled = 0;
1791 }
1792#endif
1793
krunal soni8d13b092013-07-19 13:23:29 -07001794#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1795 psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi;
1796#endif
1797
Jeff Johnson295189b2012-06-20 16:38:30 -07001798 /*Store Persona */
1799 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1800 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301801 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona,
1802 pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001803
1804 /* Copy the SSID from smejoinreq to session entry */
1805 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301806 vos_mem_copy( psessionEntry->ssId.ssId,
1807 pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length);
1808
1809 // Determin 11r or CCX connection based on input from SME
1810 // which inturn is dependent on the profile the user wants to connect
1811 // to, So input is coming from supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07001812#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301813 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001814#endif
1815#ifdef FEATURE_WLAN_CCX
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301816 psessionEntry->isCCXconnection = pSmeJoinReq->isCCXconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001817#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001818#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301819 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001820#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301821
Jeff Johnson43971f52012-07-17 12:26:56 -07001822#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301823 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
Jeff Johnson43971f52012-07-17 12:26:56 -07001824#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301825 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001826
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301827 if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001828 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301829 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1830 }
1831 else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1832 {
1833 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1834 }
1835 else
1836 {
1837 /* Throw an error and return and make sure to delete the session.*/
Abhishek Singh57aebef2014-02-03 18:47:44 +05301838 limLog(pMac, LOGE, FL("received SME_JOIN_REQ with invalid"
1839 " bss type %d"), psessionEntry->bssType);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301840 retCode = eSIR_SME_INVALID_PARAMETERS;
1841 goto end;
1842 }
1843
1844 if (pSmeJoinReq->addIEScan.length)
1845 {
1846 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan,
Jeff Johnson295189b2012-06-20 16:38:30 -07001847 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
1848 }
1849
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301850 if (pSmeJoinReq->addIEAssoc.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07001851 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301852 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc,
Jeff Johnson295189b2012-06-20 16:38:30 -07001853 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
1854 }
1855
Jeff Johnson295189b2012-06-20 16:38:30 -07001856 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301857 pMlmJoinReq = vos_mem_malloc(val);
1858 if ( NULL == pMlmJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001859 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301860 limLog(pMac, LOGP, FL("call to AllocateMemory "
1861 "failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001862 return;
1863 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301864 (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001865
1866 /* PE SessionId is stored as a part of JoinReq*/
1867 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
1868
1869 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
1870 != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001871 limLog(pMac, LOGP, FL("could not retrieve JoinFailureTimer value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001872
1873 /* copy operational rate from psessionEntry*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301874 vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001875 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301876 vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001877 sizeof(tSirMacRateSet));
1878 //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 +05301879 vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001880 sizeof(tSirMacRateSet));
1881
1882 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
1883
Jeff Johnson295189b2012-06-20 16:38:30 -07001884 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
1885
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301886 vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001887 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
1888 psessionEntry->pLimJoinReq->bssDescription.length + 2);
1889
Jeff Johnson295189b2012-06-20 16:38:30 -07001890 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07001891 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001892
Jeff Johnsone7245742012-09-05 17:12:55 -07001893 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
1894 localPowerConstraint = regMax;
1895 limExtractApCapability( pMac,
1896 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
1897 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
1898 &psessionEntry->limCurrentBssQosCaps,
1899 &psessionEntry->limCurrentBssPropCap,
1900 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07001901 , &localPowerConstraint,
1902 psessionEntry
Jeff Johnsone7245742012-09-05 17:12:55 -07001903 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001904#ifdef FEATURE_WLAN_CCX
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001905 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07001906#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301907 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001908#endif
1909#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05301910 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d,"
1911 " max tx = %d", regMax, localPowerConstraint,
1912 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07001913#endif
1914
1915 if (pMac->lim.gLimCurrentBssUapsd)
1916 {
1917 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301918 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
1919 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07001920
1921 // resetting the dynamic uapsd mask
1922 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
1923 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
1924 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001925
1926 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
1927
1928 // Initialize 11h Enable Flag
1929 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
1930 {
1931 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001932 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001933 psessionEntry->lim11hEnable = val;
1934 }
1935 else
1936 psessionEntry->lim11hEnable = 0;
1937
1938 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
1939 pMac->lim.gLimIbssCoalescingHappened = false;
1940
Jeff Johnsone7245742012-09-05 17:12:55 -07001941 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
1942 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
1943 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001944
Abhishek Singh57aebef2014-02-03 18:47:44 +05301945 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
1946 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
1947 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
1948 psessionEntry->currentOperChannel,
1949 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07001950
1951 /* Indicate whether spectrum management is enabled*/
1952 psessionEntry->spectrumMgtEnabled =
1953 pSmeJoinReq->spectrumMgtIndicator;
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301954 PELOG1(limLog(pMac,LOG1,FL("SessionId:%d MLM_JOIN_REQ is posted to MLM"
1955 "SM"),pMlmJoinReq->sessionId));
Jeff Johnson295189b2012-06-20 16:38:30 -07001956 /* Issue LIM_MLM_JOIN_REQ to MLM */
1957 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
1958 return;
1959
1960 }
1961 else
1962 {
1963 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05301964 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
1965 "in state %X"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001966 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
1967 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1968 psessionEntry = NULL;
1969 goto end;
1970
1971 }
1972
1973end:
1974 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1975
1976 if(pSmeJoinReq)
1977 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301978 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001979 pSmeJoinReq = NULL;
1980 if (NULL != psessionEntry)
1981 {
1982 psessionEntry->pLimJoinReq = NULL;
1983 }
1984 }
1985
1986 if(retCode != eSIR_SME_SUCCESS)
1987 {
1988 if(NULL != psessionEntry)
1989 {
1990 peDeleteSession(pMac,psessionEntry);
1991 psessionEntry = NULL;
1992 }
1993 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05301994 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
1995 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001996 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
1997} /*** end __limProcessSmeJoinReq() ***/
1998
1999
2000#ifdef FEATURE_WLAN_CCX
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08002001tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07002002{
2003 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302004 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002005 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07002006 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2007 maxTxPower = txPower;
2008 else if (txPower < MIN_TX_PWR_CAP)
2009 maxTxPower = MIN_TX_PWR_CAP;
2010 else
2011 maxTxPower = MAX_TX_PWR_CAP;
2012
2013 return (maxTxPower);
2014}
2015#endif
2016
Jeff Johnson295189b2012-06-20 16:38:30 -07002017/**
2018 * __limProcessSmeReassocReq()
2019 *
2020 *FUNCTION:
2021 * This function is called to process SME_REASSOC_REQ message
2022 * from HDD or upper layer application.
2023 *
2024 *LOGIC:
2025 *
2026 *ASSUMPTIONS:
2027 *
2028 *NOTE:
2029 *
2030 * @param pMac Pointer to Global MAC structure
2031 * @param *pMsgBuf A pointer to the SME message buffer
2032 * @return None
2033 */
2034
2035static void
2036__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2037{
2038 tANI_U16 caps;
2039 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002040 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002041 tLimMlmReassocReq *pMlmReassocReq;
2042 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2043 tpPESession psessionEntry = NULL;
2044 tANI_U8 sessionId;
2045 tANI_U8 smeSessionId;
2046 tANI_U16 transactionId;
2047 tPowerdBm localPowerConstraint = 0, regMax = 0;
2048 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002049 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002050
2051
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002052 PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002053
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002054 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302055 pReassocReq = vos_mem_malloc(nSize);
2056 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002057 {
2058 // Log error
2059 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302060 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002061
2062 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2063 goto end;
2064 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302065 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2067 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2068 (!limIsSmeJoinReqValid(pMac,
2069 (tpSirSmeJoinReq) pReassocReq)))
2070 {
2071 /// Received invalid eWNI_SME_REASSOC_REQ
2072 // Log the event
2073 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002074 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002075
2076 retCode = eSIR_SME_INVALID_PARAMETERS;
2077 goto end;
2078 }
2079
2080 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2081 {
2082 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002083 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002084 retCode = eSIR_SME_INVALID_PARAMETERS;
2085 goto end;
2086 }
2087
2088#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2089 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2090#endif //FEATURE_WLAN_DIAG_SUPPORT
2091 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2092
2093 /* Store the reassoc handle in the session Table.. 23rd sep review */
2094 psessionEntry->pLimReAssocReq = pReassocReq;
2095
2096 /**
2097 * Reassociate request is expected
2098 * in link established state only.
2099 */
2100
2101 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2102 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002103#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002104 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2105 {
2106 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002107 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 psessionEntry->peSessionId);
2109
2110 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302111 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002112 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2113 {
2114 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2115 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002116 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002117 retCode = eSIR_SME_INVALID_PARAMETERS;
2118 goto end;
2119 }
2120
2121 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2122 return;
2123 }
2124#endif
2125 /// Should not have received eWNI_SME_REASSOC_REQ
2126 // Log the event
2127 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002128 FL("received unexpected SME_REASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002129 psessionEntry->limSmeState);
2130 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2131
2132 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2133 goto end;
2134 }
2135
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302136 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2138 sizeof(tSirMacAddr));
2139
2140 psessionEntry->limReassocChannelId =
2141 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2142
Jeff Johnsone7245742012-09-05 17:12:55 -07002143 psessionEntry->reAssocHtSupportedChannelWidthSet =
2144 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2145 psessionEntry->reAssocHtRecommendedTxWidthSet =
2146 psessionEntry->reAssocHtSupportedChannelWidthSet;
2147 psessionEntry->reAssocHtSecondaryChannelOffset =
2148 psessionEntry->pLimReAssocReq->cbMode;
2149
Jeff Johnson295189b2012-06-20 16:38:30 -07002150 psessionEntry->limReassocBssCaps =
2151 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002152 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2153 localPowerConstraint = regMax;
2154 limExtractApCapability( pMac,
2155 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2156 limGetIElenFromBssDescription(
2157 &psessionEntry->pLimReAssocReq->bssDescription),
2158 &psessionEntry->limReassocBssQosCaps,
2159 &psessionEntry->limReassocBssPropCap,
2160 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002161 , &localPowerConstraint,
2162 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002163 );
2164
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302165 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002166#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302167 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2168 "= %d, max tx = %d", regMax, localPowerConstraint,
2169 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002170#endif
2171 {
2172 #if 0
2173 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2174 &cfgLen) != eSIR_SUCCESS)
2175 {
2176 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002177 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002178 }
2179 #endif//TO SUPPORT BT-AMP
2180
2181 /* Copy the SSID from sessio entry to local variable */
2182 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302183 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 psessionEntry->ssId.ssId,
2185 psessionEntry->ssId.length);
2186 #endif
2187 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302188 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2190
2191 }
2192
2193 if (pMac->lim.gLimCurrentBssUapsd)
2194 {
2195 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302196 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2197 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 }
2199
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302200 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2201 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002202 {
2203 // Log error
2204 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302205 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002206
2207 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2208 goto end;
2209 }
2210
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302211 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 psessionEntry->limReAssocbssId,
2213 sizeof(tSirMacAddr));
2214
2215 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2216 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2217 != eSIR_SUCCESS)
2218 {
2219 /**
2220 * Could not get ReassocFailureTimeout value
2221 * from CFG. Log error.
2222 */
2223 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002224 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 }
2226
2227 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2228 {
2229 /**
2230 * Could not get Capabilities value
2231 * from CFG. Log error.
2232 */
2233 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002234 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 }
2236 pMlmReassocReq->capabilityInfo = caps;
2237
2238 /* Update PE sessionId*/
2239 pMlmReassocReq->sessionId = sessionId;
2240
2241 /* If telescopic beaconing is enabled, set listen interval to
2242 WNI_CFG_TELE_BCN_MAX_LI */
2243 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2244 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002245 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002246
2247 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2248
2249 if(teleBcnEn)
2250 {
2251 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2252 eSIR_SUCCESS)
2253 {
2254 /**
2255 * Could not get ListenInterval value
2256 * from CFG. Log error.
2257 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002258 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002259 }
2260 }
2261 else
2262 {
2263 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2264 {
2265 /**
2266 * Could not get ListenInterval value
2267 * from CFG. Log error.
2268 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002269 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002270 }
2271 }
2272
2273 /* Delete all BA sessions before Re-Assoc.
2274 * BA frames are class 3 frames and the session
2275 * is lost upon disassociation and reassociation.
2276 */
2277
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07002278 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS);
Jeff Johnson295189b2012-06-20 16:38:30 -07002279
2280 pMlmReassocReq->listenInterval = (tANI_U16) val;
2281
2282 /* Indicate whether spectrum management is enabled*/
2283 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2284
2285 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2286 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2287
Jeff Johnsone7245742012-09-05 17:12:55 -07002288 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002289
2290 limPostMlmMessage(pMac,
2291 LIM_MLM_REASSOC_REQ,
2292 (tANI_U32 *) pMlmReassocReq);
2293 return;
2294
2295end:
2296 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302297 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002298
2299 if (psessionEntry)
2300 {
2301 // error occurred after we determined the session so extract
2302 // session and transaction info from there
2303 smeSessionId = psessionEntry->smeSessionId;
2304 transactionId = psessionEntry->transactionId;
2305 }
2306 else
2307 {
2308 // error occurred before or during the time we determined the session
2309 // so extract the session and transaction info from the message
2310 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2311 }
2312
2313 /// Send Reassoc failure response to host
2314 /// (note psessionEntry may be NULL, but that's OK)
2315 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2316 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2317 psessionEntry, smeSessionId, transactionId);
2318
2319} /*** end __limProcessSmeReassocReq() ***/
2320
2321
2322tANI_BOOLEAN sendDisassocFrame = 1;
2323/**
2324 * __limProcessSmeDisassocReq()
2325 *
2326 *FUNCTION:
2327 * This function is called to process SME_DISASSOC_REQ message
2328 * from HDD or upper layer application.
2329 *
2330 *LOGIC:
2331 *
2332 *ASSUMPTIONS:
2333 *
2334 *NOTE:
2335 *
2336 * @param pMac Pointer to Global MAC structure
2337 * @param *pMsgBuf A pointer to the SME message buffer
2338 * @return None
2339 */
2340
2341static void
2342__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2343{
2344 tANI_U16 disassocTrigger, reasonCode;
2345 tLimMlmDisassocReq *pMlmDisassocReq;
2346 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002347 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002348 tSirSmeDisassocReq smeDisassocReq;
2349 tpPESession psessionEntry = NULL;
2350 tANI_U8 sessionId;
2351 tANI_U8 smesessionId;
2352 tANI_U16 smetransactionId;
2353
Jeff Johnson295189b2012-06-20 16:38:30 -07002354
Jeff Johnson43971f52012-07-17 12:26:56 -07002355 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002356 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002357 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002358 return;
2359 }
2360
Jeff Johnson43971f52012-07-17 12:26:56 -07002361 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002362
Jeff Johnson43971f52012-07-17 12:26:56 -07002363 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002364
Jeff Johnson43971f52012-07-17 12:26:56 -07002365 if ( (eSIR_FAILURE == status) ||
2366 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002367 {
2368 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002369 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002370
2371 if (pMac->lim.gLimRspReqd)
2372 {
2373 pMac->lim.gLimRspReqd = false;
2374
2375 retCode = eSIR_SME_INVALID_PARAMETERS;
2376 disassocTrigger = eLIM_HOST_DISASSOC;
2377 goto sendDisassoc;
2378 }
2379
2380 return;
2381 }
2382
Jeff Johnson295189b2012-06-20 16:38:30 -07002383 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2384 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302385 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2386 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002387 retCode = eSIR_SME_INVALID_PARAMETERS;
2388 disassocTrigger = eLIM_HOST_DISASSOC;
2389 goto sendDisassoc;
2390
2391 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302392 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2393 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2394 smesessionId,psessionEntry->limSystemRole,
2395 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2396 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002397
2398#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2399 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2400#endif //FEATURE_WLAN_DIAG_SUPPORT
2401
2402 /* Update SME session Id and SME transaction ID*/
2403
2404 psessionEntry->smeSessionId = smesessionId;
2405 psessionEntry->transactionId = smetransactionId;
2406
2407 switch (psessionEntry->limSystemRole)
2408 {
2409 case eLIM_STA_ROLE:
2410 case eLIM_BT_AMP_STA_ROLE:
2411 switch (psessionEntry->limSmeState)
2412 {
2413 case eLIM_SME_ASSOCIATED_STATE:
2414 case eLIM_SME_LINK_EST_STATE:
2415 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2416 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002417#ifdef FEATURE_WLAN_TDLS
2418 /* Delete all TDLS peers connected before leaving BSS*/
2419 limDeleteTDLSPeers(pMac, psessionEntry);
2420#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002421 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302422 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2423 "limSmeState: %d "),psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 break;
2425
2426 case eLIM_SME_WT_DEAUTH_STATE:
2427 /* PE shall still process the DISASSOC_REQ and proceed with
2428 * link tear down even if it had already sent a DEAUTH_IND to
2429 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2430 * its been set when PE entered WT_DEAUTH_STATE.
2431 */
2432 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002433 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302434 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2435 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002436 break;
2437
2438 case eLIM_SME_WT_DISASSOC_STATE:
2439 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2440 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2441 * PE can continue processing DISASSOC_REQ and send the response instead
2442 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2443 * for disassoc frame.
2444 *
2445 * It will send a disassoc, which is ok. However, we can use the global flag
2446 * sendDisassoc to not send disassoc frame.
2447 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302448 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2449 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002450 break;
2451
2452 case eLIM_SME_JOIN_FAILURE_STATE: {
2453 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302454 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2455 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002456 if (pMac->lim.gLimRspReqd) {
2457 retCode = eSIR_SME_SUCCESS;
2458 disassocTrigger = eLIM_HOST_DISASSOC;
2459 goto sendDisassoc;
2460 }
2461 }break;
2462 default:
2463 /**
2464 * STA is not currently associated.
2465 * Log error and send response to host
2466 */
2467 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002468 FL("received unexpected SME_DISASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002469 psessionEntry->limSmeState);
2470 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2471
2472 if (pMac->lim.gLimRspReqd)
2473 {
2474 if (psessionEntry->limSmeState !=
2475 eLIM_SME_WT_ASSOC_STATE)
2476 pMac->lim.gLimRspReqd = false;
2477
2478 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2479 disassocTrigger = eLIM_HOST_DISASSOC;
2480 goto sendDisassoc;
2481 }
2482
2483 return;
2484 }
2485
2486 break;
2487
2488 case eLIM_AP_ROLE:
2489 case eLIM_BT_AMP_AP_ROLE:
2490 // Fall through
2491 break;
2492
2493 case eLIM_STA_IN_IBSS_ROLE:
2494 default: // eLIM_UNKNOWN_ROLE
2495 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002496 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002497 psessionEntry->limSystemRole);
2498
2499 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2500 disassocTrigger = eLIM_HOST_DISASSOC;
2501 goto sendDisassoc;
2502 } // end switch (pMac->lim.gLimSystemRole)
2503
2504 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2505 {
2506 /// Disassociation is triggered by Link Monitoring
Abhishek Singhcd09b562013-12-24 16:02:20 +05302507 limLog(pMac, LOG1, FL("**** Lost link with AP ****"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002508 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2509 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2510 }
2511 else
2512 {
2513 disassocTrigger = eLIM_HOST_DISASSOC;
2514 reasonCode = smeDisassocReq.reasonCode;
2515 }
2516
2517 if (smeDisassocReq.doNotSendOverTheAir)
2518 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302519 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002520 sendDisassocFrame = 0;
2521 }
2522 // Trigger Disassociation frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302523
2524 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2525 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002526 {
2527 // Log error
2528 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302529 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002530
2531 return;
2532 }
2533
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302534 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002535 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2536 sizeof(tSirMacAddr));
2537
2538 pMlmDisassocReq->reasonCode = reasonCode;
2539 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2540
2541 /* Update PE session ID*/
2542 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002543
2544 limPostMlmMessage(pMac,
2545 LIM_MLM_DISASSOC_REQ,
2546 (tANI_U32 *) pMlmDisassocReq);
2547 return;
2548
2549sendDisassoc:
2550 if (psessionEntry)
2551 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2552 retCode,
2553 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002554 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002555 else
2556 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2557 retCode,
2558 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002559 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002560
2561
2562} /*** end __limProcessSmeDisassocReq() ***/
2563
2564
2565/** -----------------------------------------------------------------
2566 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2567
2568 This function is called to process SME_DISASSOC_CNF message
2569 from HDD or upper layer application.
2570
2571 \param pMac - global mac structure
2572 \param pStaDs - station dph hash node
2573 \return none
2574 \sa
2575 ----------------------------------------------------------------- */
2576static void
2577__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2578{
2579 tSirSmeDisassocCnf smeDisassocCnf;
2580 tANI_U16 aid;
2581 tpDphHashNode pStaDs;
2582 tSirRetStatus status = eSIR_SUCCESS;
2583 tpPESession psessionEntry;
2584 tANI_U8 sessionId;
2585
2586
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002587 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002588
2589 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2590
2591 if (status == eSIR_FAILURE)
2592 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002593 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002594 return;
2595 }
2596
2597 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2598 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002599 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002600 return;
2601 }
2602
2603 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2604 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302605 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002606 return;
2607 }
2608
2609#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2610 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2611 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2612 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2613 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2614#endif //FEATURE_WLAN_DIAG_SUPPORT
2615
2616 switch (psessionEntry->limSystemRole)
2617 {
2618 case eLIM_STA_ROLE:
2619 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2620 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2621 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2622 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2623 {
2624 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002625 FL("received unexp SME_DISASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002626 psessionEntry->limSmeState);
2627 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2628 return;
2629 }
2630 break;
2631
2632 case eLIM_AP_ROLE:
2633 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002634 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002635
2636 case eLIM_STA_IN_IBSS_ROLE:
2637 default: // eLIM_UNKNOWN_ROLE
2638 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002639 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002640 psessionEntry->limSystemRole);
2641
2642 return;
2643 }
2644
2645
2646 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2647 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002648 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002649 )
2650 {
2651 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2652 if (pStaDs == NULL)
2653 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302654 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2655 "does not have context, addr= "MAC_ADDRESS_STR),
2656 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002657 return;
2658 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002659 /* Delete FT session if there exists one */
2660 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002662
2663 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002664 }
2665
2666 return;
2667}
2668
2669
2670/**
2671 * __limProcessSmeDeauthReq()
2672 *
2673 *FUNCTION:
2674 * This function is called to process SME_DEAUTH_REQ message
2675 * from HDD or upper layer application.
2676 *
2677 *LOGIC:
2678 *
2679 *ASSUMPTIONS:
2680 *
2681 *NOTE:
2682 *
2683 * @param pMac Pointer to Global MAC structure
2684 * @param *pMsgBuf A pointer to the SME message buffer
2685 * @return None
2686 */
2687
2688static void
2689__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2690{
2691 tANI_U16 deauthTrigger, reasonCode;
2692 tLimMlmDeauthReq *pMlmDeauthReq;
2693 tSirSmeDeauthReq smeDeauthReq;
2694 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2695 tSirRetStatus status = eSIR_SUCCESS;
2696 tpPESession psessionEntry;
2697 tANI_U8 sessionId; //PE sessionId
2698 tANI_U8 smesessionId;
2699 tANI_U16 smetransactionId;
2700
Jeff Johnson295189b2012-06-20 16:38:30 -07002701
2702 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002703 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2704
2705 //We need to get a session first but we don't even know if the message is correct.
2706 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2707 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002708 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002709 retCode = eSIR_SME_INVALID_PARAMETERS;
2710 deauthTrigger = eLIM_HOST_DEAUTH;
2711 goto sendDeauth;
2712
2713 }
2714
2715 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2716 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002717 PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002718 if (pMac->lim.gLimRspReqd)
2719 {
2720 pMac->lim.gLimRspReqd = false;
2721
2722 retCode = eSIR_SME_INVALID_PARAMETERS;
2723 deauthTrigger = eLIM_HOST_DEAUTH;
2724 goto sendDeauth;
2725 }
2726
2727 return;
2728 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302729 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2730 "Systemrole %d with reasoncode %u in limSmestate %d from "
2731 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2732 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2733 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002734#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2735 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2736#endif //FEATURE_WLAN_DIAG_SUPPORT
2737
2738 /* Update SME session ID and Transaction ID */
2739 psessionEntry->smeSessionId = smesessionId;
2740 psessionEntry->transactionId = smetransactionId;
2741
2742
2743 switch (psessionEntry->limSystemRole)
2744 {
2745 case eLIM_STA_ROLE:
2746 case eLIM_BT_AMP_STA_ROLE:
2747
2748 switch (psessionEntry->limSmeState)
2749 {
2750 case eLIM_SME_ASSOCIATED_STATE:
2751 case eLIM_SME_LINK_EST_STATE:
2752 case eLIM_SME_WT_ASSOC_STATE:
2753 case eLIM_SME_JOIN_FAILURE_STATE:
2754 case eLIM_SME_IDLE_STATE:
2755 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2756 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002757 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002758
2759 // Send Deauthentication request to MLM below
2760
2761 break;
2762
2763 default:
2764 /**
2765 * STA is not in a state to deauthenticate with
2766 * peer. Log error and send response to host.
2767 */
2768 limLog(pMac, LOGE,
Abhishek Singhcd09b562013-12-24 16:02:20 +05302769 FL("received unexp SME_DEAUTH_REQ in state %X"),
2770 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002771 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2772
2773 if (pMac->lim.gLimRspReqd)
2774 {
2775 pMac->lim.gLimRspReqd = false;
2776
2777 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2778 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08002779 /**
2780 *here we received deauth request from AP so sme state is
2781 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
2782 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
2783 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
2784 so the below condition captures the state where delSta
2785 not done and firmware still in connected state.
2786 */
2787 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
2788 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
2789 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
2790 {
2791 retCode = eSIR_SME_DEAUTH_STATUS;
2792 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002793 goto sendDeauth;
2794 }
2795
2796 return;
2797 }
2798
2799 break;
2800
2801 case eLIM_STA_IN_IBSS_ROLE:
2802
2803 return;
2804
2805 case eLIM_AP_ROLE:
2806 // Fall through
2807
2808 break;
2809
2810 default:
2811 limLog(pMac, LOGE,
Abhishek Singhcd09b562013-12-24 16:02:20 +05302812 FL("received unexpected SME_DEAUTH_REQ for role %X"),
2813 psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07002814
2815 return;
2816 } // end switch (pMac->lim.gLimSystemRole)
2817
2818 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
2819 {
2820 /// Deauthentication is triggered by Link Monitoring
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002821 PELOG1(limLog(pMac, LOG1, FL("**** Lost link with AP ****"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002822 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
2823 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
2824 }
2825 else
2826 {
2827 deauthTrigger = eLIM_HOST_DEAUTH;
2828 reasonCode = smeDeauthReq.reasonCode;
2829 }
2830
2831 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302832 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
2833 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002834 {
2835 // Log error
2836 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302837 FL("call to AllocateMemory failed for mlmDeauthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002838
2839 return;
2840 }
2841
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302842 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002843 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
2844 sizeof(tSirMacAddr));
2845
2846 pMlmDeauthReq->reasonCode = reasonCode;
2847 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07002848
2849 /* Update PE session Id*/
2850 pMlmDeauthReq->sessionId = sessionId;
2851
2852 limPostMlmMessage(pMac,
2853 LIM_MLM_DEAUTH_REQ,
2854 (tANI_U32 *) pMlmDeauthReq);
2855 return;
2856
2857sendDeauth:
2858 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
2859 retCode,
2860 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002861 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002862 smesessionId, smetransactionId);
2863} /*** end __limProcessSmeDeauthReq() ***/
2864
2865
2866
2867/**
2868 * __limProcessSmeSetContextReq()
2869 *
2870 *FUNCTION:
2871 * This function is called to process SME_SETCONTEXT_REQ message
2872 * from HDD or upper layer application.
2873 *
2874 *LOGIC:
2875 *
2876 *ASSUMPTIONS:
2877 *
2878 *NOTE:
2879 *
2880 * @param pMac Pointer to Global MAC structure
2881 * @param *pMsgBuf A pointer to the SME message buffer
2882 * @return None
2883 */
2884
2885static void
2886__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2887{
2888 tpSirSmeSetContextReq pSetContextReq;
2889 tLimMlmSetKeysReq *pMlmSetKeysReq;
2890 tpPESession psessionEntry;
2891 tANI_U8 sessionId; //PE sessionID
2892 tANI_U8 smesessionId;
2893 tANI_U16 smetransactionId;
2894
2895
2896 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002897 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07002898
2899
2900 if(pMsgBuf == NULL)
2901 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002902 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002903 return;
2904 }
2905
2906 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302907
2908 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
2909 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002910 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302911 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002912 return;
2913 }
2914
2915 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2916 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
2917 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002918 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002919 goto end;
2920 }
2921
2922 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2923 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002924 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 -07002925 limSendSmeSetContextRsp(pMac,
2926 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002927 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002928 eSIR_SME_INVALID_PARAMETERS,NULL,
2929 smesessionId,smetransactionId);
2930
2931 goto end;
2932 }
2933
2934
2935 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
2936 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002937 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 limSendSmeSetContextRsp(pMac,
2939 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002940 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002941 eSIR_SME_INVALID_PARAMETERS,NULL,
2942 smesessionId,smetransactionId);
2943
2944 goto end;
2945 }
2946
2947#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2948 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
2949#endif //FEATURE_WLAN_DIAG_SUPPORT
2950
2951
2952 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2953 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
2954 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
2955 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
2956 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
2957 {
2958 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302959 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
2960 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002961 {
2962 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302963 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002964 goto end;
2965 }
2966
2967 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
2968 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
2969 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2970 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002971 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002972 goto end;
2973 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302974 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002975 (tANI_U8 *) &pSetContextReq->peerMacAddr,
2976 sizeof(tSirMacAddr));
2977
Jeff Johnson295189b2012-06-20 16:38:30 -07002978
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302979 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07002980 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
2981 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
2982
2983 pMlmSetKeysReq->sessionId = sessionId;
2984#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
2985 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002986 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07002987#endif
2988
Jeff Johnson295189b2012-06-20 16:38:30 -07002989 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
2990 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
2991 {
2992 if(pSetContextReq->keyMaterial.key[0].keyLength)
2993 {
2994 tANI_U8 keyId;
2995 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302996 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07002997 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
2998 }
2999 else {
3000 tANI_U32 i;
3001 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3002 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303003 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003004 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3005 }
3006 }
3007 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003008
3009 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003010 }
3011 else
3012 {
3013 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003014 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003015 psessionEntry->limSystemRole,
3016 psessionEntry->limSmeState);
3017 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3018
3019 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003020 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003021 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3022 smesessionId,
3023 smetransactionId);
3024 }
3025
3026end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303027 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003028 return;
3029} /*** end __limProcessSmeSetContextReq() ***/
3030
3031/**
3032 * __limProcessSmeRemoveKeyReq()
3033 *
3034 *FUNCTION:
3035 * This function is called to process SME_REMOVEKEY_REQ message
3036 * from HDD or upper layer application.
3037 *
3038 *LOGIC:
3039 *
3040 *ASSUMPTIONS:
3041 *
3042 *NOTE:
3043 *
3044 * @param pMac Pointer to Global MAC structure
3045 * @param *pMsgBuf A pointer to the SME message buffer
3046 * @return None
3047 */
3048
3049static void
3050__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3051{
3052 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3053 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3054 tpPESession psessionEntry;
3055 tANI_U8 sessionId; //PE sessionID
3056 tANI_U8 smesessionId;
3057 tANI_U16 smetransactionId;
3058
3059 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003060 FL("received REMOVEKEY_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003061
3062 if(pMsgBuf == NULL)
3063 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003064 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003065 return;
3066 }
3067
3068
3069 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3070
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303071 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3072 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003073 {
3074 //Log error
3075 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303076 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003077
3078 return;
3079 }
3080
3081 if ((limRemoveKeyReqSerDes(pMac,
3082 pRemoveKeyReq,
3083 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3084 {
3085 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003086 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003087
3088 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3089
3090 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3091 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003092 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003093 //goto end;
3094 }
3095
3096 limSendSmeRemoveKeyRsp(pMac,
3097 pRemoveKeyReq->peerMacAddr,
3098 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3099 smesessionId,smetransactionId);
3100
3101 goto end;
3102 }
3103
3104 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3105 {
3106 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003107 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003108 limSendSmeRemoveKeyRsp(pMac,
3109 pRemoveKeyReq->peerMacAddr,
3110 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3111 smesessionId, smetransactionId);
3112 goto end;
3113 }
3114
3115
3116 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3117 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3118 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3119 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3120 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3121 {
3122 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303123 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3124 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003125 {
3126 // Log error
3127 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303128 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003129
3130 goto end;
3131 }
3132
3133 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3134 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3135 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3136 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3137
3138 /* Update PE session Id */
3139 pMlmRemoveKeyReq->sessionId = sessionId;
3140
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303141 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003142 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3143 sizeof(tSirMacAddr));
3144
3145
3146 limPostMlmMessage(pMac,
3147 LIM_MLM_REMOVEKEY_REQ,
3148 (tANI_U32 *) pMlmRemoveKeyReq);
3149 }
3150 else
3151 {
3152 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003153 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003154 psessionEntry->limSystemRole,
3155 psessionEntry->limSmeState);
3156 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3157
3158 limSendSmeRemoveKeyRsp(pMac,
3159 pRemoveKeyReq->peerMacAddr,
3160 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3161 smesessionId,smetransactionId);
3162 }
3163
3164end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303165 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003166} /*** end __limProcessSmeRemoveKeyReq() ***/
3167
Jeff Johnson295189b2012-06-20 16:38:30 -07003168void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3169{
3170 tSirMsgQ mmhMsg;
3171 tpSmeGetScanChnRsp pSirSmeRsp;
3172 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303173 tANI_U8 sessionId;
3174 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003175
3176 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3177 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003178 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003179 pMac->lim.scanChnInfo.numChnInfo);
3180 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3181 }
3182
3183 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003184 FL("Sending message %s with number of channels %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003185 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);)
3186
3187 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303188 pSirSmeRsp = vos_mem_malloc(len);
3189 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003190 {
3191 /// Buffer not available. Log error
3192 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303193 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003194
3195 return;
3196 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303197 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003198
Jeff Johnson295189b2012-06-20 16:38:30 -07003199 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3200 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303201
3202 if (pMac->fScanOffload)
3203 {
3204 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3205 pSirSmeRsp->sessionId = sessionId;
3206 }
3207 else
3208 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003209
3210 if(pMac->lim.scanChnInfo.numChnInfo)
3211 {
3212 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303213 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3214 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003215 }
3216 //Clear the list
3217 limRessetScanChannelInfo(pMac);
3218
3219 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3220 mmhMsg.bodyptr = pSirSmeRsp;
3221 mmhMsg.bodyval = 0;
3222
3223 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003224 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003225 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3226}
3227
3228
Jeff Johnson295189b2012-06-20 16:38:30 -07003229void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3230{
3231 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3232 tpDphHashNode pStaDs = NULL;
3233 tpPESession psessionEntry = NULL;
3234 tSap_Event sapEvent;
3235 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3236 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3237 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3238 tANI_U8 assocId = 0;
3239 tANI_U8 staCount = 0;
3240
3241 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3242 {
3243 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003244 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003245 goto limAssocStaEnd;
3246 }
3247
3248 switch (getAssocSTAsReq.modId)
3249 {
3250/**
3251 case VOS_MODULE_ID_HAL:
3252 wdaPostCtrlMsg( pMac, &msgQ );
3253 return;
3254
3255 case VOS_MODULE_ID_TL:
3256 Post msg TL
3257 return;
3258*/
3259 case VOS_MODULE_ID_PE:
3260 default:
3261 break;
3262 }
3263
Jeff Johnson1250df42012-12-10 14:31:52 -08003264 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003265 // Find PE session Entry
3266 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3267 {
3268 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003269 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003270 goto limAssocStaEnd;
3271 }
3272
3273 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3274 {
3275 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003276 FL("Received unexpected message in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303277 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003278 goto limAssocStaEnd;
3279 }
3280
3281 // Retrieve values obtained in the request message
3282 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3283 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3284
3285 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3286 {
3287 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3288
3289 if (NULL == pStaDs)
3290 continue;
3291
3292 if (pStaDs->valid)
3293 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303294 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3295 (tANI_U8 *)&pStaDs->staAddr,
3296 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003297 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3298 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3299
Kiet Lamb1233192013-11-28 13:38:20 +05303300 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003301 (tANI_U8 *)&pStaDs->supportedRates,
3302 sizeof(tSirSupportedRates));
3303 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3304 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3305 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3306
Jeff Johnson295189b2012-06-20 16:38:30 -07003307 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003308 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3309 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003310 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3311 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3312
3313 pAssocStasTemp++;
3314 staCount++;
3315 }
3316 }
3317
3318limAssocStaEnd:
3319 // Call hdd callback with sap event to send the list of associated stations from PE
3320 if (pSapEventCallback != NULL)
3321 {
3322 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3323 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3324 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3325 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3326 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3327 }
3328}
3329
3330
3331/**
3332 * limProcessSmeGetWPSPBCSessions
3333 *
3334 *FUNCTION:
3335 * This function is called when query the WPS PBC overlap message is received
3336 *
3337 *LOGIC:
3338 * This function parses get WPS PBC overlap information message and call callback to pass
3339 * WPS PBC overlap information back to hdd.
3340 *ASSUMPTIONS:
3341 *
3342 *
3343 *NOTE:
3344 *
3345 * @param pMac Pointer to Global MAC structure
3346 * @param pMsgBuf A pointer to WPS PBC overlap query message
3347*
3348 * @return None
3349 */
3350void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3351{
3352 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3353 tpPESession psessionEntry = NULL;
3354 tSap_Event sapEvent;
3355 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3356 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3357 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3358
3359 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3360
3361 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3362 {
3363 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003364 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003365 goto limGetWPSPBCSessionsEnd;
3366 }
3367
Jeff Johnson1250df42012-12-10 14:31:52 -08003368 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003369 // Find PE session Entry
3370 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3371 {
3372 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003373 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003374 goto limGetWPSPBCSessionsEnd;
3375 }
3376
3377 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3378 {
3379 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003380 FL("Received unexpected message in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003381 psessionEntry->limSystemRole);
3382 goto limGetWPSPBCSessionsEnd;
3383 }
3384
Jeff Johnson1250df42012-12-10 14:31:52 -08003385 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003386 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3387 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3388
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303389 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003390 { //This is GetWpsSession call
3391
3392 limGetWPSPBCSessions(pMac,
3393 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3394 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3395 }
3396 else
3397 {
3398 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3399 /* don't have to inform the HDD/Host */
3400 return;
3401 }
3402
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003403 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003404 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3405
3406 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3407
3408limGetWPSPBCSessionsEnd:
3409 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
3410 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
3411}
3412
Jeff Johnson295189b2012-06-20 16:38:30 -07003413
3414
3415/**
3416 * __limCounterMeasures()
3417 *
3418 * FUNCTION:
3419 * This function is called to "implement" MIC counter measure
3420 * and is *temporary* only
3421 *
3422 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3423 * we don't do the proper STA disassoc sequence since the
3424 * BSS will be stoped anyway
3425 *
3426 *ASSUMPTIONS:
3427 *
3428 *NOTE:
3429 *
3430 * @param pMac Pointer to Global MAC structure
3431 * @return None
3432 */
3433
3434static void
3435__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3436{
3437 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3438 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
3439 || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
3440
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003441 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003442
Jeff Johnson295189b2012-06-20 16:38:30 -07003443};
3444
3445
Jeff Johnson295189b2012-06-20 16:38:30 -07003446void
3447limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3448{
3449 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3450 tpPESession psessionEntry;
3451 tANI_U8 sessionId; //PE sessionId
3452
3453 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3454 {
3455 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003456 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003457 return;
3458 }
3459
3460 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3461 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003462 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003463 return;
3464 }
3465
3466 if ( tkipCntrMeasReq.bEnable )
3467 {
3468 __limCounterMeasures( pMac, psessionEntry );
3469 }
3470
3471 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3472}
Jeff Johnson295189b2012-06-20 16:38:30 -07003473
3474
3475static void
3476__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3477{
3478 tSirSmeStopBssReq stopBssReq;
3479 tSirRetStatus status;
3480 tLimSmeStates prevState;
3481 tANI_U8 sessionId; //PE sessionId
3482 tpPESession psessionEntry;
3483 tANI_U8 smesessionId;
3484 tANI_U16 smetransactionId;
3485
3486 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3487
3488
3489
3490 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3491 !limIsSmeStopBssReqValid(pMsgBuf))
3492 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003493 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003494 /// Send Stop BSS response to host
3495 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3496 return;
3497 }
3498
3499
3500 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3501 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003502 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003503 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3504 return;
3505 }
3506
3507#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3508 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3509#endif //FEATURE_WLAN_DIAG_SUPPORT
3510
3511
3512 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3513 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3514 {
3515 /**
3516 * Should not have received STOP_BSS_REQ in states
3517 * other than 'normal' state or on STA in Infrastructure
3518 * mode. Log error and return response to host.
3519 */
3520 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003521 FL("received unexpected SME_STOP_BSS_REQ in state %X, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003522 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3523 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3524 /// Send Stop BSS response to host
3525 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3526 return;
3527 }
3528
Jeff Johnson295189b2012-06-20 16:38:30 -07003529 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3530 {
3531 limWPSPBCClose(pMac, psessionEntry);
3532 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003533 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003534
3535 prevState = psessionEntry->limSmeState;
3536
3537 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003538 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003539
3540 /* Update SME session Id and Transaction Id */
3541 psessionEntry->smeSessionId = smesessionId;
3542 psessionEntry->transactionId = smetransactionId;
3543
3544 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame */
3545 if ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) && (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3546 {
3547 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3548 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3549 // Send disassoc all stations associated thru TKIP
3550 __limCounterMeasures(pMac,psessionEntry);
3551 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303552 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003553 }
3554
3555 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3556 pMac->lim.gLimIbssCoalescingHappened = false;
3557
3558 /* send a delBss to HAL and wait for a response */
3559 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3560
3561 if (status != eSIR_SUCCESS)
3562 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003563 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003564 psessionEntry->limSmeState= prevState;
3565
Jeff Johnsone7245742012-09-05 17:12:55 -07003566 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003567
3568 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3569 }
3570}
3571
3572
3573/**--------------------------------------------------------------
3574\fn __limProcessSmeStopBssReq
3575
3576\brief Wrapper for the function __limHandleSmeStopBssRequest
3577 This message will be defered until softmac come out of
3578 scan mode. Message should be handled even if we have
3579 detected radar in the current operating channel.
3580\param pMac
3581\param pMsg
3582
3583\return TRUE - If we consumed the buffer
3584 FALSE - If have defered the message.
3585 ---------------------------------------------------------------*/
3586static tANI_BOOLEAN
3587__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3588{
3589 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3590 {
3591 /**
3592 * If message defered, buffer is not consumed yet.
3593 * So return false
3594 */
3595 return eANI_BOOLEAN_FALSE;
3596 }
3597 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3598 return eANI_BOOLEAN_TRUE;
3599} /*** end __limProcessSmeStopBssReq() ***/
3600
3601
3602void limProcessSmeDelBssRsp(
3603 tpAniSirGlobal pMac,
3604 tANI_U32 body,tpPESession psessionEntry)
3605{
3606
3607 (void) body;
3608 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3609 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003610 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003611 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3612 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003613 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3614 return;
3615}
3616
3617
Jeff Johnson295189b2012-06-20 16:38:30 -07003618/**---------------------------------------------------------------
3619\fn __limProcessSmeAssocCnfNew
3620\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3621\ in BTAMP AP.
3622\
3623\param pMac
3624\param msgType - message type
3625\param pMsgBuf - a pointer to the SME message buffer
3626\return None
3627------------------------------------------------------------------*/
3628
3629 void
3630__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3631{
3632 tSirSmeAssocCnf assocCnf;
3633 tpDphHashNode pStaDs = NULL;
3634 tpPESession psessionEntry= NULL;
3635 tANI_U8 sessionId;
3636
3637
3638 if(pMsgBuf == NULL)
3639 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003640 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003641 goto end;
3642 }
3643
3644 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3645 !__limIsSmeAssocCnfValid(&assocCnf))
3646 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003647 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003648 goto end;
3649 }
3650
3651 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3652 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003653 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003654 goto end;
3655 }
3656
3657 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3658 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3659 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003660 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303661 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003662 goto end;
3663 }
3664
3665 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3666
3667 if (pStaDs == NULL)
3668 {
3669 limLog(pMac, LOG1,
3670 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
3671 msgType, assocCnf.aid);
3672 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3673
3674 /*
3675 ** send a DISASSOC_IND message to WSM to make sure
3676 ** the state in WSM and LIM is the same
3677 **/
3678 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3679 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3680 goto end;
3681 }
3682 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303683 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003684 (tANI_U8 *) assocCnf.peerMacAddr,
3685 sizeof(tSirMacAddr)) ) ||
3686 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3687 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3688 (msgType != eWNI_SME_ASSOC_CNF)) ||
3689 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003690 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003691 {
3692 limLog(pMac, LOG1,
3693 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
3694 msgType, assocCnf.aid);
3695 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3696 goto end;
3697 }
3698
3699 /*
3700 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3701 ** has been received
3702 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003703 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003704 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3705
3706 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3707 {
3708 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3709 * when it had received Assoc Request frame. Now, PE just needs to send
3710 * Association Response frame to the requesting BTAMP-STA.
3711 */
3712 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003713 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003714 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3715 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3716 goto end;
3717 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3718 else
3719 {
3720 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3721 /*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*/
3722 if(!pStaDs->mlmStaContext.updateContext)
3723 pStaDs->mlmStaContext.updateContext = 1;
3724 limRejectAssociation(pMac, pStaDs->staAddr,
3725 pStaDs->mlmStaContext.subType,
3726 true, pStaDs->mlmStaContext.authType,
3727 pStaDs->assocId, true,
3728 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003729 }
3730
3731end:
3732 if((psessionEntry != NULL) && (pStaDs != NULL))
3733 {
3734 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3735 {
3736 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3737 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303738 vos_mem_free(((tpSirAssocReq)
3739 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07003740 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
3741 }
3742
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303743 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003744 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
3745 }
3746 }
3747
3748} /*** end __limProcessSmeAssocCnfNew() ***/
3749
3750
Jeff Johnson295189b2012-06-20 16:38:30 -07003751
3752
3753static void
3754__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3755{
3756 tpDphHashNode pStaDs;
3757 tSirMacAddr peerMac;
3758 tpSirAddtsReq pSirAddts;
3759 tANI_U32 timeout;
3760 tpPESession psessionEntry;
3761 tANI_U8 sessionId; //PE sessionId
3762 tANI_U8 smesessionId;
3763 tANI_U16 smetransactionId;
3764
3765
3766 if(pMsgBuf == NULL)
3767 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003768 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003769 return;
3770 }
3771
3772 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3773
3774 pSirAddts = (tpSirAddtsReq) pMsgBuf;
3775
3776 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
3777 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003778 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003779 return;
3780 }
3781#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3782 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
3783#endif //FEATURE_WLAN_DIAG_SUPPORT
3784
3785
3786
3787 /* if sta
3788 * - verify assoc state
3789 * - send addts request to ap
3790 * - wait for addts response from ap
3791 * if ap, just ignore with error log
3792 */
3793 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003794 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003795 pSirAddts->req.tspec.tsinfo.traffic.tsid,
3796 pSirAddts->req.tspec.tsinfo.traffic.userPrio);)
3797
3798 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
3799 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003800 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003801 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3802 smesessionId,smetransactionId);
3803 return;
3804 }
3805
3806 //Ignore the request if STA is in 11B mode.
3807 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
3808 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003809 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003810 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3811 smesessionId,smetransactionId);
3812 return;
3813 }
3814
3815
3816 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3817
3818 if(pStaDs == NULL)
3819 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003820 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003821 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3822 smesessionId,smetransactionId);
3823 return;
3824 }
3825
3826 if ((! pStaDs->valid) ||
3827 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
3828 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003829 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003830 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3831 smesessionId,smetransactionId);
3832 return;
3833 }
3834
3835 pSirAddts->req.wsmTspecPresent = 0;
3836 pSirAddts->req.wmeTspecPresent = 0;
3837 pSirAddts->req.lleTspecPresent = 0;
3838
3839 if ((pStaDs->wsmEnabled) &&
3840 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
3841 pSirAddts->req.wsmTspecPresent = 1;
3842 else if (pStaDs->wmeEnabled)
3843 pSirAddts->req.wmeTspecPresent = 1;
3844 else if (pStaDs->lleEnabled)
3845 pSirAddts->req.lleTspecPresent = 1;
3846 else
3847 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003848 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003849 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3850 smesessionId,smetransactionId);
3851 return;
3852 }
3853
3854 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
3855 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
3856 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003857 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07003858 psessionEntry->limSmeState);
3859 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3860 smesessionId,smetransactionId);
3861 return;
3862 }
3863
3864 if (pMac->lim.gLimAddtsSent)
3865 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003866 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07003867 pMac->lim.gLimAddtsReq.req.dialogToken,
3868 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
3869 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
3870 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3871 smesessionId,smetransactionId);
3872 return;
3873 }
3874
3875 #if 0
3876 val = sizeof(tSirMacAddr);
3877 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
3878 {
3879 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003880 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003881 return;
3882 }
3883 #endif
3884 sirCopyMacAddr(peerMac,psessionEntry->bssId);
3885
3886 // save the addts request
3887 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303888 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07003889
3890 // ship out the message now
3891 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
3892 psessionEntry);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003893 PELOG1(limLog(pMac, LOG1, "Sent ADDTS request");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003894
3895 // start a timer to wait for the response
3896 if (pSirAddts->timeout)
3897 timeout = pSirAddts->timeout;
3898 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
3899 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003900 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003901 WNI_CFG_ADDTS_RSP_TIMEOUT);
3902 return;
3903 }
3904
3905 timeout = SYS_MS_TO_TICKS(timeout);
3906 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
3907 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003908 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003909 return;
3910 }
3911 pMac->lim.gLimAddtsRspTimerCount++;
3912 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
3913 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
3914 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003915 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003916 return;
3917 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003918 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003919
3920 //add the sessionId to the timer object
3921 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
3922 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
3923 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003924 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003925 return;
3926 }
3927 return;
3928}
3929
3930
3931static void
3932__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3933{
3934 tSirMacAddr peerMacAddr;
3935 tANI_U8 ac;
3936 tSirMacTSInfo *pTsinfo;
3937 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
3938 tpDphHashNode pStaDs = NULL;
3939 tpPESession psessionEntry;
3940 tANI_U8 sessionId;
3941 tANI_U32 status = eSIR_SUCCESS;
3942 tANI_U8 smesessionId;
3943 tANI_U16 smetransactionId;
3944
3945 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3946
3947 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
3948 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003949 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003950 status = eSIR_FAILURE;
3951 goto end;
3952 }
3953#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3954 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
3955#endif //FEATURE_WLAN_DIAG_SUPPORT
3956
3957
3958 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
3959 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003960 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003961 status = eSIR_FAILURE;
3962 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
3963 return;
3964 }
3965
Arif Hussaina7c8e412013-11-20 11:06:42 -08003966 PELOG1(limLog(pMac, LOG1, FL("Sent DELTS request to station with "
3967 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
3968 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003969
3970 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
3971 psessionEntry);
3972
3973 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
3974
3975 /* We've successfully send DELTS frame to AP. Update the
3976 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
3977 * is no longer trigger enabled or delivery enabled
3978 */
3979 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
3980
3981 /* We're deleting the TSPEC, so this particular AC is no longer
3982 * admitted. PE needs to downgrade the EDCA
3983 * parameters(for the AC for which TS is being deleted) to the
3984 * next best AC for which ACM is not enabled, and send the
3985 * updated values to HAL.
3986 */
3987 ac = upToAc(pTsinfo->traffic.userPrio);
3988
3989 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
3990 {
3991 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
3992 }
3993 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
3994 {
3995 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
3996 }
3997 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
3998 {
3999 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4000 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4001 }
4002
4003 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4004
4005 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4006 if (pStaDs != NULL)
4007 {
4008 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4009 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4010 else
4011 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4012 status = eSIR_SUCCESS;
4013 }
4014 else
4015 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004016 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004017 status = eSIR_FAILURE;
4018 }
4019#ifdef FEATURE_WLAN_CCX
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004020#ifdef FEATURE_WLAN_CCX_UPLOAD
4021 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4022#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004023 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004024#endif /* FEATURE_WLAN_CCX_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004025#endif
4026
4027 // send an sme response back
4028 end:
4029 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4030}
4031
4032
4033void
4034limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4035{
4036 //fetch the sessionEntry based on the sessionId
4037 tpPESession psessionEntry;
4038 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4039 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004040 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004041 return;
4042 }
4043
4044 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4045 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004046 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004047 pMac->lim.gLimAddtsSent = false;
4048 return;
4049 }
4050
4051 if (! pMac->lim.gLimAddtsSent)
4052 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004053 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004054 return;
4055 }
4056
4057 if (param != pMac->lim.gLimAddtsRspTimerCount)
4058 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004059 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004060 param, pMac->lim.gLimAddtsRspTimerCount);
4061 return;
4062 }
4063
4064 // this a real response timeout
4065 pMac->lim.gLimAddtsSent = false;
4066 pMac->lim.gLimAddtsRspTimerCount++;
4067
4068 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4069 psessionEntry->smeSessionId, psessionEntry->transactionId);
4070}
4071
4072
4073/**
4074 * __limProcessSmeStatsRequest()
4075 *
4076 *FUNCTION:
4077 *
4078 *
4079 *NOTE:
4080 *
4081 * @param pMac Pointer to Global MAC structure
4082 * @param *pMsgBuf A pointer to the SME message buffer
4083 * @return None
4084 */
4085static void
4086__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4087{
4088 tpAniGetStatsReq pStatsReq;
4089 tSirMsgQ msgQ;
4090 tpPESession psessionEntry;
4091 tANI_U8 sessionId;
4092
4093
4094 if(pMsgBuf == NULL)
4095 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004096 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004097 return;
4098 }
4099
4100 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4101
4102 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4103 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004104 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304105 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004106 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 return;
4108 }
4109
4110
4111
4112 switch(pStatsReq->msgType)
4113 {
4114 //Add Lim stats here. and send reqsponse.
4115
4116 //HAL maintained Stats.
4117 case eWNI_SME_STA_STAT_REQ:
4118 msgQ.type = WDA_STA_STAT_REQ;
4119 break;
4120 case eWNI_SME_AGGR_STAT_REQ:
4121 msgQ.type = WDA_AGGR_STAT_REQ;
4122 break;
4123 case eWNI_SME_GLOBAL_STAT_REQ:
4124 msgQ.type = WDA_GLOBAL_STAT_REQ;
4125 break;
4126 case eWNI_SME_STAT_SUMM_REQ:
4127 msgQ.type = WDA_STAT_SUMM_REQ;
4128 break;
4129 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004130 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304131 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004132 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004133 return;
4134 }
4135
Jeff Johnson295189b2012-06-20 16:38:30 -07004136 msgQ.reserved = 0;
4137 msgQ.bodyptr = pMsgBuf;
4138 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004139 if(NULL == psessionEntry)
4140 {
4141 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4142 }
4143 else
4144 {
4145 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4146 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004147 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004148 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304149 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004150 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004151 return;
4152 }
4153
4154 return;
4155}
4156
4157
4158/**
4159 * __limProcessSmeGetStatisticsRequest()
4160 *
4161 *FUNCTION:
4162 *
4163 *
4164 *NOTE:
4165 *
4166 * @param pMac Pointer to Global MAC structure
4167 * @param *pMsgBuf A pointer to the SME message buffer
4168 * @return None
4169 */
4170static void
4171__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4172{
4173 tpAniGetPEStatsReq pPEStatsReq;
4174 tSirMsgQ msgQ;
4175
4176 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4177
4178 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4179
4180 msgQ.type = WDA_GET_STATISTICS_REQ;
4181
Jeff Johnson295189b2012-06-20 16:38:30 -07004182 msgQ.reserved = 0;
4183 msgQ.bodyptr = pMsgBuf;
4184 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004185 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004186
4187 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304188 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004189 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004190 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004191 return;
4192 }
4193
4194 return;
4195}
4196
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004197#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
4198/**
4199 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4200 *
4201 *NOTE:
4202 *
4203 * @param pMac Pointer to Global MAC structure
4204 * @param *pMsgBuf A pointer to the SME message buffer
4205 * @return None
4206 */
4207static void
4208__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4209{
4210 tSirMsgQ msgQ;
4211
4212 msgQ.type = WDA_TSM_STATS_REQ;
4213 msgQ.reserved = 0;
4214 msgQ.bodyptr = pMsgBuf;
4215 msgQ.bodyval = 0;
4216 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4217
4218 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4219 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004220 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004221 limLog(pMac, LOGP, "Unable to forward request");
4222 return;
4223 }
4224}
4225#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
4226
4227
Jeff Johnson295189b2012-06-20 16:38:30 -07004228
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004229#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
4230/**
4231 * __limProcessSmeGetRoamRssiRequest()
4232 *
4233 *FUNCTION:
4234 *
4235 *
4236 *NOTE:
4237 *
4238 * @param pMac Pointer to Global MAC structure
4239 * @param *pMsgBuf A pointer to the SME message buffer
4240 * @return None
4241 */
4242static void
4243__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4244{
4245 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4246 tSirMsgQ msgQ;
4247
4248 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4249 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4250
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004251 msgQ.reserved = 0;
4252 msgQ.bodyptr = pMsgBuf;
4253 msgQ.bodyval = 0;
4254 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4255
4256 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304257 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004258 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004259 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004260 return;
4261 }
4262
4263 return;
4264}
4265#endif
4266
4267
Jeff Johnson295189b2012-06-20 16:38:30 -07004268static void
4269__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4270{
4271 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4272 tpPESession psessionEntry;
4273 tANI_U8 sessionId; //PE sessionID
4274
4275 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004276 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004277
4278 if(pMsgBuf == NULL)
4279 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004280 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004281 return;
4282 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004283
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304284 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4285 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004286 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304287 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004288 return;
4289 }
4290
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004291 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004292 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004293 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004294 goto end;
4295 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004296
Jeff Johnson295189b2012-06-20 16:38:30 -07004297 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4298 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004299 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004300 goto end;
4301 }
4302
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304303 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004304
Jeff Johnson295189b2012-06-20 16:38:30 -07004305 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004306 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004307
4308end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304309 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004310 return;
4311} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4312
4313static void
4314__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4315{
4316 tpSirUpdateParams pUpdateParams;
4317 tpPESession psessionEntry;
4318
4319 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004320 FL("received HIDE_SSID message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004321
4322 if(pMsgBuf == NULL)
4323 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004324 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004325 return;
4326 }
4327
4328 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4329
4330 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4331 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004332 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004333 pUpdateParams->sessionId);
4334 return;
4335 }
4336
4337 /* Update the session entry */
4338 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4339
4340 /* Update beacon */
4341 schSetFixedBeaconFields(pMac, psessionEntry);
4342 limSendBeaconInd(pMac, psessionEntry);
4343
4344 return;
4345} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4346
4347static void
4348__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4349{
4350 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4351 tpPESession psessionEntry;
4352 tANI_U8 sessionId; //PE sessionID
4353
4354 if(pMsgBuf == NULL)
4355 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004356 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004357 return;
4358 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304359
4360 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4361 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004362 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304363 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004364 return;
4365 }
4366
4367 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4368 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004369 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004370 goto end;
4371 }
4372
4373 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4374 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004375 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004376 goto end;
4377 }
4378
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304379 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4380 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004381
4382 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4383
4384 psessionEntry->pLimStartBssReq->privacy = 1;
4385 psessionEntry->privacy = 1;
4386
4387 schSetFixedBeaconFields(pMac, psessionEntry);
4388 limSendBeaconInd(pMac, psessionEntry);
4389
4390end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304391 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004392 return;
4393} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4394
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004395/*
4396Update the beacon Interval dynamically if beaconInterval is different in MCC
4397*/
4398static void
4399__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4400{
4401 tpSirChangeBIParams pChangeBIParams;
4402 tpPESession psessionEntry;
4403 tANI_U8 sessionId = 0;
4404 tUpdateBeaconParams beaconParams;
4405
4406 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004407 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004408
4409 if(pMsgBuf == NULL)
4410 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004411 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004412 return;
4413 }
4414
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304415 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004416 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4417
4418 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4419 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004420 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004421 return;
4422 }
4423
4424 /*Update sessionEntry Beacon Interval*/
4425 if(psessionEntry->beaconParams.beaconInterval !=
4426 pChangeBIParams->beaconInterval )
4427 {
4428 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4429 }
4430
4431 /*Update sch beaconInterval*/
4432 if(pMac->sch.schObject.gSchBeaconInterval !=
4433 pChangeBIParams->beaconInterval )
4434 {
4435 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4436
4437 PELOG1(limLog(pMac, LOG1,
4438 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4439
4440 /* Update beacon */
4441 schSetFixedBeaconFields(pMac, psessionEntry);
4442
Sunil Ravib96f7b52013-05-22 21:40:05 -07004443 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004444 //Set change in beacon Interval
4445 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004446 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004447 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4448 }
4449
4450 return;
4451} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4452
Jeff Johnson295189b2012-06-20 16:38:30 -07004453
4454
4455/** -------------------------------------------------------------
4456\fn limProcessSmeDelBaPeerInd
4457\brief handles indication message from HDD to send delete BA request
4458\param tpAniSirGlobal pMac
4459\param tANI_U32 pMsgBuf
4460\return None
4461-------------------------------------------------------------*/
4462void
4463limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4464{
4465 tANI_U16 assocId =0;
4466 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4467 tpDphHashNode pSta;
4468 tpPESession psessionEntry;
4469 tANI_U8 sessionId;
4470
4471
4472
4473 if(NULL == pSmeDelBAPeerInd)
4474 return;
4475
4476 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4477 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004478 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004479 return;
4480 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004481 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004482 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4483
4484 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4485 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4486 pSta,
4487 pSmeDelBAPeerInd->baDirection,
4488 pSmeDelBAPeerInd->baTID,
4489 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4490 {
4491 limLog( pMac, LOGW,
4492 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4493 if (pSta)
4494 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4495 }
4496}
4497
4498// --------------------------------------------------------------------
4499/**
4500 * __limProcessReportMessage
4501 *
4502 * FUNCTION: Processes the next received Radio Resource Management message
4503 *
4504 * LOGIC:
4505 *
4506 * ASSUMPTIONS:
4507 *
4508 * NOTE:
4509 *
4510 * @param None
4511 * @return None
4512 */
4513
4514void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4515{
4516#ifdef WLAN_FEATURE_VOWIFI
4517 switch (pMsg->type)
4518 {
4519 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4520 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4521 break;
4522 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4523 {
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004524#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004525 tpSirBeaconReportXmitInd pBcnReport=NULL;
4526 tpPESession psessionEntry=NULL;
4527 tANI_U8 sessionId;
4528
4529 if(pMsg->bodyptr == NULL)
4530 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004531 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004532 return;
4533 }
4534 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4535 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4536 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004537 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004538 return;
4539 }
4540 if (psessionEntry->isCCXconnection)
4541 ccxProcessBeaconReportXmit( pMac, pMsg->bodyptr);
4542 else
4543#endif
4544 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4545 }
4546 break;
4547 }
4548#endif
4549}
4550
4551#if defined(FEATURE_WLAN_CCX) || defined(WLAN_FEATURE_VOWIFI)
4552// --------------------------------------------------------------------
4553/**
4554 * limSendSetMaxTxPowerReq
4555 *
4556 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4557 *
4558 * LOGIC:
4559 *
4560 * ASSUMPTIONS:
4561 *
4562 * NOTE:
4563 *
4564 * @param txPower txPower to be set.
4565 * @param pSessionEntry session entry.
4566 * @return None
4567 */
4568tSirRetStatus
4569limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4570{
4571 tpMaxTxPowerParams pMaxTxParams = NULL;
4572 tSirRetStatus retCode = eSIR_SUCCESS;
4573 tSirMsgQ msgQ;
4574
4575 if( pSessionEntry == NULL )
4576 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004577 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004578 return eSIR_FAILURE;
4579 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304580
4581 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4582 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004583 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004584 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004585 return eSIR_MEM_ALLOC_FAILED;
4586
4587 }
4588#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_CCX)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004589 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 -07004590#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004591 if( pMaxTxParams == NULL )
4592 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004593 limLog( pMac, LOGE, "%s:%d: pMaxTxParams is NULL", __func__, __LINE__);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004594 return eSIR_FAILURE;
4595 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004596 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304597 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4598 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004599
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004600 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4601 msgQ.bodyptr = pMaxTxParams;
4602 msgQ.bodyval = 0;
4603 PELOG1(limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));)
4604 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
4605 retCode = wdaPostCtrlMsg(pMac, &msgQ);
4606 if (eSIR_SUCCESS != retCode)
4607 {
4608 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304609 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004610 }
4611 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004612}
4613#endif
4614
4615/**
4616 * __limProcessSmeAddStaSelfReq()
4617 *
4618 *FUNCTION:
4619 * This function is called to process SME_ADD_STA_SELF_REQ message
4620 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4621 *
4622 *LOGIC:
4623 *
4624 *ASSUMPTIONS:
4625 *
4626 *NOTE:
4627 *
4628 * @param pMac Pointer to Global MAC structure
4629 * @param *pMsgBuf A pointer to the SME message buffer
4630 * @return None
4631 */
4632
4633static void
4634__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4635{
4636 tSirMsgQ msg;
4637 tpAddStaSelfParams pAddStaSelfParams;
4638 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
4639
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304640 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
4641 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004642 {
4643 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
4644 return;
4645 }
4646
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304647 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07004648 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004649 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
4650 msg.reserved = 0;
4651 msg.bodyptr = pAddStaSelfParams;
4652 msg.bodyval = 0;
4653
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004654 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004655 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004656
4657 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4658 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004659 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004660 }
4661 return;
4662} /*** end __limProcessAddStaSelfReq() ***/
4663
4664
4665/**
4666 * __limProcessSmeDelStaSelfReq()
4667 *
4668 *FUNCTION:
4669 * This function is called to process SME_DEL_STA_SELF_REQ message
4670 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
4671 *
4672 *LOGIC:
4673 *
4674 *ASSUMPTIONS:
4675 *
4676 *NOTE:
4677 *
4678 * @param pMac Pointer to Global MAC structure
4679 * @param *pMsgBuf A pointer to the SME message buffer
4680 * @return None
4681 */
4682
4683static void
4684__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4685{
4686 tSirMsgQ msg;
4687 tpDelStaSelfParams pDelStaSelfParams;
4688 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
4689
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304690 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
4691 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004692 {
4693 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
4694 return;
4695 }
4696
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304697 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004698
4699 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
4700 msg.reserved = 0;
4701 msg.bodyptr = pDelStaSelfParams;
4702 msg.bodyval = 0;
4703
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004704 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004705 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004706
4707 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4708 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004709 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004710 }
4711 return;
4712} /*** end __limProcessSmeDelStaSelfReq() ***/
4713
4714
Jeff Johnson295189b2012-06-20 16:38:30 -07004715/**
4716 * __limProcessSmeRegisterMgmtFrameReq()
4717 *
4718 *FUNCTION:
4719 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
4720 * from SME. It Register this information within PE.
4721 *
4722 *LOGIC:
4723 *
4724 *ASSUMPTIONS:
4725 *
4726 *NOTE:
4727 *
4728 * @param pMac Pointer to Global MAC structure
4729 * @param *pMsgBuf A pointer to the SME message buffer
4730 * @return None
4731 */
4732static void
4733__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4734{
4735 VOS_STATUS vosStatus;
4736 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
4737 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004738 tANI_BOOLEAN match = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004739 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004740 FL("registerFrame %d, frameType %d, matchLen %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07004741 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004742
Jeff Johnsond13512a2012-07-17 11:42:19 -07004743 /* First check whether entry exists already*/
4744
4745 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4746 (vos_list_node_t**)&pLimMgmtRegistration);
4747
4748 while(pLimMgmtRegistration != NULL)
4749 {
4750 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
4751 {
4752 if(pSmeReq->matchLen)
4753 {
4754 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
4755 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304756 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07004757 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
4758 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004759 /* found match! */
4760 match = VOS_TRUE;
4761 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004762 }
4763 }
4764 }
4765 else
4766 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004767 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07004768 match = VOS_TRUE;
4769 break;
4770 }
4771 }
4772 vosStatus = vos_list_peek_next (
4773 &pMac->lim.gLimMgmtFrameRegistratinQueue,
4774 (vos_list_node_t*) pLimMgmtRegistration,
4775 (vos_list_node_t**) &pNext );
4776
4777 pLimMgmtRegistration = pNext;
4778 pNext = NULL;
4779
4780 }
4781
4782 if (match)
4783 {
4784 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4785 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304786 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07004787 }
4788
Jeff Johnson295189b2012-06-20 16:38:30 -07004789 if(pSmeReq->registerFrame)
4790 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304791 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
4792 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07004793 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304794 vos_mem_set((void*)pLimMgmtRegistration,
4795 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004796 pLimMgmtRegistration->frameType = pSmeReq->frameType;
4797 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
4798 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
4799 if(pSmeReq->matchLen)
4800 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304801 vos_mem_copy(pLimMgmtRegistration->matchData,
4802 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07004803 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004804 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4805 &pLimMgmtRegistration->node);
4806 }
4807 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004808
4809 return;
4810} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08004811
4812static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08004813__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08004814{
4815 tpP2pPsParams pMsgNoA;
4816 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08004817
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304818 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
4819 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08004820 {
4821 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004822 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08004823 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004824 }
4825
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304826 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08004827 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
4828 pMsgNoA->opp_ps = 0;
4829 pMsgNoA->ctWindow = 0;
4830 pMsgNoA->duration = 0;
4831 pMsgNoA->interval = 0;
4832 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08004833
Vinay Malekal62757362012-12-17 12:15:51 -08004834 /* Below params used for Single Shot NOA - so assign proper values */
4835 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08004836 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08004837
Viral Modid86bde22012-12-10 13:09:21 -08004838 /* Start Insert NOA timer
4839 * 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 -08004840 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
4841 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08004842 */
4843 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
4844 == TX_TIMER_ERROR)
4845 {
4846 /// Could not activate Insert NOA timer.
4847 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004848 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08004849
4850 // send the scan response back with status failure and do not even call insert NOA
4851 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304852 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08004853 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004854 }
4855
Viral Modid440e682013-03-06 02:25:31 -08004856 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
4857
Viral Modid86bde22012-12-10 13:09:21 -08004858 msg.type = WDA_SET_P2P_GO_NOA_REQ;
4859 msg.reserved = 0;
4860 msg.bodyptr = pMsgNoA;
4861 msg.bodyval = 0;
4862
4863 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4864 {
4865 /* 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 -07004866 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08004867 /* Deactivate the NOA timer in failure case */
4868 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
4869 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004870 }
Viral Modid440e682013-03-06 02:25:31 -08004871 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08004872
Viral Modid440e682013-03-06 02:25:31 -08004873error:
4874 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
4875 * worrying about the NOA
4876 */
4877 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
4878 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08004879 return FALSE;
4880
4881}
4882
Viral Modid440e682013-03-06 02:25:31 -08004883static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4884{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004885 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08004886 pMac->lim.gDeferMsgTypeForNOA = msgType;
4887 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
4888}
4889
4890static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4891{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004892 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08004893 pMac->lim.gDeferMsgTypeForNOA = 0;
4894 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
4895 {
4896 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304897 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004898 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4899 }
4900}
4901
4902static
4903tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4904{
4905 tANI_U32 noaDuration = 0;
4906
4907 switch (msgType)
4908 {
4909 case eWNI_SME_SCAN_REQ:
4910 {
4911 tANI_U32 val;
4912 tANI_U8 i;
4913 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
4914 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
4915 {
4916 /*
4917 * Could not get max channel value
4918 * from CFG. Log error.
4919 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004920 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08004921
4922 /* use a default value of 110ms */
4923 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
4924 }
4925
4926 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
4927 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
4928
4929 if (limActiveScanAllowed(pMac, channelNum)) {
4930 /* Use min + max channel time to calculate the total duration of scan */
4931 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
4932 } else {
4933 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
4934 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
4935 */
4936 noaDuration += val;
4937 }
4938 }
4939
4940 /* Adding an overhead of 20ms to account for the scan messaging delays */
4941 noaDuration += SCAN_MESSAGING_OVERHEAD;
4942 noaDuration *= CONV_MS_TO_US;
4943
4944 break;
4945 }
4946
4947 case eWNI_SME_OEM_DATA_REQ:
4948 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
4949 break;
4950
4951 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
4952 {
4953 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
4954 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
4955 break;
4956 }
4957
4958 case eWNI_SME_JOIN_REQ:
4959 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
4960 break;
4961
4962 default:
4963 noaDuration = 0;
4964 break;
4965
4966 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004967 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08004968 return noaDuration;
4969}
4970
4971void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4972{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05304973 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08004974
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004975 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004976 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
4977 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
4978 {
4979 switch (pMac->lim.gDeferMsgTypeForNOA)
4980 {
4981 case eWNI_SME_SCAN_REQ:
4982 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4983 break;
4984 case eWNI_SME_OEM_DATA_REQ:
4985 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4986 break;
4987 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05304988 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4989 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
4990 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
4991 */
4992 if (FALSE == bufConsumed)
4993 {
4994 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4995 }
Viral Modid440e682013-03-06 02:25:31 -08004996 break;
4997 case eWNI_SME_JOIN_REQ:
4998 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4999 break;
5000 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005001 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005002 break;
5003 }
5004 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5005 }
5006 else
5007 {
5008 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005009 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005010 }
5011}
Jeff Johnson295189b2012-06-20 16:38:30 -07005012
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005013#ifdef FEATURE_WLAN_TDLS_INTERNAL
5014/*
5015 * Process Discovery request recieved from SME and transmit to AP.
5016 */
5017static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
5018 tANI_U32 *pMsgBuf)
5019{
5020 /* get all discovery request parameters */
5021 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
5022 tpPESession psessionEntry;
5023 tANI_U8 sessionId;
5024
5025 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005026 ("Discovery Req Recieved")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005027
5028 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
5029 == NULL)
5030 {
5031 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005032 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005033 disReq->sessionId);
5034 goto lim_tdls_dis_start_error;
5035 }
5036
5037 /* check if we are in proper state to work as TDLS client */
5038 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5039 {
5040 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005041 "dis req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005042 psessionEntry->limSystemRole);
5043 goto lim_tdls_dis_start_error;
5044 }
5045
5046 /*
5047 * if we are still good, go ahead and check if we are in proper state to
5048 * do TDLS discovery procedure.
5049 */
5050 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5051 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5052 {
5053
5054 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005055 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005056 goto lim_tdls_dis_start_error;
5057 }
5058
5059 /*
5060 * if we are still good, go ahead and transmit TDLS discovery request,
5061 * and save Dis Req info for future reference.
5062 */
5063
5064#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
5065 /*
5066 * send message to HAL to set RXP filters to receieve frame on
5067 * direct link..
5068 */
5069 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
5070 // psessionEntry->bssId) ;
5071#endif
5072
5073 /* save dis request message for matching dialog token */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305074 vos_mem_copy((tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
5075 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005076
5077 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005078 "Transmit Discovery Request Frame") ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005079 /* format TDLS discovery request frame and transmit it */
5080 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
5081 psessionEntry) ;
5082
5083 /* prepare for response */
5084 pMac->lim.gLimTdlsDisStaCount = 0 ;
5085 pMac->lim.gLimTdlsDisResultList = NULL ;
5086
5087 /*
5088 * start TDLS discovery request timer to wait for discovery responses
5089 * from all TDLS enabled clients in BSS.
5090 */
5091
5092 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005093 ("Start Discovery request Timeout Timer")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005094 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
5095 eLIM_TDLS_DISCOVERY_RSP_WAIT));
5096
5097 /* assign appropriate sessionId to the timer object */
5098 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
5099 psessionEntry->peSessionId;
5100
5101 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
5102 != TX_SUCCESS)
5103 {
5104 limLog(pMac, LOGP, FL("TDLS discovery response timer \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005105 activation failed!"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005106 goto lim_tdls_dis_start_error;
5107 }
5108 /*
5109 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
5110 * back to SME
5111 */
5112 return (eSIR_SUCCESS) ;
5113lim_tdls_dis_start_error:
5114 /* in error case, PE has to sent the response SME immediately with error code */
5115 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
5116 eWNI_SME_TDLS_DISCOVERY_START_RSP);
5117 return eSIR_FAILURE;
5118}
5119/*
5120 * Process link start request recieved from SME and transmit to AP.
5121 */
5122eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5123{
5124 /* get all discovery request parameters */
5125 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
5126 tLimTdlsLinkSetupInfo *linkSetupInfo;
5127 //tLimTdlsLinkSetupPeer *setupPeer;
5128 tpPESession psessionEntry;
5129 tANI_U8 sessionId;
5130 eHalStatus status;
5131
5132 if((psessionEntry = peFindSessionByBssid(pMac,
5133 setupReq->bssid, &sessionId)) == NULL)
5134 {
5135 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005136 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005137 setupReq->sessionId);
5138 goto lim_tdls_link_start_error;
5139 }
5140
5141 /* check if we are in proper state to work as TDLS client */
5142 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5143 {
5144 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005145 "TDLS link setup req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005146 psessionEntry->limSystemRole);
5147 goto lim_tdls_link_start_error;
5148 }
5149
5150 /*
5151 * if we are still good, go ahead and check if we are in proper state to
5152 * do TDLS setup procedure.
5153 */
5154 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5155 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5156 {
5157 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005158 state (%d)", pMac->lim.gLimSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005159 goto lim_tdls_link_start_error;
5160 }
5161
5162 /*
5163 * Now, go ahead and transmit TDLS discovery request, and save setup Req
5164 * info for future reference.
5165 */
5166 /* create node for Link setup */
5167 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
5168 //setupPeer = NULL ;
5169
5170 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
5171 setupReq->peerMac, psessionEntry) ;
5172 if(eHAL_STATUS_SUCCESS == status)
5173 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5174 TDLS setup cnf TX complete is successful. */
5175 return eSIR_SUCCESS;
5176#if 0
5177
5178 /*
5179 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005180 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005181 * free this memory if any timeout is happen in link setup procedure
5182 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305183 setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
5184 if ( NULL == setupPeer )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005185 {
5186 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005187 FL( "Unable to allocate memory during ADD_STA" ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005188 VOS_ASSERT(0) ;
5189 return eSIR_MEM_ALLOC_FAILED;
5190 }
5191 setupPeer->dialog = setupReq->dialog ;
5192 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
5193 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
5194 /* TDLS_sessionize: remember sessionId for future */
5195 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
5196 setupPeer->tdls_bIsResponder = 1;
5197
5198 /*
5199 * we only populate peer MAC, so it can assit us to find the
5200 * TDLS peer after response/or after response timeout
5201 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305202 vos_mem_copy(setupPeer->peerMac, setupReq->peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005203 sizeof(tSirMacAddr)) ;
5204 /* format TDLS discovery request frame and transmit it */
5205 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
5206 setupReq->dialog, psessionEntry, NULL, 0) ;
5207
5208 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
5209 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
5210 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
5211 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
5212 /* update setup peer list */
5213 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
5214 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
5215 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5216 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
5217 return eSIR_SUCCESS ;
5218#endif
5219lim_tdls_link_start_error:
5220 /* in case of error, return immediately to SME */
5221 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
5222 eWNI_SME_TDLS_LINK_START_RSP);
5223 return eSIR_FAILURE ;
5224}
5225
5226/*
5227 * Process link teardown request recieved from SME and transmit to AP.
5228 */
5229eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5230{
5231 /* get all discovery request parameters */
5232 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
5233 tLimTdlsLinkSetupPeer *setupPeer;
5234 tpPESession psessionEntry;
5235 tANI_U8 sessionId;
5236
5237 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
5238 {
5239 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005240 "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005241 goto lim_tdls_teardown_req_error;
5242 }
5243
5244 /* check if we are in proper state to work as TDLS client */
5245 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5246 {
5247 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005248 "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005249 goto lim_tdls_teardown_req_error;
5250 }
5251
5252 /*
5253 * if we are still good, go ahead and check if we are in proper state to
5254 * do TDLS setup procedure.
5255 */
5256 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5257 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5258 {
5259 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005260 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005261 goto lim_tdls_teardown_req_error;
5262 }
5263
5264 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Arif Hussain24bafea2013-11-15 15:10:03 -08005265 "Teardown for peer = " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(teardownReq->peerMac));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005266 /*
5267 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5268 * info for future reference.
5269 */
5270 /* Verify if this link is setup */
5271 setupPeer = NULL ;
5272 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5273 if(NULL == setupPeer)
5274 {
5275 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005276 ("invalid Peer on teardown ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005277 goto lim_tdls_teardown_req_error;
5278 }
5279
5280
5281 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5282 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5283 /* TDLS_sessionize: check sessionId in case */
5284 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5285 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005286 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005287 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5288 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5289 }
5290
5291 /* format TDLS teardown request frame and transmit it */
5292 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5293 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5294 {
5295 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005296 ("couldn't send teardown frame ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005297 goto lim_tdls_teardown_req_error;
5298 }
5299 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5300 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5301 return eSIR_SUCCESS;
5302lim_tdls_teardown_req_error:
5303 /* in case of error, return immediately to SME */
5304 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5305 eWNI_SME_TDLS_TEARDOWN_RSP);
5306 return eSIR_FAILURE;
5307}
5308
5309
5310#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005311
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305312static void
5313__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5314{
5315 tpSirResetAPCapsChange pResetCapsChange;
5316 tpPESession psessionEntry;
5317 tANI_U8 sessionId = 0;
5318 if (pMsgBuf == NULL)
5319 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005320 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305321 return;
5322 }
5323
5324 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5325 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5326 if (psessionEntry == NULL)
5327 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005328 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305329 return;
5330 }
5331
5332 psessionEntry->limSentCapsChangeNtf = false;
5333 return;
5334}
5335
Jeff Johnson295189b2012-06-20 16:38:30 -07005336/**
5337 * limProcessSmeReqMessages()
5338 *
5339 *FUNCTION:
5340 * This function is called by limProcessMessageQueue(). This
5341 * function processes SME request messages from HDD or upper layer
5342 * application.
5343 *
5344 *LOGIC:
5345 *
5346 *ASSUMPTIONS:
5347 *
5348 *NOTE:
5349 *
5350 * @param pMac Pointer to Global MAC structure
5351 * @param msgType Indicates the SME message type
5352 * @param *pMsgBuf A pointer to the SME message buffer
5353 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5354 * FALSE - if pMsgBuf is not to be freed.
5355 */
5356
5357tANI_BOOLEAN
5358limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5359{
5360 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5361 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005362 tpSirSmeScanReq pScanReq;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005363 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 -07005364 limMsgStr(pMsg->type), pMsg->type,
5365 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5366 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5367
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005368 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005369 /* Special handling of some SME Req msgs where we have an existing GO session and
5370 * want to insert NOA before processing those msgs. These msgs will be processed later when
5371 * start event happens
5372 */
5373 switch (pMsg->type)
5374 {
5375 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005376 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005377
5378 /* If scan is disabled return from here
5379 */
5380 if (pMac->lim.fScanDisabled)
5381 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005382 if (pMsg->type == eWNI_SME_SCAN_REQ)
5383 {
5384 limSendSmeScanRsp(pMac,
5385 offsetof(tSirSmeScanRsp,bssDescription[0]),
5386 eSIR_SME_INVALID_PARAMETERS,
5387 pScanReq->sessionId,
5388 pScanReq->transactionId);
5389
5390 bufConsumed = TRUE;
5391 }
5392 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5393 {
5394 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5395 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5396 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5397
5398 /*
5399 * limRemainOnChnRsp will free the buffer this change is to
5400 * avoid "double free"
5401 */
5402 bufConsumed = FALSE;
5403 }
5404
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305405 limLog(pMac, LOGE,
5406 FL("Error: Scan Disabled."
5407 " Return with error status for SME Message %s(%d)"),
5408 limMsgStr(pMsg->type), pMsg->type);
5409
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005410 return bufConsumed;
5411 }
5412 /*
5413 * Do not add BREAK here
5414 */
5415 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005416 case eWNI_SME_JOIN_REQ:
5417 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5418 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5419 {
5420 tANI_U32 noaDuration;
5421 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
5422 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf);
5423 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5424 return bufConsumed;
5425 }
5426 }
5427 /* If no insert NOA required then execute the code below */
5428
Jeff Johnson295189b2012-06-20 16:38:30 -07005429 switch (pMsg->type)
5430 {
5431 case eWNI_SME_START_REQ:
5432 __limProcessSmeStartReq(pMac, pMsgBuf);
5433 break;
5434
5435 case eWNI_SME_SYS_READY_IND:
5436 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5437 break;
5438
Jeff Johnson295189b2012-06-20 16:38:30 -07005439 case eWNI_SME_START_BSS_REQ:
5440 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5441 break;
5442
5443 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005444 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005445 break;
5446
Jeff Johnsone7245742012-09-05 17:12:55 -07005447#ifdef FEATURE_OEM_DATA_SUPPORT
5448 case eWNI_SME_OEM_DATA_REQ:
5449 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005450 break;
5451#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005452 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5453 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5454 break;
5455
5456 case eWNI_SME_UPDATE_NOA:
5457 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5458 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305459 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5460 __limProcessClearDfsChannelList(pMac, pMsg);
5461 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005462 case eWNI_SME_JOIN_REQ:
5463 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005464 break;
5465
5466 case eWNI_SME_AUTH_REQ:
5467 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5468
5469 break;
5470
5471 case eWNI_SME_REASSOC_REQ:
5472 __limProcessSmeReassocReq(pMac, pMsgBuf);
5473
5474 break;
5475
5476 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5477 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5478
5479 break;
5480
5481 case eWNI_SME_DISASSOC_REQ:
5482 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5483
5484 break;
5485
5486 case eWNI_SME_DISASSOC_CNF:
5487 case eWNI_SME_DEAUTH_CNF:
5488 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5489
5490 break;
5491
5492 case eWNI_SME_DEAUTH_REQ:
5493 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5494
5495 break;
5496
Jeff Johnson295189b2012-06-20 16:38:30 -07005497
5498
5499 case eWNI_SME_SETCONTEXT_REQ:
5500 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5501
5502 break;
5503
5504 case eWNI_SME_REMOVEKEY_REQ:
5505 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5506
5507 break;
5508
5509 case eWNI_SME_STOP_BSS_REQ:
5510 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5511 break;
5512
5513 case eWNI_SME_ASSOC_CNF:
5514 case eWNI_SME_REASSOC_CNF:
5515 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005516 PELOG1(limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005517 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005518 PELOG1(limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005519 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5520 break;
5521
5522 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005523 PELOG1(limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005524 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5525 break;
5526
5527 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005528 PELOG1(limLog(pMac, LOG1, FL("Received DELTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005529 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5530 break;
5531
5532 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005533 PELOG1(limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005534 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5535 break;
5536
5537 case eWNI_SME_STA_STAT_REQ:
5538 case eWNI_SME_AGGR_STAT_REQ:
5539 case eWNI_SME_GLOBAL_STAT_REQ:
5540 case eWNI_SME_STAT_SUMM_REQ:
5541 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5542 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5543 bufConsumed = FALSE;
5544 break;
5545 case eWNI_SME_GET_STATISTICS_REQ:
5546 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5547 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5548 bufConsumed = FALSE;
5549 break;
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005550#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
5551 case eWNI_SME_GET_ROAM_RSSI_REQ:
5552 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5553 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5554 bufConsumed = FALSE;
5555 break;
5556#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005557#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
5558 case eWNI_SME_GET_TSM_STATS_REQ:
5559 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5560 bufConsumed = FALSE;
5561 break;
5562#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005563 case eWNI_SME_DEL_BA_PEER_IND:
5564 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5565 break;
5566 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5567 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5568 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005569 case eWNI_SME_GET_ASSOC_STAS_REQ:
5570 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5571 break;
5572 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5573 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5574 break;
5575
5576 case eWNI_SME_HIDE_SSID_REQ:
5577 __limProcessSmeHideSSID(pMac, pMsgBuf);
5578 break;
5579 case eWNI_SME_UPDATE_APWPSIE_REQ:
5580 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5581 break;
5582 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5583 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5584 break;
5585
5586 case eWNI_SME_SET_APWPARSNIEs_REQ:
5587 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5588 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005589
5590 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5591 //Update the beaconInterval
5592 __limProcessSmeChangeBI(pMac, pMsgBuf );
5593 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005594
5595#if defined WLAN_FEATURE_VOWIFI
5596 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5597 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5598 __limProcessReportMessage(pMac, pMsg);
5599 break;
5600#endif
5601
5602#if defined WLAN_FEATURE_VOWIFI_11R
5603 case eWNI_SME_FT_PRE_AUTH_REQ:
5604 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5605 break;
5606 case eWNI_SME_FT_UPDATE_KEY:
5607 limProcessFTUpdateKey(pMac, pMsgBuf);
5608 break;
5609
5610 case eWNI_SME_FT_AGGR_QOS_REQ:
5611 limProcessFTAggrQosReq(pMac, pMsgBuf);
5612 break;
5613#endif
5614
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005615#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07005616 case eWNI_SME_CCX_ADJACENT_AP_REPORT:
5617 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5618 break;
5619#endif
5620 case eWNI_SME_ADD_STA_SELF_REQ:
5621 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5622 break;
5623 case eWNI_SME_DEL_STA_SELF_REQ:
5624 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5625 break;
5626
Jeff Johnson295189b2012-06-20 16:38:30 -07005627 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5628 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5629 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005630#ifdef FEATURE_WLAN_TDLS
5631 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5632 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5633 break;
5634 case eWNI_SME_TDLS_ADD_STA_REQ:
5635 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5636 break;
5637 case eWNI_SME_TDLS_DEL_STA_REQ:
5638 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5639 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305640 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5641 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5642 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005643#endif
5644#ifdef FEATURE_WLAN_TDLS_INTERNAL
5645 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
5646 limProcessSmeDisStartReq(pMac, pMsgBuf);
5647 break ;
5648 case eWNI_SME_TDLS_LINK_START_REQ:
5649 limProcessSmeLinkStartReq(pMac, pMsgBuf);
5650 break ;
5651 case eWNI_SME_TDLS_TEARDOWN_REQ:
5652 limProcessSmeTeardownReq(pMac, pMsgBuf);
5653 break ;
5654#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305655 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5656 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5657 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005658
schang86c22c42013-03-13 18:41:24 -07005659 case eWNI_SME_SET_TX_POWER_REQ:
5660 limSendSetTxPowerReq(pMac, pMsgBuf);
5661 break ;
5662
Jeff Johnson295189b2012-06-20 16:38:30 -07005663 default:
5664 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5665 pMsg->bodyptr = NULL;
5666 break;
5667 } // switch (msgType)
5668
5669 return bufConsumed;
5670} /*** end limProcessSmeReqMessages() ***/