blob: 81c91a891d9e419fb195b4abe596bad601739823 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -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/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*
43 * Airgo Networks, Inc proprietary. All rights reserved.
44 * This file limProcessSmeReqMessages.cc contains the code
45 * for processing SME request messages.
46 * Author: Chandra Modumudi
47 * Date: 02/11/02
48 * History:-
49 * Date Modified by Modification Information
50 * --------------------------------------------------------------------
51 *
52 */
53
54#include "palTypes.h"
55#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070056#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070057#include "cfgApi.h"
58#include "sirApi.h"
59#include "schApi.h"
60#include "utilsApi.h"
61#include "limTypes.h"
62#include "limUtils.h"
63#include "limAssocUtils.h"
64#include "limSecurityUtils.h"
65#include "limSerDesUtils.h"
66#include "limSmeReqUtils.h"
67#include "limIbssPeerMgmt.h"
68#include "limAdmitControl.h"
69#include "dphHashTable.h"
70#include "limSendMessages.h"
71#include "limApi.h"
72#include "wmmApsd.h"
73
Jeff Johnson295189b2012-06-20 16:38:30 -070074#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070075
76#if defined WLAN_FEATURE_VOWIFI
77#include "rrmApi.h"
78#endif
79#if defined FEATURE_WLAN_CCX
80#include "ccxApi.h"
81#endif
82
83#if defined WLAN_FEATURE_VOWIFI_11R
84#include <limFT.h>
85#endif
86
87#ifdef FEATURE_WLAN_CCX
88/* These are the min/max tx power (non virtual rates) range
89 supported by prima hardware */
90#define MIN_TX_PWR_CAP 12
91#define MAX_TX_PWR_CAP 19
92
93#endif
94
Viral Modid86bde22012-12-10 13:09:21 -080095/* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK
96 * 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 -080097 * taking care of sending null data and receiving ACK to/from AP/Also SetChannel with calibration is taking
98 * around 7ms .
Viral Modid86bde22012-12-10 13:09:21 -080099 */
Viral Modid440e682013-03-06 02:25:31 -0800100#define SCAN_MESSAGING_OVERHEAD 20 // in msecs
101#define JOIN_NOA_DURATION 2000 // in msecs
102#define OEM_DATA_NOA_DURATION 60 // in msecs
103#define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 // in msecs
Jeff Johnson295189b2012-06-20 16:38:30 -0700104
Gopichand Nakkala096a1052012-12-21 07:05:34 -0800105#define CONV_MS_TO_US 1024 //conversion factor from ms to us
106
Jeff Johnson295189b2012-06-20 16:38:30 -0700107// SME REQ processing function templates
108static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *);
109static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *);
110static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
Viral Modid440e682013-03-06 02:25:31 -0800111static void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *);
Jeff Johnson295189b2012-06-20 16:38:30 -0700112static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *);
113static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *);
114static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *);
115static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *);
116static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *);
117static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *);
118static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
119
Jeff Johnson295189b2012-06-20 16:38:30 -0700120void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *);
121
Jeff Johnson295189b2012-06-20 16:38:30 -0700122extern void peRegisterTLHandle(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700123
Jeff Johnson295189b2012-06-20 16:38:30 -0700124extern int limProcessRemainOnChnlReq(tpAniSirGlobal pMac, tANI_U32 *pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700125
Jeff Johnson295189b2012-06-20 16:38:30 -0700126#ifdef BACKGROUND_SCAN_ENABLED
127
128// start the background scan timers if it hasn't already started
129static void
130__limBackgroundScanInitiate(tpAniSirGlobal pMac)
131{
132 if (pMac->lim.gLimBackgroundScanStarted)
133 return;
134
135 //make sure timer is created first
136 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
137 {
138 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -0700139 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700140 if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700141 limLog(pMac, LOGP, FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700142 pMac->lim.gLimBackgroundScanStarted = true;
143 pMac->lim.gLimBackgroundScanChannelId = 0;
144 }
145}
146
147#endif // BACKGROUND_SCAN_ENABLED
Jeff Johnson295189b2012-06-20 16:38:30 -0700148
149// determine if a fresh scan request must be issued or not
150/*
151* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
152* If one of the sessions is not in one of the above states, then PE does not do fresh scan
153* If no session exists (scanning very first time), then PE will always do fresh scan if SME
154* asks it to do that.
155*/
156static tANI_U8
157__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
158{
159
160 tANI_U8 validState = TRUE;
161 int i;
162
163 if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
164 {
165 return FALSE;
166 }
167 for(i =0; i < pMac->lim.maxBssId; i++)
168 {
169
170 if(pMac->lim.gpSession[i].valid == TRUE)
171 {
172 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
173 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
174 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
175
176 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
177 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
178 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
179 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700180 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
181 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
182 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
183 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700184 ))
185 {
186 validState = FALSE;
187 break;
188 }
189
190 }
191 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700192 PELOG1(limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700193
194 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
195 return TRUE;
196
197 return FALSE;
198}
199
Jeff Johnson295189b2012-06-20 16:38:30 -0700200
201
202/**
203 * __limIsSmeAssocCnfValid()
204 *
205 *FUNCTION:
206 * This function is called by limProcessLmmMessages() upon
207 * receiving SME_ASSOC_CNF.
208 *
209 *LOGIC:
210 * Message validity checks are performed in this function
211 *
212 *ASSUMPTIONS:
213 *
214 *NOTE:
215 *
216 * @param pMeasReq Pointer to Received ASSOC_CNF message
217 * @return true When received SME_ASSOC_CNF is formatted
218 * correctly
219 * false otherwise
220 */
221
222inline static tANI_U8
223__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
224{
225 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
226 return false;
227 else
228 return true;
229} /*** end __limIsSmeAssocCnfValid() ***/
230
231
232/**
233 * __limGetSmeJoinReqSizeForAlloc()
234 *
235 *FUNCTION:
236 * This function is called in various places to get IE length
237 * from tSirBssDescription structure
238 * number being scanned.
239 *
240 *PARAMS:
241 *
242 *LOGIC:
243 *
244 *ASSUMPTIONS:
245 * NA
246 *
247 *NOTE:
248 * NA
249 *
250 * @param pBssDescr
251 * @return Total IE length
252 */
253
254static tANI_U16
255__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
256{
257 tANI_U16 len = 0;
258
259 if (!pBuf)
260 return len;
261
262 pBuf += sizeof(tANI_U16);
263 len = limGetU16( pBuf );
264 return (len + sizeof( tANI_U16 ));
265} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
266
267
268/**----------------------------------------------------------------
269\fn __limIsDeferedMsgForLearn
270
271\brief Has role only if 11h is enabled. Not used on STA side.
272 Defers the message if SME is in learn state and brings
273 the LIM back to normal mode.
274
275\param pMac
276\param pMsg - Pointer to message posted from SME to LIM.
277\return TRUE - If defered
278 FALSE - Otherwise
279------------------------------------------------------------------*/
280static tANI_BOOLEAN
281__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
282{
283 if (limIsSystemInScanState(pMac))
284 {
285 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
286 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700287 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700288 return eANI_BOOLEAN_FALSE;
289 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700290 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 pMsg->type);)
292
293 /** Send finish scan req to HAL only if LIM is not waiting for any response
294 * from HAL like init scan rsp, start scan rsp etc.
295 */
296 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
297 {
298 //Set the resume channel to Any valid channel (invalid).
299 //This will instruct HAL to set it to any previous valid channel.
300 peSetResumeChannel(pMac, 0, 0);
301 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
302 }
303
304 return eANI_BOOLEAN_TRUE;
305 }
306 return eANI_BOOLEAN_FALSE;
307}
308
309/**----------------------------------------------------------------
310\fn __limIsDeferedMsgForRadar
311
312\brief Has role only if 11h is enabled. Not used on STA side.
313 Defers the message if radar is detected.
314
315\param pMac
316\param pMsg - Pointer to message posted from SME to LIM.
317\return TRUE - If defered
318 FALSE - Otherwise
319------------------------------------------------------------------*/
320static tANI_BOOLEAN
321__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
322{
323 /** fRadarDetCurOperChan will be set only if we detect radar in current
324 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700325 //TODO: Need to take care radar detection.
326 //if (LIM_IS_RADAR_DETECTED(pMac))
327 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 {
329 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
330 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700331 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700332 return eANI_BOOLEAN_FALSE;
333 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700334 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700335 pMsg->type);)
336 return eANI_BOOLEAN_TRUE;
337 }
338 return eANI_BOOLEAN_FALSE;
339}
340
341
342/**
343 * __limProcessSmeStartReq()
344 *
345 *FUNCTION:
346 * This function is called to process SME_START_REQ message
347 * from HDD or upper layer application.
348 *
349 *LOGIC:
350 *
351 *ASSUMPTIONS:
352 *
353 *NOTE:
354 *
355 * @param pMac Pointer to Global MAC structure
356 * @param *pMsgBuf A pointer to the SME message buffer
357 * @return None
358 */
359
360static void
361__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
362{
363 tSirResultCodes retCode = eSIR_SME_SUCCESS;
364 tANI_U8 smesessionId;
365 tANI_U16 smetransactionId;
366
367
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700368 PELOG1(limLog(pMac, LOG1, FL("Received START_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700369
370 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
371
372 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
373 {
374 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
375
Jeff Johnsone7245742012-09-05 17:12:55 -0700376 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700377
378 /// By default do not return after first scan match
379 pMac->lim.gLimReturnAfterFirstMatch = 0;
380
381 /// Initialize MLM state machine
382 limInitMlm(pMac);
383
384 /// By default return unique scan results
385 pMac->lim.gLimReturnUniqueResults = true;
386 pMac->lim.gLimSmeScanResultLength = 0;
387
Jeff Johnson295189b2012-06-20 16:38:30 -0700388 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
389 {
390 /*
391 * Need to indicate new BSSs found during background scanning to
392 * host. Update this parameter at CFG
393 */
394 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
395 != eSIR_SUCCESS)
396 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700397 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700398 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
399 }
400 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700401 }
402 else
403 {
404 /**
405 * Should not have received eWNI_SME_START_REQ in states
406 * other than OFFLINE. Return response to host and
407 * log error
408 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700409 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
411 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
412 }
413 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
414} /*** end __limProcessSmeStartReq() ***/
415
416
417/** -------------------------------------------------------------
418\fn __limProcessSmeSysReadyInd
419\brief handles the notification from HDD. PE just forwards this message to HAL.
420\param tpAniSirGlobal pMac
421\param tANI_U32* pMsgBuf
422\return TRUE-Posting to HAL failed, so PE will consume the buffer.
423\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
424 -------------------------------------------------------------*/
425static tANI_BOOLEAN
426__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
427{
428 tSirMsgQ msg;
429
430 msg.type = WDA_SYS_READY_IND;
431 msg.reserved = 0;
432 msg.bodyptr = pMsgBuf;
433 msg.bodyval = 0;
434
Jeff Johnson92751692013-03-06 16:00:33 -0800435 if (pMac->gDriverType != eDRIVER_TYPE_MFG)
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 {
Jeff Johnson92751692013-03-06 16:00:33 -0800437 peRegisterTLHandle(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700439 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700440 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700441
Jeff Johnson92751692013-03-06 16:00:33 -0800442 if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
Jeff Johnson295189b2012-06-20 16:38:30 -0700443 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700444 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 return eANI_BOOLEAN_TRUE;
446 }
447 return eANI_BOOLEAN_FALSE;
448}
449
Jeff Johnsone7245742012-09-05 17:12:55 -0700450#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700451
Jeff Johnsone7245742012-09-05 17:12:55 -0700452tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
453{
454 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
455 {
456 switch(secondaryChanOffset)
457 {
458 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
459 return primarychanNum;
460 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
461 return primarychanNum + 2;
462 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
463 return primarychanNum - 2;
464 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
465 return primarychanNum + 6;
466 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
467 return primarychanNum + 2;
468 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
469 return primarychanNum - 2;
470 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
471 return primarychanNum - 6;
472 default :
473 return eSIR_CFG_INVALID_ID;
474 }
475 }
476 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
477 {
478 switch(secondaryChanOffset)
479 {
480 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
481 return primarychanNum + 2;
482 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
483 return primarychanNum - 2;
484 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
485 return primarychanNum;
486 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
487 return primarychanNum + 2;
488 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
489 return primarychanNum - 2;
490 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
491 return primarychanNum + 2;
492 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
493 return primarychanNum - 2;
494 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
495 return primarychanNum + 2;
496 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
497 return primarychanNum - 2;
498 default :
499 return eSIR_CFG_INVALID_ID;
500 }
501 }
502 return primarychanNum;
503}
504
505#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700506/**
507 * __limHandleSmeStartBssRequest()
508 *
509 *FUNCTION:
510 * This function is called to process SME_START_BSS_REQ message
511 * from HDD or upper layer application.
512 *
513 *LOGIC:
514 *
515 *ASSUMPTIONS:
516 *
517 *NOTE:
518 *
519 * @param pMac Pointer to Global MAC structure
520 * @param *pMsgBuf A pointer to the SME message buffer
521 * @return None
522 */
523
524static void
525__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
526{
527 tANI_U16 size;
528 tANI_U32 val = 0;
529 tSirRetStatus retStatus;
530 tSirMacChanNum channelNumber;
Jeff Johnsonace91102013-04-05 08:03:18 -0700531 tLimMlmStartReq *pMlmStartReq = NULL;
532 tpSirSmeStartBssReq pSmeStartBssReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700533 tSirResultCodes retCode = eSIR_SME_SUCCESS;
534 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 tANI_U8 sessionId;
536 tpPESession psessionEntry = NULL;
537 tANI_U8 smesessionId;
538 tANI_U16 smetransactionId;
539
540#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
541 //Since the session is not created yet, sending NULL. The response should have the correct state.
542 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
543#endif //FEATURE_WLAN_DIAG_SUPPORT
544
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700545 PELOG1(limLog(pMac, LOG1, FL("Received START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700546
547 /* Global Sme state and mlm states are not defined yet , for BT-AMP Suppoprt . TO BE DONE */
548 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
549 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
550 {
551 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
552
Jeff Johnson295189b2012-06-20 16:38:30 -0700553
554 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSmeStartBssReq, size))
555 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700556 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed for pMac->lim.gpLimStartBssReq"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 /// Send failure response to host
558 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
559 goto end;
560 }
561
562 (void) palZeroMemory(pMac->hHdd, (void *)pSmeStartBssReq, size);
563
564 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
565 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
566 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700567 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700568 retCode = eSIR_SME_INVALID_PARAMETERS;
569 goto free;
570 }
571#if 0
572 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700573 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700574 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
575#endif
576
577 /* This is the place where PE is going to create a session.
578 * If session is not existed , then create a new session */
579 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
580 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700581 limLog(pMac, LOGW, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700582 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
583 psessionEntry = NULL;
584 goto free;
585 }
586 else
587 {
588 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
589 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700590 limLog(pMac, LOGW, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700591 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
592 goto free;
593 }
594
595 }
596
597 /* Store the session related parameters in newly created session */
598 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
599
600 /* Store PE sessionId in session Table */
601 psessionEntry->peSessionId = sessionId;
602
603 /* Store SME session Id in sessionTable */
604 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
605
606 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
607
608 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
609
610 /* Copy SSID to session table */
611 palCopyMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->ssId,
612 (tANI_U8 *)&pSmeStartBssReq->ssId,
613 (pSmeStartBssReq->ssId.length + 1));
614
615
616
617 psessionEntry->bssType = pSmeStartBssReq->bssType;
618
619 psessionEntry->nwType = pSmeStartBssReq->nwType;
620
621 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
622
623 /* Store the channel number in session Table */
624 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
625
626 /*Store Persona */
627 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700628 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 psessionEntry->pePersona);
630
631 /*Update the phymode*/
632 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
633
634 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
635 psessionEntry->currentOperChannel );
636 /* Store the dot 11 mode in to the session Table*/
637
638 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700639 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
640#ifdef WLAN_FEATURE_11AC
641 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700642 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
643 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700644#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800645
646 psessionEntry->txLdpcIniFeatureEnabled =
647 pSmeStartBssReq->txLdpcIniFeatureEnabled;
648
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 palCopyMemory(pMac->hHdd, (void*)&psessionEntry->rateSet,
650 (void*)&pSmeStartBssReq->operationalRateSet,
651 sizeof(tSirMacRateSet));
652 palCopyMemory(pMac->hHdd, (void*)&psessionEntry->extRateSet,
653 (void*)&pSmeStartBssReq->extendedRateSet,
654 sizeof(tSirMacRateSet));
655
656 switch(pSmeStartBssReq->bssType)
657 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 case eSIR_INFRA_AP_MODE:
659 psessionEntry->limSystemRole = eLIM_AP_ROLE;
660 psessionEntry->privacy = pSmeStartBssReq->privacy;
661 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
662 psessionEntry->authType = pSmeStartBssReq->authType;
663 /* Store the DTIM period */
664 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
665 /*Enable/disable UAPSD*/
666 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
667 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
668 {
669 psessionEntry->proxyProbeRspEn = 0;
670 }
671 else
672 {
673 /* To detect PBC overlap in SAP WPS mode, Host handles
674 * Probe Requests.
675 */
676 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
677 {
678 psessionEntry->proxyProbeRspEn = 1;
679 }
680 else
681 {
682 psessionEntry->proxyProbeRspEn = 0;
683 }
684 }
685 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
686 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -0700687 psessionEntry->shortSlotTimeSupported = limGetShortSlotFromPhyMode(pMac, psessionEntry, psessionEntry->gLimPhyMode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 case eSIR_IBSS_MODE:
690 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
691 break;
692
693 case eSIR_BTAMP_AP_MODE:
694 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
695 break;
696
697 case eSIR_BTAMP_STA_MODE:
698 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
699 break;
700
701 /* There is one more mode called auto mode. which is used no where */
702
703 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
704
705
706 default:
707 //not used anywhere...used in scan function
708 break;
709 }
710
711 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
712 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700714 )
715 {
716 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&psessionEntry->parsedAssocReq,
717 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)) ))
718 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700719 limLog(pMac, LOGW, FL("palAllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
721 goto free;
722 }
723 palZeroMemory(pMac->hHdd, psessionEntry->parsedAssocReq, (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)) );
724 }
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 }
747
748 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ || chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
749 {
750 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
751 != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700752 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700753 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 retCode = eSIR_LOGP_EXCEPTION;
Jeff Johnsone7245742012-09-05 17:12:55 -0700755 goto free;
Jeff Johnson295189b2012-06-20 16:38:30 -0700756 }
757 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700758 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
759 {
760 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
761 != eSIR_SUCCESS)
762 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700763 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700764 retCode = eSIR_LOGP_EXCEPTION;
765 goto free;
766 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700767
Jeff Johnsone7245742012-09-05 17:12:55 -0700768 centerChan = limGetCenterChannel(pMac,channelNumber,pSmeStartBssReq->cbMode,WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
769 if(centerChan != eSIR_CFG_INVALID_ID)
770 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700771 limLog(pMac, LOGW, FL("***Center Channel for 80MHZ channel width = %ld"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700772 psessionEntry->apCenterChan = centerChan;
Jeff Johnsone7245742012-09-05 17:12:55 -0700773 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1, centerChan)
774 != eSIR_SUCCESS)
775 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700776 limLog(pMac, LOGP, FL("could not set 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
783 /* All the translation is done by now for gVhtChannelWidth from .ini file to
784 * the actual values as defined in spec. So, grabing the spec value which is
785 * updated in .dat file by the above logic */
786 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
787 &chanWidth) != eSIR_SUCCESS)
788 {
789 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700790 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700791 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700792 /*For Sta+p2p-Go concurrency
793 vhtTxChannelWidthSet is used for storing p2p-GO channel width
794 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
795 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
796 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700797 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700798 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700799 }
800 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
801#endif
802 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 else
804 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700805 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 retCode = eSIR_SME_INVALID_PARAMETERS;
807 goto free;
808 }
809
810 // Delete pre-auth list if any
811 limDeletePreAuthList(pMac);
812
813 // Delete IBSS peer BSSdescription list if any
814 //limIbssDelete(pMac); sep 26 review
815
816
817
818#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
819 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700820 limInitMlm(pMac);
821#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700822
Jeff Johnsone7245742012-09-05 17:12:55 -0700823 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700824
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 /* keep the RSN/WPA IE information in PE Session Entry
826 * later will be using this to check when received (Re)Assoc req
827 * */
828 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
829
Jeff Johnson295189b2012-06-20 16:38:30 -0700830
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 //Taken care for only softAP case rest need to be done
832 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
833 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
834 /*each byte will have the following info
835 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
836 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
837 palCopyMemory( pMac->hHdd, (void *) &psessionEntry->cfgProtection,
838 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700839 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
841 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700842
843 // Prepare and Issue LIM_MLM_START_REQ to MLM
844 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmStartReq, sizeof(tLimMlmStartReq)))
845 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700846 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
848 goto free;
849 }
850
851 (void)palZeroMemory(pMac->hHdd, (void *) pMlmStartReq, sizeof(tLimMlmStartReq));
852
853 /* Copy SSID to the MLM start structure */
854 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmStartReq->ssId,
855 (tANI_U8 *) &pSmeStartBssReq->ssId,
856 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700857 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
858 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700859
860
861 pMlmStartReq->bssType = psessionEntry->bssType;
862
863 /* Fill PE session Id from the session Table */
864 pMlmStartReq->sessionId = psessionEntry->peSessionId;
865
866 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700867 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700868 )
869 {
870 //len = sizeof(tSirMacAddr);
871 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
872 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700873 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700874
875 /* Copy the BSSId from sessionTable to mlmStartReq struct */
876 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
877 }
878
879 else // ibss mode
880 {
881 pMac->lim.gLimIbssCoalescingHappened = false;
882
883 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
884 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700885 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 retCode = eSIR_LOGP_EXCEPTION;
887 goto free;
888 }
889
890 if(!autoGenBssId)
891 {
892 // We're not auto generating BSSID. Instead, get it from session entry
893 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
894
895 if(pMlmStartReq->bssId[0] & 0x01)
896 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700897 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 autoGenBssId = TRUE;
899 }
900 }
901
902 if( autoGenBssId )
903 { //if BSSID is not any uc id. then use locally generated BSSID.
904 //Autogenerate the BSSID
905 limGetRandomBssid( pMac, pMlmStartReq->bssId);
906 pMlmStartReq->bssId[0]= 0x02;
907
908 /* Copy randomly generated BSSID to the session Table */
909 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
910 }
911 }
912 /* store the channel num in mlmstart req structure */
913 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
914 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
915 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
916
Jeff Johnson295189b2012-06-20 16:38:30 -0700917 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
918 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
919 pMlmStartReq->wps_state = psessionEntry->wps_state;
920
921 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700922 {
923 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700924 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700925 pMlmStartReq->dtimPeriod = (tANI_U8)val;
926 }
927
928 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700929 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
931
932 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700933 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700934 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
935
936 //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
937 palCopyMemory(pMac->hHdd, (void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
938 sizeof(tSirMacRateSet));
939
940
941 // Now populate the 11n related parameters
942 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700943 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700944 //
945 // FIXME_GEN4 - Determine the appropriate defaults...
946 //
947 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
948 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700949 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700950
951 /* sep26 review */
952 psessionEntry->limRFBand = limGetRFBand(channelNumber);
953
954 // Initialize 11h Enable Flag
955 psessionEntry->lim11hEnable = 0;
956 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
957 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
958 {
959 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700960 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700961 psessionEntry->lim11hEnable = val;
962 }
963
964 if (!psessionEntry->lim11hEnable)
965 {
966 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700967 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700968 }
969
Jeff Johnson295189b2012-06-20 16:38:30 -0700970 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
971 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700972 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700973
974 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
975 return;
976 }
977 else
978 {
979
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700980 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700981 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
982 goto end;
983 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
984
985free:
Jeff Johnsonace91102013-04-05 08:03:18 -0700986 if ((psessionEntry != NULL) &&
987 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
988 {
989 psessionEntry->pLimStartBssReq = NULL;
990 }
991 palFreeMemory(pMac->hHdd, pSmeStartBssReq);
992 palFreeMemory(pMac->hHdd, pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700993
994end:
995
996 /* This routine should return the sme sessionId and SME transaction Id */
997 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
998
999 if(NULL != psessionEntry)
1000 {
1001 peDeleteSession(pMac,psessionEntry);
1002 psessionEntry = NULL;
1003 }
1004 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
1005} /*** end __limHandleSmeStartBssRequest() ***/
1006
1007
1008/**--------------------------------------------------------------
1009\fn __limProcessSmeStartBssReq
1010
1011\brief Wrapper for the function __limHandleSmeStartBssRequest
1012 This message will be defered until softmac come out of
1013 scan mode or if we have detected radar on the current
1014 operating channel.
1015\param pMac
1016\param pMsg
1017
1018\return TRUE - If we consumed the buffer
1019 FALSE - If have defered the message.
1020 ---------------------------------------------------------------*/
1021static tANI_BOOLEAN
1022__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1023{
1024 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1025 __limIsDeferedMsgForRadar(pMac, pMsg))
1026 {
1027 /**
1028 * If message defered, buffer is not consumed yet.
1029 * So return false
1030 */
1031 return eANI_BOOLEAN_FALSE;
1032 }
1033
1034 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1035 return eANI_BOOLEAN_TRUE;
1036}
1037
1038
1039/**
1040 * limGetRandomBssid()
1041 *
1042 * FUNCTION:This function is called to process generate the random number for bssid
1043 * This function is called to process SME_SCAN_REQ message
1044 * from HDD or upper layer application.
1045 *
1046 * LOGIC:
1047 *
1048 * ASSUMPTIONS:
1049 *
1050 * NOTE:
1051 * 1. geneartes the unique random number for bssid in ibss
1052 *
1053 * @param pMac Pointer to Global MAC structure
1054 * @param *data Pointer to bssid buffer
1055 * @return None
1056 */
1057void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1058{
1059 tANI_U32 random[2] ;
1060 random[0] = tx_time_get();
1061 random[0] |= (random[0] << 15) ;
1062 random[1] = random[0] >> 1;
1063 palCopyMemory(pMac->hHdd, data, (tANI_U8*)random, sizeof(tSirMacAddr));
1064}
1065
1066
1067/**
1068 * __limProcessSmeScanReq()
1069 *
1070 *FUNCTION:
1071 * This function is called to process SME_SCAN_REQ message
1072 * from HDD or upper layer application.
1073 *
1074 *LOGIC:
1075 *
1076 *ASSUMPTIONS:
1077 *
1078 *NOTE:
1079 * 1. Periodic scanning should be requesting to return unique
1080 * scan results.
1081 *
1082 * @param pMac Pointer to Global MAC structure
1083 * @param *pMsgBuf A pointer to the SME message buffer
1084 * @return None
1085 */
1086
Viral Modid440e682013-03-06 02:25:31 -08001087static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001088__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1089{
1090 tANI_U32 len;
1091 tLimMlmScanReq *pMlmScanReq;
1092 tpSirSmeScanReq pScanReq;
1093 tANI_U8 i = 0;
1094
1095#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1096 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1097#endif //FEATURE_WLAN_DIAG_SUPPORT
1098
1099 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001100 PELOG1(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 -07001101 pScanReq->channelList.numChannels,
1102 pScanReq->minChannelTime,
1103 pScanReq->maxChannelTime,
1104 pScanReq->uIEFieldLen,
1105 pScanReq->returnAfterFirstMatch,
1106 pScanReq->returnFreshResults,
1107 pScanReq->returnUniqueResults,
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001108 pScanReq->scanType,
1109 pScanReq->backgroundScanMode,
1110 pMac->lim.gLimRspReqd ? 1 : 0);)
Viral Modid86bde22012-12-10 13:09:21 -08001111
1112 /* Since scan req always requires a response, we will overwrite response required here.
1113 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1114 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1115 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1116 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1117 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1118 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1119 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1120 * the global flag gLimRspReqd to TRUE here.
1121 */
1122 pMac->lim.gLimRspReqd = TRUE;
1123
Jeff Johnson295189b2012-06-20 16:38:30 -07001124 /*copy the Self MAC address from SmeReq to the globalplace , used for sending probe req.discussed on code review sep18*/
1125 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1126
1127 /* This routine should return the sme sessionId and SME transaction Id */
1128
1129 if (!limIsSmeScanReqValid(pMac, pScanReq))
1130 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001131 PELOGW(limLog(pMac, LOGW, FL("Received SME_SCAN_REQ with invalid parameters"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001132
1133 if (pMac->lim.gLimRspReqd)
1134 {
1135 pMac->lim.gLimRspReqd = false;
1136
1137 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1138
1139 } // if (pMac->lim.gLimRspReqd)
1140
1141 return;
1142 }
1143
1144 //if scan is disabled then return as invalid scan request.
1145 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1146 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1147 {
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001148 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001149 return;
1150 }
1151
1152
1153 /**
1154 * If scan request is received in idle, joinFailed
1155 * states or in link established state (in STA role)
1156 * or in normal state (in STA-in-IBSS/AP role) with
1157 * 'return fresh scan results' request from HDD or
1158 * it is periodic background scanning request,
1159 * trigger fresh scan request to MLM
1160 */
1161 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1162 {
1163 #if 0
1164 // Update global SME state
1165 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1166 if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) ||
1167 (pMac->lim.gLimSmeState == eLIM_SME_JOIN_FAILURE_STATE))
1168 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1169 else if (pMac->lim.gLimSmeState == eLIM_SME_NORMAL_STATE)
1170 pMac->lim.gLimSmeState = eLIM_SME_NORMAL_CHANNEL_SCAN_STATE;
1171 else
1172
1173 #endif //TO SUPPORT BT-AMP
1174
1175 /*Change Global SME state */
1176
1177 /* Store the previous SME state */
1178
1179 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1180
1181 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
Leela V Kiran Kumar Reddy Chiralac3b9d382013-01-31 20:49:53 -08001182 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001183
1184 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1185 {
1186 // Discard previously cached scan results
1187 limReInitScanResults(pMac);
1188 }
1189
1190 pMac->lim.gLim24Band11dScanDone = 0;
1191 pMac->lim.gLim50Band11dScanDone = 0;
1192 pMac->lim.gLimReturnAfterFirstMatch =
1193 pScanReq->returnAfterFirstMatch;
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001194 pMac->lim.gLimBackgroundScanMode =
1195 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001196
1197 pMac->lim.gLimReturnUniqueResults =
1198 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1199 /* De-activate Heartbeat timers for connected sessions while
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001200 * scan is in progress if the system is in Active mode *
1201 * AND it is not a ROAMING ("background") scan */
1202 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
Yathish9f22e662012-12-10 14:21:35 -08001203 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1204 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1205 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 {
1207 for(i=0;i<pMac->lim.maxBssId;i++)
1208 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07001209 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1210 (pMac->lim.gpSession[i].valid == TRUE) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001211 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1212 {
1213 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1214 }
1215 }
1216 }
1217
1218 if (pScanReq->channelList.numChannels == 0)
1219 {
1220 tANI_U32 cfg_len;
1221 // Scan all channels
1222 len = sizeof(tLimMlmScanReq) +
1223 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1224 pScanReq->uIEFieldLen;
1225 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq, len) )
1226 {
1227 // Log error
1228 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001229 FL("call to palAllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001230
1231 return;
1232 }
1233
1234 // Initialize this buffer
1235 palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq, len );
1236
1237 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1238 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
1239 pMlmScanReq->channelList.channelNumber,
1240 &cfg_len) != eSIR_SUCCESS)
1241 {
1242 /**
1243 * Could not get Valid channel list from CFG.
1244 * Log error.
1245 */
1246 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001247 FL("could not retrieve Valid channel list"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001248 }
1249 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
1250 }
1251 else
1252 {
1253 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1254 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1255 pScanReq->uIEFieldLen;
1256
1257 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq, len) )
1258 {
1259 // Log error
1260 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001261 FL("call to palAllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001262
1263 return;
1264 }
1265
1266 // Initialize this buffer
1267 palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq, len);
1268 pMlmScanReq->channelList.numChannels =
1269 pScanReq->channelList.numChannels;
1270
1271 palCopyMemory( pMac->hHdd, pMlmScanReq->channelList.channelNumber,
1272 pScanReq->channelList.channelNumber,
1273 pScanReq->channelList.numChannels);
1274 }
1275
1276 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1277 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1278
1279 if(pScanReq->uIEFieldLen)
1280 {
1281 palCopyMemory( pMac->hHdd, (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1282 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1283 pScanReq->uIEFieldLen);
1284 }
1285
1286 pMlmScanReq->bssType = pScanReq->bssType;
1287 palCopyMemory( pMac->hHdd, pMlmScanReq->bssId,
1288 pScanReq->bssId,
1289 sizeof(tSirMacAddr));
1290 pMlmScanReq->numSsid = pScanReq->numSsid;
1291
1292 i = 0;
1293 while (i < pMlmScanReq->numSsid)
1294 {
1295 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmScanReq->ssId[i],
1296 (tANI_U8 *) &pScanReq->ssId[i],
1297 pScanReq->ssId[i].length + 1);
1298
1299 i++;
1300 }
1301
1302
1303 pMlmScanReq->scanType = pScanReq->scanType;
1304 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
1305 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1306 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
Kiran Kumar Lokere3527f0c2013-02-24 22:21:28 -08001307 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1308 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
Jeff Johnson295189b2012-06-20 16:38:30 -07001309 pMlmScanReq->dot11mode = pScanReq->dot11mode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001310 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001311
1312 //Store the smeSessionID and transaction ID for later use.
1313 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1314 pMac->lim.gTransactionId = pScanReq->transactionId;
1315
1316 // Issue LIM_MLM_SCAN_REQ to MLM
1317 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1318
1319 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1320
1321 else
1322 {
1323 /// In all other cases return 'cached' scan results
1324 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1325 {
1326 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1327
1328 pMac->lim.gLimRspReqd = false;
1329
1330 if (pMac->lim.gLimSmeScanResultLength == 0)
1331 {
1332 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pScanReq->sessionId, pScanReq->transactionId);
1333 }
1334 else
1335 {
1336 scanRspLen = sizeof(tSirSmeScanRsp) +
1337 pMac->lim.gLimSmeScanResultLength -
1338 sizeof(tSirBssDescription);
1339 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pScanReq->sessionId, pScanReq->transactionId);
1340 }
1341
1342 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1343 {
1344 // Discard previously cached scan results
1345 limReInitScanResults(pMac);
1346 }
1347
1348 } // if (pMac->lim.gLimRspReqd)
1349 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1350
Jeff Johnson295189b2012-06-20 16:38:30 -07001351#ifdef BACKGROUND_SCAN_ENABLED
1352 // start background scans if needed
1353 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1354 __limBackgroundScanInitiate(pMac);
1355#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001356
1357} /*** end __limProcessSmeScanReq() ***/
1358
Jeff Johnsone7245742012-09-05 17:12:55 -07001359#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001360
Jeff Johnsone7245742012-09-05 17:12:55 -07001361static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1362{
1363 tpSirOemDataReq pOemDataReq;
1364 tLimMlmOemDataReq* pMlmOemDataReq;
1365
1366 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1367
1368 //post the lim mlm message now
1369 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)&pMlmOemDataReq, (sizeof(tLimMlmOemDataReq))))
1370 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001371 limLog(pMac, LOGP, FL("palAllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001372 return;
1373 }
1374
1375 //Initialize this buffer
1376 palZeroMemory(pMac->hHdd, pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)));
1377
1378 palCopyMemory(pMac->hHdd, pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr, sizeof(tSirMacAddr));
1379 palCopyMemory(pMac->hHdd, pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq, OEM_DATA_REQ_SIZE);
1380
1381 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1382 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1383
1384 return;
1385
1386} /*** end __limProcessSmeOemDataReq() ***/
1387
1388#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001389
1390
1391/**
1392 * __limProcessSmeJoinReq()
1393 *
1394 *FUNCTION:
1395 * This function is called to process SME_JOIN_REQ message
1396 * from HDD or upper layer application.
1397 *
1398 *LOGIC:
1399 *
1400 *ASSUMPTIONS:
1401 *
1402 *NOTE:
1403 *
1404 * @param pMac Pointer to Global MAC structure
1405 * @param *pMsgBuf A pointer to the SME message buffer
1406 * @return None
1407 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001408static void
1409__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1410{
1411 // tANI_U8 *pBuf;
1412 //tANI_U32 len;
1413// tSirMacAddr currentBssId;
1414 tpSirSmeJoinReq pSmeJoinReq = NULL;
1415 tLimMlmJoinReq *pMlmJoinReq;
1416 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1417 tANI_U32 val = 0;
1418 tANI_U16 nSize;
1419 tANI_U8 sessionId;
1420 tpPESession psessionEntry = NULL;
1421 tANI_U8 smesessionId;
1422 tANI_U16 smetransactionId;
1423 tPowerdBm localPowerConstraint = 0, regMax = 0;
1424
1425#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1426 //Not sending any session, since it is not created yet. The response whould have correct state.
1427 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1428#endif //FEATURE_WLAN_DIAG_SUPPORT
1429
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001430 PELOG1(limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001431
1432#ifdef WLAN_FEATURE_VOWIFI
1433 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1434 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1435 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1436 * like not honoring power constraint on 1st association after driver loading. */
1437 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001438 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001439 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1440 val = 0;
1441#endif /* WLAN_FEATURE_VOWIFI */
1442
1443 /**
1444 * Expect Join request in idle state.
1445 * Reassociate request is expected in link established state.
1446 */
1447
1448 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1449 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1450 {
1451 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
1452 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSmeJoinReq, nSize))
1453 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001454 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001455 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1456 goto end;
1457 }
1458 (void) palZeroMemory(pMac->hHdd, (void *) pSmeJoinReq, nSize);
1459
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1461 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1462 {
1463 /// Received invalid eWNI_SME_JOIN_REQ
1464 // Log the event
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001465 limLog(pMac, LOGW, FL("received SME_JOIN_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001466 retCode = eSIR_SME_INVALID_PARAMETERS;
1467 goto end;
1468 }
1469
1470 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP ,review os sep 23
1471
1472 /* check for the existence of start BSS session */
1473#ifdef FIXME_GEN6
1474 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1475 {
1476 if(peValidateBtJoinRequest(pMac)!= TRUE)
1477 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001478 limLog(pMac, LOGW, FL("Start Bss session not present::SME_JOIN_REQ in unexpected state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1480 psessionEntry = NULL;
1481 goto end;
1482 }
1483 }
1484
1485#endif
1486
1487
1488 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1489 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001490 limLog(pMac, LOGE, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001491
1492 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1493 {
1494 // Received eWNI_SME_JOIN_REQ for same
1495 // BSS as currently associated.
1496 // Log the event and send success
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001497 PELOGW(limLog(pMac, LOGW, FL("Received SME_JOIN_REQ for currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001498 /// Send Join success response to host
1499 retCode = eSIR_SME_SUCCESS;
1500 goto end;
1501 }
1502 else
1503 {
1504 retCode = eSIR_SME_REFUSED;
1505 psessionEntry = NULL;
1506 goto end;
1507 }
1508 }
1509 else /* Session Entry does not exist for given BSSId */
1510 {
1511 /* Try to Create a new session */
1512 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1513 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001514 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001515 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1516 goto end;
1517 }
1518 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001519 handleHTCapabilityandHTInfo(pMac, psessionEntry);
1520
Jeff Johnson295189b2012-06-20 16:38:30 -07001521 /* Store Session related parameters */
1522 /* Store PE session Id in session Table */
1523 psessionEntry->peSessionId = sessionId;
1524
1525 /* store the smejoin req handle in session table */
1526 psessionEntry->pLimJoinReq = pSmeJoinReq;
1527
1528 /* Store SME session Id in sessionTable */
1529 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1530
1531 /* Store SME transaction Id in session Table */
1532 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1533
1534 /* Store beaconInterval */
1535 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1536
1537 /* Copying of bssId is already done, while creating session */
1538 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1539 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1540 psessionEntry->bssType = pSmeJoinReq->bsstype;
1541
1542 psessionEntry->statypeForBss = STA_ENTRY_PEER;
1543
1544 /* Copy the dot 11 mode in to the session table */
1545
1546 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1547 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001548#ifdef WLAN_FEATURE_11AC
1549 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001550 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001551 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001552 if (psessionEntry->vhtCapability )
1553 {
1554 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1555
1556 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001557 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001558 psessionEntry->txBFIniFeatureEnabled);
1559
1560 if( psessionEntry->txBFIniFeatureEnabled )
1561 {
1562 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1563 != eSIR_SUCCESS)
1564 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001565 limLog(pMac, LOGP, FL("could not set WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001566 retCode = eSIR_LOGP_EXCEPTION;
1567 goto end;
1568 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001569 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001570 "***__limProcessSmeJoinReq: txBFCsnValue=%d****", pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001571
1572 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001573 != eSIR_SUCCESS)
1574 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001575 limLog(pMac, LOGP, FL("could not set WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001576 retCode = eSIR_LOGP_EXCEPTION;
1577 goto end;
1578 }
1579 }
1580 }
1581
Jeff Johnsone7245742012-09-05 17:12:55 -07001582#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001583
1584 /*Phy mode*/
1585 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1586
1587 /* Copy The channel Id to the session Table */
1588 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001589 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1590 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1591 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001592
Chet Lanctot186b5732013-03-18 10:26:30 -07001593 /* Record if management frames need to be protected */
1594#ifdef WLAN_FEATURE_11W
1595 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1596 {
1597 psessionEntry->limRmfEnabled = 1;
1598 }
1599 else
1600 {
1601 psessionEntry->limRmfEnabled = 0;
1602 }
1603#endif
1604
Jeff Johnson295189b2012-06-20 16:38:30 -07001605 /*Store Persona */
1606 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1607 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -07001608 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona, pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001609
1610 /* Copy the SSID from smejoinreq to session entry */
1611 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
1612 palCopyMemory( pMac->hHdd,psessionEntry->ssId.ssId,pSmeJoinReq->ssId.ssId,psessionEntry->ssId.length);
1613
1614 /* Copy the SSID from smejoinreq to session entry */
1615 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
1616 palCopyMemory( pMac->hHdd,psessionEntry->ssId.ssId,pSmeJoinReq->ssId.ssId,psessionEntry->ssId.length);
1617
1618 // Determin 11r or CCX connection based on input from SME
1619 // which inturn is dependent on the profile the user wants to connect
1620 // to, So input is coming from supplicant
1621#ifdef WLAN_FEATURE_VOWIFI_11R
1622 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
1623#endif
1624#ifdef FEATURE_WLAN_CCX
1625 psessionEntry->isCCXconnection = pSmeJoinReq->isCCXconnection;
1626#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001627#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001628 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
1629#endif
1630
Jeff Johnson43971f52012-07-17 12:26:56 -07001631#ifdef FEATURE_WLAN_LFR
1632 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
1633#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001634 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
1635
Jeff Johnson295189b2012-06-20 16:38:30 -07001636 if(psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1637 {
1638 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1639 }
1640 else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1641 {
1642 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1643 }
1644 else
1645 {
1646 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001647 limLog(pMac, LOGW, FL("received SME_JOIN_REQ with invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001648 retCode = eSIR_SME_INVALID_PARAMETERS;
1649 goto end;
1650 }
1651
1652 if(pSmeJoinReq->addIEScan.length)
1653 {
1654 palCopyMemory(pMac->hHdd, &psessionEntry->pLimJoinReq->addIEScan,
1655 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
1656 }
1657
1658 if(pSmeJoinReq->addIEAssoc.length)
1659 {
1660 palCopyMemory(pMac->hHdd, &psessionEntry->pLimJoinReq->addIEAssoc,
1661 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
1662 }
1663
Jeff Johnson295189b2012-06-20 16:38:30 -07001664 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001665 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmJoinReq, val))
1666 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001667 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001668 return;
1669 }
1670 (void) palZeroMemory(pMac->hHdd, (void *) pMlmJoinReq, val);
1671
1672 /* PE SessionId is stored as a part of JoinReq*/
1673 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
1674
1675 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
1676 != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001677 limLog(pMac, LOGP, FL("could not retrieve JoinFailureTimer value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001678
1679 /* copy operational rate from psessionEntry*/
1680 palCopyMemory(pMac->hHdd, (void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
1681 sizeof(tSirMacRateSet));
1682 palCopyMemory(pMac->hHdd, (void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
1683 sizeof(tSirMacRateSet));
1684 //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
1685 palCopyMemory(pMac->hHdd, (void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
1686 sizeof(tSirMacRateSet));
1687
1688 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
1689
Jeff Johnson295189b2012-06-20 16:38:30 -07001690 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
1691
1692 palCopyMemory( pMac->hHdd,
1693 (tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
1694 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
1695 psessionEntry->pLimJoinReq->bssDescription.length + 2);
1696
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07001698 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001699
Jeff Johnsone7245742012-09-05 17:12:55 -07001700 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
1701 localPowerConstraint = regMax;
1702 limExtractApCapability( pMac,
1703 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
1704 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
1705 &psessionEntry->limCurrentBssQosCaps,
1706 &psessionEntry->limCurrentBssPropCap,
1707 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07001708 , &localPowerConstraint,
1709 psessionEntry
Jeff Johnsone7245742012-09-05 17:12:55 -07001710 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001711#ifdef FEATURE_WLAN_CCX
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001712 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07001713#else
1714 psessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
1715#endif
1716#if defined WLAN_VOWIFI_DEBUG
1717 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localPowerConstraint, psessionEntry->maxTxPower );
1718#endif
1719
1720 if (pMac->lim.gLimCurrentBssUapsd)
1721 {
1722 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001723 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"), pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07001724
1725 // resetting the dynamic uapsd mask
1726 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
1727 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
1728 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001729
1730 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
1731
1732 // Initialize 11h Enable Flag
1733 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
1734 {
1735 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001736 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001737 psessionEntry->lim11hEnable = val;
1738 }
1739 else
1740 psessionEntry->lim11hEnable = 0;
1741
1742 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
1743 pMac->lim.gLimIbssCoalescingHappened = false;
1744
Jeff Johnsone7245742012-09-05 17:12:55 -07001745 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
1746 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
1747 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001748
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001749 PELOG1(limLog(pMac, LOG1, FL("SME JoinReq: SSID %d.%c%c%c%c%c%c"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001750 psessionEntry->ssId.length,
1751 psessionEntry->ssId.ssId[0],
1752 psessionEntry->ssId.ssId[1],
1753 psessionEntry->ssId.ssId[2],
1754 psessionEntry->ssId.ssId[3],
1755 psessionEntry->ssId.ssId[4],
1756 psessionEntry->ssId.ssId[5]);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001757 limLog(pMac, LOG1, FL("Channel %d, BSSID %x:%x:%x:%x:%x:%x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001758 psessionEntry->currentOperChannel,
1759 psessionEntry->bssId[0],
1760 psessionEntry->bssId[1],
1761 psessionEntry->bssId[2],
1762 psessionEntry->bssId[3],
1763 psessionEntry->bssId[4],
1764 psessionEntry->bssId[5]);)
1765
1766 /* Indicate whether spectrum management is enabled*/
1767 psessionEntry->spectrumMgtEnabled =
1768 pSmeJoinReq->spectrumMgtIndicator;
1769 /* Issue LIM_MLM_JOIN_REQ to MLM */
1770 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
1771 return;
1772
1773 }
1774 else
1775 {
1776 /* Received eWNI_SME_JOIN_REQ un expected state */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001777 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ in state %X"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001778 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
1779 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1780 psessionEntry = NULL;
1781 goto end;
1782
1783 }
1784
1785end:
1786 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1787
1788 if(pSmeJoinReq)
1789 {
1790 palFreeMemory( pMac->hHdd, pSmeJoinReq);
1791 pSmeJoinReq = NULL;
1792 if (NULL != psessionEntry)
1793 {
1794 psessionEntry->pLimJoinReq = NULL;
1795 }
1796 }
1797
1798 if(retCode != eSIR_SME_SUCCESS)
1799 {
1800 if(NULL != psessionEntry)
1801 {
1802 peDeleteSession(pMac,psessionEntry);
1803 psessionEntry = NULL;
1804 }
1805 }
1806
1807 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
1808} /*** end __limProcessSmeJoinReq() ***/
1809
1810
1811#ifdef FEATURE_WLAN_CCX
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08001812tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07001813{
1814 tANI_U8 maxTxPower = 0;
1815 tANI_U8 txPower = VOS_MIN( regMax , (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001816 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07001817 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
1818 maxTxPower = txPower;
1819 else if (txPower < MIN_TX_PWR_CAP)
1820 maxTxPower = MIN_TX_PWR_CAP;
1821 else
1822 maxTxPower = MAX_TX_PWR_CAP;
1823
1824 return (maxTxPower);
1825}
1826#endif
1827
Jeff Johnson295189b2012-06-20 16:38:30 -07001828/**
1829 * __limProcessSmeReassocReq()
1830 *
1831 *FUNCTION:
1832 * This function is called to process SME_REASSOC_REQ message
1833 * from HDD or upper layer application.
1834 *
1835 *LOGIC:
1836 *
1837 *ASSUMPTIONS:
1838 *
1839 *NOTE:
1840 *
1841 * @param pMac Pointer to Global MAC structure
1842 * @param *pMsgBuf A pointer to the SME message buffer
1843 * @return None
1844 */
1845
1846static void
1847__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1848{
1849 tANI_U16 caps;
1850 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08001851 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001852 tLimMlmReassocReq *pMlmReassocReq;
1853 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1854 tpPESession psessionEntry = NULL;
1855 tANI_U8 sessionId;
1856 tANI_U8 smeSessionId;
1857 tANI_U16 transactionId;
1858 tPowerdBm localPowerConstraint = 0, regMax = 0;
1859 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07001860 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07001861
1862
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001863 PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001864
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07001865 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
1866 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pReassocReq, nSize ))
Jeff Johnson295189b2012-06-20 16:38:30 -07001867 {
1868 // Log error
1869 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001870 FL("call to palAllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001871
1872 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1873 goto end;
1874 }
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07001875 (void) palZeroMemory(pMac->hHdd, (void *) pReassocReq, nSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001876 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
1877 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
1878 (!limIsSmeJoinReqValid(pMac,
1879 (tpSirSmeJoinReq) pReassocReq)))
1880 {
1881 /// Received invalid eWNI_SME_REASSOC_REQ
1882 // Log the event
1883 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001884 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001885
1886 retCode = eSIR_SME_INVALID_PARAMETERS;
1887 goto end;
1888 }
1889
1890 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
1891 {
1892 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001893 limLog(pMac, LOGP, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001894 retCode = eSIR_SME_INVALID_PARAMETERS;
1895 goto end;
1896 }
1897
1898#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1899 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
1900#endif //FEATURE_WLAN_DIAG_SUPPORT
1901 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
1902
1903 /* Store the reassoc handle in the session Table.. 23rd sep review */
1904 psessionEntry->pLimReAssocReq = pReassocReq;
1905
1906 /**
1907 * Reassociate request is expected
1908 * in link established state only.
1909 */
1910
1911 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
1912 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001913#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001914 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1915 {
1916 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001917 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001918 psessionEntry->peSessionId);
1919
1920 // Make sure its our preauth bssid
1921 if (!palEqualMemory( pMac->hHdd, pReassocReq->bssDescription.bssId,
1922 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
1923 {
1924 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
1925 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001926 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001927 retCode = eSIR_SME_INVALID_PARAMETERS;
1928 goto end;
1929 }
1930
1931 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
1932 return;
1933 }
1934#endif
1935 /// Should not have received eWNI_SME_REASSOC_REQ
1936 // Log the event
1937 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001938 FL("received unexpected SME_REASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001939 psessionEntry->limSmeState);
1940 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
1941
1942 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1943 goto end;
1944 }
1945
Jeff Johnson295189b2012-06-20 16:38:30 -07001946 palCopyMemory( pMac->hHdd,
1947 psessionEntry->limReAssocbssId,
1948 psessionEntry->pLimReAssocReq->bssDescription.bssId,
1949 sizeof(tSirMacAddr));
1950
1951 psessionEntry->limReassocChannelId =
1952 psessionEntry->pLimReAssocReq->bssDescription.channelId;
1953
Jeff Johnsone7245742012-09-05 17:12:55 -07001954 psessionEntry->reAssocHtSupportedChannelWidthSet =
1955 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
1956 psessionEntry->reAssocHtRecommendedTxWidthSet =
1957 psessionEntry->reAssocHtSupportedChannelWidthSet;
1958 psessionEntry->reAssocHtSecondaryChannelOffset =
1959 psessionEntry->pLimReAssocReq->cbMode;
1960
Jeff Johnson295189b2012-06-20 16:38:30 -07001961 psessionEntry->limReassocBssCaps =
1962 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001963 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
1964 localPowerConstraint = regMax;
1965 limExtractApCapability( pMac,
1966 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
1967 limGetIElenFromBssDescription(
1968 &psessionEntry->pLimReAssocReq->bssDescription),
1969 &psessionEntry->limReassocBssQosCaps,
1970 &psessionEntry->limReassocBssPropCap,
1971 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07001972 , &localPowerConstraint,
1973 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07001974 );
1975
1976 psessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
1977#if defined WLAN_VOWIFI_DEBUG
1978 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localPowerConstraint, psessionEntry->maxTxPower );
1979#endif
1980 {
1981 #if 0
1982 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
1983 &cfgLen) != eSIR_SUCCESS)
1984 {
1985 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001986 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001987 }
1988 #endif//TO SUPPORT BT-AMP
1989
1990 /* Copy the SSID from sessio entry to local variable */
1991 #if 0
1992 palCopyMemory( pMac->hHdd, pMac->lim.gLimReassocSSID.ssId,
1993 psessionEntry->ssId.ssId,
1994 psessionEntry->ssId.length);
1995 #endif
1996 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
1997 palCopyMemory( pMac->hHdd, psessionEntry->limReassocSSID.ssId,
1998 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
1999
2000 }
2001
2002 if (pMac->lim.gLimCurrentBssUapsd)
2003 {
2004 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002005 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"), pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002006 }
2007
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq, sizeof(tLimMlmReassocReq)))
2009 {
2010 // Log error
2011 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002012 FL("call to palAllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002013
2014 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2015 goto end;
2016 }
2017
2018 palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
2019 psessionEntry->limReAssocbssId,
2020 sizeof(tSirMacAddr));
2021
2022 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2023 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2024 != eSIR_SUCCESS)
2025 {
2026 /**
2027 * Could not get ReassocFailureTimeout value
2028 * from CFG. Log error.
2029 */
2030 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002031 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002032 }
2033
2034 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2035 {
2036 /**
2037 * Could not get Capabilities value
2038 * from CFG. Log error.
2039 */
2040 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002041 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 }
2043 pMlmReassocReq->capabilityInfo = caps;
2044
2045 /* Update PE sessionId*/
2046 pMlmReassocReq->sessionId = sessionId;
2047
2048 /* If telescopic beaconing is enabled, set listen interval to
2049 WNI_CFG_TELE_BCN_MAX_LI */
2050 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2051 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002052 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002053
2054 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2055
2056 if(teleBcnEn)
2057 {
2058 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2059 eSIR_SUCCESS)
2060 {
2061 /**
2062 * Could not get ListenInterval value
2063 * from CFG. Log error.
2064 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002065 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 }
2067 }
2068 else
2069 {
2070 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2071 {
2072 /**
2073 * Could not get ListenInterval value
2074 * from CFG. Log error.
2075 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002076 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 }
2078 }
2079
2080 /* Delete all BA sessions before Re-Assoc.
2081 * BA frames are class 3 frames and the session
2082 * is lost upon disassociation and reassociation.
2083 */
2084
2085 limDelAllBASessions(pMac);
2086
2087 pMlmReassocReq->listenInterval = (tANI_U16) val;
2088
2089 /* Indicate whether spectrum management is enabled*/
2090 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2091
2092 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2093 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2094
Jeff Johnsone7245742012-09-05 17:12:55 -07002095 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002096
2097 limPostMlmMessage(pMac,
2098 LIM_MLM_REASSOC_REQ,
2099 (tANI_U32 *) pMlmReassocReq);
2100 return;
2101
2102end:
2103 if (pReassocReq)
2104 palFreeMemory( pMac->hHdd, pReassocReq);
2105
2106 if (psessionEntry)
2107 {
2108 // error occurred after we determined the session so extract
2109 // session and transaction info from there
2110 smeSessionId = psessionEntry->smeSessionId;
2111 transactionId = psessionEntry->transactionId;
2112 }
2113 else
2114 {
2115 // error occurred before or during the time we determined the session
2116 // so extract the session and transaction info from the message
2117 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2118 }
2119
2120 /// Send Reassoc failure response to host
2121 /// (note psessionEntry may be NULL, but that's OK)
2122 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2123 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2124 psessionEntry, smeSessionId, transactionId);
2125
2126} /*** end __limProcessSmeReassocReq() ***/
2127
2128
2129tANI_BOOLEAN sendDisassocFrame = 1;
2130/**
2131 * __limProcessSmeDisassocReq()
2132 *
2133 *FUNCTION:
2134 * This function is called to process SME_DISASSOC_REQ message
2135 * from HDD or upper layer application.
2136 *
2137 *LOGIC:
2138 *
2139 *ASSUMPTIONS:
2140 *
2141 *NOTE:
2142 *
2143 * @param pMac Pointer to Global MAC structure
2144 * @param *pMsgBuf A pointer to the SME message buffer
2145 * @return None
2146 */
2147
2148static void
2149__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2150{
2151 tANI_U16 disassocTrigger, reasonCode;
2152 tLimMlmDisassocReq *pMlmDisassocReq;
2153 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002154 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002155 tSirSmeDisassocReq smeDisassocReq;
2156 tpPESession psessionEntry = NULL;
2157 tANI_U8 sessionId;
2158 tANI_U8 smesessionId;
2159 tANI_U16 smetransactionId;
2160
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002161 PELOG1(limLog(pMac, LOG1,FL("received DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002162
Jeff Johnson43971f52012-07-17 12:26:56 -07002163 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002164 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002165 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 return;
2167 }
2168
Jeff Johnson43971f52012-07-17 12:26:56 -07002169 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002170
Jeff Johnson43971f52012-07-17 12:26:56 -07002171 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002172
Jeff Johnson43971f52012-07-17 12:26:56 -07002173 if ( (eSIR_FAILURE == status) ||
2174 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002175 {
2176 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002177 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002178
2179 if (pMac->lim.gLimRspReqd)
2180 {
2181 pMac->lim.gLimRspReqd = false;
2182
2183 retCode = eSIR_SME_INVALID_PARAMETERS;
2184 disassocTrigger = eLIM_HOST_DISASSOC;
2185 goto sendDisassoc;
2186 }
2187
2188 return;
2189 }
2190
2191
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002192 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_REQ message. Reason: %d global SmeState: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002193 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState);)
2194
2195
2196 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2197 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002198 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 retCode = eSIR_SME_INVALID_PARAMETERS;
2200 disassocTrigger = eLIM_HOST_DISASSOC;
2201 goto sendDisassoc;
2202
2203 }
2204
2205#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2206 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2207#endif //FEATURE_WLAN_DIAG_SUPPORT
2208
2209 /* Update SME session Id and SME transaction ID*/
2210
2211 psessionEntry->smeSessionId = smesessionId;
2212 psessionEntry->transactionId = smetransactionId;
2213
2214 switch (psessionEntry->limSystemRole)
2215 {
2216 case eLIM_STA_ROLE:
2217 case eLIM_BT_AMP_STA_ROLE:
2218 switch (psessionEntry->limSmeState)
2219 {
2220 case eLIM_SME_ASSOCIATED_STATE:
2221 case eLIM_SME_LINK_EST_STATE:
2222 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2223 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002224 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002225 break;
2226
2227 case eLIM_SME_WT_DEAUTH_STATE:
2228 /* PE shall still process the DISASSOC_REQ and proceed with
2229 * link tear down even if it had already sent a DEAUTH_IND to
2230 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2231 * its been set when PE entered WT_DEAUTH_STATE.
2232 */
2233 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002234 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002235 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002236 break;
2237
2238 case eLIM_SME_WT_DISASSOC_STATE:
2239 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2240 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2241 * PE can continue processing DISASSOC_REQ and send the response instead
2242 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2243 * for disassoc frame.
2244 *
2245 * It will send a disassoc, which is ok. However, we can use the global flag
2246 * sendDisassoc to not send disassoc frame.
2247 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002248 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002249 break;
2250
2251 case eLIM_SME_JOIN_FAILURE_STATE: {
2252 /** Return Success as we are already in Disconnected State*/
2253 if (pMac->lim.gLimRspReqd) {
2254 retCode = eSIR_SME_SUCCESS;
2255 disassocTrigger = eLIM_HOST_DISASSOC;
2256 goto sendDisassoc;
2257 }
2258 }break;
2259 default:
2260 /**
2261 * STA is not currently associated.
2262 * Log error and send response to host
2263 */
2264 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002265 FL("received unexpected SME_DISASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002266 psessionEntry->limSmeState);
2267 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2268
2269 if (pMac->lim.gLimRspReqd)
2270 {
2271 if (psessionEntry->limSmeState !=
2272 eLIM_SME_WT_ASSOC_STATE)
2273 pMac->lim.gLimRspReqd = false;
2274
2275 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2276 disassocTrigger = eLIM_HOST_DISASSOC;
2277 goto sendDisassoc;
2278 }
2279
2280 return;
2281 }
2282
2283 break;
2284
2285 case eLIM_AP_ROLE:
2286 case eLIM_BT_AMP_AP_ROLE:
2287 // Fall through
2288 break;
2289
2290 case eLIM_STA_IN_IBSS_ROLE:
2291 default: // eLIM_UNKNOWN_ROLE
2292 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002293 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002294 psessionEntry->limSystemRole);
2295
2296 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2297 disassocTrigger = eLIM_HOST_DISASSOC;
2298 goto sendDisassoc;
2299 } // end switch (pMac->lim.gLimSystemRole)
2300
2301 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2302 {
2303 /// Disassociation is triggered by Link Monitoring
2304 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2305 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2306 }
2307 else
2308 {
2309 disassocTrigger = eLIM_HOST_DISASSOC;
2310 reasonCode = smeDisassocReq.reasonCode;
2311 }
2312
2313 if (smeDisassocReq.doNotSendOverTheAir)
2314 {
2315 sendDisassocFrame = 0;
2316 }
2317 // Trigger Disassociation frame to peer MAC entity
2318 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmDisassocReq, sizeof(tLimMlmDisassocReq)))
2319 {
2320 // Log error
2321 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002322 FL("call to palAllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002323
2324 return;
2325 }
2326
2327 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
2328 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2329 sizeof(tSirMacAddr));
2330
2331 pMlmDisassocReq->reasonCode = reasonCode;
2332 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2333
2334 /* Update PE session ID*/
2335 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002336
2337 limPostMlmMessage(pMac,
2338 LIM_MLM_DISASSOC_REQ,
2339 (tANI_U32 *) pMlmDisassocReq);
2340 return;
2341
2342sendDisassoc:
2343 if (psessionEntry)
2344 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2345 retCode,
2346 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002347 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002348 else
2349 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2350 retCode,
2351 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002352 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002353
2354
2355} /*** end __limProcessSmeDisassocReq() ***/
2356
2357
2358/** -----------------------------------------------------------------
2359 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2360
2361 This function is called to process SME_DISASSOC_CNF message
2362 from HDD or upper layer application.
2363
2364 \param pMac - global mac structure
2365 \param pStaDs - station dph hash node
2366 \return none
2367 \sa
2368 ----------------------------------------------------------------- */
2369static void
2370__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2371{
2372 tSirSmeDisassocCnf smeDisassocCnf;
2373 tANI_U16 aid;
2374 tpDphHashNode pStaDs;
2375 tSirRetStatus status = eSIR_SUCCESS;
2376 tpPESession psessionEntry;
2377 tANI_U8 sessionId;
2378
2379
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002380 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002381
2382 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2383
2384 if (status == eSIR_FAILURE)
2385 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002386 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002387 return;
2388 }
2389
2390 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2391 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002392 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002393 return;
2394 }
2395
2396 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2397 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002398 limLog(pMac, LOGW, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002399 return;
2400 }
2401
2402#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2403 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2404 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2405 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2406 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2407#endif //FEATURE_WLAN_DIAG_SUPPORT
2408
2409 switch (psessionEntry->limSystemRole)
2410 {
2411 case eLIM_STA_ROLE:
2412 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2413 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2414 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2415 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2416 {
2417 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002418 FL("received unexp SME_DISASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002419 psessionEntry->limSmeState);
2420 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2421 return;
2422 }
2423 break;
2424
2425 case eLIM_AP_ROLE:
2426 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002427 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002428
2429 case eLIM_STA_IN_IBSS_ROLE:
2430 default: // eLIM_UNKNOWN_ROLE
2431 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002432 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002433 psessionEntry->limSystemRole);
2434
2435 return;
2436 }
2437
2438
2439 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2440 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002441 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002442 )
2443 {
2444 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2445 if (pStaDs == NULL)
2446 {
2447 PELOGW(limLog(pMac, LOGW, FL("received DISASSOC_CNF for a STA that does not have context, addr= "));
2448 limPrintMacAddr(pMac, smeDisassocCnf.peerMacAddr, LOGW);)
2449 return;
2450 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002451 /* Delete FT session if there exists one */
2452 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002453 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002454
2455 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002456 }
2457
2458 return;
2459}
2460
2461
2462/**
2463 * __limProcessSmeDeauthReq()
2464 *
2465 *FUNCTION:
2466 * This function is called to process SME_DEAUTH_REQ message
2467 * from HDD or upper layer application.
2468 *
2469 *LOGIC:
2470 *
2471 *ASSUMPTIONS:
2472 *
2473 *NOTE:
2474 *
2475 * @param pMac Pointer to Global MAC structure
2476 * @param *pMsgBuf A pointer to the SME message buffer
2477 * @return None
2478 */
2479
2480static void
2481__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2482{
2483 tANI_U16 deauthTrigger, reasonCode;
2484 tLimMlmDeauthReq *pMlmDeauthReq;
2485 tSirSmeDeauthReq smeDeauthReq;
2486 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2487 tSirRetStatus status = eSIR_SUCCESS;
2488 tpPESession psessionEntry;
2489 tANI_U8 sessionId; //PE sessionId
2490 tANI_U8 smesessionId;
2491 tANI_U16 smetransactionId;
2492
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002493 PELOG1(limLog(pMac, LOG1,FL("received DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002494
2495 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
2496
2497 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2498
2499 //We need to get a session first but we don't even know if the message is correct.
2500 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2501 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002502 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002503 retCode = eSIR_SME_INVALID_PARAMETERS;
2504 deauthTrigger = eLIM_HOST_DEAUTH;
2505 goto sendDeauth;
2506
2507 }
2508
2509 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2510 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002511 PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002512 if (pMac->lim.gLimRspReqd)
2513 {
2514 pMac->lim.gLimRspReqd = false;
2515
2516 retCode = eSIR_SME_INVALID_PARAMETERS;
2517 deauthTrigger = eLIM_HOST_DEAUTH;
2518 goto sendDeauth;
2519 }
2520
2521 return;
2522 }
2523
2524#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2525 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2526#endif //FEATURE_WLAN_DIAG_SUPPORT
2527
2528 /* Update SME session ID and Transaction ID */
2529 psessionEntry->smeSessionId = smesessionId;
2530 psessionEntry->transactionId = smetransactionId;
2531
2532
2533 switch (psessionEntry->limSystemRole)
2534 {
2535 case eLIM_STA_ROLE:
2536 case eLIM_BT_AMP_STA_ROLE:
2537
2538 switch (psessionEntry->limSmeState)
2539 {
2540 case eLIM_SME_ASSOCIATED_STATE:
2541 case eLIM_SME_LINK_EST_STATE:
2542 case eLIM_SME_WT_ASSOC_STATE:
2543 case eLIM_SME_JOIN_FAILURE_STATE:
2544 case eLIM_SME_IDLE_STATE:
2545 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2546 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002547 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002548
2549 // Send Deauthentication request to MLM below
2550
2551 break;
2552
2553 default:
2554 /**
2555 * STA is not in a state to deauthenticate with
2556 * peer. Log error and send response to host.
2557 */
2558 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002559 FL("received unexp SME_DEAUTH_REQ in state %X"),psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002560 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2561
2562 if (pMac->lim.gLimRspReqd)
2563 {
2564 pMac->lim.gLimRspReqd = false;
2565
2566 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2567 deauthTrigger = eLIM_HOST_DEAUTH;
2568 goto sendDeauth;
2569 }
2570
2571 return;
2572 }
2573
2574 break;
2575
2576 case eLIM_STA_IN_IBSS_ROLE:
2577
2578 return;
2579
2580 case eLIM_AP_ROLE:
2581 // Fall through
2582
2583 break;
2584
2585 default:
2586 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002587 FL("received unexpected SME_DEAUTH_REQ for role %X"),psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07002588
2589 return;
2590 } // end switch (pMac->lim.gLimSystemRole)
2591
2592 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
2593 {
2594 /// Deauthentication is triggered by Link Monitoring
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002595 PELOG1(limLog(pMac, LOG1, FL("**** Lost link with AP ****"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002596 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
2597 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
2598 }
2599 else
2600 {
2601 deauthTrigger = eLIM_HOST_DEAUTH;
2602 reasonCode = smeDeauthReq.reasonCode;
2603 }
2604
2605 // Trigger Deauthentication frame to peer MAC entity
2606 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmDeauthReq, sizeof(tLimMlmDeauthReq)))
2607 {
2608 // Log error
2609 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002610 FL("call to palAllocateMemory failed for mlmDeauthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002611
2612 return;
2613 }
2614
2615 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
2616 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
2617 sizeof(tSirMacAddr));
2618
2619 pMlmDeauthReq->reasonCode = reasonCode;
2620 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07002621
2622 /* Update PE session Id*/
2623 pMlmDeauthReq->sessionId = sessionId;
2624
2625 limPostMlmMessage(pMac,
2626 LIM_MLM_DEAUTH_REQ,
2627 (tANI_U32 *) pMlmDeauthReq);
2628 return;
2629
2630sendDeauth:
2631 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
2632 retCode,
2633 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002634 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002635 smesessionId, smetransactionId);
2636} /*** end __limProcessSmeDeauthReq() ***/
2637
2638
2639
2640/**
2641 * __limProcessSmeSetContextReq()
2642 *
2643 *FUNCTION:
2644 * This function is called to process SME_SETCONTEXT_REQ message
2645 * from HDD or upper layer application.
2646 *
2647 *LOGIC:
2648 *
2649 *ASSUMPTIONS:
2650 *
2651 *NOTE:
2652 *
2653 * @param pMac Pointer to Global MAC structure
2654 * @param *pMsgBuf A pointer to the SME message buffer
2655 * @return None
2656 */
2657
2658static void
2659__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2660{
2661 tpSirSmeSetContextReq pSetContextReq;
2662 tLimMlmSetKeysReq *pMlmSetKeysReq;
2663 tpPESession psessionEntry;
2664 tANI_U8 sessionId; //PE sessionID
2665 tANI_U8 smesessionId;
2666 tANI_U16 smetransactionId;
2667
2668
2669 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002670 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07002671
2672
2673 if(pMsgBuf == NULL)
2674 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002675 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 return;
2677 }
2678
2679 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2680
2681 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSetContextReq,
2682 (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)))
2683 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002684 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002685 return;
2686 }
2687
2688 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2689 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
2690 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002691 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002692 goto end;
2693 }
2694
2695 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2696 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002697 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 -07002698 limSendSmeSetContextRsp(pMac,
2699 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002700 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002701 eSIR_SME_INVALID_PARAMETERS,NULL,
2702 smesessionId,smetransactionId);
2703
2704 goto end;
2705 }
2706
2707
2708 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
2709 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002710 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 limSendSmeSetContextRsp(pMac,
2712 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002713 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002714 eSIR_SME_INVALID_PARAMETERS,NULL,
2715 smesessionId,smetransactionId);
2716
2717 goto end;
2718 }
2719
2720#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2721 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
2722#endif //FEATURE_WLAN_DIAG_SUPPORT
2723
2724
2725 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2726 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
2727 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
2728 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
2729 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
2730 {
2731 // Trigger MLM_SETKEYS_REQ
2732 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmSetKeysReq, sizeof(tLimMlmSetKeysReq)))
2733 {
2734 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002735 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002736 goto end;
2737 }
2738
2739 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
2740 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
2741 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2742 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002743 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002744 goto end;
2745 }
2746 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
2747 (tANI_U8 *) &pSetContextReq->peerMacAddr,
2748 sizeof(tSirMacAddr));
2749
Jeff Johnson295189b2012-06-20 16:38:30 -07002750
2751 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmSetKeysReq->key,
2752 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
2753 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
2754
2755 pMlmSetKeysReq->sessionId = sessionId;
2756#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
2757 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002758 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07002759#endif
2760
Jeff Johnson295189b2012-06-20 16:38:30 -07002761 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
2762 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
2763 {
2764 if(pSetContextReq->keyMaterial.key[0].keyLength)
2765 {
2766 tANI_U8 keyId;
2767 keyId = pSetContextReq->keyMaterial.key[0].keyId;
2768 palCopyMemory(pMac, (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
2769 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
2770 }
2771 else {
2772 tANI_U32 i;
2773 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
2774 {
2775 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmSetKeysReq->key[i],
2776 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
2777 }
2778 }
2779 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002780
2781 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002782 }
2783 else
2784 {
2785 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002786 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002787 psessionEntry->limSystemRole,
2788 psessionEntry->limSmeState);
2789 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2790
2791 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002792 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002793 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
2794 smesessionId,
2795 smetransactionId);
2796 }
2797
2798end:
2799 palFreeMemory( pMac->hHdd, pSetContextReq);
2800 return;
2801} /*** end __limProcessSmeSetContextReq() ***/
2802
2803/**
2804 * __limProcessSmeRemoveKeyReq()
2805 *
2806 *FUNCTION:
2807 * This function is called to process SME_REMOVEKEY_REQ message
2808 * from HDD or upper layer application.
2809 *
2810 *LOGIC:
2811 *
2812 *ASSUMPTIONS:
2813 *
2814 *NOTE:
2815 *
2816 * @param pMac Pointer to Global MAC structure
2817 * @param *pMsgBuf A pointer to the SME message buffer
2818 * @return None
2819 */
2820
2821static void
2822__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2823{
2824 tpSirSmeRemoveKeyReq pRemoveKeyReq;
2825 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
2826 tpPESession psessionEntry;
2827 tANI_U8 sessionId; //PE sessionID
2828 tANI_U8 smesessionId;
2829 tANI_U16 smetransactionId;
2830
2831 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002832 FL("received REMOVEKEY_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002833
2834 if(pMsgBuf == NULL)
2835 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002836 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002837 return;
2838 }
2839
2840
2841 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2842
2843 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRemoveKeyReq,
2844 (sizeof(*pRemoveKeyReq))))
2845 {
2846 //Log error
2847 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002848 FL("call to palAllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002849
2850 return;
2851 }
2852
2853 if ((limRemoveKeyReqSerDes(pMac,
2854 pRemoveKeyReq,
2855 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
2856 {
2857 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002858 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002859
2860 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
2861
2862 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
2863 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002864 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002865 //goto end;
2866 }
2867
2868 limSendSmeRemoveKeyRsp(pMac,
2869 pRemoveKeyReq->peerMacAddr,
2870 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
2871 smesessionId,smetransactionId);
2872
2873 goto end;
2874 }
2875
2876 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
2877 {
2878 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002879 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002880 limSendSmeRemoveKeyRsp(pMac,
2881 pRemoveKeyReq->peerMacAddr,
2882 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
2883 smesessionId, smetransactionId);
2884 goto end;
2885 }
2886
2887
2888 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
2889 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
2890 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
2891 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
2892 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
2893 {
2894 // Trigger MLM_REMOVEKEYS_REQ
2895 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmRemoveKeyReq, sizeof(tLimMlmRemoveKeyReq)))
2896 {
2897 // Log error
2898 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002899 FL("call to palAllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002900
2901 goto end;
2902 }
2903
2904 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
2905 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
2906 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
2907 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
2908
2909 /* Update PE session Id */
2910 pMlmRemoveKeyReq->sessionId = sessionId;
2911
2912 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
2913 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
2914 sizeof(tSirMacAddr));
2915
2916
2917 limPostMlmMessage(pMac,
2918 LIM_MLM_REMOVEKEY_REQ,
2919 (tANI_U32 *) pMlmRemoveKeyReq);
2920 }
2921 else
2922 {
2923 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002924 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002925 psessionEntry->limSystemRole,
2926 psessionEntry->limSmeState);
2927 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2928
2929 limSendSmeRemoveKeyRsp(pMac,
2930 pRemoveKeyReq->peerMacAddr,
2931 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
2932 smesessionId,smetransactionId);
2933 }
2934
2935end:
2936 palFreeMemory( pMac->hHdd, pRemoveKeyReq);
2937} /*** end __limProcessSmeRemoveKeyReq() ***/
2938
Jeff Johnson295189b2012-06-20 16:38:30 -07002939void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2940{
2941 tSirMsgQ mmhMsg;
2942 tpSmeGetScanChnRsp pSirSmeRsp;
2943 tANI_U16 len = 0;
2944
2945 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
2946 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002947 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002948 pMac->lim.scanChnInfo.numChnInfo);
2949 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
2950 }
2951
2952 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002953 FL("Sending message %s with number of channels %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002954 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);)
2955
2956 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
2957 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, len ))
2958 {
2959 /// Buffer not available. Log error
2960 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002961 FL("call to palAllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002962
2963 return;
2964 }
2965 palZeroMemory(pMac->hHdd, pSirSmeRsp, len);
2966
Jeff Johnson295189b2012-06-20 16:38:30 -07002967 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
2968 pSirSmeRsp->mesgLen = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07002969 pSirSmeRsp->sessionId = 0;
2970
2971 if(pMac->lim.scanChnInfo.numChnInfo)
2972 {
2973 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
2974 palCopyMemory(pMac->hHdd, pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn, sizeof(tLimScanChn) * pSirSmeRsp->numChn);
2975 }
2976 //Clear the list
2977 limRessetScanChannelInfo(pMac);
2978
2979 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
2980 mmhMsg.bodyptr = pSirSmeRsp;
2981 mmhMsg.bodyval = 0;
2982
2983 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07002984 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07002985 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
2986}
2987
2988
Jeff Johnson295189b2012-06-20 16:38:30 -07002989void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2990{
2991 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
2992 tpDphHashNode pStaDs = NULL;
2993 tpPESession psessionEntry = NULL;
2994 tSap_Event sapEvent;
2995 tpWLAN_SAPEventCB pSapEventCallback = NULL;
2996 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
2997 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
2998 tANI_U8 assocId = 0;
2999 tANI_U8 staCount = 0;
3000
3001 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3002 {
3003 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003004 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003005 goto limAssocStaEnd;
3006 }
3007
3008 switch (getAssocSTAsReq.modId)
3009 {
3010/**
3011 case VOS_MODULE_ID_HAL:
3012 wdaPostCtrlMsg( pMac, &msgQ );
3013 return;
3014
3015 case VOS_MODULE_ID_TL:
3016 Post msg TL
3017 return;
3018*/
3019 case VOS_MODULE_ID_PE:
3020 default:
3021 break;
3022 }
3023
Jeff Johnson1250df42012-12-10 14:31:52 -08003024 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003025 // Find PE session Entry
3026 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3027 {
3028 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003029 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003030 goto limAssocStaEnd;
3031 }
3032
3033 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3034 {
3035 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003036 FL("Received unexpected message in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003037 psessionEntry->limSmeState , psessionEntry->limSystemRole);
3038 goto limAssocStaEnd;
3039 }
3040
3041 // Retrieve values obtained in the request message
3042 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3043 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3044
3045 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3046 {
3047 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3048
3049 if (NULL == pStaDs)
3050 continue;
3051
3052 if (pStaDs->valid)
3053 {
3054 palCopyMemory(pMac->hHdd, (tANI_U8 *)&pAssocStasTemp->staMac,
3055 (tANI_U8 *)&pStaDs->staAddr,
3056 sizeof(v_MACADDR_t)); // Mac address
3057 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3058 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3059
3060 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
3061 limLog(pMac, LOG1, FL("MAC = %02x:%02x:%02x:%02x:%02x:%02x"),
3062 pStaDs->staAddr[0],
3063 pStaDs->staAddr[1],
3064 pStaDs->staAddr[2],
3065 pStaDs->staAddr[3],
3066 pStaDs->staAddr[4],
3067 pStaDs->staAddr[5]);
3068 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3069 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3070
3071 pAssocStasTemp++;
3072 staCount++;
3073 }
3074 }
3075
3076limAssocStaEnd:
3077 // Call hdd callback with sap event to send the list of associated stations from PE
3078 if (pSapEventCallback != NULL)
3079 {
3080 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3081 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3082 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3083 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3084 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3085 }
3086}
3087
3088
3089/**
3090 * limProcessSmeGetWPSPBCSessions
3091 *
3092 *FUNCTION:
3093 * This function is called when query the WPS PBC overlap message is received
3094 *
3095 *LOGIC:
3096 * This function parses get WPS PBC overlap information message and call callback to pass
3097 * WPS PBC overlap information back to hdd.
3098 *ASSUMPTIONS:
3099 *
3100 *
3101 *NOTE:
3102 *
3103 * @param pMac Pointer to Global MAC structure
3104 * @param pMsgBuf A pointer to WPS PBC overlap query message
3105*
3106 * @return None
3107 */
3108void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3109{
3110 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3111 tpPESession psessionEntry = NULL;
3112 tSap_Event sapEvent;
3113 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3114 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3115 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3116
3117 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3118
3119 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3120 {
3121 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003122 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003123 goto limGetWPSPBCSessionsEnd;
3124 }
3125
Jeff Johnson1250df42012-12-10 14:31:52 -08003126 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003127 // Find PE session Entry
3128 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3129 {
3130 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003131 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003132 goto limGetWPSPBCSessionsEnd;
3133 }
3134
3135 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3136 {
3137 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003138 FL("Received unexpected message in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003139 psessionEntry->limSystemRole);
3140 goto limGetWPSPBCSessionsEnd;
3141 }
3142
Jeff Johnson1250df42012-12-10 14:31:52 -08003143 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003144 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3145 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3146
3147 if (palEqualMemory(pMac->hHdd, zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
3148 { //This is GetWpsSession call
3149
3150 limGetWPSPBCSessions(pMac,
3151 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3152 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3153 }
3154 else
3155 {
3156 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3157 /* don't have to inform the HDD/Host */
3158 return;
3159 }
3160
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003161 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003162 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3163
3164 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3165
3166limGetWPSPBCSessionsEnd:
3167 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
3168 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
3169}
3170
Jeff Johnson295189b2012-06-20 16:38:30 -07003171
3172
3173/**
3174 * __limCounterMeasures()
3175 *
3176 * FUNCTION:
3177 * This function is called to "implement" MIC counter measure
3178 * and is *temporary* only
3179 *
3180 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3181 * we don't do the proper STA disassoc sequence since the
3182 * BSS will be stoped anyway
3183 *
3184 *ASSUMPTIONS:
3185 *
3186 *NOTE:
3187 *
3188 * @param pMac Pointer to Global MAC structure
3189 * @return None
3190 */
3191
3192static void
3193__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3194{
3195 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3196 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
3197 || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
3198
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003199 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003200
Jeff Johnson295189b2012-06-20 16:38:30 -07003201};
3202
3203
Jeff Johnson295189b2012-06-20 16:38:30 -07003204void
3205limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3206{
3207 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3208 tpPESession psessionEntry;
3209 tANI_U8 sessionId; //PE sessionId
3210
3211 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3212 {
3213 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003214 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003215 return;
3216 }
3217
3218 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3219 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003220 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003221 return;
3222 }
3223
3224 if ( tkipCntrMeasReq.bEnable )
3225 {
3226 __limCounterMeasures( pMac, psessionEntry );
3227 }
3228
3229 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3230}
Jeff Johnson295189b2012-06-20 16:38:30 -07003231
3232
3233static void
3234__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3235{
3236 tSirSmeStopBssReq stopBssReq;
3237 tSirRetStatus status;
3238 tLimSmeStates prevState;
3239 tANI_U8 sessionId; //PE sessionId
3240 tpPESession psessionEntry;
3241 tANI_U8 smesessionId;
3242 tANI_U16 smetransactionId;
3243
3244 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3245
3246
3247
3248 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3249 !limIsSmeStopBssReqValid(pMsgBuf))
3250 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003251 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003252 /// Send Stop BSS response to host
3253 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3254 return;
3255 }
3256
3257
3258 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3259 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003260 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003261 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3262 return;
3263 }
3264
3265#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3266 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3267#endif //FEATURE_WLAN_DIAG_SUPPORT
3268
3269
3270 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3271 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3272 {
3273 /**
3274 * Should not have received STOP_BSS_REQ in states
3275 * other than 'normal' state or on STA in Infrastructure
3276 * mode. Log error and return response to host.
3277 */
3278 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003279 FL("received unexpected SME_STOP_BSS_REQ in state %X, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003280 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3281 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3282 /// Send Stop BSS response to host
3283 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3284 return;
3285 }
3286
Jeff Johnson295189b2012-06-20 16:38:30 -07003287 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3288 {
3289 limWPSPBCClose(pMac, psessionEntry);
3290 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003291 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003292
3293 prevState = psessionEntry->limSmeState;
3294
3295 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003296 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003297
3298 /* Update SME session Id and Transaction Id */
3299 psessionEntry->smeSessionId = smesessionId;
3300 psessionEntry->transactionId = smetransactionId;
3301
3302 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame */
3303 if ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) && (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3304 {
3305 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3306 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3307 // Send disassoc all stations associated thru TKIP
3308 __limCounterMeasures(pMac,psessionEntry);
3309 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303310 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003311 }
3312
3313 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3314 pMac->lim.gLimIbssCoalescingHappened = false;
3315
3316 /* send a delBss to HAL and wait for a response */
3317 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3318
3319 if (status != eSIR_SUCCESS)
3320 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003321 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003322 psessionEntry->limSmeState= prevState;
3323
Jeff Johnsone7245742012-09-05 17:12:55 -07003324 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003325
3326 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3327 }
3328}
3329
3330
3331/**--------------------------------------------------------------
3332\fn __limProcessSmeStopBssReq
3333
3334\brief Wrapper for the function __limHandleSmeStopBssRequest
3335 This message will be defered until softmac come out of
3336 scan mode. Message should be handled even if we have
3337 detected radar in the current operating channel.
3338\param pMac
3339\param pMsg
3340
3341\return TRUE - If we consumed the buffer
3342 FALSE - If have defered the message.
3343 ---------------------------------------------------------------*/
3344static tANI_BOOLEAN
3345__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3346{
3347 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3348 {
3349 /**
3350 * If message defered, buffer is not consumed yet.
3351 * So return false
3352 */
3353 return eANI_BOOLEAN_FALSE;
3354 }
3355 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3356 return eANI_BOOLEAN_TRUE;
3357} /*** end __limProcessSmeStopBssReq() ***/
3358
3359
3360void limProcessSmeDelBssRsp(
3361 tpAniSirGlobal pMac,
3362 tANI_U32 body,tpPESession psessionEntry)
3363{
3364
3365 (void) body;
3366 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3367 //TBD: get the sessionEntry
3368 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3369 limDeletePreAuthList(pMac);
3370 limIbssDelete(pMac,psessionEntry);
3371 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3372 return;
3373}
3374
3375
Jeff Johnson295189b2012-06-20 16:38:30 -07003376/**---------------------------------------------------------------
3377\fn __limProcessSmeAssocCnfNew
3378\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3379\ in BTAMP AP.
3380\
3381\param pMac
3382\param msgType - message type
3383\param pMsgBuf - a pointer to the SME message buffer
3384\return None
3385------------------------------------------------------------------*/
3386
3387 void
3388__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3389{
3390 tSirSmeAssocCnf assocCnf;
3391 tpDphHashNode pStaDs = NULL;
3392 tpPESession psessionEntry= NULL;
3393 tANI_U8 sessionId;
3394
3395
3396 if(pMsgBuf == NULL)
3397 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003398 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003399 goto end;
3400 }
3401
3402 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3403 !__limIsSmeAssocCnfValid(&assocCnf))
3404 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003405 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003406 goto end;
3407 }
3408
3409 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3410 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003411 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 goto end;
3413 }
3414
3415 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3416 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3417 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003418 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003419 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
3420 goto end;
3421 }
3422
3423 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3424
3425 if (pStaDs == NULL)
3426 {
3427 limLog(pMac, LOG1,
3428 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
3429 msgType, assocCnf.aid);
3430 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3431
3432 /*
3433 ** send a DISASSOC_IND message to WSM to make sure
3434 ** the state in WSM and LIM is the same
3435 **/
3436 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3437 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3438 goto end;
3439 }
3440 if ((pStaDs &&
3441 (( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pStaDs->staAddr,
3442 (tANI_U8 *) assocCnf.peerMacAddr,
3443 sizeof(tSirMacAddr)) ) ||
3444 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3445 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3446 (msgType != eWNI_SME_ASSOC_CNF)) ||
3447 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003448 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003449 {
3450 limLog(pMac, LOG1,
3451 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
3452 msgType, assocCnf.aid);
3453 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3454 goto end;
3455 }
3456
3457 /*
3458 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3459 ** has been received
3460 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003461 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003462 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3463
3464 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3465 {
3466 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3467 * when it had received Assoc Request frame. Now, PE just needs to send
3468 * Association Response frame to the requesting BTAMP-STA.
3469 */
3470 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003471 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003472 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3473 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3474 goto end;
3475 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3476 else
3477 {
3478 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3479 /*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*/
3480 if(!pStaDs->mlmStaContext.updateContext)
3481 pStaDs->mlmStaContext.updateContext = 1;
3482 limRejectAssociation(pMac, pStaDs->staAddr,
3483 pStaDs->mlmStaContext.subType,
3484 true, pStaDs->mlmStaContext.authType,
3485 pStaDs->assocId, true,
3486 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
3487 return;
3488 }
3489
3490end:
3491 if((psessionEntry != NULL) && (pStaDs != NULL))
3492 {
3493 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3494 {
3495 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3496 {
3497 palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
3498 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
3499 }
3500
3501 palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]);
3502 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
3503 }
3504 }
3505
3506} /*** end __limProcessSmeAssocCnfNew() ***/
3507
3508
Jeff Johnson295189b2012-06-20 16:38:30 -07003509
3510
3511static void
3512__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3513{
3514 tpDphHashNode pStaDs;
3515 tSirMacAddr peerMac;
3516 tpSirAddtsReq pSirAddts;
3517 tANI_U32 timeout;
3518 tpPESession psessionEntry;
3519 tANI_U8 sessionId; //PE sessionId
3520 tANI_U8 smesessionId;
3521 tANI_U16 smetransactionId;
3522
3523
3524 if(pMsgBuf == NULL)
3525 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003526 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003527 return;
3528 }
3529
3530 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3531
3532 pSirAddts = (tpSirAddtsReq) pMsgBuf;
3533
3534 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
3535 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003536 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003537 return;
3538 }
3539#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3540 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
3541#endif //FEATURE_WLAN_DIAG_SUPPORT
3542
3543
3544
3545 /* if sta
3546 * - verify assoc state
3547 * - send addts request to ap
3548 * - wait for addts response from ap
3549 * if ap, just ignore with error log
3550 */
3551 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003552 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003553 pSirAddts->req.tspec.tsinfo.traffic.tsid,
3554 pSirAddts->req.tspec.tsinfo.traffic.userPrio);)
3555
3556 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
3557 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003558 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003559 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3560 smesessionId,smetransactionId);
3561 return;
3562 }
3563
3564 //Ignore the request if STA is in 11B mode.
3565 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
3566 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003567 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003568 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3569 smesessionId,smetransactionId);
3570 return;
3571 }
3572
3573
3574 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3575
3576 if(pStaDs == NULL)
3577 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003578 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003579 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3580 smesessionId,smetransactionId);
3581 return;
3582 }
3583
3584 if ((! pStaDs->valid) ||
3585 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
3586 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003587 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003588 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3589 smesessionId,smetransactionId);
3590 return;
3591 }
3592
3593 pSirAddts->req.wsmTspecPresent = 0;
3594 pSirAddts->req.wmeTspecPresent = 0;
3595 pSirAddts->req.lleTspecPresent = 0;
3596
3597 if ((pStaDs->wsmEnabled) &&
3598 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
3599 pSirAddts->req.wsmTspecPresent = 1;
3600 else if (pStaDs->wmeEnabled)
3601 pSirAddts->req.wmeTspecPresent = 1;
3602 else if (pStaDs->lleEnabled)
3603 pSirAddts->req.lleTspecPresent = 1;
3604 else
3605 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003606 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003607 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3608 smesessionId,smetransactionId);
3609 return;
3610 }
3611
3612 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
3613 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
3614 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003615 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07003616 psessionEntry->limSmeState);
3617 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3618 smesessionId,smetransactionId);
3619 return;
3620 }
3621
3622 if (pMac->lim.gLimAddtsSent)
3623 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003624 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07003625 pMac->lim.gLimAddtsReq.req.dialogToken,
3626 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
3627 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
3628 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3629 smesessionId,smetransactionId);
3630 return;
3631 }
3632
3633 #if 0
3634 val = sizeof(tSirMacAddr);
3635 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
3636 {
3637 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003638 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003639 return;
3640 }
3641 #endif
3642 sirCopyMacAddr(peerMac,psessionEntry->bssId);
3643
3644 // save the addts request
3645 pMac->lim.gLimAddtsSent = true;
3646 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
3647
3648 // ship out the message now
3649 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
3650 psessionEntry);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003651 PELOG1(limLog(pMac, LOG1, "Sent ADDTS request");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003652
3653 // start a timer to wait for the response
3654 if (pSirAddts->timeout)
3655 timeout = pSirAddts->timeout;
3656 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
3657 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003658 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003659 WNI_CFG_ADDTS_RSP_TIMEOUT);
3660 return;
3661 }
3662
3663 timeout = SYS_MS_TO_TICKS(timeout);
3664 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
3665 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003666 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003667 return;
3668 }
3669 pMac->lim.gLimAddtsRspTimerCount++;
3670 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
3671 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
3672 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003673 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003674 return;
3675 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003676 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003677
3678 //add the sessionId to the timer object
3679 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
3680 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
3681 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003682 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003683 return;
3684 }
3685 return;
3686}
3687
3688
3689static void
3690__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3691{
3692 tSirMacAddr peerMacAddr;
3693 tANI_U8 ac;
3694 tSirMacTSInfo *pTsinfo;
3695 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
3696 tpDphHashNode pStaDs = NULL;
3697 tpPESession psessionEntry;
3698 tANI_U8 sessionId;
3699 tANI_U32 status = eSIR_SUCCESS;
3700 tANI_U8 smesessionId;
3701 tANI_U16 smetransactionId;
3702
3703 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3704
3705 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
3706 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003707 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003708 status = eSIR_FAILURE;
3709 goto end;
3710 }
3711#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3712 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
3713#endif //FEATURE_WLAN_DIAG_SUPPORT
3714
3715
3716 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
3717 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003718 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003719 status = eSIR_FAILURE;
3720 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
3721 return;
3722 }
3723
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003724 PELOG1(limLog(pMac, LOG1, FL("Sent DELTS request to station with assocId = %d MacAddr = %x:%x:%x:%x:%x:%x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003725 pDeltsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
3726 peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);)
3727
3728 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
3729 psessionEntry);
3730
3731 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
3732
3733 /* We've successfully send DELTS frame to AP. Update the
3734 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
3735 * is no longer trigger enabled or delivery enabled
3736 */
3737 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
3738
3739 /* We're deleting the TSPEC, so this particular AC is no longer
3740 * admitted. PE needs to downgrade the EDCA
3741 * parameters(for the AC for which TS is being deleted) to the
3742 * next best AC for which ACM is not enabled, and send the
3743 * updated values to HAL.
3744 */
3745 ac = upToAc(pTsinfo->traffic.userPrio);
3746
3747 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
3748 {
3749 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
3750 }
3751 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
3752 {
3753 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
3754 }
3755 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
3756 {
3757 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
3758 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
3759 }
3760
3761 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3762
3763 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3764 if (pStaDs != NULL)
3765 {
3766 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
3767 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3768 else
3769 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3770 status = eSIR_SUCCESS;
3771 }
3772 else
3773 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003774 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 status = eSIR_FAILURE;
3776 }
3777#ifdef FEATURE_WLAN_CCX
3778 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
3779#endif
3780
3781 // send an sme response back
3782 end:
3783 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
3784}
3785
3786
3787void
3788limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
3789{
3790 //fetch the sessionEntry based on the sessionId
3791 tpPESession psessionEntry;
3792 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
3793 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003794 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003795 return;
3796 }
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 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003801 pMac->lim.gLimAddtsSent = false;
3802 return;
3803 }
3804
3805 if (! pMac->lim.gLimAddtsSent)
3806 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003807 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003808 return;
3809 }
3810
3811 if (param != pMac->lim.gLimAddtsRspTimerCount)
3812 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003813 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003814 param, pMac->lim.gLimAddtsRspTimerCount);
3815 return;
3816 }
3817
3818 // this a real response timeout
3819 pMac->lim.gLimAddtsSent = false;
3820 pMac->lim.gLimAddtsRspTimerCount++;
3821
3822 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
3823 psessionEntry->smeSessionId, psessionEntry->transactionId);
3824}
3825
3826
3827/**
3828 * __limProcessSmeStatsRequest()
3829 *
3830 *FUNCTION:
3831 *
3832 *
3833 *NOTE:
3834 *
3835 * @param pMac Pointer to Global MAC structure
3836 * @param *pMsgBuf A pointer to the SME message buffer
3837 * @return None
3838 */
3839static void
3840__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3841{
3842 tpAniGetStatsReq pStatsReq;
3843 tSirMsgQ msgQ;
3844 tpPESession psessionEntry;
3845 tANI_U8 sessionId;
3846
3847
3848 if(pMsgBuf == NULL)
3849 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003850 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003851 return;
3852 }
3853
3854 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
3855
3856 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
3857 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003858 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnsone7245742012-09-05 17:12:55 -07003859 palFreeMemory( pMac, pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07003860 return;
3861 }
3862
3863
3864
3865 switch(pStatsReq->msgType)
3866 {
3867 //Add Lim stats here. and send reqsponse.
3868
3869 //HAL maintained Stats.
3870 case eWNI_SME_STA_STAT_REQ:
3871 msgQ.type = WDA_STA_STAT_REQ;
3872 break;
3873 case eWNI_SME_AGGR_STAT_REQ:
3874 msgQ.type = WDA_AGGR_STAT_REQ;
3875 break;
3876 case eWNI_SME_GLOBAL_STAT_REQ:
3877 msgQ.type = WDA_GLOBAL_STAT_REQ;
3878 break;
3879 case eWNI_SME_STAT_SUMM_REQ:
3880 msgQ.type = WDA_STAT_SUMM_REQ;
3881 break;
3882 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003883 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003884 palFreeMemory( pMac, pMsgBuf );
3885 return;
3886 }
3887
3888 if ( !pMac->lim.gLimRspReqd )
3889 {
3890 palFreeMemory( pMac, pMsgBuf );
3891 return;
3892 }
3893 else
3894 {
3895 pMac->lim.gLimRspReqd = FALSE;
3896 }
3897
3898 msgQ.reserved = 0;
3899 msgQ.bodyptr = pMsgBuf;
3900 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08003901 if(NULL == psessionEntry)
3902 {
3903 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
3904 }
3905 else
3906 {
3907 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
3908 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003909 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003910 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnsone7245742012-09-05 17:12:55 -07003911 palFreeMemory( pMac, pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07003912 return;
3913 }
3914
3915 return;
3916}
3917
3918
3919/**
3920 * __limProcessSmeGetStatisticsRequest()
3921 *
3922 *FUNCTION:
3923 *
3924 *
3925 *NOTE:
3926 *
3927 * @param pMac Pointer to Global MAC structure
3928 * @param *pMsgBuf A pointer to the SME message buffer
3929 * @return None
3930 */
3931static void
3932__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3933{
3934 tpAniGetPEStatsReq pPEStatsReq;
3935 tSirMsgQ msgQ;
3936
3937 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
3938
3939 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
3940
3941 msgQ.type = WDA_GET_STATISTICS_REQ;
3942
3943 if ( !pMac->lim.gLimRspReqd )
3944 {
3945 palFreeMemory( pMac, pMsgBuf );
3946 return;
3947 }
3948 else
3949 {
3950 pMac->lim.gLimRspReqd = FALSE;
3951 }
3952
3953 msgQ.reserved = 0;
3954 msgQ.bodyptr = pMsgBuf;
3955 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07003956 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003957
3958 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
3959 palFreeMemory( pMac, pMsgBuf );
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003960 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07003961 return;
3962 }
3963
3964 return;
3965}
3966
3967
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08003968#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
3969/**
3970 * __limProcessSmeGetRoamRssiRequest()
3971 *
3972 *FUNCTION:
3973 *
3974 *
3975 *NOTE:
3976 *
3977 * @param pMac Pointer to Global MAC structure
3978 * @param *pMsgBuf A pointer to the SME message buffer
3979 * @return None
3980 */
3981static void
3982__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3983{
3984 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
3985 tSirMsgQ msgQ;
3986
3987 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
3988 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
3989
3990 if ( !pMac->lim.gLimRspReqd )
3991 {
3992 palFreeMemory( pMac, pMsgBuf );
3993 return;
3994 }
3995 else
3996 {
3997 pMac->lim.gLimRspReqd = FALSE;
3998 }
3999
4000 msgQ.reserved = 0;
4001 msgQ.bodyptr = pMsgBuf;
4002 msgQ.bodyval = 0;
4003 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4004
4005 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4006 palFreeMemory( pMac, pMsgBuf );
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004007 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004008 return;
4009 }
4010
4011 return;
4012}
4013#endif
4014
4015
Jeff Johnson295189b2012-06-20 16:38:30 -07004016static void
4017__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4018{
4019 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4020 tpPESession psessionEntry;
4021 tANI_U8 sessionId; //PE sessionID
4022
4023 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004024 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004025
4026 if(pMsgBuf == NULL)
4027 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004028 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004029 return;
4030 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004031
Jeff Johnson295189b2012-06-20 16:38:30 -07004032 if( palAllocateMemory( pMac->hHdd, (void **)&pUpdateAPWPSIEsReq, sizeof(tSirUpdateAPWPSIEsReq)))
4033 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004034 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004035 return;
4036 }
4037
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004038 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004039 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004040 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004041 goto end;
4042 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004043
Jeff Johnson295189b2012-06-20 16:38:30 -07004044 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4045 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004046 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004047 goto end;
4048 }
4049
4050 palCopyMemory(pMac->hHdd, &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004051
Jeff Johnson295189b2012-06-20 16:38:30 -07004052 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004053 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004054
4055end:
4056 palFreeMemory( pMac->hHdd, pUpdateAPWPSIEsReq);
4057 return;
4058} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4059
4060static void
4061__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4062{
4063 tpSirUpdateParams pUpdateParams;
4064 tpPESession psessionEntry;
4065
4066 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004067 FL("received HIDE_SSID message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004068
4069 if(pMsgBuf == NULL)
4070 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004071 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004072 return;
4073 }
4074
4075 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4076
4077 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4078 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004079 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004080 pUpdateParams->sessionId);
4081 return;
4082 }
4083
4084 /* Update the session entry */
4085 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4086
4087 /* Update beacon */
4088 schSetFixedBeaconFields(pMac, psessionEntry);
4089 limSendBeaconInd(pMac, psessionEntry);
4090
4091 return;
4092} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4093
4094static void
4095__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4096{
4097 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4098 tpPESession psessionEntry;
4099 tANI_U8 sessionId; //PE sessionID
4100
4101 if(pMsgBuf == NULL)
4102 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004103 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004104 return;
4105 }
4106
4107 if( palAllocateMemory( pMac->hHdd, (void **)&pUpdateAPWPARSNIEsReq, sizeof(tSirUpdateAPWPSIEsReq)))
4108 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004109 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004110 return;
4111 }
4112
4113 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4114 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004115 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004116 goto end;
4117 }
4118
4119 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4120 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004121 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004122 goto end;
4123 }
4124
4125 palCopyMemory(pMac->hHdd, &psessionEntry->pLimStartBssReq->rsnIE, &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
4126
4127 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4128
4129 psessionEntry->pLimStartBssReq->privacy = 1;
4130 psessionEntry->privacy = 1;
4131
4132 schSetFixedBeaconFields(pMac, psessionEntry);
4133 limSendBeaconInd(pMac, psessionEntry);
4134
4135end:
4136 palFreeMemory( pMac->hHdd, pUpdateAPWPARSNIEsReq);
4137 return;
4138} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4139
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004140/*
4141Update the beacon Interval dynamically if beaconInterval is different in MCC
4142*/
4143static void
4144__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4145{
4146 tpSirChangeBIParams pChangeBIParams;
4147 tpPESession psessionEntry;
4148 tANI_U8 sessionId = 0;
4149 tUpdateBeaconParams beaconParams;
4150
4151 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004152 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004153
4154 if(pMsgBuf == NULL)
4155 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004156 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004157 return;
4158 }
4159
4160 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4161
4162 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4163 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004164 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004165 return;
4166 }
4167
4168 /*Update sessionEntry Beacon Interval*/
4169 if(psessionEntry->beaconParams.beaconInterval !=
4170 pChangeBIParams->beaconInterval )
4171 {
4172 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4173 }
4174
4175 /*Update sch beaconInterval*/
4176 if(pMac->sch.schObject.gSchBeaconInterval !=
4177 pChangeBIParams->beaconInterval )
4178 {
4179 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4180
4181 PELOG1(limLog(pMac, LOG1,
4182 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4183
4184 /* Update beacon */
4185 schSetFixedBeaconFields(pMac, psessionEntry);
4186
4187 //Set change in beacon Interval
4188 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004189 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004190 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4191 }
4192
4193 return;
4194} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4195
Jeff Johnson295189b2012-06-20 16:38:30 -07004196
4197
4198/** -------------------------------------------------------------
4199\fn limProcessSmeDelBaPeerInd
4200\brief handles indication message from HDD to send delete BA request
4201\param tpAniSirGlobal pMac
4202\param tANI_U32 pMsgBuf
4203\return None
4204-------------------------------------------------------------*/
4205void
4206limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4207{
4208 tANI_U16 assocId =0;
4209 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4210 tpDphHashNode pSta;
4211 tpPESession psessionEntry;
4212 tANI_U8 sessionId;
4213
4214
4215
4216 if(NULL == pSmeDelBAPeerInd)
4217 return;
4218
4219 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4220 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004221 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004222 return;
4223 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004224 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004225 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4226
4227 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4228 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4229 pSta,
4230 pSmeDelBAPeerInd->baDirection,
4231 pSmeDelBAPeerInd->baTID,
4232 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4233 {
4234 limLog( pMac, LOGW,
4235 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4236 if (pSta)
4237 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4238 }
4239}
4240
4241// --------------------------------------------------------------------
4242/**
4243 * __limProcessReportMessage
4244 *
4245 * FUNCTION: Processes the next received Radio Resource Management message
4246 *
4247 * LOGIC:
4248 *
4249 * ASSUMPTIONS:
4250 *
4251 * NOTE:
4252 *
4253 * @param None
4254 * @return None
4255 */
4256
4257void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4258{
4259#ifdef WLAN_FEATURE_VOWIFI
4260 switch (pMsg->type)
4261 {
4262 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4263 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4264 break;
4265 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4266 {
4267#if defined FEATURE_WLAN_CCX
4268 tpSirBeaconReportXmitInd pBcnReport=NULL;
4269 tpPESession psessionEntry=NULL;
4270 tANI_U8 sessionId;
4271
4272 if(pMsg->bodyptr == NULL)
4273 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004274 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004275 return;
4276 }
4277 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4278 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4279 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004280 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004281 return;
4282 }
4283 if (psessionEntry->isCCXconnection)
4284 ccxProcessBeaconReportXmit( pMac, pMsg->bodyptr);
4285 else
4286#endif
4287 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4288 }
4289 break;
4290 }
4291#endif
4292}
4293
4294#if defined(FEATURE_WLAN_CCX) || defined(WLAN_FEATURE_VOWIFI)
4295// --------------------------------------------------------------------
4296/**
4297 * limSendSetMaxTxPowerReq
4298 *
4299 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4300 *
4301 * LOGIC:
4302 *
4303 * ASSUMPTIONS:
4304 *
4305 * NOTE:
4306 *
4307 * @param txPower txPower to be set.
4308 * @param pSessionEntry session entry.
4309 * @return None
4310 */
4311tSirRetStatus
4312limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4313{
4314 tpMaxTxPowerParams pMaxTxParams = NULL;
4315 tSirRetStatus retCode = eSIR_SUCCESS;
4316 tSirMsgQ msgQ;
4317
4318 if( pSessionEntry == NULL )
4319 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004320 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004321 return eSIR_FAILURE;
4322 }
4323 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
4324 (void **) &pMaxTxParams, sizeof(tMaxTxPowerParams) ) )
4325 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004326 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004327 return eSIR_MEM_ALLOC_FAILED;
4328
4329 }
4330#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_CCX)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004331 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 -07004332#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004333 if( pMaxTxParams == NULL )
4334 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004335 limLog( pMac, LOGE, "%s:%d: pMaxTxParams is NULL", __func__, __LINE__);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004336 return eSIR_FAILURE;
4337 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004338 pMaxTxParams->power = txPower;
4339 palCopyMemory( pMac->hHdd, pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4340 palCopyMemory( pMac->hHdd, pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
4341
4342 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4343 msgQ.bodyptr = pMaxTxParams;
4344 msgQ.bodyval = 0;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004345 PELOGW(limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));)
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08004346 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004347 if(eSIR_SUCCESS != (retCode = wdaPostCtrlMsg(pMac, &msgQ)))
4348 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004349 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07004350 if (NULL != pMaxTxParams)
4351 {
4352 palFreeMemory(pMac->hHdd, (tANI_U8*)pMaxTxParams);
4353 }
4354 return retCode;
4355 }
4356 return retCode;
4357}
4358#endif
4359
4360/**
4361 * __limProcessSmeAddStaSelfReq()
4362 *
4363 *FUNCTION:
4364 * This function is called to process SME_ADD_STA_SELF_REQ message
4365 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4366 *
4367 *LOGIC:
4368 *
4369 *ASSUMPTIONS:
4370 *
4371 *NOTE:
4372 *
4373 * @param pMac Pointer to Global MAC structure
4374 * @param *pMsgBuf A pointer to the SME message buffer
4375 * @return None
4376 */
4377
4378static void
4379__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4380{
4381 tSirMsgQ msg;
4382 tpAddStaSelfParams pAddStaSelfParams;
4383 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
4384
4385 if ( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void**) &pAddStaSelfParams,
4386 sizeof( tAddStaSelfParams) ) )
4387 {
4388 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
4389 return;
4390 }
4391
4392 palCopyMemory( pMac->hHdd, pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
4393
4394 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
4395 msg.reserved = 0;
4396 msg.bodyptr = pAddStaSelfParams;
4397 msg.bodyval = 0;
4398
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004399 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004400 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004401
4402 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4403 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004404 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004405 }
4406 return;
4407} /*** end __limProcessAddStaSelfReq() ***/
4408
4409
4410/**
4411 * __limProcessSmeDelStaSelfReq()
4412 *
4413 *FUNCTION:
4414 * This function is called to process SME_DEL_STA_SELF_REQ message
4415 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
4416 *
4417 *LOGIC:
4418 *
4419 *ASSUMPTIONS:
4420 *
4421 *NOTE:
4422 *
4423 * @param pMac Pointer to Global MAC structure
4424 * @param *pMsgBuf A pointer to the SME message buffer
4425 * @return None
4426 */
4427
4428static void
4429__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4430{
4431 tSirMsgQ msg;
4432 tpDelStaSelfParams pDelStaSelfParams;
4433 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
4434
4435 if ( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void**) &pDelStaSelfParams,
4436 sizeof( tDelStaSelfParams) ) )
4437 {
4438 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
4439 return;
4440 }
4441
4442 palCopyMemory( pMac->hHdd, pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
4443
4444 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
4445 msg.reserved = 0;
4446 msg.bodyptr = pDelStaSelfParams;
4447 msg.bodyval = 0;
4448
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004449 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004450 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004451
4452 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4453 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004454 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004455 }
4456 return;
4457} /*** end __limProcessSmeDelStaSelfReq() ***/
4458
4459
Jeff Johnson295189b2012-06-20 16:38:30 -07004460/**
4461 * __limProcessSmeRegisterMgmtFrameReq()
4462 *
4463 *FUNCTION:
4464 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
4465 * from SME. It Register this information within PE.
4466 *
4467 *LOGIC:
4468 *
4469 *ASSUMPTIONS:
4470 *
4471 *NOTE:
4472 *
4473 * @param pMac Pointer to Global MAC structure
4474 * @param *pMsgBuf A pointer to the SME message buffer
4475 * @return None
4476 */
4477static void
4478__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4479{
4480 VOS_STATUS vosStatus;
4481 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
4482 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004483 tANI_BOOLEAN match = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004484 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004485 FL("registerFrame %d, frameType %d, matchLen %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07004486 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004487
Jeff Johnsond13512a2012-07-17 11:42:19 -07004488 /* First check whether entry exists already*/
4489
4490 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4491 (vos_list_node_t**)&pLimMgmtRegistration);
4492
4493 while(pLimMgmtRegistration != NULL)
4494 {
4495 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
4496 {
4497 if(pSmeReq->matchLen)
4498 {
4499 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
4500 {
4501 if (palEqualMemory(pMac, pLimMgmtRegistration->matchData,
4502 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
4503 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004504 /* found match! */
4505 match = VOS_TRUE;
4506 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004507 }
4508 }
4509 }
4510 else
4511 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004512 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07004513 match = VOS_TRUE;
4514 break;
4515 }
4516 }
4517 vosStatus = vos_list_peek_next (
4518 &pMac->lim.gLimMgmtFrameRegistratinQueue,
4519 (vos_list_node_t*) pLimMgmtRegistration,
4520 (vos_list_node_t**) &pNext );
4521
4522 pLimMgmtRegistration = pNext;
4523 pNext = NULL;
4524
4525 }
4526
4527 if (match)
4528 {
4529 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4530 (vos_list_node_t*)pLimMgmtRegistration);
4531 palFreeMemory(pMac,pLimMgmtRegistration);
4532 }
4533
Jeff Johnson295189b2012-06-20 16:38:30 -07004534 if(pSmeReq->registerFrame)
4535 {
4536 palAllocateMemory(pMac, (void**)&pLimMgmtRegistration,
4537 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
4538 if(pLimMgmtRegistration != NULL)
4539 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004540 palZeroMemory(pMac, (void*)pLimMgmtRegistration,
Jeff Johnson295189b2012-06-20 16:38:30 -07004541 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen );
4542 pLimMgmtRegistration->frameType = pSmeReq->frameType;
4543 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
4544 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
4545 if(pSmeReq->matchLen)
4546 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004547 palCopyMemory(pMac,pLimMgmtRegistration->matchData,
Jeff Johnson295189b2012-06-20 16:38:30 -07004548 pSmeReq->matchData, pSmeReq->matchLen);
4549 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004550 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4551 &pLimMgmtRegistration->node);
4552 }
4553 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004554
4555 return;
4556} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08004557
4558static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08004559__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08004560{
4561 tpP2pPsParams pMsgNoA;
4562 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08004563
Viral Modid86bde22012-12-10 13:09:21 -08004564 if( eHAL_STATUS_SUCCESS != palAllocateMemory(
4565 pMac->hHdd, (void **) &pMsgNoA, sizeof( tP2pPsConfig )))
4566 {
4567 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004568 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08004569 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004570 }
4571
4572 palZeroMemory( pMac->hHdd, (tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig));
4573 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
4574 pMsgNoA->opp_ps = 0;
4575 pMsgNoA->ctWindow = 0;
4576 pMsgNoA->duration = 0;
4577 pMsgNoA->interval = 0;
4578 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08004579
Vinay Malekal62757362012-12-17 12:15:51 -08004580 /* Below params used for Single Shot NOA - so assign proper values */
4581 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08004582 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08004583
Viral Modid86bde22012-12-10 13:09:21 -08004584 /* Start Insert NOA timer
4585 * 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 -08004586 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
4587 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08004588 */
4589 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
4590 == TX_TIMER_ERROR)
4591 {
4592 /// Could not activate Insert NOA timer.
4593 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004594 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08004595
4596 // send the scan response back with status failure and do not even call insert NOA
4597 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Jeff Johnson04f6c402013-04-05 08:43:48 -07004598 palFreeMemory( pMac->hHdd, pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08004599 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004600 }
4601
Viral Modid440e682013-03-06 02:25:31 -08004602 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
4603
Viral Modid86bde22012-12-10 13:09:21 -08004604 msg.type = WDA_SET_P2P_GO_NOA_REQ;
4605 msg.reserved = 0;
4606 msg.bodyptr = pMsgNoA;
4607 msg.bodyval = 0;
4608
4609 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4610 {
4611 /* 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 -07004612 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08004613 /* Deactivate the NOA timer in failure case */
4614 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
4615 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004616 }
Viral Modid440e682013-03-06 02:25:31 -08004617 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08004618
Viral Modid440e682013-03-06 02:25:31 -08004619error:
4620 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
4621 * worrying about the NOA
4622 */
4623 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
4624 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08004625 return FALSE;
4626
4627}
4628
Viral Modid440e682013-03-06 02:25:31 -08004629static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4630{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004631 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08004632 pMac->lim.gDeferMsgTypeForNOA = msgType;
4633 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
4634}
4635
4636static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4637{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004638 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08004639 pMac->lim.gDeferMsgTypeForNOA = 0;
4640 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
4641 {
4642 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
4643 palFreeMemory( pMac->hHdd, (tANI_U32 *) pMac->lim.gpDefdSmeMsgForNOA);
4644 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4645 }
4646}
4647
4648static
4649tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4650{
4651 tANI_U32 noaDuration = 0;
4652
4653 switch (msgType)
4654 {
4655 case eWNI_SME_SCAN_REQ:
4656 {
4657 tANI_U32 val;
4658 tANI_U8 i;
4659 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
4660 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
4661 {
4662 /*
4663 * Could not get max channel value
4664 * from CFG. Log error.
4665 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004666 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08004667
4668 /* use a default value of 110ms */
4669 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
4670 }
4671
4672 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
4673 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
4674
4675 if (limActiveScanAllowed(pMac, channelNum)) {
4676 /* Use min + max channel time to calculate the total duration of scan */
4677 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
4678 } else {
4679 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
4680 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
4681 */
4682 noaDuration += val;
4683 }
4684 }
4685
4686 /* Adding an overhead of 20ms to account for the scan messaging delays */
4687 noaDuration += SCAN_MESSAGING_OVERHEAD;
4688 noaDuration *= CONV_MS_TO_US;
4689
4690 break;
4691 }
4692
4693 case eWNI_SME_OEM_DATA_REQ:
4694 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
4695 break;
4696
4697 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
4698 {
4699 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
4700 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
4701 break;
4702 }
4703
4704 case eWNI_SME_JOIN_REQ:
4705 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
4706 break;
4707
4708 default:
4709 noaDuration = 0;
4710 break;
4711
4712 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004713 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08004714 return noaDuration;
4715}
4716
4717void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4718{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05304719 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08004720
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004721 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004722 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
4723 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
4724 {
4725 switch (pMac->lim.gDeferMsgTypeForNOA)
4726 {
4727 case eWNI_SME_SCAN_REQ:
4728 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4729 break;
4730 case eWNI_SME_OEM_DATA_REQ:
4731 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4732 break;
4733 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05304734 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4735 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
4736 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
4737 */
4738 if (FALSE == bufConsumed)
4739 {
4740 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4741 }
Viral Modid440e682013-03-06 02:25:31 -08004742 break;
4743 case eWNI_SME_JOIN_REQ:
4744 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4745 break;
4746 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004747 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004748 break;
4749 }
4750 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
4751 }
4752 else
4753 {
4754 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004755 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08004756 }
4757}
Jeff Johnson295189b2012-06-20 16:38:30 -07004758
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004759#ifdef FEATURE_WLAN_TDLS_INTERNAL
4760/*
4761 * Process Discovery request recieved from SME and transmit to AP.
4762 */
4763static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
4764 tANI_U32 *pMsgBuf)
4765{
4766 /* get all discovery request parameters */
4767 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
4768 tpPESession psessionEntry;
4769 tANI_U8 sessionId;
4770
4771 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004772 ("Discovery Req Recieved")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004773
4774 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
4775 == NULL)
4776 {
4777 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004778 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004779 disReq->sessionId);
4780 goto lim_tdls_dis_start_error;
4781 }
4782
4783 /* check if we are in proper state to work as TDLS client */
4784 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
4785 {
4786 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004787 "dis req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004788 psessionEntry->limSystemRole);
4789 goto lim_tdls_dis_start_error;
4790 }
4791
4792 /*
4793 * if we are still good, go ahead and check if we are in proper state to
4794 * do TDLS discovery procedure.
4795 */
4796 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4797 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4798 {
4799
4800 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004801 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004802 goto lim_tdls_dis_start_error;
4803 }
4804
4805 /*
4806 * if we are still good, go ahead and transmit TDLS discovery request,
4807 * and save Dis Req info for future reference.
4808 */
4809
4810#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
4811 /*
4812 * send message to HAL to set RXP filters to receieve frame on
4813 * direct link..
4814 */
4815 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
4816 // psessionEntry->bssId) ;
4817#endif
4818
4819 /* save dis request message for matching dialog token */
4820 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
4821 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
4822
4823 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004824 "Transmit Discovery Request Frame") ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004825 /* format TDLS discovery request frame and transmit it */
4826 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
4827 psessionEntry) ;
4828
4829 /* prepare for response */
4830 pMac->lim.gLimTdlsDisStaCount = 0 ;
4831 pMac->lim.gLimTdlsDisResultList = NULL ;
4832
4833 /*
4834 * start TDLS discovery request timer to wait for discovery responses
4835 * from all TDLS enabled clients in BSS.
4836 */
4837
4838 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004839 ("Start Discovery request Timeout Timer")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004840 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
4841 eLIM_TDLS_DISCOVERY_RSP_WAIT));
4842
4843 /* assign appropriate sessionId to the timer object */
4844 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
4845 psessionEntry->peSessionId;
4846
4847 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
4848 != TX_SUCCESS)
4849 {
4850 limLog(pMac, LOGP, FL("TDLS discovery response timer \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004851 activation failed!"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004852 goto lim_tdls_dis_start_error;
4853 }
4854 /*
4855 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
4856 * back to SME
4857 */
4858 return (eSIR_SUCCESS) ;
4859lim_tdls_dis_start_error:
4860 /* in error case, PE has to sent the response SME immediately with error code */
4861 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
4862 eWNI_SME_TDLS_DISCOVERY_START_RSP);
4863 return eSIR_FAILURE;
4864}
4865/*
4866 * Process link start request recieved from SME and transmit to AP.
4867 */
4868eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4869{
4870 /* get all discovery request parameters */
4871 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
4872 tLimTdlsLinkSetupInfo *linkSetupInfo;
4873 //tLimTdlsLinkSetupPeer *setupPeer;
4874 tpPESession psessionEntry;
4875 tANI_U8 sessionId;
4876 eHalStatus status;
4877
4878 if((psessionEntry = peFindSessionByBssid(pMac,
4879 setupReq->bssid, &sessionId)) == NULL)
4880 {
4881 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004882 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004883 setupReq->sessionId);
4884 goto lim_tdls_link_start_error;
4885 }
4886
4887 /* check if we are in proper state to work as TDLS client */
4888 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
4889 {
4890 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004891 "TDLS link setup req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004892 psessionEntry->limSystemRole);
4893 goto lim_tdls_link_start_error;
4894 }
4895
4896 /*
4897 * if we are still good, go ahead and check if we are in proper state to
4898 * do TDLS setup procedure.
4899 */
4900 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4901 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4902 {
4903 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004904 state (%d)", pMac->lim.gLimSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004905 goto lim_tdls_link_start_error;
4906 }
4907
4908 /*
4909 * Now, go ahead and transmit TDLS discovery request, and save setup Req
4910 * info for future reference.
4911 */
4912 /* create node for Link setup */
4913 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
4914 //setupPeer = NULL ;
4915
4916 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
4917 setupReq->peerMac, psessionEntry) ;
4918 if(eHAL_STATUS_SUCCESS == status)
4919 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
4920 TDLS setup cnf TX complete is successful. */
4921 return eSIR_SUCCESS;
4922#if 0
4923
4924 /*
4925 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08004926 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004927 * free this memory if any timeout is happen in link setup procedure
4928 */
4929 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
4930 (void **) &setupPeer, sizeof( tLimTdlsLinkSetupPeer )))
4931 {
4932 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004933 FL( "Unable to allocate memory during ADD_STA" ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004934 VOS_ASSERT(0) ;
4935 return eSIR_MEM_ALLOC_FAILED;
4936 }
4937 setupPeer->dialog = setupReq->dialog ;
4938 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
4939 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
4940 /* TDLS_sessionize: remember sessionId for future */
4941 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
4942 setupPeer->tdls_bIsResponder = 1;
4943
4944 /*
4945 * we only populate peer MAC, so it can assit us to find the
4946 * TDLS peer after response/or after response timeout
4947 */
4948 palCopyMemory(pMac->hHdd, setupPeer->peerMac, setupReq->peerMac,
4949 sizeof(tSirMacAddr)) ;
4950 /* format TDLS discovery request frame and transmit it */
4951 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
4952 setupReq->dialog, psessionEntry, NULL, 0) ;
4953
4954 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
4955 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
4956 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
4957 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
4958 /* update setup peer list */
4959 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
4960 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
4961 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
4962 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
4963 return eSIR_SUCCESS ;
4964#endif
4965lim_tdls_link_start_error:
4966 /* in case of error, return immediately to SME */
4967 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
4968 eWNI_SME_TDLS_LINK_START_RSP);
4969 return eSIR_FAILURE ;
4970}
4971
4972/*
4973 * Process link teardown request recieved from SME and transmit to AP.
4974 */
4975eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4976{
4977 /* get all discovery request parameters */
4978 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
4979 tLimTdlsLinkSetupPeer *setupPeer;
4980 tpPESession psessionEntry;
4981 tANI_U8 sessionId;
4982
4983 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
4984 {
4985 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004986 "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004987 goto lim_tdls_teardown_req_error;
4988 }
4989
4990 /* check if we are in proper state to work as TDLS client */
4991 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
4992 {
4993 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004994 "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004995 goto lim_tdls_teardown_req_error;
4996 }
4997
4998 /*
4999 * if we are still good, go ahead and check if we are in proper state to
5000 * do TDLS setup procedure.
5001 */
5002 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5003 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5004 {
5005 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005006 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005007 goto lim_tdls_teardown_req_error;
5008 }
5009
5010 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005011 "Teardown for peer = %02x,%02x,%02x,%02x,%02x,%02x",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005012 teardownReq->peerMac[0],
5013 teardownReq->peerMac[1],
5014 teardownReq->peerMac[2],
5015 teardownReq->peerMac[3],
5016 teardownReq->peerMac[4],
5017 teardownReq->peerMac[5]) ;
5018 /*
5019 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5020 * info for future reference.
5021 */
5022 /* Verify if this link is setup */
5023 setupPeer = NULL ;
5024 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5025 if(NULL == setupPeer)
5026 {
5027 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005028 ("invalid Peer on teardown ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005029 goto lim_tdls_teardown_req_error;
5030 }
5031
5032
5033 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5034 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5035 /* TDLS_sessionize: check sessionId in case */
5036 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5037 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005038 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005039 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5040 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5041 }
5042
5043 /* format TDLS teardown request frame and transmit it */
5044 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5045 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5046 {
5047 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005048 ("couldn't send teardown frame ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005049 goto lim_tdls_teardown_req_error;
5050 }
5051 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5052 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5053 return eSIR_SUCCESS;
5054lim_tdls_teardown_req_error:
5055 /* in case of error, return immediately to SME */
5056 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5057 eWNI_SME_TDLS_TEARDOWN_RSP);
5058 return eSIR_FAILURE;
5059}
5060
5061
5062#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005063
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305064static void
5065__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5066{
5067 tpSirResetAPCapsChange pResetCapsChange;
5068 tpPESession psessionEntry;
5069 tANI_U8 sessionId = 0;
5070 if (pMsgBuf == NULL)
5071 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005072 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305073 return;
5074 }
5075
5076 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5077 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5078 if (psessionEntry == NULL)
5079 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005080 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305081 return;
5082 }
5083
5084 psessionEntry->limSentCapsChangeNtf = false;
5085 return;
5086}
5087
Jeff Johnson295189b2012-06-20 16:38:30 -07005088/**
5089 * limProcessSmeReqMessages()
5090 *
5091 *FUNCTION:
5092 * This function is called by limProcessMessageQueue(). This
5093 * function processes SME request messages from HDD or upper layer
5094 * application.
5095 *
5096 *LOGIC:
5097 *
5098 *ASSUMPTIONS:
5099 *
5100 *NOTE:
5101 *
5102 * @param pMac Pointer to Global MAC structure
5103 * @param msgType Indicates the SME message type
5104 * @param *pMsgBuf A pointer to the SME message buffer
5105 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5106 * FALSE - if pMsgBuf is not to be freed.
5107 */
5108
5109tANI_BOOLEAN
5110limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5111{
5112 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5113 tANI_U32 *pMsgBuf = pMsg->bodyptr;
5114
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005115 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 -07005116 limMsgStr(pMsg->type), pMsg->type,
5117 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5118 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5119
Viral Modid440e682013-03-06 02:25:31 -08005120 /* Special handling of some SME Req msgs where we have an existing GO session and
5121 * want to insert NOA before processing those msgs. These msgs will be processed later when
5122 * start event happens
5123 */
5124 switch (pMsg->type)
5125 {
5126 case eWNI_SME_SCAN_REQ:
5127 case eWNI_SME_OEM_DATA_REQ:
5128 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5129 case eWNI_SME_JOIN_REQ:
5130 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5131 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5132 {
5133 tANI_U32 noaDuration;
5134 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
5135 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf);
5136 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5137 return bufConsumed;
5138 }
5139 }
5140 /* If no insert NOA required then execute the code below */
5141
Jeff Johnson295189b2012-06-20 16:38:30 -07005142 switch (pMsg->type)
5143 {
5144 case eWNI_SME_START_REQ:
5145 __limProcessSmeStartReq(pMac, pMsgBuf);
5146 break;
5147
5148 case eWNI_SME_SYS_READY_IND:
5149 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5150 break;
5151
Jeff Johnson295189b2012-06-20 16:38:30 -07005152 case eWNI_SME_START_BSS_REQ:
5153 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5154 break;
5155
5156 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005157 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005158 break;
5159
Jeff Johnsone7245742012-09-05 17:12:55 -07005160#ifdef FEATURE_OEM_DATA_SUPPORT
5161 case eWNI_SME_OEM_DATA_REQ:
5162 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005163 break;
5164#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005165 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5166 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5167 break;
5168
5169 case eWNI_SME_UPDATE_NOA:
5170 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5171 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005172 case eWNI_SME_JOIN_REQ:
5173 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005174 break;
5175
5176 case eWNI_SME_AUTH_REQ:
5177 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5178
5179 break;
5180
5181 case eWNI_SME_REASSOC_REQ:
5182 __limProcessSmeReassocReq(pMac, pMsgBuf);
5183
5184 break;
5185
5186 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5187 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5188
5189 break;
5190
5191 case eWNI_SME_DISASSOC_REQ:
5192 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5193
5194 break;
5195
5196 case eWNI_SME_DISASSOC_CNF:
5197 case eWNI_SME_DEAUTH_CNF:
5198 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5199
5200 break;
5201
5202 case eWNI_SME_DEAUTH_REQ:
5203 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5204
5205 break;
5206
Jeff Johnson295189b2012-06-20 16:38:30 -07005207
5208
5209 case eWNI_SME_SETCONTEXT_REQ:
5210 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5211
5212 break;
5213
5214 case eWNI_SME_REMOVEKEY_REQ:
5215 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5216
5217 break;
5218
5219 case eWNI_SME_STOP_BSS_REQ:
5220 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5221 break;
5222
5223 case eWNI_SME_ASSOC_CNF:
5224 case eWNI_SME_REASSOC_CNF:
5225 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005226 PELOG1(limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005227 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005228 PELOG1(limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005229 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5230 break;
5231
5232 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005233 PELOG1(limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005234 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5235 break;
5236
5237 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005238 PELOG1(limLog(pMac, LOG1, FL("Received DELTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005239 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5240 break;
5241
5242 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005243 PELOG1(limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005244 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5245 break;
5246
5247 case eWNI_SME_STA_STAT_REQ:
5248 case eWNI_SME_AGGR_STAT_REQ:
5249 case eWNI_SME_GLOBAL_STAT_REQ:
5250 case eWNI_SME_STAT_SUMM_REQ:
5251 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5252 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5253 bufConsumed = FALSE;
5254 break;
5255 case eWNI_SME_GET_STATISTICS_REQ:
5256 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5257 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5258 bufConsumed = FALSE;
5259 break;
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005260#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
5261 case eWNI_SME_GET_ROAM_RSSI_REQ:
5262 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5263 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5264 bufConsumed = FALSE;
5265 break;
5266#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005267 case eWNI_SME_DEL_BA_PEER_IND:
5268 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5269 break;
5270 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5271 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5272 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005273 case eWNI_SME_GET_ASSOC_STAS_REQ:
5274 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5275 break;
5276 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5277 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5278 break;
5279
5280 case eWNI_SME_HIDE_SSID_REQ:
5281 __limProcessSmeHideSSID(pMac, pMsgBuf);
5282 break;
5283 case eWNI_SME_UPDATE_APWPSIE_REQ:
5284 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5285 break;
5286 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5287 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5288 break;
5289
5290 case eWNI_SME_SET_APWPARSNIEs_REQ:
5291 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5292 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005293
5294 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5295 //Update the beaconInterval
5296 __limProcessSmeChangeBI(pMac, pMsgBuf );
5297 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005298
5299#if defined WLAN_FEATURE_VOWIFI
5300 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5301 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5302 __limProcessReportMessage(pMac, pMsg);
5303 break;
5304#endif
5305
5306#if defined WLAN_FEATURE_VOWIFI_11R
5307 case eWNI_SME_FT_PRE_AUTH_REQ:
5308 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5309 break;
5310 case eWNI_SME_FT_UPDATE_KEY:
5311 limProcessFTUpdateKey(pMac, pMsgBuf);
5312 break;
5313
5314 case eWNI_SME_FT_AGGR_QOS_REQ:
5315 limProcessFTAggrQosReq(pMac, pMsgBuf);
5316 break;
5317#endif
5318
5319#if defined FEATURE_WLAN_CCX
5320 case eWNI_SME_CCX_ADJACENT_AP_REPORT:
5321 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5322 break;
5323#endif
5324 case eWNI_SME_ADD_STA_SELF_REQ:
5325 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5326 break;
5327 case eWNI_SME_DEL_STA_SELF_REQ:
5328 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5329 break;
5330
Jeff Johnson295189b2012-06-20 16:38:30 -07005331 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5332 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5333 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005334#ifdef FEATURE_WLAN_TDLS
5335 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5336 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5337 break;
5338 case eWNI_SME_TDLS_ADD_STA_REQ:
5339 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5340 break;
5341 case eWNI_SME_TDLS_DEL_STA_REQ:
5342 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5343 break;
5344#endif
5345#ifdef FEATURE_WLAN_TDLS_INTERNAL
5346 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
5347 limProcessSmeDisStartReq(pMac, pMsgBuf);
5348 break ;
5349 case eWNI_SME_TDLS_LINK_START_REQ:
5350 limProcessSmeLinkStartReq(pMac, pMsgBuf);
5351 break ;
5352 case eWNI_SME_TDLS_TEARDOWN_REQ:
5353 limProcessSmeTeardownReq(pMac, pMsgBuf);
5354 break ;
5355#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305356 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5357 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5358 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005359
schang86c22c42013-03-13 18:41:24 -07005360 case eWNI_SME_SET_TX_POWER_REQ:
5361 limSendSetTxPowerReq(pMac, pMsgBuf);
5362 break ;
5363
Jeff Johnson295189b2012-06-20 16:38:30 -07005364 default:
5365 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5366 pMsg->bodyptr = NULL;
5367 break;
5368 } // switch (msgType)
5369
5370 return bufConsumed;
5371} /*** end limProcessSmeReqMessages() ***/