blob: 612710fb9b758763fe0e805b125db49cae771a34 [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 -0700124
Jeff Johnson295189b2012-06-20 16:38:30 -0700125#ifdef BACKGROUND_SCAN_ENABLED
126
127// start the background scan timers if it hasn't already started
128static void
129__limBackgroundScanInitiate(tpAniSirGlobal pMac)
130{
131 if (pMac->lim.gLimBackgroundScanStarted)
132 return;
133
134 //make sure timer is created first
135 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
136 {
137 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -0700138 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700139 if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700140 limLog(pMac, LOGP, FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700141 pMac->lim.gLimBackgroundScanStarted = true;
142 pMac->lim.gLimBackgroundScanChannelId = 0;
143 }
144}
145
146#endif // BACKGROUND_SCAN_ENABLED
Jeff Johnson295189b2012-06-20 16:38:30 -0700147
148// determine if a fresh scan request must be issued or not
149/*
150* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
151* If one of the sessions is not in one of the above states, then PE does not do fresh scan
152* If no session exists (scanning very first time), then PE will always do fresh scan if SME
153* asks it to do that.
154*/
155static tANI_U8
156__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
157{
158
159 tANI_U8 validState = TRUE;
160 int i;
161
162 if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
163 {
164 return FALSE;
165 }
166 for(i =0; i < pMac->lim.maxBssId; i++)
167 {
168
169 if(pMac->lim.gpSession[i].valid == TRUE)
170 {
171 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
172 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
173 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
174
175 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
176 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
177 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
178 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700179 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
180 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
181 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
182 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700183 ))
184 {
185 validState = FALSE;
186 break;
187 }
188
189 }
190 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700191 PELOG1(limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700192
193 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
194 return TRUE;
195
196 return FALSE;
197}
198
Jeff Johnson295189b2012-06-20 16:38:30 -0700199
200
201/**
202 * __limIsSmeAssocCnfValid()
203 *
204 *FUNCTION:
205 * This function is called by limProcessLmmMessages() upon
206 * receiving SME_ASSOC_CNF.
207 *
208 *LOGIC:
209 * Message validity checks are performed in this function
210 *
211 *ASSUMPTIONS:
212 *
213 *NOTE:
214 *
215 * @param pMeasReq Pointer to Received ASSOC_CNF message
216 * @return true When received SME_ASSOC_CNF is formatted
217 * correctly
218 * false otherwise
219 */
220
221inline static tANI_U8
222__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
223{
224 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
225 return false;
226 else
227 return true;
228} /*** end __limIsSmeAssocCnfValid() ***/
229
230
231/**
232 * __limGetSmeJoinReqSizeForAlloc()
233 *
234 *FUNCTION:
235 * This function is called in various places to get IE length
236 * from tSirBssDescription structure
237 * number being scanned.
238 *
239 *PARAMS:
240 *
241 *LOGIC:
242 *
243 *ASSUMPTIONS:
244 * NA
245 *
246 *NOTE:
247 * NA
248 *
249 * @param pBssDescr
250 * @return Total IE length
251 */
252
253static tANI_U16
254__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
255{
256 tANI_U16 len = 0;
257
258 if (!pBuf)
259 return len;
260
261 pBuf += sizeof(tANI_U16);
262 len = limGetU16( pBuf );
263 return (len + sizeof( tANI_U16 ));
264} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
265
266
267/**----------------------------------------------------------------
268\fn __limIsDeferedMsgForLearn
269
270\brief Has role only if 11h is enabled. Not used on STA side.
271 Defers the message if SME is in learn state and brings
272 the LIM back to normal mode.
273
274\param pMac
275\param pMsg - Pointer to message posted from SME to LIM.
276\return TRUE - If defered
277 FALSE - Otherwise
278------------------------------------------------------------------*/
279static tANI_BOOLEAN
280__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
281{
282 if (limIsSystemInScanState(pMac))
283 {
284 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
285 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700286 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 return eANI_BOOLEAN_FALSE;
288 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700289 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 pMsg->type);)
291
292 /** Send finish scan req to HAL only if LIM is not waiting for any response
293 * from HAL like init scan rsp, start scan rsp etc.
294 */
295 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
296 {
297 //Set the resume channel to Any valid channel (invalid).
298 //This will instruct HAL to set it to any previous valid channel.
299 peSetResumeChannel(pMac, 0, 0);
300 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
301 }
302
303 return eANI_BOOLEAN_TRUE;
304 }
305 return eANI_BOOLEAN_FALSE;
306}
307
308/**----------------------------------------------------------------
309\fn __limIsDeferedMsgForRadar
310
311\brief Has role only if 11h is enabled. Not used on STA side.
312 Defers the message if radar is detected.
313
314\param pMac
315\param pMsg - Pointer to message posted from SME to LIM.
316\return TRUE - If defered
317 FALSE - Otherwise
318------------------------------------------------------------------*/
319static tANI_BOOLEAN
320__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
321{
322 /** fRadarDetCurOperChan will be set only if we detect radar in current
323 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700324 //TODO: Need to take care radar detection.
325 //if (LIM_IS_RADAR_DETECTED(pMac))
326 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 {
328 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
329 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700330 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 return eANI_BOOLEAN_FALSE;
332 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700333 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 pMsg->type);)
335 return eANI_BOOLEAN_TRUE;
336 }
337 return eANI_BOOLEAN_FALSE;
338}
339
340
341/**
342 * __limProcessSmeStartReq()
343 *
344 *FUNCTION:
345 * This function is called to process SME_START_REQ message
346 * from HDD or upper layer application.
347 *
348 *LOGIC:
349 *
350 *ASSUMPTIONS:
351 *
352 *NOTE:
353 *
354 * @param pMac Pointer to Global MAC structure
355 * @param *pMsgBuf A pointer to the SME message buffer
356 * @return None
357 */
358
359static void
360__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
361{
362 tSirResultCodes retCode = eSIR_SME_SUCCESS;
363 tANI_U8 smesessionId;
364 tANI_U16 smetransactionId;
365
366
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700367 PELOG1(limLog(pMac, LOG1, FL("Received START_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700368
369 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
370
371 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
372 {
373 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
374
Jeff Johnsone7245742012-09-05 17:12:55 -0700375 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700376
377 /// By default do not return after first scan match
378 pMac->lim.gLimReturnAfterFirstMatch = 0;
379
380 /// Initialize MLM state machine
381 limInitMlm(pMac);
382
383 /// By default return unique scan results
384 pMac->lim.gLimReturnUniqueResults = true;
385 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700386#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
387 pMac->lim.gLimSmeLfrScanResultLength = 0;
388#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700389
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
391 {
392 /*
393 * Need to indicate new BSSs found during background scanning to
394 * host. Update this parameter at CFG
395 */
396 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
397 != eSIR_SUCCESS)
398 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700399 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
401 }
402 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 }
404 else
405 {
406 /**
407 * Should not have received eWNI_SME_START_REQ in states
408 * other than OFFLINE. Return response to host and
409 * log error
410 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700411 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
413 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
414 }
415 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
416} /*** end __limProcessSmeStartReq() ***/
417
418
419/** -------------------------------------------------------------
420\fn __limProcessSmeSysReadyInd
421\brief handles the notification from HDD. PE just forwards this message to HAL.
422\param tpAniSirGlobal pMac
423\param tANI_U32* pMsgBuf
424\return TRUE-Posting to HAL failed, so PE will consume the buffer.
425\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
426 -------------------------------------------------------------*/
427static tANI_BOOLEAN
428__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
429{
430 tSirMsgQ msg;
431
432 msg.type = WDA_SYS_READY_IND;
433 msg.reserved = 0;
434 msg.bodyptr = pMsgBuf;
435 msg.bodyval = 0;
436
Jeff Johnson92751692013-03-06 16:00:33 -0800437 if (pMac->gDriverType != eDRIVER_TYPE_MFG)
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 {
Jeff Johnson92751692013-03-06 16:00:33 -0800439 peRegisterTLHandle(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700440 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700441 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700442 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700443
Jeff Johnson92751692013-03-06 16:00:33 -0800444 if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700446 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700447 return eANI_BOOLEAN_TRUE;
448 }
449 return eANI_BOOLEAN_FALSE;
450}
451
Jeff Johnsone7245742012-09-05 17:12:55 -0700452#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700453
Jeff Johnsone7245742012-09-05 17:12:55 -0700454tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
455{
456 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
457 {
458 switch(secondaryChanOffset)
459 {
460 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
461 return primarychanNum;
462 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
463 return primarychanNum + 2;
464 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
465 return primarychanNum - 2;
466 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
467 return primarychanNum + 6;
468 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
469 return primarychanNum + 2;
470 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
471 return primarychanNum - 2;
472 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
473 return primarychanNum - 6;
474 default :
475 return eSIR_CFG_INVALID_ID;
476 }
477 }
478 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
479 {
480 switch(secondaryChanOffset)
481 {
482 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
483 return primarychanNum + 2;
484 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
485 return primarychanNum - 2;
486 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
487 return primarychanNum;
488 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
489 return primarychanNum + 2;
490 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
491 return primarychanNum - 2;
492 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
493 return primarychanNum + 2;
494 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
495 return primarychanNum - 2;
496 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
497 return primarychanNum + 2;
498 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
499 return primarychanNum - 2;
500 default :
501 return eSIR_CFG_INVALID_ID;
502 }
503 }
504 return primarychanNum;
505}
506
507#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700508/**
509 * __limHandleSmeStartBssRequest()
510 *
511 *FUNCTION:
512 * This function is called to process SME_START_BSS_REQ message
513 * from HDD or upper layer application.
514 *
515 *LOGIC:
516 *
517 *ASSUMPTIONS:
518 *
519 *NOTE:
520 *
521 * @param pMac Pointer to Global MAC structure
522 * @param *pMsgBuf A pointer to the SME message buffer
523 * @return None
524 */
525
526static void
527__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
528{
529 tANI_U16 size;
530 tANI_U32 val = 0;
531 tSirRetStatus retStatus;
532 tSirMacChanNum channelNumber;
Jeff Johnsonace91102013-04-05 08:03:18 -0700533 tLimMlmStartReq *pMlmStartReq = NULL;
534 tpSirSmeStartBssReq pSmeStartBssReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 tSirResultCodes retCode = eSIR_SME_SUCCESS;
536 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 tANI_U8 sessionId;
538 tpPESession psessionEntry = NULL;
539 tANI_U8 smesessionId;
540 tANI_U16 smetransactionId;
541
542#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
543 //Since the session is not created yet, sending NULL. The response should have the correct state.
544 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
545#endif //FEATURE_WLAN_DIAG_SUPPORT
546
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700547 PELOG1(limLog(pMac, LOG1, FL("Received START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700548
549 /* Global Sme state and mlm states are not defined yet , for BT-AMP Suppoprt . TO BE DONE */
550 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
551 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
552 {
553 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
554
Jeff Johnson295189b2012-06-20 16:38:30 -0700555
556 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSmeStartBssReq, size))
557 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700558 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed for pMac->lim.gpLimStartBssReq"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 /// Send failure response to host
560 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
561 goto end;
562 }
563
564 (void) palZeroMemory(pMac->hHdd, (void *)pSmeStartBssReq, size);
565
566 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
567 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
568 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700569 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 retCode = eSIR_SME_INVALID_PARAMETERS;
571 goto free;
572 }
573#if 0
574 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700575 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700576 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
577#endif
578
579 /* This is the place where PE is going to create a session.
580 * If session is not existed , then create a new session */
581 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
582 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700583 limLog(pMac, LOGW, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
585 psessionEntry = NULL;
586 goto free;
587 }
588 else
589 {
590 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
591 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700592 limLog(pMac, LOGW, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
594 goto free;
595 }
596
597 }
598
599 /* Store the session related parameters in newly created session */
600 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
601
602 /* Store PE sessionId in session Table */
603 psessionEntry->peSessionId = sessionId;
604
605 /* Store SME session Id in sessionTable */
606 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
607
608 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
609
610 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
611
612 /* Copy SSID to session table */
613 palCopyMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->ssId,
614 (tANI_U8 *)&pSmeStartBssReq->ssId,
615 (pSmeStartBssReq->ssId.length + 1));
616
617
618
619 psessionEntry->bssType = pSmeStartBssReq->bssType;
620
621 psessionEntry->nwType = pSmeStartBssReq->nwType;
622
623 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
624
625 /* Store the channel number in session Table */
626 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
627
628 /*Store Persona */
629 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700630 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700631 psessionEntry->pePersona);
632
633 /*Update the phymode*/
634 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
635
636 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
637 psessionEntry->currentOperChannel );
638 /* Store the dot 11 mode in to the session Table*/
639
640 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700641 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
642#ifdef WLAN_FEATURE_11AC
643 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700644 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
645 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700646#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800647
648 psessionEntry->txLdpcIniFeatureEnabled =
649 pSmeStartBssReq->txLdpcIniFeatureEnabled;
650
krunal soni4f087d22013-07-29 16:32:26 -0700651 psessionEntry->oxygenNwkIniFeatureEnabled =
652 pSmeStartBssReq->oxygenNwkIniFeatureEnabled;
653
Jeff Johnson295189b2012-06-20 16:38:30 -0700654 palCopyMemory(pMac->hHdd, (void*)&psessionEntry->rateSet,
655 (void*)&pSmeStartBssReq->operationalRateSet,
656 sizeof(tSirMacRateSet));
657 palCopyMemory(pMac->hHdd, (void*)&psessionEntry->extRateSet,
658 (void*)&pSmeStartBssReq->extendedRateSet,
659 sizeof(tSirMacRateSet));
660
661 switch(pSmeStartBssReq->bssType)
662 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700663 case eSIR_INFRA_AP_MODE:
664 psessionEntry->limSystemRole = eLIM_AP_ROLE;
665 psessionEntry->privacy = pSmeStartBssReq->privacy;
666 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
667 psessionEntry->authType = pSmeStartBssReq->authType;
668 /* Store the DTIM period */
669 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
670 /*Enable/disable UAPSD*/
671 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
672 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
673 {
674 psessionEntry->proxyProbeRspEn = 0;
675 }
676 else
677 {
678 /* To detect PBC overlap in SAP WPS mode, Host handles
679 * Probe Requests.
680 */
681 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
682 {
683 psessionEntry->proxyProbeRspEn = 1;
684 }
685 else
686 {
687 psessionEntry->proxyProbeRspEn = 0;
688 }
689 }
690 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
691 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -0700692 psessionEntry->shortSlotTimeSupported = limGetShortSlotFromPhyMode(pMac, psessionEntry, psessionEntry->gLimPhyMode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700693 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700694 case eSIR_IBSS_MODE:
695 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
696 break;
697
698 case eSIR_BTAMP_AP_MODE:
699 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
700 break;
701
702 case eSIR_BTAMP_STA_MODE:
703 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
704 break;
705
706 /* There is one more mode called auto mode. which is used no where */
707
708 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
709
710
711 default:
712 //not used anywhere...used in scan function
713 break;
714 }
715
716 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
717 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700718 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 )
720 {
721 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&psessionEntry->parsedAssocReq,
722 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)) ))
723 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700724 limLog(pMac, LOGW, FL("palAllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
726 goto free;
727 }
728 palZeroMemory(pMac->hHdd, psessionEntry->parsedAssocReq, (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)) );
729 }
730
731 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
732 if (pSmeStartBssReq->channelId)
733 {
734 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700735 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
736 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
737 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700738 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700739 FL("cbMode %u"), pSmeStartBssReq->cbMode);
740#ifdef WLAN_FEATURE_11AC
741 if(psessionEntry->vhtCapability)
742 {
743 tANI_U32 centerChan;
744 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700745
Jeff Johnsone7245742012-09-05 17:12:55 -0700746 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
747 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700748 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700749 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700750 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700751 }
752
753 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ || chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
754 {
755 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
756 != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700758 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 retCode = eSIR_LOGP_EXCEPTION;
Jeff Johnsone7245742012-09-05 17:12:55 -0700760 goto free;
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 }
762 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700763 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
764 {
765 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
766 != eSIR_SUCCESS)
767 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700768 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700769 retCode = eSIR_LOGP_EXCEPTION;
770 goto free;
771 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700772
Jeff Johnsone7245742012-09-05 17:12:55 -0700773 centerChan = limGetCenterChannel(pMac,channelNumber,pSmeStartBssReq->cbMode,WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
774 if(centerChan != eSIR_CFG_INVALID_ID)
775 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700776 limLog(pMac, LOGW, FL("***Center Channel for 80MHZ channel width = %ld"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700777 psessionEntry->apCenterChan = centerChan;
Jeff Johnsone7245742012-09-05 17:12:55 -0700778 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1, centerChan)
779 != eSIR_SUCCESS)
780 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700781 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700782 retCode = eSIR_LOGP_EXCEPTION;
783 goto free;
784 }
785 }
786 }
787
788 /* All the translation is done by now for gVhtChannelWidth from .ini file to
789 * the actual values as defined in spec. So, grabing the spec value which is
790 * updated in .dat file by the above logic */
791 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
792 &chanWidth) != eSIR_SUCCESS)
793 {
794 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700795 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700796 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700797 /*For Sta+p2p-Go concurrency
798 vhtTxChannelWidthSet is used for storing p2p-GO channel width
799 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
800 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
801 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700802 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700803 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700804 }
805 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
806#endif
807 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700808 else
809 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700810 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 retCode = eSIR_SME_INVALID_PARAMETERS;
812 goto free;
813 }
814
815 // Delete pre-auth list if any
816 limDeletePreAuthList(pMac);
817
818 // Delete IBSS peer BSSdescription list if any
819 //limIbssDelete(pMac); sep 26 review
820
821
822
823#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
824 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 limInitMlm(pMac);
826#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700827
Jeff Johnsone7245742012-09-05 17:12:55 -0700828 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700829
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 /* keep the RSN/WPA IE information in PE Session Entry
831 * later will be using this to check when received (Re)Assoc req
832 * */
833 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
834
Jeff Johnson295189b2012-06-20 16:38:30 -0700835
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 //Taken care for only softAP case rest need to be done
837 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
838 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
839 /*each byte will have the following info
840 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
841 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
842 palCopyMemory( pMac->hHdd, (void *) &psessionEntry->cfgProtection,
843 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700844 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
846 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700847
848 // Prepare and Issue LIM_MLM_START_REQ to MLM
849 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmStartReq, sizeof(tLimMlmStartReq)))
850 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700851 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700852 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
853 goto free;
854 }
855
856 (void)palZeroMemory(pMac->hHdd, (void *) pMlmStartReq, sizeof(tLimMlmStartReq));
857
858 /* Copy SSID to the MLM start structure */
859 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmStartReq->ssId,
860 (tANI_U8 *) &pSmeStartBssReq->ssId,
861 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
863 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700864
865
866 pMlmStartReq->bssType = psessionEntry->bssType;
867
868 /* Fill PE session Id from the session Table */
869 pMlmStartReq->sessionId = psessionEntry->peSessionId;
870
871 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700873 )
874 {
875 //len = sizeof(tSirMacAddr);
876 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
877 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700878 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700879
880 /* Copy the BSSId from sessionTable to mlmStartReq struct */
881 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
882 }
883
884 else // ibss mode
885 {
886 pMac->lim.gLimIbssCoalescingHappened = false;
887
888 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
889 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700890 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700891 retCode = eSIR_LOGP_EXCEPTION;
892 goto free;
893 }
894
895 if(!autoGenBssId)
896 {
897 // We're not auto generating BSSID. Instead, get it from session entry
898 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
899
900 if(pMlmStartReq->bssId[0] & 0x01)
901 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700902 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700903 autoGenBssId = TRUE;
904 }
905 }
906
907 if( autoGenBssId )
908 { //if BSSID is not any uc id. then use locally generated BSSID.
909 //Autogenerate the BSSID
910 limGetRandomBssid( pMac, pMlmStartReq->bssId);
911 pMlmStartReq->bssId[0]= 0x02;
912
913 /* Copy randomly generated BSSID to the session Table */
914 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
915 }
916 }
917 /* store the channel num in mlmstart req structure */
918 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
919 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
920 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
921
Jeff Johnson295189b2012-06-20 16:38:30 -0700922 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
923 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
924 pMlmStartReq->wps_state = psessionEntry->wps_state;
925
926 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700927 {
928 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700929 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 pMlmStartReq->dtimPeriod = (tANI_U8)val;
931 }
932
933 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700934 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700935 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
936
937 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700938 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
940
941 //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
942 palCopyMemory(pMac->hHdd, (void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
943 sizeof(tSirMacRateSet));
944
945
946 // Now populate the 11n related parameters
947 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700948 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700949 //
950 // FIXME_GEN4 - Determine the appropriate defaults...
951 //
952 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
953 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700954 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700955
956 /* sep26 review */
957 psessionEntry->limRFBand = limGetRFBand(channelNumber);
958
959 // Initialize 11h Enable Flag
960 psessionEntry->lim11hEnable = 0;
961 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
962 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
963 {
964 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700965 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700966 psessionEntry->lim11hEnable = val;
967 }
968
969 if (!psessionEntry->lim11hEnable)
970 {
971 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700972 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700973 }
974
Jeff Johnson295189b2012-06-20 16:38:30 -0700975 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
976 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700977 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700978
979 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
980 return;
981 }
982 else
983 {
984
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700985 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700986 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
987 goto end;
988 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
989
990free:
Jeff Johnsonace91102013-04-05 08:03:18 -0700991 if ((psessionEntry != NULL) &&
992 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
993 {
994 psessionEntry->pLimStartBssReq = NULL;
995 }
996 palFreeMemory(pMac->hHdd, pSmeStartBssReq);
997 palFreeMemory(pMac->hHdd, pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700998
999end:
1000
1001 /* This routine should return the sme sessionId and SME transaction Id */
1002 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1003
1004 if(NULL != psessionEntry)
1005 {
1006 peDeleteSession(pMac,psessionEntry);
1007 psessionEntry = NULL;
1008 }
1009 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
1010} /*** end __limHandleSmeStartBssRequest() ***/
1011
1012
1013/**--------------------------------------------------------------
1014\fn __limProcessSmeStartBssReq
1015
1016\brief Wrapper for the function __limHandleSmeStartBssRequest
1017 This message will be defered until softmac come out of
1018 scan mode or if we have detected radar on the current
1019 operating channel.
1020\param pMac
1021\param pMsg
1022
1023\return TRUE - If we consumed the buffer
1024 FALSE - If have defered the message.
1025 ---------------------------------------------------------------*/
1026static tANI_BOOLEAN
1027__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1028{
1029 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1030 __limIsDeferedMsgForRadar(pMac, pMsg))
1031 {
1032 /**
1033 * If message defered, buffer is not consumed yet.
1034 * So return false
1035 */
1036 return eANI_BOOLEAN_FALSE;
1037 }
1038
1039 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1040 return eANI_BOOLEAN_TRUE;
1041}
1042
1043
1044/**
1045 * limGetRandomBssid()
1046 *
1047 * FUNCTION:This function is called to process generate the random number for bssid
1048 * This function is called to process SME_SCAN_REQ message
1049 * from HDD or upper layer application.
1050 *
1051 * LOGIC:
1052 *
1053 * ASSUMPTIONS:
1054 *
1055 * NOTE:
1056 * 1. geneartes the unique random number for bssid in ibss
1057 *
1058 * @param pMac Pointer to Global MAC structure
1059 * @param *data Pointer to bssid buffer
1060 * @return None
1061 */
1062void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1063{
1064 tANI_U32 random[2] ;
1065 random[0] = tx_time_get();
1066 random[0] |= (random[0] << 15) ;
1067 random[1] = random[0] >> 1;
1068 palCopyMemory(pMac->hHdd, data, (tANI_U8*)random, sizeof(tSirMacAddr));
1069}
1070
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301071static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
1072 tpSirSmeScanReq pScanReq)
1073{
1074 tSirScanOffloadReq *pScanOffloadReq;
1075 tANI_U8 *p;
1076 tSirMsgQ msg;
1077 eHalStatus status;
1078 tANI_U16 i, len;
1079 tSirRetStatus rc = eSIR_SUCCESS;
1080
1081 /* The tSirScanOffloadReq will reserve the space for first channel,
1082 so allocate the memory for (numChannels - 1) and uIEFieldLen */
1083 len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
1084 pScanReq->uIEFieldLen;
1085
1086 status = palAllocateMemory(pMac->hHdd, (void **) &pScanOffloadReq, len);
1087 if (status != eHAL_STATUS_SUCCESS)
1088 {
1089 limLog(pMac, LOGE,
1090 FL("palAllocateMemory failed for pScanOffloadReq"));
1091 return eHAL_STATUS_FAILURE;
1092 }
1093
1094 palZeroMemory( pMac->hHdd, (tANI_U8 *) pScanOffloadReq, len);
1095
1096 msg.type = WDA_START_SCAN_OFFLOAD_REQ;
1097 msg.bodyptr = pScanOffloadReq;
1098 msg.bodyval = 0;
1099
1100 palCopyMemory(pMac->hHdd, (tANI_U8 *) pScanOffloadReq->bssId,
1101 (tANI_U8*) pScanReq->bssId,
1102 sizeof(tSirMacAddr));
1103
1104 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
1105 {
1106 limLog(pMac, LOGE,
1107 FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001108 palFreeMemory(pMac->hHdd, (void *)pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301109 return eHAL_STATUS_FAILURE;
1110 }
1111
1112 pScanOffloadReq->numSsid = pScanReq->numSsid;
1113 for (i = 0; i < pScanOffloadReq->numSsid; i++)
1114 {
1115 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
1116 palCopyMemory(pMac->hHdd, (tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
1117 (tANI_U8 *) pScanReq->ssId[i].ssId,
1118 pScanOffloadReq->ssId[i].length);
1119 }
1120
1121 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
1122 palCopyMemory(pMac->hHdd, (tANI_U8 *) pScanOffloadReq->selfMacAddr,
1123 (tANI_U8 *) pScanReq->selfMacAddr,
1124 sizeof(tSirMacAddr));
1125 pScanOffloadReq->bssType = pScanReq->bssType;
1126 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1127 pScanOffloadReq->scanType = pScanReq->scanType;
1128 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1129 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1130 pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
1131 pScanOffloadReq->sessionId = pScanReq->sessionId;
1132 pScanOffloadReq->channelList.numChannels =
1133 pScanReq->channelList.numChannels;
1134 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1135 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1136 p[i] = pScanReq->channelList.channelNumber[i];
1137
1138 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1139 pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
1140 palCopyMemory(pMac->hHdd, (tANI_U8 *) p + i,
1141 (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
1142 pScanOffloadReq->uIEFieldLen);
1143
1144 rc = wdaPostCtrlMsg(pMac, &msg);
1145 if (rc != eSIR_SUCCESS)
1146 {
1147 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"),
1148 pMac);
1149 palFreeMemory(pMac->hHdd, (void *)pScanOffloadReq);
1150 return eHAL_STATUS_FAILURE;
1151 }
1152
1153 return eHAL_STATUS_SUCCESS;
1154}
Jeff Johnson295189b2012-06-20 16:38:30 -07001155
1156/**
1157 * __limProcessSmeScanReq()
1158 *
1159 *FUNCTION:
1160 * This function is called to process SME_SCAN_REQ message
1161 * from HDD or upper layer application.
1162 *
1163 *LOGIC:
1164 *
1165 *ASSUMPTIONS:
1166 *
1167 *NOTE:
1168 * 1. Periodic scanning should be requesting to return unique
1169 * scan results.
1170 *
1171 * @param pMac Pointer to Global MAC structure
1172 * @param *pMsgBuf A pointer to the SME message buffer
1173 * @return None
1174 */
1175
Viral Modid440e682013-03-06 02:25:31 -08001176static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001177__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1178{
1179 tANI_U32 len;
1180 tLimMlmScanReq *pMlmScanReq;
1181 tpSirSmeScanReq pScanReq;
1182 tANI_U8 i = 0;
1183
1184#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1185 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1186#endif //FEATURE_WLAN_DIAG_SUPPORT
1187
1188 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001189 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 -07001190 pScanReq->channelList.numChannels,
1191 pScanReq->minChannelTime,
1192 pScanReq->maxChannelTime,
1193 pScanReq->uIEFieldLen,
1194 pScanReq->returnAfterFirstMatch,
1195 pScanReq->returnFreshResults,
1196 pScanReq->returnUniqueResults,
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001197 pScanReq->scanType,
1198 pScanReq->backgroundScanMode,
1199 pMac->lim.gLimRspReqd ? 1 : 0);)
Viral Modid86bde22012-12-10 13:09:21 -08001200
1201 /* Since scan req always requires a response, we will overwrite response required here.
1202 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1203 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1204 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1205 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1206 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1207 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1208 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1209 * the global flag gLimRspReqd to TRUE here.
1210 */
1211 pMac->lim.gLimRspReqd = TRUE;
1212
Jeff Johnson295189b2012-06-20 16:38:30 -07001213 /*copy the Self MAC address from SmeReq to the globalplace , used for sending probe req.discussed on code review sep18*/
1214 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1215
1216 /* This routine should return the sme sessionId and SME transaction Id */
1217
1218 if (!limIsSmeScanReqValid(pMac, pScanReq))
1219 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001220 PELOGW(limLog(pMac, LOGW, FL("Received SME_SCAN_REQ with invalid parameters"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001221
1222 if (pMac->lim.gLimRspReqd)
1223 {
1224 pMac->lim.gLimRspReqd = false;
1225
1226 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1227
1228 } // if (pMac->lim.gLimRspReqd)
1229
1230 return;
1231 }
1232
1233 //if scan is disabled then return as invalid scan request.
1234 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1235 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1236 {
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001237 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 return;
1239 }
1240
1241
1242 /**
1243 * If scan request is received in idle, joinFailed
1244 * states or in link established state (in STA role)
1245 * or in normal state (in STA-in-IBSS/AP role) with
1246 * 'return fresh scan results' request from HDD or
1247 * it is periodic background scanning request,
1248 * trigger fresh scan request to MLM
1249 */
1250 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1251 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301252 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1253 {
1254 // Discard previously cached scan results
1255 limReInitScanResults(pMac);
1256 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001257
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301258 pMac->lim.gLim24Band11dScanDone = 0;
1259 pMac->lim.gLim50Band11dScanDone = 0;
1260 pMac->lim.gLimReturnAfterFirstMatch =
1261 pScanReq->returnAfterFirstMatch;
1262 pMac->lim.gLimBackgroundScanMode =
1263 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001264
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301265 pMac->lim.gLimReturnUniqueResults =
1266 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1267 /* De-activate Heartbeat timers for connected sessions while
1268 * scan is in progress if the system is in Active mode *
1269 * AND it is not a ROAMING ("background") scan */
1270 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1271 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1272 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1273 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1274 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001275 for(i=0;i<pMac->lim.maxBssId;i++)
1276 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301277 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1278 (pMac->lim.gpSession[i].valid == TRUE) &&
1279 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1280 {
1281 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1282 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001283 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301284 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001285
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301286 if (pMac->fScanOffload)
1287 {
1288 if (eHAL_STATUS_SUCCESS !=
1289 limSendHalStartScanOffloadReq(pMac, pScanReq))
1290 {
1291 limSendSmeScanRsp(pMac,
1292 offsetof(tSirSmeScanRsp, bssDescription[0]),
1293 eSIR_SME_INVALID_PARAMETERS,
1294 pScanReq->sessionId,
1295 pScanReq->transactionId);
1296 return;
1297 }
1298 }
1299 else
1300 {
1301
1302 /*Change Global SME state */
1303 /* Store the previous SME state */
1304 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1305 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1306 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1307
1308 if (pScanReq->channelList.numChannels == 0)
1309 {
1310 tANI_U32 cfg_len;
1311 // Scan all channels
1312 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001313 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1314 pScanReq->uIEFieldLen;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301315 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq, len) )
1316 {
1317 // Log error
1318 limLog(pMac, LOGP,
1319 FL("call to palAllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001320
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301321 return;
1322 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001323
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301324 // Initialize this buffer
1325 palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq, len );
Jeff Johnson295189b2012-06-20 16:38:30 -07001326
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301327 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1328 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001329 pMlmScanReq->channelList.channelNumber,
1330 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301331 {
1332 /**
1333 * Could not get Valid channel list from CFG.
1334 * Log error.
1335 */
1336 limLog(pMac, LOGP,
1337 FL("could not retrieve Valid channel list"));
1338 }
1339 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
1340 }
1341 else
1342 {
1343 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1344 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1345 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001346
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301347 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq, len) )
1348 {
1349 // Log error
1350 limLog(pMac, LOGP,
1351 FL("call to palAllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001352
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301353 return;
1354 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001355
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301356 // Initialize this buffer
1357 palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq, len);
1358 pMlmScanReq->channelList.numChannels =
1359 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001360
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301361 palCopyMemory( pMac->hHdd, pMlmScanReq->channelList.channelNumber,
1362 pScanReq->channelList.channelNumber,
1363 pScanReq->channelList.numChannels);
1364 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001365
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301366 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1367 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001368
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301369 if(pScanReq->uIEFieldLen)
1370 {
1371 palCopyMemory( pMac->hHdd, (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1372 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1373 pScanReq->uIEFieldLen);
1374 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001375
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301376 pMlmScanReq->bssType = pScanReq->bssType;
1377 palCopyMemory( pMac->hHdd, pMlmScanReq->bssId,
1378 pScanReq->bssId,
1379 sizeof(tSirMacAddr));
1380 pMlmScanReq->numSsid = pScanReq->numSsid;
1381
1382 i = 0;
1383 while (i < pMlmScanReq->numSsid)
1384 {
1385 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001386 (tANI_U8 *) &pScanReq->ssId[i],
1387 pScanReq->ssId[i].length + 1);
1388
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301389 i++;
1390 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001391
Jeff Johnson295189b2012-06-20 16:38:30 -07001392
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301393 pMlmScanReq->scanType = pScanReq->scanType;
1394 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
1395 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1396 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1397 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1398 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
1399 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1400 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001401
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301402 //Store the smeSessionID and transaction ID for later use.
1403 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1404 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001405
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301406 // Issue LIM_MLM_SCAN_REQ to MLM
1407 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1408 }
1409 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001410
1411 else
1412 {
1413 /// In all other cases return 'cached' scan results
1414 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1415 {
1416 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1417
1418 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001419#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1420 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001421 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001422 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1423 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1424 {
1425 limSendSmeLfrScanRsp(pMac, scanRspLen,
1426 eSIR_SME_SUCCESS,
1427 pScanReq->sessionId,
1428 pScanReq->transactionId);
1429 }
1430 else
1431 {
1432 scanRspLen = sizeof(tSirSmeScanRsp) +
1433 pMac->lim.gLimSmeLfrScanResultLength -
1434 sizeof(tSirBssDescription);
1435 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1436 pScanReq->sessionId, pScanReq->transactionId);
1437 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001438 }
1439 else
1440 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001441#endif
1442 if (pMac->lim.gLimSmeScanResultLength == 0)
1443 {
1444 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1445 pScanReq->sessionId, pScanReq->transactionId);
1446 }
1447 else
1448 {
1449 scanRspLen = sizeof(tSirSmeScanRsp) +
1450 pMac->lim.gLimSmeScanResultLength -
1451 sizeof(tSirBssDescription);
1452 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1453 pScanReq->sessionId, pScanReq->transactionId);
1454 }
1455#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001456 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001457#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001458
1459 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1460 {
1461 // Discard previously cached scan results
1462 limReInitScanResults(pMac);
1463 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001464#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1465 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1466 {
1467 // Discard previously cached scan results
1468 limReInitLfrScanResults(pMac);
1469 }
1470#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001471
1472 } // if (pMac->lim.gLimRspReqd)
1473 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1474
Jeff Johnson295189b2012-06-20 16:38:30 -07001475#ifdef BACKGROUND_SCAN_ENABLED
1476 // start background scans if needed
1477 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1478 __limBackgroundScanInitiate(pMac);
1479#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001480
1481} /*** end __limProcessSmeScanReq() ***/
1482
Jeff Johnsone7245742012-09-05 17:12:55 -07001483#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001484
Jeff Johnsone7245742012-09-05 17:12:55 -07001485static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1486{
1487 tpSirOemDataReq pOemDataReq;
1488 tLimMlmOemDataReq* pMlmOemDataReq;
1489
1490 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1491
1492 //post the lim mlm message now
1493 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)&pMlmOemDataReq, (sizeof(tLimMlmOemDataReq))))
1494 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001495 limLog(pMac, LOGP, FL("palAllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001496 return;
1497 }
1498
1499 //Initialize this buffer
1500 palZeroMemory(pMac->hHdd, pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)));
1501
1502 palCopyMemory(pMac->hHdd, pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr, sizeof(tSirMacAddr));
1503 palCopyMemory(pMac->hHdd, pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq, OEM_DATA_REQ_SIZE);
1504
1505 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1506 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1507
1508 return;
1509
1510} /*** end __limProcessSmeOemDataReq() ***/
1511
1512#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001513
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301514/**
1515 * __limProcessClearDfsChannelList()
1516 *
1517 *FUNCTION:
1518 *Clear DFS channel list when country is changed/aquired.
1519.*This message is sent from SME.
1520 *
1521 *LOGIC:
1522 *
1523 *ASSUMPTIONS:
1524 *
1525 *NOTE:
1526 *
1527 * @param pMac Pointer to Global MAC structure
1528 * @param *pMsgBuf A pointer to the SME message buffer
1529 * @return None
1530 */
1531static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1532 tpSirMsgQ pMsg)
1533{
1534 palZeroMemory(pMac->hHdd, &pMac->lim.dfschannelList,
1535 sizeof(tSirDFSChannelList));
1536}
Jeff Johnson295189b2012-06-20 16:38:30 -07001537
1538/**
1539 * __limProcessSmeJoinReq()
1540 *
1541 *FUNCTION:
1542 * This function is called to process SME_JOIN_REQ message
1543 * from HDD or upper layer application.
1544 *
1545 *LOGIC:
1546 *
1547 *ASSUMPTIONS:
1548 *
1549 *NOTE:
1550 *
1551 * @param pMac Pointer to Global MAC structure
1552 * @param *pMsgBuf A pointer to the SME message buffer
1553 * @return None
1554 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001555static void
1556__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1557{
1558 // tANI_U8 *pBuf;
1559 //tANI_U32 len;
1560// tSirMacAddr currentBssId;
1561 tpSirSmeJoinReq pSmeJoinReq = NULL;
1562 tLimMlmJoinReq *pMlmJoinReq;
1563 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1564 tANI_U32 val = 0;
1565 tANI_U16 nSize;
1566 tANI_U8 sessionId;
1567 tpPESession psessionEntry = NULL;
1568 tANI_U8 smesessionId;
1569 tANI_U16 smetransactionId;
1570 tPowerdBm localPowerConstraint = 0, regMax = 0;
1571
1572#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1573 //Not sending any session, since it is not created yet. The response whould have correct state.
1574 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1575#endif //FEATURE_WLAN_DIAG_SUPPORT
1576
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001577 PELOG1(limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001578
1579#ifdef WLAN_FEATURE_VOWIFI
1580 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1581 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1582 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1583 * like not honoring power constraint on 1st association after driver loading. */
1584 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001585 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1587 val = 0;
1588#endif /* WLAN_FEATURE_VOWIFI */
1589
1590 /**
1591 * Expect Join request in idle state.
1592 * Reassociate request is expected in link established state.
1593 */
1594
1595 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1596 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1597 {
1598 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
1599 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSmeJoinReq, nSize))
1600 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001601 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001602 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1603 goto end;
1604 }
1605 (void) palZeroMemory(pMac->hHdd, (void *) pSmeJoinReq, nSize);
1606
Jeff Johnson295189b2012-06-20 16:38:30 -07001607 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1608 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1609 {
1610 /// Received invalid eWNI_SME_JOIN_REQ
1611 // Log the event
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001612 limLog(pMac, LOGW, FL("received SME_JOIN_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 retCode = eSIR_SME_INVALID_PARAMETERS;
1614 goto end;
1615 }
1616
1617 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP ,review os sep 23
1618
1619 /* check for the existence of start BSS session */
1620#ifdef FIXME_GEN6
1621 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1622 {
1623 if(peValidateBtJoinRequest(pMac)!= TRUE)
1624 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001625 limLog(pMac, LOGW, FL("Start Bss session not present::SME_JOIN_REQ in unexpected state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001626 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1627 psessionEntry = NULL;
1628 goto end;
1629 }
1630 }
1631
1632#endif
1633
1634
1635 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1636 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001637 limLog(pMac, LOGE, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001638
1639 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1640 {
1641 // Received eWNI_SME_JOIN_REQ for same
1642 // BSS as currently associated.
1643 // Log the event and send success
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001644 PELOGW(limLog(pMac, LOGW, FL("Received SME_JOIN_REQ for currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001645 /// Send Join success response to host
1646 retCode = eSIR_SME_SUCCESS;
1647 goto end;
1648 }
1649 else
1650 {
1651 retCode = eSIR_SME_REFUSED;
1652 psessionEntry = NULL;
1653 goto end;
1654 }
1655 }
1656 else /* Session Entry does not exist for given BSSId */
1657 {
1658 /* Try to Create a new session */
1659 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1660 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001661 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001662 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1663 goto end;
1664 }
1665 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001666 handleHTCapabilityandHTInfo(pMac, psessionEntry);
1667
Jeff Johnson295189b2012-06-20 16:38:30 -07001668 /* Store Session related parameters */
1669 /* Store PE session Id in session Table */
1670 psessionEntry->peSessionId = sessionId;
1671
1672 /* store the smejoin req handle in session table */
1673 psessionEntry->pLimJoinReq = pSmeJoinReq;
1674
1675 /* Store SME session Id in sessionTable */
1676 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1677
1678 /* Store SME transaction Id in session Table */
1679 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1680
1681 /* Store beaconInterval */
1682 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1683
1684 /* Copying of bssId is already done, while creating session */
1685 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1686 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1687 psessionEntry->bssType = pSmeJoinReq->bsstype;
1688
1689 psessionEntry->statypeForBss = STA_ENTRY_PEER;
1690
1691 /* Copy the dot 11 mode in to the session table */
1692
1693 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1694 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001695#ifdef WLAN_FEATURE_11AC
1696 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001697 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001698 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001699 if (psessionEntry->vhtCapability )
1700 {
1701 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1702
1703 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001704 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001705 psessionEntry->txBFIniFeatureEnabled);
1706
1707 if( psessionEntry->txBFIniFeatureEnabled )
1708 {
1709 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1710 != eSIR_SUCCESS)
1711 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001712 limLog(pMac, LOGP, FL("could not set WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001713 retCode = eSIR_LOGP_EXCEPTION;
1714 goto end;
1715 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001716 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001717 "***__limProcessSmeJoinReq: txBFCsnValue=%d****", pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001718
1719 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001720 != eSIR_SUCCESS)
1721 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001722 limLog(pMac, LOGP, FL("could not set WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001723 retCode = eSIR_LOGP_EXCEPTION;
1724 goto end;
1725 }
1726 }
1727 }
1728
Jeff Johnsone7245742012-09-05 17:12:55 -07001729#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001730
1731 /*Phy mode*/
1732 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1733
1734 /* Copy The channel Id to the session Table */
1735 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001736 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1737 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1738 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001739
Chet Lanctot186b5732013-03-18 10:26:30 -07001740 /* Record if management frames need to be protected */
1741#ifdef WLAN_FEATURE_11W
1742 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1743 {
1744 psessionEntry->limRmfEnabled = 1;
1745 }
1746 else
1747 {
1748 psessionEntry->limRmfEnabled = 0;
1749 }
1750#endif
1751
Jeff Johnson295189b2012-06-20 16:38:30 -07001752 /*Store Persona */
1753 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1754 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -07001755 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona, pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001756
1757 /* Copy the SSID from smejoinreq to session entry */
1758 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
1759 palCopyMemory( pMac->hHdd,psessionEntry->ssId.ssId,pSmeJoinReq->ssId.ssId,psessionEntry->ssId.length);
1760
1761 /* Copy the SSID from smejoinreq to session entry */
1762 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
1763 palCopyMemory( pMac->hHdd,psessionEntry->ssId.ssId,pSmeJoinReq->ssId.ssId,psessionEntry->ssId.length);
1764
1765 // Determin 11r or CCX connection based on input from SME
1766 // which inturn is dependent on the profile the user wants to connect
1767 // to, So input is coming from supplicant
1768#ifdef WLAN_FEATURE_VOWIFI_11R
1769 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
1770#endif
1771#ifdef FEATURE_WLAN_CCX
1772 psessionEntry->isCCXconnection = pSmeJoinReq->isCCXconnection;
1773#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001774#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001775 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
1776#endif
1777
Jeff Johnson43971f52012-07-17 12:26:56 -07001778#ifdef FEATURE_WLAN_LFR
1779 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
1780#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001781 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
1782
Jeff Johnson295189b2012-06-20 16:38:30 -07001783 if(psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1784 {
1785 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1786 }
1787 else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1788 {
1789 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1790 }
1791 else
1792 {
1793 /* Throw an error and return and make sure to delete the session.*/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001794 limLog(pMac, LOGW, FL("received SME_JOIN_REQ with invalid bss type"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001795 retCode = eSIR_SME_INVALID_PARAMETERS;
1796 goto end;
1797 }
1798
1799 if(pSmeJoinReq->addIEScan.length)
1800 {
1801 palCopyMemory(pMac->hHdd, &psessionEntry->pLimJoinReq->addIEScan,
1802 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
1803 }
1804
1805 if(pSmeJoinReq->addIEAssoc.length)
1806 {
1807 palCopyMemory(pMac->hHdd, &psessionEntry->pLimJoinReq->addIEAssoc,
1808 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
1809 }
1810
Jeff Johnson295189b2012-06-20 16:38:30 -07001811 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Jeff Johnson295189b2012-06-20 16:38:30 -07001812 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmJoinReq, val))
1813 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001814 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001815 return;
1816 }
1817 (void) palZeroMemory(pMac->hHdd, (void *) pMlmJoinReq, val);
1818
1819 /* PE SessionId is stored as a part of JoinReq*/
1820 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
1821
1822 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
1823 != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001824 limLog(pMac, LOGP, FL("could not retrieve JoinFailureTimer value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001825
1826 /* copy operational rate from psessionEntry*/
1827 palCopyMemory(pMac->hHdd, (void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
1828 sizeof(tSirMacRateSet));
1829 palCopyMemory(pMac->hHdd, (void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
1830 sizeof(tSirMacRateSet));
1831 //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
1832 palCopyMemory(pMac->hHdd, (void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
1833 sizeof(tSirMacRateSet));
1834
1835 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
1836
Jeff Johnson295189b2012-06-20 16:38:30 -07001837 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
1838
1839 palCopyMemory( pMac->hHdd,
1840 (tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
1841 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
1842 psessionEntry->pLimJoinReq->bssDescription.length + 2);
1843
Jeff Johnson295189b2012-06-20 16:38:30 -07001844 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07001845 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001846
Jeff Johnsone7245742012-09-05 17:12:55 -07001847 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
1848 localPowerConstraint = regMax;
1849 limExtractApCapability( pMac,
1850 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
1851 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
1852 &psessionEntry->limCurrentBssQosCaps,
1853 &psessionEntry->limCurrentBssPropCap,
1854 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07001855 , &localPowerConstraint,
1856 psessionEntry
Jeff Johnsone7245742012-09-05 17:12:55 -07001857 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001858#ifdef FEATURE_WLAN_CCX
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001859 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07001860#else
1861 psessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
1862#endif
1863#if defined WLAN_VOWIFI_DEBUG
1864 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localPowerConstraint, psessionEntry->maxTxPower );
1865#endif
1866
1867 if (pMac->lim.gLimCurrentBssUapsd)
1868 {
1869 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001870 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"), pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07001871
1872 // resetting the dynamic uapsd mask
1873 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
1874 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
1875 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001876
1877 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
1878
1879 // Initialize 11h Enable Flag
1880 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
1881 {
1882 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001883 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001884 psessionEntry->lim11hEnable = val;
1885 }
1886 else
1887 psessionEntry->lim11hEnable = 0;
1888
1889 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
1890 pMac->lim.gLimIbssCoalescingHappened = false;
1891
Jeff Johnsone7245742012-09-05 17:12:55 -07001892 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
1893 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
1894 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001895
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001896 PELOG1(limLog(pMac, LOG1, FL("SME JoinReq: SSID %d.%c%c%c%c%c%c"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001897 psessionEntry->ssId.length,
1898 psessionEntry->ssId.ssId[0],
1899 psessionEntry->ssId.ssId[1],
1900 psessionEntry->ssId.ssId[2],
1901 psessionEntry->ssId.ssId[3],
1902 psessionEntry->ssId.ssId[4],
1903 psessionEntry->ssId.ssId[5]);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001904 limLog(pMac, LOG1, FL("Channel %d, BSSID %x:%x:%x:%x:%x:%x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001905 psessionEntry->currentOperChannel,
1906 psessionEntry->bssId[0],
1907 psessionEntry->bssId[1],
1908 psessionEntry->bssId[2],
1909 psessionEntry->bssId[3],
1910 psessionEntry->bssId[4],
1911 psessionEntry->bssId[5]);)
1912
1913 /* Indicate whether spectrum management is enabled*/
1914 psessionEntry->spectrumMgtEnabled =
1915 pSmeJoinReq->spectrumMgtIndicator;
1916 /* Issue LIM_MLM_JOIN_REQ to MLM */
1917 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
1918 return;
1919
1920 }
1921 else
1922 {
1923 /* Received eWNI_SME_JOIN_REQ un expected state */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001924 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ in state %X"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001925 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
1926 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1927 psessionEntry = NULL;
1928 goto end;
1929
1930 }
1931
1932end:
1933 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1934
1935 if(pSmeJoinReq)
1936 {
1937 palFreeMemory( pMac->hHdd, pSmeJoinReq);
1938 pSmeJoinReq = NULL;
1939 if (NULL != psessionEntry)
1940 {
1941 psessionEntry->pLimJoinReq = NULL;
1942 }
1943 }
1944
1945 if(retCode != eSIR_SME_SUCCESS)
1946 {
1947 if(NULL != psessionEntry)
1948 {
1949 peDeleteSession(pMac,psessionEntry);
1950 psessionEntry = NULL;
1951 }
1952 }
1953
1954 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
1955} /*** end __limProcessSmeJoinReq() ***/
1956
1957
1958#ifdef FEATURE_WLAN_CCX
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08001959tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07001960{
1961 tANI_U8 maxTxPower = 0;
1962 tANI_U8 txPower = VOS_MIN( regMax , (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001963 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07001964 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
1965 maxTxPower = txPower;
1966 else if (txPower < MIN_TX_PWR_CAP)
1967 maxTxPower = MIN_TX_PWR_CAP;
1968 else
1969 maxTxPower = MAX_TX_PWR_CAP;
1970
1971 return (maxTxPower);
1972}
1973#endif
1974
Jeff Johnson295189b2012-06-20 16:38:30 -07001975/**
1976 * __limProcessSmeReassocReq()
1977 *
1978 *FUNCTION:
1979 * This function is called to process SME_REASSOC_REQ message
1980 * from HDD or upper layer application.
1981 *
1982 *LOGIC:
1983 *
1984 *ASSUMPTIONS:
1985 *
1986 *NOTE:
1987 *
1988 * @param pMac Pointer to Global MAC structure
1989 * @param *pMsgBuf A pointer to the SME message buffer
1990 * @return None
1991 */
1992
1993static void
1994__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1995{
1996 tANI_U16 caps;
1997 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08001998 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001999 tLimMlmReassocReq *pMlmReassocReq;
2000 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2001 tpPESession psessionEntry = NULL;
2002 tANI_U8 sessionId;
2003 tANI_U8 smeSessionId;
2004 tANI_U16 transactionId;
2005 tPowerdBm localPowerConstraint = 0, regMax = 0;
2006 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002007 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002008
2009
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002010 PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002011
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002012 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
2013 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pReassocReq, nSize ))
Jeff Johnson295189b2012-06-20 16:38:30 -07002014 {
2015 // Log error
2016 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002017 FL("call to palAllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002018
2019 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2020 goto end;
2021 }
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002022 (void) palZeroMemory(pMac->hHdd, (void *) pReassocReq, nSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07002023 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2024 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2025 (!limIsSmeJoinReqValid(pMac,
2026 (tpSirSmeJoinReq) pReassocReq)))
2027 {
2028 /// Received invalid eWNI_SME_REASSOC_REQ
2029 // Log the event
2030 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002031 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002032
2033 retCode = eSIR_SME_INVALID_PARAMETERS;
2034 goto end;
2035 }
2036
2037 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2038 {
2039 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002040 limLog(pMac, LOGP, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002041 retCode = eSIR_SME_INVALID_PARAMETERS;
2042 goto end;
2043 }
2044
2045#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2046 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2047#endif //FEATURE_WLAN_DIAG_SUPPORT
2048 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2049
2050 /* Store the reassoc handle in the session Table.. 23rd sep review */
2051 psessionEntry->pLimReAssocReq = pReassocReq;
2052
2053 /**
2054 * Reassociate request is expected
2055 * in link established state only.
2056 */
2057
2058 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2059 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002060#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002061 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2062 {
2063 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002064 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002065 psessionEntry->peSessionId);
2066
2067 // Make sure its our preauth bssid
2068 if (!palEqualMemory( pMac->hHdd, pReassocReq->bssDescription.bssId,
2069 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2070 {
2071 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2072 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002073 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 retCode = eSIR_SME_INVALID_PARAMETERS;
2075 goto end;
2076 }
2077
2078 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2079 return;
2080 }
2081#endif
2082 /// Should not have received eWNI_SME_REASSOC_REQ
2083 // Log the event
2084 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002085 FL("received unexpected SME_REASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002086 psessionEntry->limSmeState);
2087 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2088
2089 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2090 goto end;
2091 }
2092
Jeff Johnson295189b2012-06-20 16:38:30 -07002093 palCopyMemory( pMac->hHdd,
2094 psessionEntry->limReAssocbssId,
2095 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2096 sizeof(tSirMacAddr));
2097
2098 psessionEntry->limReassocChannelId =
2099 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2100
Jeff Johnsone7245742012-09-05 17:12:55 -07002101 psessionEntry->reAssocHtSupportedChannelWidthSet =
2102 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2103 psessionEntry->reAssocHtRecommendedTxWidthSet =
2104 psessionEntry->reAssocHtSupportedChannelWidthSet;
2105 psessionEntry->reAssocHtSecondaryChannelOffset =
2106 psessionEntry->pLimReAssocReq->cbMode;
2107
Jeff Johnson295189b2012-06-20 16:38:30 -07002108 psessionEntry->limReassocBssCaps =
2109 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2111 localPowerConstraint = regMax;
2112 limExtractApCapability( pMac,
2113 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2114 limGetIElenFromBssDescription(
2115 &psessionEntry->pLimReAssocReq->bssDescription),
2116 &psessionEntry->limReassocBssQosCaps,
2117 &psessionEntry->limReassocBssPropCap,
2118 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002119 , &localPowerConstraint,
2120 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002121 );
2122
2123 psessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
2124#if defined WLAN_VOWIFI_DEBUG
2125 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localPowerConstraint, psessionEntry->maxTxPower );
2126#endif
2127 {
2128 #if 0
2129 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2130 &cfgLen) != eSIR_SUCCESS)
2131 {
2132 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002133 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002134 }
2135 #endif//TO SUPPORT BT-AMP
2136
2137 /* Copy the SSID from sessio entry to local variable */
2138 #if 0
2139 palCopyMemory( pMac->hHdd, pMac->lim.gLimReassocSSID.ssId,
2140 psessionEntry->ssId.ssId,
2141 psessionEntry->ssId.length);
2142 #endif
2143 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
2144 palCopyMemory( pMac->hHdd, psessionEntry->limReassocSSID.ssId,
2145 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2146
2147 }
2148
2149 if (pMac->lim.gLimCurrentBssUapsd)
2150 {
2151 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002152 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"), pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 }
2154
Jeff Johnson295189b2012-06-20 16:38:30 -07002155 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq, sizeof(tLimMlmReassocReq)))
2156 {
2157 // Log error
2158 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002159 FL("call to palAllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002160
2161 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2162 goto end;
2163 }
2164
2165 palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
2166 psessionEntry->limReAssocbssId,
2167 sizeof(tSirMacAddr));
2168
2169 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2170 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2171 != eSIR_SUCCESS)
2172 {
2173 /**
2174 * Could not get ReassocFailureTimeout value
2175 * from CFG. Log error.
2176 */
2177 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002178 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 }
2180
2181 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2182 {
2183 /**
2184 * Could not get Capabilities value
2185 * from CFG. Log error.
2186 */
2187 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002188 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002189 }
2190 pMlmReassocReq->capabilityInfo = caps;
2191
2192 /* Update PE sessionId*/
2193 pMlmReassocReq->sessionId = sessionId;
2194
2195 /* If telescopic beaconing is enabled, set listen interval to
2196 WNI_CFG_TELE_BCN_MAX_LI */
2197 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2198 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002199 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002200
2201 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2202
2203 if(teleBcnEn)
2204 {
2205 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2206 eSIR_SUCCESS)
2207 {
2208 /**
2209 * Could not get ListenInterval value
2210 * from CFG. Log error.
2211 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002212 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002213 }
2214 }
2215 else
2216 {
2217 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2218 {
2219 /**
2220 * Could not get ListenInterval value
2221 * from CFG. Log error.
2222 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002223 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002224 }
2225 }
2226
2227 /* Delete all BA sessions before Re-Assoc.
2228 * BA frames are class 3 frames and the session
2229 * is lost upon disassociation and reassociation.
2230 */
2231
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07002232 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS);
Jeff Johnson295189b2012-06-20 16:38:30 -07002233
2234 pMlmReassocReq->listenInterval = (tANI_U16) val;
2235
2236 /* Indicate whether spectrum management is enabled*/
2237 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2238
2239 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2240 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2241
Jeff Johnsone7245742012-09-05 17:12:55 -07002242 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002243
2244 limPostMlmMessage(pMac,
2245 LIM_MLM_REASSOC_REQ,
2246 (tANI_U32 *) pMlmReassocReq);
2247 return;
2248
2249end:
2250 if (pReassocReq)
2251 palFreeMemory( pMac->hHdd, pReassocReq);
2252
2253 if (psessionEntry)
2254 {
2255 // error occurred after we determined the session so extract
2256 // session and transaction info from there
2257 smeSessionId = psessionEntry->smeSessionId;
2258 transactionId = psessionEntry->transactionId;
2259 }
2260 else
2261 {
2262 // error occurred before or during the time we determined the session
2263 // so extract the session and transaction info from the message
2264 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2265 }
2266
2267 /// Send Reassoc failure response to host
2268 /// (note psessionEntry may be NULL, but that's OK)
2269 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2270 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2271 psessionEntry, smeSessionId, transactionId);
2272
2273} /*** end __limProcessSmeReassocReq() ***/
2274
2275
2276tANI_BOOLEAN sendDisassocFrame = 1;
2277/**
2278 * __limProcessSmeDisassocReq()
2279 *
2280 *FUNCTION:
2281 * This function is called to process SME_DISASSOC_REQ message
2282 * from HDD or upper layer application.
2283 *
2284 *LOGIC:
2285 *
2286 *ASSUMPTIONS:
2287 *
2288 *NOTE:
2289 *
2290 * @param pMac Pointer to Global MAC structure
2291 * @param *pMsgBuf A pointer to the SME message buffer
2292 * @return None
2293 */
2294
2295static void
2296__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2297{
2298 tANI_U16 disassocTrigger, reasonCode;
2299 tLimMlmDisassocReq *pMlmDisassocReq;
2300 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002301 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002302 tSirSmeDisassocReq smeDisassocReq;
2303 tpPESession psessionEntry = NULL;
2304 tANI_U8 sessionId;
2305 tANI_U8 smesessionId;
2306 tANI_U16 smetransactionId;
2307
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002308 PELOG1(limLog(pMac, LOG1,FL("received DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002309
Jeff Johnson43971f52012-07-17 12:26:56 -07002310 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002311 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002312 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002313 return;
2314 }
2315
Jeff Johnson43971f52012-07-17 12:26:56 -07002316 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002317
Jeff Johnson43971f52012-07-17 12:26:56 -07002318 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002319
Jeff Johnson43971f52012-07-17 12:26:56 -07002320 if ( (eSIR_FAILURE == status) ||
2321 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002322 {
2323 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002324 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002325
2326 if (pMac->lim.gLimRspReqd)
2327 {
2328 pMac->lim.gLimRspReqd = false;
2329
2330 retCode = eSIR_SME_INVALID_PARAMETERS;
2331 disassocTrigger = eLIM_HOST_DISASSOC;
2332 goto sendDisassoc;
2333 }
2334
2335 return;
2336 }
2337
2338
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002339 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_REQ message. Reason: %d global SmeState: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002340 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState);)
2341
2342
2343 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2344 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002345 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002346 retCode = eSIR_SME_INVALID_PARAMETERS;
2347 disassocTrigger = eLIM_HOST_DISASSOC;
2348 goto sendDisassoc;
2349
2350 }
2351
2352#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2353 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2354#endif //FEATURE_WLAN_DIAG_SUPPORT
2355
2356 /* Update SME session Id and SME transaction ID*/
2357
2358 psessionEntry->smeSessionId = smesessionId;
2359 psessionEntry->transactionId = smetransactionId;
2360
2361 switch (psessionEntry->limSystemRole)
2362 {
2363 case eLIM_STA_ROLE:
2364 case eLIM_BT_AMP_STA_ROLE:
2365 switch (psessionEntry->limSmeState)
2366 {
2367 case eLIM_SME_ASSOCIATED_STATE:
2368 case eLIM_SME_LINK_EST_STATE:
2369 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2370 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002371#ifdef FEATURE_WLAN_TDLS
2372 /* Delete all TDLS peers connected before leaving BSS*/
2373 limDeleteTDLSPeers(pMac, psessionEntry);
2374#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002375 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002376 break;
2377
2378 case eLIM_SME_WT_DEAUTH_STATE:
2379 /* PE shall still process the DISASSOC_REQ and proceed with
2380 * link tear down even if it had already sent a DEAUTH_IND to
2381 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2382 * its been set when PE entered WT_DEAUTH_STATE.
2383 */
2384 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002385 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002386 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002387 break;
2388
2389 case eLIM_SME_WT_DISASSOC_STATE:
2390 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2391 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2392 * PE can continue processing DISASSOC_REQ and send the response instead
2393 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2394 * for disassoc frame.
2395 *
2396 * It will send a disassoc, which is ok. However, we can use the global flag
2397 * sendDisassoc to not send disassoc frame.
2398 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002399 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002400 break;
2401
2402 case eLIM_SME_JOIN_FAILURE_STATE: {
2403 /** Return Success as we are already in Disconnected State*/
2404 if (pMac->lim.gLimRspReqd) {
2405 retCode = eSIR_SME_SUCCESS;
2406 disassocTrigger = eLIM_HOST_DISASSOC;
2407 goto sendDisassoc;
2408 }
2409 }break;
2410 default:
2411 /**
2412 * STA is not currently associated.
2413 * Log error and send response to host
2414 */
2415 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002416 FL("received unexpected SME_DISASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002417 psessionEntry->limSmeState);
2418 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2419
2420 if (pMac->lim.gLimRspReqd)
2421 {
2422 if (psessionEntry->limSmeState !=
2423 eLIM_SME_WT_ASSOC_STATE)
2424 pMac->lim.gLimRspReqd = false;
2425
2426 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2427 disassocTrigger = eLIM_HOST_DISASSOC;
2428 goto sendDisassoc;
2429 }
2430
2431 return;
2432 }
2433
2434 break;
2435
2436 case eLIM_AP_ROLE:
2437 case eLIM_BT_AMP_AP_ROLE:
2438 // Fall through
2439 break;
2440
2441 case eLIM_STA_IN_IBSS_ROLE:
2442 default: // eLIM_UNKNOWN_ROLE
2443 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002444 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002445 psessionEntry->limSystemRole);
2446
2447 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2448 disassocTrigger = eLIM_HOST_DISASSOC;
2449 goto sendDisassoc;
2450 } // end switch (pMac->lim.gLimSystemRole)
2451
2452 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2453 {
2454 /// Disassociation is triggered by Link Monitoring
2455 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2456 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2457 }
2458 else
2459 {
2460 disassocTrigger = eLIM_HOST_DISASSOC;
2461 reasonCode = smeDisassocReq.reasonCode;
2462 }
2463
2464 if (smeDisassocReq.doNotSendOverTheAir)
2465 {
2466 sendDisassocFrame = 0;
2467 }
2468 // Trigger Disassociation frame to peer MAC entity
2469 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmDisassocReq, sizeof(tLimMlmDisassocReq)))
2470 {
2471 // Log error
2472 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002473 FL("call to palAllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002474
2475 return;
2476 }
2477
2478 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
2479 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2480 sizeof(tSirMacAddr));
2481
2482 pMlmDisassocReq->reasonCode = reasonCode;
2483 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2484
2485 /* Update PE session ID*/
2486 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002487
2488 limPostMlmMessage(pMac,
2489 LIM_MLM_DISASSOC_REQ,
2490 (tANI_U32 *) pMlmDisassocReq);
2491 return;
2492
2493sendDisassoc:
2494 if (psessionEntry)
2495 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2496 retCode,
2497 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002498 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002499 else
2500 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2501 retCode,
2502 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002503 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002504
2505
2506} /*** end __limProcessSmeDisassocReq() ***/
2507
2508
2509/** -----------------------------------------------------------------
2510 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2511
2512 This function is called to process SME_DISASSOC_CNF message
2513 from HDD or upper layer application.
2514
2515 \param pMac - global mac structure
2516 \param pStaDs - station dph hash node
2517 \return none
2518 \sa
2519 ----------------------------------------------------------------- */
2520static void
2521__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2522{
2523 tSirSmeDisassocCnf smeDisassocCnf;
2524 tANI_U16 aid;
2525 tpDphHashNode pStaDs;
2526 tSirRetStatus status = eSIR_SUCCESS;
2527 tpPESession psessionEntry;
2528 tANI_U8 sessionId;
2529
2530
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002531 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002532
2533 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2534
2535 if (status == eSIR_FAILURE)
2536 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002537 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002538 return;
2539 }
2540
2541 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2542 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002543 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002544 return;
2545 }
2546
2547 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2548 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002549 limLog(pMac, LOGW, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002550 return;
2551 }
2552
2553#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2554 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2555 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2556 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2557 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2558#endif //FEATURE_WLAN_DIAG_SUPPORT
2559
2560 switch (psessionEntry->limSystemRole)
2561 {
2562 case eLIM_STA_ROLE:
2563 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2564 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2565 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2566 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2567 {
2568 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002569 FL("received unexp SME_DISASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002570 psessionEntry->limSmeState);
2571 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2572 return;
2573 }
2574 break;
2575
2576 case eLIM_AP_ROLE:
2577 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002578 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002579
2580 case eLIM_STA_IN_IBSS_ROLE:
2581 default: // eLIM_UNKNOWN_ROLE
2582 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002583 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002584 psessionEntry->limSystemRole);
2585
2586 return;
2587 }
2588
2589
2590 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2591 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002592 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002593 )
2594 {
2595 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2596 if (pStaDs == NULL)
2597 {
2598 PELOGW(limLog(pMac, LOGW, FL("received DISASSOC_CNF for a STA that does not have context, addr= "));
2599 limPrintMacAddr(pMac, smeDisassocCnf.peerMacAddr, LOGW);)
2600 return;
2601 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002602 /* Delete FT session if there exists one */
2603 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002604 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002605
2606 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002607 }
2608
2609 return;
2610}
2611
2612
2613/**
2614 * __limProcessSmeDeauthReq()
2615 *
2616 *FUNCTION:
2617 * This function is called to process SME_DEAUTH_REQ message
2618 * from HDD or upper layer application.
2619 *
2620 *LOGIC:
2621 *
2622 *ASSUMPTIONS:
2623 *
2624 *NOTE:
2625 *
2626 * @param pMac Pointer to Global MAC structure
2627 * @param *pMsgBuf A pointer to the SME message buffer
2628 * @return None
2629 */
2630
2631static void
2632__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2633{
2634 tANI_U16 deauthTrigger, reasonCode;
2635 tLimMlmDeauthReq *pMlmDeauthReq;
2636 tSirSmeDeauthReq smeDeauthReq;
2637 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2638 tSirRetStatus status = eSIR_SUCCESS;
2639 tpPESession psessionEntry;
2640 tANI_U8 sessionId; //PE sessionId
2641 tANI_U8 smesessionId;
2642 tANI_U16 smetransactionId;
2643
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002644 PELOG1(limLog(pMac, LOG1,FL("received DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002645
2646 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
2647
2648 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2649
2650 //We need to get a session first but we don't even know if the message is correct.
2651 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2652 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002653 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002654 retCode = eSIR_SME_INVALID_PARAMETERS;
2655 deauthTrigger = eLIM_HOST_DEAUTH;
2656 goto sendDeauth;
2657
2658 }
2659
2660 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2661 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002662 PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002663 if (pMac->lim.gLimRspReqd)
2664 {
2665 pMac->lim.gLimRspReqd = false;
2666
2667 retCode = eSIR_SME_INVALID_PARAMETERS;
2668 deauthTrigger = eLIM_HOST_DEAUTH;
2669 goto sendDeauth;
2670 }
2671
2672 return;
2673 }
2674
2675#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2676 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2677#endif //FEATURE_WLAN_DIAG_SUPPORT
2678
2679 /* Update SME session ID and Transaction ID */
2680 psessionEntry->smeSessionId = smesessionId;
2681 psessionEntry->transactionId = smetransactionId;
2682
2683
2684 switch (psessionEntry->limSystemRole)
2685 {
2686 case eLIM_STA_ROLE:
2687 case eLIM_BT_AMP_STA_ROLE:
2688
2689 switch (psessionEntry->limSmeState)
2690 {
2691 case eLIM_SME_ASSOCIATED_STATE:
2692 case eLIM_SME_LINK_EST_STATE:
2693 case eLIM_SME_WT_ASSOC_STATE:
2694 case eLIM_SME_JOIN_FAILURE_STATE:
2695 case eLIM_SME_IDLE_STATE:
2696 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2697 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002698 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002699
2700 // Send Deauthentication request to MLM below
2701
2702 break;
2703
2704 default:
2705 /**
2706 * STA is not in a state to deauthenticate with
2707 * peer. Log error and send response to host.
2708 */
2709 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002710 FL("received unexp SME_DEAUTH_REQ in state %X"),psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002711 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2712
2713 if (pMac->lim.gLimRspReqd)
2714 {
2715 pMac->lim.gLimRspReqd = false;
2716
2717 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2718 deauthTrigger = eLIM_HOST_DEAUTH;
2719 goto sendDeauth;
2720 }
2721
2722 return;
2723 }
2724
2725 break;
2726
2727 case eLIM_STA_IN_IBSS_ROLE:
2728
2729 return;
2730
2731 case eLIM_AP_ROLE:
2732 // Fall through
2733
2734 break;
2735
2736 default:
2737 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002738 FL("received unexpected SME_DEAUTH_REQ for role %X"),psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07002739
2740 return;
2741 } // end switch (pMac->lim.gLimSystemRole)
2742
2743 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
2744 {
2745 /// Deauthentication is triggered by Link Monitoring
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002746 PELOG1(limLog(pMac, LOG1, FL("**** Lost link with AP ****"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002747 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
2748 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
2749 }
2750 else
2751 {
2752 deauthTrigger = eLIM_HOST_DEAUTH;
2753 reasonCode = smeDeauthReq.reasonCode;
2754 }
2755
2756 // Trigger Deauthentication frame to peer MAC entity
2757 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmDeauthReq, sizeof(tLimMlmDeauthReq)))
2758 {
2759 // Log error
2760 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002761 FL("call to palAllocateMemory failed for mlmDeauthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002762
2763 return;
2764 }
2765
2766 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
2767 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
2768 sizeof(tSirMacAddr));
2769
2770 pMlmDeauthReq->reasonCode = reasonCode;
2771 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07002772
2773 /* Update PE session Id*/
2774 pMlmDeauthReq->sessionId = sessionId;
2775
2776 limPostMlmMessage(pMac,
2777 LIM_MLM_DEAUTH_REQ,
2778 (tANI_U32 *) pMlmDeauthReq);
2779 return;
2780
2781sendDeauth:
2782 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
2783 retCode,
2784 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002785 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002786 smesessionId, smetransactionId);
2787} /*** end __limProcessSmeDeauthReq() ***/
2788
2789
2790
2791/**
2792 * __limProcessSmeSetContextReq()
2793 *
2794 *FUNCTION:
2795 * This function is called to process SME_SETCONTEXT_REQ message
2796 * from HDD or upper layer application.
2797 *
2798 *LOGIC:
2799 *
2800 *ASSUMPTIONS:
2801 *
2802 *NOTE:
2803 *
2804 * @param pMac Pointer to Global MAC structure
2805 * @param *pMsgBuf A pointer to the SME message buffer
2806 * @return None
2807 */
2808
2809static void
2810__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2811{
2812 tpSirSmeSetContextReq pSetContextReq;
2813 tLimMlmSetKeysReq *pMlmSetKeysReq;
2814 tpPESession psessionEntry;
2815 tANI_U8 sessionId; //PE sessionID
2816 tANI_U8 smesessionId;
2817 tANI_U16 smetransactionId;
2818
2819
2820 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002821 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07002822
2823
2824 if(pMsgBuf == NULL)
2825 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002826 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002827 return;
2828 }
2829
2830 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2831
2832 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSetContextReq,
2833 (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)))
2834 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002835 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002836 return;
2837 }
2838
2839 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2840 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
2841 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002842 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002843 goto end;
2844 }
2845
2846 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2847 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002848 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 -07002849 limSendSmeSetContextRsp(pMac,
2850 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002851 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002852 eSIR_SME_INVALID_PARAMETERS,NULL,
2853 smesessionId,smetransactionId);
2854
2855 goto end;
2856 }
2857
2858
2859 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
2860 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002861 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002862 limSendSmeSetContextRsp(pMac,
2863 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002864 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002865 eSIR_SME_INVALID_PARAMETERS,NULL,
2866 smesessionId,smetransactionId);
2867
2868 goto end;
2869 }
2870
2871#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2872 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
2873#endif //FEATURE_WLAN_DIAG_SUPPORT
2874
2875
2876 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2877 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
2878 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
2879 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
2880 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
2881 {
2882 // Trigger MLM_SETKEYS_REQ
2883 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmSetKeysReq, sizeof(tLimMlmSetKeysReq)))
2884 {
2885 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002886 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002887 goto end;
2888 }
2889
2890 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
2891 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
2892 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2893 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002894 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002895 goto end;
2896 }
2897 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
2898 (tANI_U8 *) &pSetContextReq->peerMacAddr,
2899 sizeof(tSirMacAddr));
2900
Jeff Johnson295189b2012-06-20 16:38:30 -07002901
2902 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmSetKeysReq->key,
2903 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
2904 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
2905
2906 pMlmSetKeysReq->sessionId = sessionId;
2907#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
2908 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002909 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07002910#endif
2911
Jeff Johnson295189b2012-06-20 16:38:30 -07002912 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
2913 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
2914 {
2915 if(pSetContextReq->keyMaterial.key[0].keyLength)
2916 {
2917 tANI_U8 keyId;
2918 keyId = pSetContextReq->keyMaterial.key[0].keyId;
2919 palCopyMemory(pMac, (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
2920 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
2921 }
2922 else {
2923 tANI_U32 i;
2924 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
2925 {
2926 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmSetKeysReq->key[i],
2927 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
2928 }
2929 }
2930 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002931
2932 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002933 }
2934 else
2935 {
2936 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002937 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 psessionEntry->limSystemRole,
2939 psessionEntry->limSmeState);
2940 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2941
2942 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002943 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002944 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
2945 smesessionId,
2946 smetransactionId);
2947 }
2948
2949end:
2950 palFreeMemory( pMac->hHdd, pSetContextReq);
2951 return;
2952} /*** end __limProcessSmeSetContextReq() ***/
2953
2954/**
2955 * __limProcessSmeRemoveKeyReq()
2956 *
2957 *FUNCTION:
2958 * This function is called to process SME_REMOVEKEY_REQ message
2959 * from HDD or upper layer application.
2960 *
2961 *LOGIC:
2962 *
2963 *ASSUMPTIONS:
2964 *
2965 *NOTE:
2966 *
2967 * @param pMac Pointer to Global MAC structure
2968 * @param *pMsgBuf A pointer to the SME message buffer
2969 * @return None
2970 */
2971
2972static void
2973__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2974{
2975 tpSirSmeRemoveKeyReq pRemoveKeyReq;
2976 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
2977 tpPESession psessionEntry;
2978 tANI_U8 sessionId; //PE sessionID
2979 tANI_U8 smesessionId;
2980 tANI_U16 smetransactionId;
2981
2982 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002983 FL("received REMOVEKEY_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002984
2985 if(pMsgBuf == NULL)
2986 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002987 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002988 return;
2989 }
2990
2991
2992 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2993
2994 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRemoveKeyReq,
2995 (sizeof(*pRemoveKeyReq))))
2996 {
2997 //Log error
2998 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002999 FL("call to palAllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003000
3001 return;
3002 }
3003
3004 if ((limRemoveKeyReqSerDes(pMac,
3005 pRemoveKeyReq,
3006 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3007 {
3008 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003009 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003010
3011 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3012
3013 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3014 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003015 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003016 //goto end;
3017 }
3018
3019 limSendSmeRemoveKeyRsp(pMac,
3020 pRemoveKeyReq->peerMacAddr,
3021 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3022 smesessionId,smetransactionId);
3023
3024 goto end;
3025 }
3026
3027 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3028 {
3029 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003030 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003031 limSendSmeRemoveKeyRsp(pMac,
3032 pRemoveKeyReq->peerMacAddr,
3033 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3034 smesessionId, smetransactionId);
3035 goto end;
3036 }
3037
3038
3039 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3040 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3041 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3042 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3043 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3044 {
3045 // Trigger MLM_REMOVEKEYS_REQ
3046 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmRemoveKeyReq, sizeof(tLimMlmRemoveKeyReq)))
3047 {
3048 // Log error
3049 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003050 FL("call to palAllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003051
3052 goto end;
3053 }
3054
3055 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3056 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3057 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3058 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3059
3060 /* Update PE session Id */
3061 pMlmRemoveKeyReq->sessionId = sessionId;
3062
3063 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
3064 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3065 sizeof(tSirMacAddr));
3066
3067
3068 limPostMlmMessage(pMac,
3069 LIM_MLM_REMOVEKEY_REQ,
3070 (tANI_U32 *) pMlmRemoveKeyReq);
3071 }
3072 else
3073 {
3074 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003075 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003076 psessionEntry->limSystemRole,
3077 psessionEntry->limSmeState);
3078 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3079
3080 limSendSmeRemoveKeyRsp(pMac,
3081 pRemoveKeyReq->peerMacAddr,
3082 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3083 smesessionId,smetransactionId);
3084 }
3085
3086end:
3087 palFreeMemory( pMac->hHdd, pRemoveKeyReq);
3088} /*** end __limProcessSmeRemoveKeyReq() ***/
3089
Jeff Johnson295189b2012-06-20 16:38:30 -07003090void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3091{
3092 tSirMsgQ mmhMsg;
3093 tpSmeGetScanChnRsp pSirSmeRsp;
3094 tANI_U16 len = 0;
3095
3096 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3097 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003098 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003099 pMac->lim.scanChnInfo.numChnInfo);
3100 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3101 }
3102
3103 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003104 FL("Sending message %s with number of channels %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003105 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);)
3106
3107 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
3108 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, len ))
3109 {
3110 /// Buffer not available. Log error
3111 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003112 FL("call to palAllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003113
3114 return;
3115 }
3116 palZeroMemory(pMac->hHdd, pSirSmeRsp, len);
3117
Jeff Johnson295189b2012-06-20 16:38:30 -07003118 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3119 pSirSmeRsp->mesgLen = len;
Jeff Johnson295189b2012-06-20 16:38:30 -07003120 pSirSmeRsp->sessionId = 0;
3121
3122 if(pMac->lim.scanChnInfo.numChnInfo)
3123 {
3124 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
3125 palCopyMemory(pMac->hHdd, pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn, sizeof(tLimScanChn) * pSirSmeRsp->numChn);
3126 }
3127 //Clear the list
3128 limRessetScanChannelInfo(pMac);
3129
3130 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3131 mmhMsg.bodyptr = pSirSmeRsp;
3132 mmhMsg.bodyval = 0;
3133
3134 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003135 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003136 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3137}
3138
3139
Jeff Johnson295189b2012-06-20 16:38:30 -07003140void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3141{
3142 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3143 tpDphHashNode pStaDs = NULL;
3144 tpPESession psessionEntry = NULL;
3145 tSap_Event sapEvent;
3146 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3147 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3148 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3149 tANI_U8 assocId = 0;
3150 tANI_U8 staCount = 0;
3151
3152 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3153 {
3154 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003155 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003156 goto limAssocStaEnd;
3157 }
3158
3159 switch (getAssocSTAsReq.modId)
3160 {
3161/**
3162 case VOS_MODULE_ID_HAL:
3163 wdaPostCtrlMsg( pMac, &msgQ );
3164 return;
3165
3166 case VOS_MODULE_ID_TL:
3167 Post msg TL
3168 return;
3169*/
3170 case VOS_MODULE_ID_PE:
3171 default:
3172 break;
3173 }
3174
Jeff Johnson1250df42012-12-10 14:31:52 -08003175 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003176 // Find PE session Entry
3177 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3178 {
3179 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003180 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003181 goto limAssocStaEnd;
3182 }
3183
3184 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3185 {
3186 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003187 FL("Received unexpected message in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003188 psessionEntry->limSmeState , psessionEntry->limSystemRole);
3189 goto limAssocStaEnd;
3190 }
3191
3192 // Retrieve values obtained in the request message
3193 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3194 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3195
3196 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3197 {
3198 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3199
3200 if (NULL == pStaDs)
3201 continue;
3202
3203 if (pStaDs->valid)
3204 {
3205 palCopyMemory(pMac->hHdd, (tANI_U8 *)&pAssocStasTemp->staMac,
3206 (tANI_U8 *)&pStaDs->staAddr,
3207 sizeof(v_MACADDR_t)); // Mac address
3208 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3209 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3210
3211 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
3212 limLog(pMac, LOG1, FL("MAC = %02x:%02x:%02x:%02x:%02x:%02x"),
3213 pStaDs->staAddr[0],
3214 pStaDs->staAddr[1],
3215 pStaDs->staAddr[2],
3216 pStaDs->staAddr[3],
3217 pStaDs->staAddr[4],
3218 pStaDs->staAddr[5]);
3219 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3220 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3221
3222 pAssocStasTemp++;
3223 staCount++;
3224 }
3225 }
3226
3227limAssocStaEnd:
3228 // Call hdd callback with sap event to send the list of associated stations from PE
3229 if (pSapEventCallback != NULL)
3230 {
3231 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3232 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3233 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3234 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3235 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3236 }
3237}
3238
3239
3240/**
3241 * limProcessSmeGetWPSPBCSessions
3242 *
3243 *FUNCTION:
3244 * This function is called when query the WPS PBC overlap message is received
3245 *
3246 *LOGIC:
3247 * This function parses get WPS PBC overlap information message and call callback to pass
3248 * WPS PBC overlap information back to hdd.
3249 *ASSUMPTIONS:
3250 *
3251 *
3252 *NOTE:
3253 *
3254 * @param pMac Pointer to Global MAC structure
3255 * @param pMsgBuf A pointer to WPS PBC overlap query message
3256*
3257 * @return None
3258 */
3259void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3260{
3261 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3262 tpPESession psessionEntry = NULL;
3263 tSap_Event sapEvent;
3264 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3265 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3266 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3267
3268 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3269
3270 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3271 {
3272 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003273 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003274 goto limGetWPSPBCSessionsEnd;
3275 }
3276
Jeff Johnson1250df42012-12-10 14:31:52 -08003277 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003278 // Find PE session Entry
3279 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3280 {
3281 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003282 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003283 goto limGetWPSPBCSessionsEnd;
3284 }
3285
3286 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3287 {
3288 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003289 FL("Received unexpected message in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003290 psessionEntry->limSystemRole);
3291 goto limGetWPSPBCSessionsEnd;
3292 }
3293
Jeff Johnson1250df42012-12-10 14:31:52 -08003294 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003295 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3296 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3297
3298 if (palEqualMemory(pMac->hHdd, zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
3299 { //This is GetWpsSession call
3300
3301 limGetWPSPBCSessions(pMac,
3302 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3303 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3304 }
3305 else
3306 {
3307 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3308 /* don't have to inform the HDD/Host */
3309 return;
3310 }
3311
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003312 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003313 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3314
3315 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3316
3317limGetWPSPBCSessionsEnd:
3318 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
3319 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
3320}
3321
Jeff Johnson295189b2012-06-20 16:38:30 -07003322
3323
3324/**
3325 * __limCounterMeasures()
3326 *
3327 * FUNCTION:
3328 * This function is called to "implement" MIC counter measure
3329 * and is *temporary* only
3330 *
3331 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3332 * we don't do the proper STA disassoc sequence since the
3333 * BSS will be stoped anyway
3334 *
3335 *ASSUMPTIONS:
3336 *
3337 *NOTE:
3338 *
3339 * @param pMac Pointer to Global MAC structure
3340 * @return None
3341 */
3342
3343static void
3344__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3345{
3346 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3347 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
3348 || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
3349
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003350 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003351
Jeff Johnson295189b2012-06-20 16:38:30 -07003352};
3353
3354
Jeff Johnson295189b2012-06-20 16:38:30 -07003355void
3356limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3357{
3358 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3359 tpPESession psessionEntry;
3360 tANI_U8 sessionId; //PE sessionId
3361
3362 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3363 {
3364 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003365 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003366 return;
3367 }
3368
3369 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3370 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003371 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003372 return;
3373 }
3374
3375 if ( tkipCntrMeasReq.bEnable )
3376 {
3377 __limCounterMeasures( pMac, psessionEntry );
3378 }
3379
3380 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3381}
Jeff Johnson295189b2012-06-20 16:38:30 -07003382
3383
3384static void
3385__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3386{
3387 tSirSmeStopBssReq stopBssReq;
3388 tSirRetStatus status;
3389 tLimSmeStates prevState;
3390 tANI_U8 sessionId; //PE sessionId
3391 tpPESession psessionEntry;
3392 tANI_U8 smesessionId;
3393 tANI_U16 smetransactionId;
3394
3395 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3396
3397
3398
3399 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3400 !limIsSmeStopBssReqValid(pMsgBuf))
3401 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003402 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003403 /// Send Stop BSS response to host
3404 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3405 return;
3406 }
3407
3408
3409 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3410 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003411 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003412 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3413 return;
3414 }
3415
3416#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3417 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3418#endif //FEATURE_WLAN_DIAG_SUPPORT
3419
3420
3421 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3422 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3423 {
3424 /**
3425 * Should not have received STOP_BSS_REQ in states
3426 * other than 'normal' state or on STA in Infrastructure
3427 * mode. Log error and return response to host.
3428 */
3429 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003430 FL("received unexpected SME_STOP_BSS_REQ in state %X, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003431 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3432 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3433 /// Send Stop BSS response to host
3434 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3435 return;
3436 }
3437
Jeff Johnson295189b2012-06-20 16:38:30 -07003438 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3439 {
3440 limWPSPBCClose(pMac, psessionEntry);
3441 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003442 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003443
3444 prevState = psessionEntry->limSmeState;
3445
3446 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003447 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003448
3449 /* Update SME session Id and Transaction Id */
3450 psessionEntry->smeSessionId = smesessionId;
3451 psessionEntry->transactionId = smetransactionId;
3452
3453 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame */
3454 if ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) && (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3455 {
3456 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3457 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3458 // Send disassoc all stations associated thru TKIP
3459 __limCounterMeasures(pMac,psessionEntry);
3460 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303461 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003462 }
3463
3464 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3465 pMac->lim.gLimIbssCoalescingHappened = false;
3466
3467 /* send a delBss to HAL and wait for a response */
3468 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3469
3470 if (status != eSIR_SUCCESS)
3471 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003472 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003473 psessionEntry->limSmeState= prevState;
3474
Jeff Johnsone7245742012-09-05 17:12:55 -07003475 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003476
3477 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3478 }
3479}
3480
3481
3482/**--------------------------------------------------------------
3483\fn __limProcessSmeStopBssReq
3484
3485\brief Wrapper for the function __limHandleSmeStopBssRequest
3486 This message will be defered until softmac come out of
3487 scan mode. Message should be handled even if we have
3488 detected radar in the current operating channel.
3489\param pMac
3490\param pMsg
3491
3492\return TRUE - If we consumed the buffer
3493 FALSE - If have defered the message.
3494 ---------------------------------------------------------------*/
3495static tANI_BOOLEAN
3496__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3497{
3498 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3499 {
3500 /**
3501 * If message defered, buffer is not consumed yet.
3502 * So return false
3503 */
3504 return eANI_BOOLEAN_FALSE;
3505 }
3506 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3507 return eANI_BOOLEAN_TRUE;
3508} /*** end __limProcessSmeStopBssReq() ***/
3509
3510
3511void limProcessSmeDelBssRsp(
3512 tpAniSirGlobal pMac,
3513 tANI_U32 body,tpPESession psessionEntry)
3514{
3515
3516 (void) body;
3517 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3518 //TBD: get the sessionEntry
3519 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3520 limDeletePreAuthList(pMac);
3521 limIbssDelete(pMac,psessionEntry);
3522 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3523 return;
3524}
3525
3526
Jeff Johnson295189b2012-06-20 16:38:30 -07003527/**---------------------------------------------------------------
3528\fn __limProcessSmeAssocCnfNew
3529\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3530\ in BTAMP AP.
3531\
3532\param pMac
3533\param msgType - message type
3534\param pMsgBuf - a pointer to the SME message buffer
3535\return None
3536------------------------------------------------------------------*/
3537
3538 void
3539__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3540{
3541 tSirSmeAssocCnf assocCnf;
3542 tpDphHashNode pStaDs = NULL;
3543 tpPESession psessionEntry= NULL;
3544 tANI_U8 sessionId;
3545
3546
3547 if(pMsgBuf == NULL)
3548 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003549 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003550 goto end;
3551 }
3552
3553 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3554 !__limIsSmeAssocCnfValid(&assocCnf))
3555 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003556 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003557 goto end;
3558 }
3559
3560 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3561 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003562 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003563 goto end;
3564 }
3565
3566 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3567 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3568 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003569 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003570 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
3571 goto end;
3572 }
3573
3574 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3575
3576 if (pStaDs == NULL)
3577 {
3578 limLog(pMac, LOG1,
3579 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
3580 msgType, assocCnf.aid);
3581 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3582
3583 /*
3584 ** send a DISASSOC_IND message to WSM to make sure
3585 ** the state in WSM and LIM is the same
3586 **/
3587 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3588 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3589 goto end;
3590 }
3591 if ((pStaDs &&
3592 (( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pStaDs->staAddr,
3593 (tANI_U8 *) assocCnf.peerMacAddr,
3594 sizeof(tSirMacAddr)) ) ||
3595 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3596 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3597 (msgType != eWNI_SME_ASSOC_CNF)) ||
3598 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003599 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003600 {
3601 limLog(pMac, LOG1,
3602 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
3603 msgType, assocCnf.aid);
3604 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3605 goto end;
3606 }
3607
3608 /*
3609 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3610 ** has been received
3611 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003612 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003613 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3614
3615 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3616 {
3617 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3618 * when it had received Assoc Request frame. Now, PE just needs to send
3619 * Association Response frame to the requesting BTAMP-STA.
3620 */
3621 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003622 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003623 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3624 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3625 goto end;
3626 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3627 else
3628 {
3629 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3630 /*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*/
3631 if(!pStaDs->mlmStaContext.updateContext)
3632 pStaDs->mlmStaContext.updateContext = 1;
3633 limRejectAssociation(pMac, pStaDs->staAddr,
3634 pStaDs->mlmStaContext.subType,
3635 true, pStaDs->mlmStaContext.authType,
3636 pStaDs->assocId, true,
3637 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
3638 return;
3639 }
3640
3641end:
3642 if((psessionEntry != NULL) && (pStaDs != NULL))
3643 {
3644 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3645 {
3646 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3647 {
3648 palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
3649 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
3650 }
3651
3652 palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]);
3653 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
3654 }
3655 }
3656
3657} /*** end __limProcessSmeAssocCnfNew() ***/
3658
3659
Jeff Johnson295189b2012-06-20 16:38:30 -07003660
3661
3662static void
3663__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3664{
3665 tpDphHashNode pStaDs;
3666 tSirMacAddr peerMac;
3667 tpSirAddtsReq pSirAddts;
3668 tANI_U32 timeout;
3669 tpPESession psessionEntry;
3670 tANI_U8 sessionId; //PE sessionId
3671 tANI_U8 smesessionId;
3672 tANI_U16 smetransactionId;
3673
3674
3675 if(pMsgBuf == NULL)
3676 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003677 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003678 return;
3679 }
3680
3681 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3682
3683 pSirAddts = (tpSirAddtsReq) pMsgBuf;
3684
3685 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
3686 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003687 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 return;
3689 }
3690#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3691 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
3692#endif //FEATURE_WLAN_DIAG_SUPPORT
3693
3694
3695
3696 /* if sta
3697 * - verify assoc state
3698 * - send addts request to ap
3699 * - wait for addts response from ap
3700 * if ap, just ignore with error log
3701 */
3702 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003703 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003704 pSirAddts->req.tspec.tsinfo.traffic.tsid,
3705 pSirAddts->req.tspec.tsinfo.traffic.userPrio);)
3706
3707 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
3708 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003709 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003710 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3711 smesessionId,smetransactionId);
3712 return;
3713 }
3714
3715 //Ignore the request if STA is in 11B mode.
3716 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
3717 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003718 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003719 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3720 smesessionId,smetransactionId);
3721 return;
3722 }
3723
3724
3725 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3726
3727 if(pStaDs == NULL)
3728 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003729 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003730 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3731 smesessionId,smetransactionId);
3732 return;
3733 }
3734
3735 if ((! pStaDs->valid) ||
3736 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
3737 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003738 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003739 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3740 smesessionId,smetransactionId);
3741 return;
3742 }
3743
3744 pSirAddts->req.wsmTspecPresent = 0;
3745 pSirAddts->req.wmeTspecPresent = 0;
3746 pSirAddts->req.lleTspecPresent = 0;
3747
3748 if ((pStaDs->wsmEnabled) &&
3749 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
3750 pSirAddts->req.wsmTspecPresent = 1;
3751 else if (pStaDs->wmeEnabled)
3752 pSirAddts->req.wmeTspecPresent = 1;
3753 else if (pStaDs->lleEnabled)
3754 pSirAddts->req.lleTspecPresent = 1;
3755 else
3756 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003757 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003758 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3759 smesessionId,smetransactionId);
3760 return;
3761 }
3762
3763 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
3764 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
3765 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003766 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07003767 psessionEntry->limSmeState);
3768 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3769 smesessionId,smetransactionId);
3770 return;
3771 }
3772
3773 if (pMac->lim.gLimAddtsSent)
3774 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003775 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07003776 pMac->lim.gLimAddtsReq.req.dialogToken,
3777 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
3778 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
3779 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3780 smesessionId,smetransactionId);
3781 return;
3782 }
3783
3784 #if 0
3785 val = sizeof(tSirMacAddr);
3786 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
3787 {
3788 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003789 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003790 return;
3791 }
3792 #endif
3793 sirCopyMacAddr(peerMac,psessionEntry->bssId);
3794
3795 // save the addts request
3796 pMac->lim.gLimAddtsSent = true;
3797 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
3798
3799 // ship out the message now
3800 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
3801 psessionEntry);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003802 PELOG1(limLog(pMac, LOG1, "Sent ADDTS request");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003803
3804 // start a timer to wait for the response
3805 if (pSirAddts->timeout)
3806 timeout = pSirAddts->timeout;
3807 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
3808 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003809 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003810 WNI_CFG_ADDTS_RSP_TIMEOUT);
3811 return;
3812 }
3813
3814 timeout = SYS_MS_TO_TICKS(timeout);
3815 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
3816 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003817 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003818 return;
3819 }
3820 pMac->lim.gLimAddtsRspTimerCount++;
3821 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
3822 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
3823 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003824 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003825 return;
3826 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003827 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003828
3829 //add the sessionId to the timer object
3830 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
3831 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
3832 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003833 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003834 return;
3835 }
3836 return;
3837}
3838
3839
3840static void
3841__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3842{
3843 tSirMacAddr peerMacAddr;
3844 tANI_U8 ac;
3845 tSirMacTSInfo *pTsinfo;
3846 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
3847 tpDphHashNode pStaDs = NULL;
3848 tpPESession psessionEntry;
3849 tANI_U8 sessionId;
3850 tANI_U32 status = eSIR_SUCCESS;
3851 tANI_U8 smesessionId;
3852 tANI_U16 smetransactionId;
3853
3854 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3855
3856 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
3857 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003858 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003859 status = eSIR_FAILURE;
3860 goto end;
3861 }
3862#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3863 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
3864#endif //FEATURE_WLAN_DIAG_SUPPORT
3865
3866
3867 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
3868 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003869 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003870 status = eSIR_FAILURE;
3871 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
3872 return;
3873 }
3874
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003875 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 -07003876 pDeltsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
3877 peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);)
3878
3879 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
3880 psessionEntry);
3881
3882 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
3883
3884 /* We've successfully send DELTS frame to AP. Update the
3885 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
3886 * is no longer trigger enabled or delivery enabled
3887 */
3888 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
3889
3890 /* We're deleting the TSPEC, so this particular AC is no longer
3891 * admitted. PE needs to downgrade the EDCA
3892 * parameters(for the AC for which TS is being deleted) to the
3893 * next best AC for which ACM is not enabled, and send the
3894 * updated values to HAL.
3895 */
3896 ac = upToAc(pTsinfo->traffic.userPrio);
3897
3898 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
3899 {
3900 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
3901 }
3902 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
3903 {
3904 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
3905 }
3906 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
3907 {
3908 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
3909 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
3910 }
3911
3912 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3913
3914 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3915 if (pStaDs != NULL)
3916 {
3917 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
3918 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3919 else
3920 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3921 status = eSIR_SUCCESS;
3922 }
3923 else
3924 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003925 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003926 status = eSIR_FAILURE;
3927 }
3928#ifdef FEATURE_WLAN_CCX
3929 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
3930#endif
3931
3932 // send an sme response back
3933 end:
3934 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
3935}
3936
3937
3938void
3939limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
3940{
3941 //fetch the sessionEntry based on the sessionId
3942 tpPESession psessionEntry;
3943 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
3944 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003945 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003946 return;
3947 }
3948
3949 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
3950 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003951 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003952 pMac->lim.gLimAddtsSent = false;
3953 return;
3954 }
3955
3956 if (! pMac->lim.gLimAddtsSent)
3957 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003958 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003959 return;
3960 }
3961
3962 if (param != pMac->lim.gLimAddtsRspTimerCount)
3963 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003964 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003965 param, pMac->lim.gLimAddtsRspTimerCount);
3966 return;
3967 }
3968
3969 // this a real response timeout
3970 pMac->lim.gLimAddtsSent = false;
3971 pMac->lim.gLimAddtsRspTimerCount++;
3972
3973 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
3974 psessionEntry->smeSessionId, psessionEntry->transactionId);
3975}
3976
3977
3978/**
3979 * __limProcessSmeStatsRequest()
3980 *
3981 *FUNCTION:
3982 *
3983 *
3984 *NOTE:
3985 *
3986 * @param pMac Pointer to Global MAC structure
3987 * @param *pMsgBuf A pointer to the SME message buffer
3988 * @return None
3989 */
3990static void
3991__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3992{
3993 tpAniGetStatsReq pStatsReq;
3994 tSirMsgQ msgQ;
3995 tpPESession psessionEntry;
3996 tANI_U8 sessionId;
3997
3998
3999 if(pMsgBuf == NULL)
4000 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004001 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004002 return;
4003 }
4004
4005 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4006
4007 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4008 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004009 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnsone7245742012-09-05 17:12:55 -07004010 palFreeMemory( pMac, pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004011 return;
4012 }
4013
4014
4015
4016 switch(pStatsReq->msgType)
4017 {
4018 //Add Lim stats here. and send reqsponse.
4019
4020 //HAL maintained Stats.
4021 case eWNI_SME_STA_STAT_REQ:
4022 msgQ.type = WDA_STA_STAT_REQ;
4023 break;
4024 case eWNI_SME_AGGR_STAT_REQ:
4025 msgQ.type = WDA_AGGR_STAT_REQ;
4026 break;
4027 case eWNI_SME_GLOBAL_STAT_REQ:
4028 msgQ.type = WDA_GLOBAL_STAT_REQ;
4029 break;
4030 case eWNI_SME_STAT_SUMM_REQ:
4031 msgQ.type = WDA_STAT_SUMM_REQ;
4032 break;
4033 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004034 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004035 palFreeMemory( pMac, pMsgBuf );
4036 return;
4037 }
4038
4039 if ( !pMac->lim.gLimRspReqd )
4040 {
4041 palFreeMemory( pMac, pMsgBuf );
4042 return;
4043 }
4044 else
4045 {
4046 pMac->lim.gLimRspReqd = FALSE;
4047 }
4048
4049 msgQ.reserved = 0;
4050 msgQ.bodyptr = pMsgBuf;
4051 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004052 if(NULL == psessionEntry)
4053 {
4054 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4055 }
4056 else
4057 {
4058 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4059 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004060 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004061 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnsone7245742012-09-05 17:12:55 -07004062 palFreeMemory( pMac, pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004063 return;
4064 }
4065
4066 return;
4067}
4068
4069
4070/**
4071 * __limProcessSmeGetStatisticsRequest()
4072 *
4073 *FUNCTION:
4074 *
4075 *
4076 *NOTE:
4077 *
4078 * @param pMac Pointer to Global MAC structure
4079 * @param *pMsgBuf A pointer to the SME message buffer
4080 * @return None
4081 */
4082static void
4083__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4084{
4085 tpAniGetPEStatsReq pPEStatsReq;
4086 tSirMsgQ msgQ;
4087
4088 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4089
4090 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4091
4092 msgQ.type = WDA_GET_STATISTICS_REQ;
4093
4094 if ( !pMac->lim.gLimRspReqd )
4095 {
4096 palFreeMemory( pMac, pMsgBuf );
4097 return;
4098 }
4099 else
4100 {
4101 pMac->lim.gLimRspReqd = FALSE;
4102 }
4103
4104 msgQ.reserved = 0;
4105 msgQ.bodyptr = pMsgBuf;
4106 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004107 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004108
4109 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4110 palFreeMemory( pMac, pMsgBuf );
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004111 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004112 return;
4113 }
4114
4115 return;
4116}
4117
4118
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004119#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
4120/**
4121 * __limProcessSmeGetRoamRssiRequest()
4122 *
4123 *FUNCTION:
4124 *
4125 *
4126 *NOTE:
4127 *
4128 * @param pMac Pointer to Global MAC structure
4129 * @param *pMsgBuf A pointer to the SME message buffer
4130 * @return None
4131 */
4132static void
4133__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4134{
4135 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4136 tSirMsgQ msgQ;
4137
4138 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4139 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4140
4141 if ( !pMac->lim.gLimRspReqd )
4142 {
4143 palFreeMemory( pMac, pMsgBuf );
4144 return;
4145 }
4146 else
4147 {
4148 pMac->lim.gLimRspReqd = FALSE;
4149 }
4150
4151 msgQ.reserved = 0;
4152 msgQ.bodyptr = pMsgBuf;
4153 msgQ.bodyval = 0;
4154 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4155
4156 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4157 palFreeMemory( pMac, pMsgBuf );
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004158 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004159 return;
4160 }
4161
4162 return;
4163}
4164#endif
4165
4166
Jeff Johnson295189b2012-06-20 16:38:30 -07004167static void
4168__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4169{
4170 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4171 tpPESession psessionEntry;
4172 tANI_U8 sessionId; //PE sessionID
4173
4174 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004175 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004176
4177 if(pMsgBuf == NULL)
4178 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004179 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004180 return;
4181 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004182
Jeff Johnson295189b2012-06-20 16:38:30 -07004183 if( palAllocateMemory( pMac->hHdd, (void **)&pUpdateAPWPSIEsReq, sizeof(tSirUpdateAPWPSIEsReq)))
4184 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004185 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004186 return;
4187 }
4188
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004189 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004190 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004191 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004192 goto end;
4193 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004194
Jeff Johnson295189b2012-06-20 16:38:30 -07004195 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4196 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004197 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004198 goto end;
4199 }
4200
4201 palCopyMemory(pMac->hHdd, &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004202
Jeff Johnson295189b2012-06-20 16:38:30 -07004203 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004204 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004205
4206end:
4207 palFreeMemory( pMac->hHdd, pUpdateAPWPSIEsReq);
4208 return;
4209} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4210
4211static void
4212__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4213{
4214 tpSirUpdateParams pUpdateParams;
4215 tpPESession psessionEntry;
4216
4217 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004218 FL("received HIDE_SSID message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004219
4220 if(pMsgBuf == NULL)
4221 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004222 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004223 return;
4224 }
4225
4226 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4227
4228 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4229 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004230 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004231 pUpdateParams->sessionId);
4232 return;
4233 }
4234
4235 /* Update the session entry */
4236 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4237
4238 /* Update beacon */
4239 schSetFixedBeaconFields(pMac, psessionEntry);
4240 limSendBeaconInd(pMac, psessionEntry);
4241
4242 return;
4243} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4244
4245static void
4246__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4247{
4248 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4249 tpPESession psessionEntry;
4250 tANI_U8 sessionId; //PE sessionID
4251
4252 if(pMsgBuf == NULL)
4253 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004254 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004255 return;
4256 }
4257
4258 if( palAllocateMemory( pMac->hHdd, (void **)&pUpdateAPWPARSNIEsReq, sizeof(tSirUpdateAPWPSIEsReq)))
4259 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004260 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004261 return;
4262 }
4263
4264 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4265 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004266 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004267 goto end;
4268 }
4269
4270 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4271 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004272 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004273 goto end;
4274 }
4275
4276 palCopyMemory(pMac->hHdd, &psessionEntry->pLimStartBssReq->rsnIE, &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
4277
4278 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4279
4280 psessionEntry->pLimStartBssReq->privacy = 1;
4281 psessionEntry->privacy = 1;
4282
4283 schSetFixedBeaconFields(pMac, psessionEntry);
4284 limSendBeaconInd(pMac, psessionEntry);
4285
4286end:
4287 palFreeMemory( pMac->hHdd, pUpdateAPWPARSNIEsReq);
4288 return;
4289} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4290
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004291/*
4292Update the beacon Interval dynamically if beaconInterval is different in MCC
4293*/
4294static void
4295__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4296{
4297 tpSirChangeBIParams pChangeBIParams;
4298 tpPESession psessionEntry;
4299 tANI_U8 sessionId = 0;
4300 tUpdateBeaconParams beaconParams;
4301
4302 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004303 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004304
4305 if(pMsgBuf == NULL)
4306 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004307 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004308 return;
4309 }
4310
4311 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4312
4313 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4314 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004315 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004316 return;
4317 }
4318
4319 /*Update sessionEntry Beacon Interval*/
4320 if(psessionEntry->beaconParams.beaconInterval !=
4321 pChangeBIParams->beaconInterval )
4322 {
4323 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4324 }
4325
4326 /*Update sch beaconInterval*/
4327 if(pMac->sch.schObject.gSchBeaconInterval !=
4328 pChangeBIParams->beaconInterval )
4329 {
4330 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4331
4332 PELOG1(limLog(pMac, LOG1,
4333 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4334
4335 /* Update beacon */
4336 schSetFixedBeaconFields(pMac, psessionEntry);
4337
Sunil Ravib96f7b52013-05-22 21:40:05 -07004338 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004339 //Set change in beacon Interval
4340 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004341 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004342 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4343 }
4344
4345 return;
4346} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4347
Jeff Johnson295189b2012-06-20 16:38:30 -07004348
4349
4350/** -------------------------------------------------------------
4351\fn limProcessSmeDelBaPeerInd
4352\brief handles indication message from HDD to send delete BA request
4353\param tpAniSirGlobal pMac
4354\param tANI_U32 pMsgBuf
4355\return None
4356-------------------------------------------------------------*/
4357void
4358limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4359{
4360 tANI_U16 assocId =0;
4361 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4362 tpDphHashNode pSta;
4363 tpPESession psessionEntry;
4364 tANI_U8 sessionId;
4365
4366
4367
4368 if(NULL == pSmeDelBAPeerInd)
4369 return;
4370
4371 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4372 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004373 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004374 return;
4375 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004376 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004377 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4378
4379 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4380 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4381 pSta,
4382 pSmeDelBAPeerInd->baDirection,
4383 pSmeDelBAPeerInd->baTID,
4384 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4385 {
4386 limLog( pMac, LOGW,
4387 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4388 if (pSta)
4389 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4390 }
4391}
4392
4393// --------------------------------------------------------------------
4394/**
4395 * __limProcessReportMessage
4396 *
4397 * FUNCTION: Processes the next received Radio Resource Management message
4398 *
4399 * LOGIC:
4400 *
4401 * ASSUMPTIONS:
4402 *
4403 * NOTE:
4404 *
4405 * @param None
4406 * @return None
4407 */
4408
4409void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4410{
4411#ifdef WLAN_FEATURE_VOWIFI
4412 switch (pMsg->type)
4413 {
4414 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4415 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4416 break;
4417 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4418 {
4419#if defined FEATURE_WLAN_CCX
4420 tpSirBeaconReportXmitInd pBcnReport=NULL;
4421 tpPESession psessionEntry=NULL;
4422 tANI_U8 sessionId;
4423
4424 if(pMsg->bodyptr == NULL)
4425 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004426 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004427 return;
4428 }
4429 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4430 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4431 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004432 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004433 return;
4434 }
4435 if (psessionEntry->isCCXconnection)
4436 ccxProcessBeaconReportXmit( pMac, pMsg->bodyptr);
4437 else
4438#endif
4439 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4440 }
4441 break;
4442 }
4443#endif
4444}
4445
4446#if defined(FEATURE_WLAN_CCX) || defined(WLAN_FEATURE_VOWIFI)
4447// --------------------------------------------------------------------
4448/**
4449 * limSendSetMaxTxPowerReq
4450 *
4451 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4452 *
4453 * LOGIC:
4454 *
4455 * ASSUMPTIONS:
4456 *
4457 * NOTE:
4458 *
4459 * @param txPower txPower to be set.
4460 * @param pSessionEntry session entry.
4461 * @return None
4462 */
4463tSirRetStatus
4464limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4465{
4466 tpMaxTxPowerParams pMaxTxParams = NULL;
4467 tSirRetStatus retCode = eSIR_SUCCESS;
4468 tSirMsgQ msgQ;
4469
4470 if( pSessionEntry == NULL )
4471 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004472 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004473 return eSIR_FAILURE;
4474 }
4475 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
4476 (void **) &pMaxTxParams, sizeof(tMaxTxPowerParams) ) )
4477 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004478 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004479 return eSIR_MEM_ALLOC_FAILED;
4480
4481 }
4482#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_CCX)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004483 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 -07004484#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004485 if( pMaxTxParams == NULL )
4486 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004487 limLog( pMac, LOGE, "%s:%d: pMaxTxParams is NULL", __func__, __LINE__);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004488 return eSIR_FAILURE;
4489 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004490 pMaxTxParams->power = txPower;
4491 palCopyMemory( pMac->hHdd, pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4492 palCopyMemory( pMac->hHdd, pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
4493
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004494 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4495 msgQ.bodyptr = pMaxTxParams;
4496 msgQ.bodyval = 0;
4497 PELOG1(limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));)
4498 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
4499 retCode = wdaPostCtrlMsg(pMac, &msgQ);
4500 if (eSIR_SUCCESS != retCode)
4501 {
4502 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
4503 palFreeMemory(pMac->hHdd, pMaxTxParams);
4504 }
4505 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004506}
4507#endif
4508
4509/**
4510 * __limProcessSmeAddStaSelfReq()
4511 *
4512 *FUNCTION:
4513 * This function is called to process SME_ADD_STA_SELF_REQ message
4514 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4515 *
4516 *LOGIC:
4517 *
4518 *ASSUMPTIONS:
4519 *
4520 *NOTE:
4521 *
4522 * @param pMac Pointer to Global MAC structure
4523 * @param *pMsgBuf A pointer to the SME message buffer
4524 * @return None
4525 */
4526
4527static void
4528__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4529{
4530 tSirMsgQ msg;
4531 tpAddStaSelfParams pAddStaSelfParams;
4532 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
4533
4534 if ( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void**) &pAddStaSelfParams,
4535 sizeof( tAddStaSelfParams) ) )
4536 {
4537 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
4538 return;
4539 }
4540
4541 palCopyMemory( pMac->hHdd, pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokere0ad5cd32013-06-25 11:26:22 -07004542 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004543 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
4544 msg.reserved = 0;
4545 msg.bodyptr = pAddStaSelfParams;
4546 msg.bodyval = 0;
4547
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004548 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004549 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004550
4551 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4552 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004553 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004554 }
4555 return;
4556} /*** end __limProcessAddStaSelfReq() ***/
4557
4558
4559/**
4560 * __limProcessSmeDelStaSelfReq()
4561 *
4562 *FUNCTION:
4563 * This function is called to process SME_DEL_STA_SELF_REQ message
4564 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
4565 *
4566 *LOGIC:
4567 *
4568 *ASSUMPTIONS:
4569 *
4570 *NOTE:
4571 *
4572 * @param pMac Pointer to Global MAC structure
4573 * @param *pMsgBuf A pointer to the SME message buffer
4574 * @return None
4575 */
4576
4577static void
4578__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4579{
4580 tSirMsgQ msg;
4581 tpDelStaSelfParams pDelStaSelfParams;
4582 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
4583
4584 if ( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void**) &pDelStaSelfParams,
4585 sizeof( tDelStaSelfParams) ) )
4586 {
4587 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
4588 return;
4589 }
4590
4591 palCopyMemory( pMac->hHdd, pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
4592
4593 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
4594 msg.reserved = 0;
4595 msg.bodyptr = pDelStaSelfParams;
4596 msg.bodyval = 0;
4597
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004598 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004599 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004600
4601 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4602 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004603 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004604 }
4605 return;
4606} /*** end __limProcessSmeDelStaSelfReq() ***/
4607
4608
Jeff Johnson295189b2012-06-20 16:38:30 -07004609/**
4610 * __limProcessSmeRegisterMgmtFrameReq()
4611 *
4612 *FUNCTION:
4613 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
4614 * from SME. It Register this information within PE.
4615 *
4616 *LOGIC:
4617 *
4618 *ASSUMPTIONS:
4619 *
4620 *NOTE:
4621 *
4622 * @param pMac Pointer to Global MAC structure
4623 * @param *pMsgBuf A pointer to the SME message buffer
4624 * @return None
4625 */
4626static void
4627__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4628{
4629 VOS_STATUS vosStatus;
4630 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
4631 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004632 tANI_BOOLEAN match = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004633 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004634 FL("registerFrame %d, frameType %d, matchLen %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07004635 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004636
Jeff Johnsond13512a2012-07-17 11:42:19 -07004637 /* First check whether entry exists already*/
4638
4639 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4640 (vos_list_node_t**)&pLimMgmtRegistration);
4641
4642 while(pLimMgmtRegistration != NULL)
4643 {
4644 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
4645 {
4646 if(pSmeReq->matchLen)
4647 {
4648 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
4649 {
4650 if (palEqualMemory(pMac, pLimMgmtRegistration->matchData,
4651 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
4652 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004653 /* found match! */
4654 match = VOS_TRUE;
4655 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004656 }
4657 }
4658 }
4659 else
4660 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004661 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07004662 match = VOS_TRUE;
4663 break;
4664 }
4665 }
4666 vosStatus = vos_list_peek_next (
4667 &pMac->lim.gLimMgmtFrameRegistratinQueue,
4668 (vos_list_node_t*) pLimMgmtRegistration,
4669 (vos_list_node_t**) &pNext );
4670
4671 pLimMgmtRegistration = pNext;
4672 pNext = NULL;
4673
4674 }
4675
4676 if (match)
4677 {
4678 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4679 (vos_list_node_t*)pLimMgmtRegistration);
4680 palFreeMemory(pMac,pLimMgmtRegistration);
4681 }
4682
Jeff Johnson295189b2012-06-20 16:38:30 -07004683 if(pSmeReq->registerFrame)
4684 {
4685 palAllocateMemory(pMac, (void**)&pLimMgmtRegistration,
4686 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
4687 if(pLimMgmtRegistration != NULL)
4688 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004689 palZeroMemory(pMac, (void*)pLimMgmtRegistration,
Jeff Johnson295189b2012-06-20 16:38:30 -07004690 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen );
4691 pLimMgmtRegistration->frameType = pSmeReq->frameType;
4692 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
4693 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
4694 if(pSmeReq->matchLen)
4695 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004696 palCopyMemory(pMac,pLimMgmtRegistration->matchData,
Jeff Johnson295189b2012-06-20 16:38:30 -07004697 pSmeReq->matchData, pSmeReq->matchLen);
4698 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004699 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4700 &pLimMgmtRegistration->node);
4701 }
4702 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004703
4704 return;
4705} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08004706
4707static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08004708__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08004709{
4710 tpP2pPsParams pMsgNoA;
4711 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08004712
Viral Modid86bde22012-12-10 13:09:21 -08004713 if( eHAL_STATUS_SUCCESS != palAllocateMemory(
4714 pMac->hHdd, (void **) &pMsgNoA, sizeof( tP2pPsConfig )))
4715 {
4716 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004717 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08004718 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004719 }
4720
4721 palZeroMemory( pMac->hHdd, (tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig));
4722 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
4723 pMsgNoA->opp_ps = 0;
4724 pMsgNoA->ctWindow = 0;
4725 pMsgNoA->duration = 0;
4726 pMsgNoA->interval = 0;
4727 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08004728
Vinay Malekal62757362012-12-17 12:15:51 -08004729 /* Below params used for Single Shot NOA - so assign proper values */
4730 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08004731 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08004732
Viral Modid86bde22012-12-10 13:09:21 -08004733 /* Start Insert NOA timer
4734 * 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 -08004735 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
4736 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08004737 */
4738 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
4739 == TX_TIMER_ERROR)
4740 {
4741 /// Could not activate Insert NOA timer.
4742 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004743 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08004744
4745 // send the scan response back with status failure and do not even call insert NOA
4746 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Jeff Johnson04f6c402013-04-05 08:43:48 -07004747 palFreeMemory( pMac->hHdd, pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08004748 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004749 }
4750
Viral Modid440e682013-03-06 02:25:31 -08004751 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
4752
Viral Modid86bde22012-12-10 13:09:21 -08004753 msg.type = WDA_SET_P2P_GO_NOA_REQ;
4754 msg.reserved = 0;
4755 msg.bodyptr = pMsgNoA;
4756 msg.bodyval = 0;
4757
4758 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4759 {
4760 /* 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 -07004761 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08004762 /* Deactivate the NOA timer in failure case */
4763 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
4764 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004765 }
Viral Modid440e682013-03-06 02:25:31 -08004766 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08004767
Viral Modid440e682013-03-06 02:25:31 -08004768error:
4769 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
4770 * worrying about the NOA
4771 */
4772 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
4773 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08004774 return FALSE;
4775
4776}
4777
Viral Modid440e682013-03-06 02:25:31 -08004778static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4779{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004780 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08004781 pMac->lim.gDeferMsgTypeForNOA = msgType;
4782 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
4783}
4784
4785static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4786{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004787 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08004788 pMac->lim.gDeferMsgTypeForNOA = 0;
4789 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
4790 {
4791 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
4792 palFreeMemory( pMac->hHdd, (tANI_U32 *) pMac->lim.gpDefdSmeMsgForNOA);
4793 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4794 }
4795}
4796
4797static
4798tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4799{
4800 tANI_U32 noaDuration = 0;
4801
4802 switch (msgType)
4803 {
4804 case eWNI_SME_SCAN_REQ:
4805 {
4806 tANI_U32 val;
4807 tANI_U8 i;
4808 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
4809 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
4810 {
4811 /*
4812 * Could not get max channel value
4813 * from CFG. Log error.
4814 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004815 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08004816
4817 /* use a default value of 110ms */
4818 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
4819 }
4820
4821 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
4822 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
4823
4824 if (limActiveScanAllowed(pMac, channelNum)) {
4825 /* Use min + max channel time to calculate the total duration of scan */
4826 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
4827 } else {
4828 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
4829 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
4830 */
4831 noaDuration += val;
4832 }
4833 }
4834
4835 /* Adding an overhead of 20ms to account for the scan messaging delays */
4836 noaDuration += SCAN_MESSAGING_OVERHEAD;
4837 noaDuration *= CONV_MS_TO_US;
4838
4839 break;
4840 }
4841
4842 case eWNI_SME_OEM_DATA_REQ:
4843 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
4844 break;
4845
4846 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
4847 {
4848 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
4849 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
4850 break;
4851 }
4852
4853 case eWNI_SME_JOIN_REQ:
4854 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
4855 break;
4856
4857 default:
4858 noaDuration = 0;
4859 break;
4860
4861 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004862 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08004863 return noaDuration;
4864}
4865
4866void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4867{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05304868 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08004869
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004870 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004871 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
4872 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
4873 {
4874 switch (pMac->lim.gDeferMsgTypeForNOA)
4875 {
4876 case eWNI_SME_SCAN_REQ:
4877 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4878 break;
4879 case eWNI_SME_OEM_DATA_REQ:
4880 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4881 break;
4882 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05304883 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4884 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
4885 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
4886 */
4887 if (FALSE == bufConsumed)
4888 {
4889 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4890 }
Viral Modid440e682013-03-06 02:25:31 -08004891 break;
4892 case eWNI_SME_JOIN_REQ:
4893 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4894 break;
4895 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004896 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004897 break;
4898 }
4899 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
4900 }
4901 else
4902 {
4903 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004904 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08004905 }
4906}
Jeff Johnson295189b2012-06-20 16:38:30 -07004907
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004908#ifdef FEATURE_WLAN_TDLS_INTERNAL
4909/*
4910 * Process Discovery request recieved from SME and transmit to AP.
4911 */
4912static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
4913 tANI_U32 *pMsgBuf)
4914{
4915 /* get all discovery request parameters */
4916 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
4917 tpPESession psessionEntry;
4918 tANI_U8 sessionId;
4919
4920 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004921 ("Discovery Req Recieved")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004922
4923 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
4924 == NULL)
4925 {
4926 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004927 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004928 disReq->sessionId);
4929 goto lim_tdls_dis_start_error;
4930 }
4931
4932 /* check if we are in proper state to work as TDLS client */
4933 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
4934 {
4935 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004936 "dis req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004937 psessionEntry->limSystemRole);
4938 goto lim_tdls_dis_start_error;
4939 }
4940
4941 /*
4942 * if we are still good, go ahead and check if we are in proper state to
4943 * do TDLS discovery procedure.
4944 */
4945 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4946 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4947 {
4948
4949 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004950 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004951 goto lim_tdls_dis_start_error;
4952 }
4953
4954 /*
4955 * if we are still good, go ahead and transmit TDLS discovery request,
4956 * and save Dis Req info for future reference.
4957 */
4958
4959#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
4960 /*
4961 * send message to HAL to set RXP filters to receieve frame on
4962 * direct link..
4963 */
4964 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
4965 // psessionEntry->bssId) ;
4966#endif
4967
4968 /* save dis request message for matching dialog token */
4969 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
4970 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
4971
4972 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004973 "Transmit Discovery Request Frame") ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004974 /* format TDLS discovery request frame and transmit it */
4975 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
4976 psessionEntry) ;
4977
4978 /* prepare for response */
4979 pMac->lim.gLimTdlsDisStaCount = 0 ;
4980 pMac->lim.gLimTdlsDisResultList = NULL ;
4981
4982 /*
4983 * start TDLS discovery request timer to wait for discovery responses
4984 * from all TDLS enabled clients in BSS.
4985 */
4986
4987 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004988 ("Start Discovery request Timeout Timer")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004989 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
4990 eLIM_TDLS_DISCOVERY_RSP_WAIT));
4991
4992 /* assign appropriate sessionId to the timer object */
4993 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
4994 psessionEntry->peSessionId;
4995
4996 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
4997 != TX_SUCCESS)
4998 {
4999 limLog(pMac, LOGP, FL("TDLS discovery response timer \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005000 activation failed!"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005001 goto lim_tdls_dis_start_error;
5002 }
5003 /*
5004 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
5005 * back to SME
5006 */
5007 return (eSIR_SUCCESS) ;
5008lim_tdls_dis_start_error:
5009 /* in error case, PE has to sent the response SME immediately with error code */
5010 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
5011 eWNI_SME_TDLS_DISCOVERY_START_RSP);
5012 return eSIR_FAILURE;
5013}
5014/*
5015 * Process link start request recieved from SME and transmit to AP.
5016 */
5017eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5018{
5019 /* get all discovery request parameters */
5020 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
5021 tLimTdlsLinkSetupInfo *linkSetupInfo;
5022 //tLimTdlsLinkSetupPeer *setupPeer;
5023 tpPESession psessionEntry;
5024 tANI_U8 sessionId;
5025 eHalStatus status;
5026
5027 if((psessionEntry = peFindSessionByBssid(pMac,
5028 setupReq->bssid, &sessionId)) == NULL)
5029 {
5030 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005031 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005032 setupReq->sessionId);
5033 goto lim_tdls_link_start_error;
5034 }
5035
5036 /* check if we are in proper state to work as TDLS client */
5037 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5038 {
5039 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005040 "TDLS link setup req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005041 psessionEntry->limSystemRole);
5042 goto lim_tdls_link_start_error;
5043 }
5044
5045 /*
5046 * if we are still good, go ahead and check if we are in proper state to
5047 * do TDLS setup procedure.
5048 */
5049 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5050 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5051 {
5052 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005053 state (%d)", pMac->lim.gLimSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005054 goto lim_tdls_link_start_error;
5055 }
5056
5057 /*
5058 * Now, go ahead and transmit TDLS discovery request, and save setup Req
5059 * info for future reference.
5060 */
5061 /* create node for Link setup */
5062 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
5063 //setupPeer = NULL ;
5064
5065 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
5066 setupReq->peerMac, psessionEntry) ;
5067 if(eHAL_STATUS_SUCCESS == status)
5068 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5069 TDLS setup cnf TX complete is successful. */
5070 return eSIR_SUCCESS;
5071#if 0
5072
5073 /*
5074 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005075 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005076 * free this memory if any timeout is happen in link setup procedure
5077 */
5078 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
5079 (void **) &setupPeer, sizeof( tLimTdlsLinkSetupPeer )))
5080 {
5081 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005082 FL( "Unable to allocate memory during ADD_STA" ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005083 VOS_ASSERT(0) ;
5084 return eSIR_MEM_ALLOC_FAILED;
5085 }
5086 setupPeer->dialog = setupReq->dialog ;
5087 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
5088 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
5089 /* TDLS_sessionize: remember sessionId for future */
5090 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
5091 setupPeer->tdls_bIsResponder = 1;
5092
5093 /*
5094 * we only populate peer MAC, so it can assit us to find the
5095 * TDLS peer after response/or after response timeout
5096 */
5097 palCopyMemory(pMac->hHdd, setupPeer->peerMac, setupReq->peerMac,
5098 sizeof(tSirMacAddr)) ;
5099 /* format TDLS discovery request frame and transmit it */
5100 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
5101 setupReq->dialog, psessionEntry, NULL, 0) ;
5102
5103 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
5104 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
5105 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
5106 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
5107 /* update setup peer list */
5108 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
5109 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
5110 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5111 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
5112 return eSIR_SUCCESS ;
5113#endif
5114lim_tdls_link_start_error:
5115 /* in case of error, return immediately to SME */
5116 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
5117 eWNI_SME_TDLS_LINK_START_RSP);
5118 return eSIR_FAILURE ;
5119}
5120
5121/*
5122 * Process link teardown request recieved from SME and transmit to AP.
5123 */
5124eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5125{
5126 /* get all discovery request parameters */
5127 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
5128 tLimTdlsLinkSetupPeer *setupPeer;
5129 tpPESession psessionEntry;
5130 tANI_U8 sessionId;
5131
5132 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
5133 {
5134 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005135 "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005136 goto lim_tdls_teardown_req_error;
5137 }
5138
5139 /* check if we are in proper state to work as TDLS client */
5140 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5141 {
5142 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005143 "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005144 goto lim_tdls_teardown_req_error;
5145 }
5146
5147 /*
5148 * if we are still good, go ahead and check if we are in proper state to
5149 * do TDLS setup procedure.
5150 */
5151 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5152 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5153 {
5154 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005155 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005156 goto lim_tdls_teardown_req_error;
5157 }
5158
5159 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005160 "Teardown for peer = %02x,%02x,%02x,%02x,%02x,%02x",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005161 teardownReq->peerMac[0],
5162 teardownReq->peerMac[1],
5163 teardownReq->peerMac[2],
5164 teardownReq->peerMac[3],
5165 teardownReq->peerMac[4],
5166 teardownReq->peerMac[5]) ;
5167 /*
5168 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5169 * info for future reference.
5170 */
5171 /* Verify if this link is setup */
5172 setupPeer = NULL ;
5173 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5174 if(NULL == setupPeer)
5175 {
5176 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005177 ("invalid Peer on teardown ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005178 goto lim_tdls_teardown_req_error;
5179 }
5180
5181
5182 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5183 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5184 /* TDLS_sessionize: check sessionId in case */
5185 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5186 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005187 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005188 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5189 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5190 }
5191
5192 /* format TDLS teardown request frame and transmit it */
5193 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5194 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5195 {
5196 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005197 ("couldn't send teardown frame ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005198 goto lim_tdls_teardown_req_error;
5199 }
5200 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5201 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5202 return eSIR_SUCCESS;
5203lim_tdls_teardown_req_error:
5204 /* in case of error, return immediately to SME */
5205 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5206 eWNI_SME_TDLS_TEARDOWN_RSP);
5207 return eSIR_FAILURE;
5208}
5209
5210
5211#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005212
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305213static void
5214__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5215{
5216 tpSirResetAPCapsChange pResetCapsChange;
5217 tpPESession psessionEntry;
5218 tANI_U8 sessionId = 0;
5219 if (pMsgBuf == NULL)
5220 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005221 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305222 return;
5223 }
5224
5225 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5226 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5227 if (psessionEntry == NULL)
5228 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005229 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305230 return;
5231 }
5232
5233 psessionEntry->limSentCapsChangeNtf = false;
5234 return;
5235}
5236
Jeff Johnson295189b2012-06-20 16:38:30 -07005237/**
5238 * limProcessSmeReqMessages()
5239 *
5240 *FUNCTION:
5241 * This function is called by limProcessMessageQueue(). This
5242 * function processes SME request messages from HDD or upper layer
5243 * application.
5244 *
5245 *LOGIC:
5246 *
5247 *ASSUMPTIONS:
5248 *
5249 *NOTE:
5250 *
5251 * @param pMac Pointer to Global MAC structure
5252 * @param msgType Indicates the SME message type
5253 * @param *pMsgBuf A pointer to the SME message buffer
5254 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5255 * FALSE - if pMsgBuf is not to be freed.
5256 */
5257
5258tANI_BOOLEAN
5259limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5260{
5261 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5262 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005263 tpSirSmeScanReq pScanReq;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005264 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 -07005265 limMsgStr(pMsg->type), pMsg->type,
5266 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5267 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5268
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005269 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005270 /* Special handling of some SME Req msgs where we have an existing GO session and
5271 * want to insert NOA before processing those msgs. These msgs will be processed later when
5272 * start event happens
5273 */
5274 switch (pMsg->type)
5275 {
5276 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005277 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005278
5279 /* If scan is disabled return from here
5280 */
5281 if (pMac->lim.fScanDisabled)
5282 {
5283 PELOGE(limLog(pMac, LOGE, FL("Error: Scan Disabled"));)
5284 if (pMsg->type == eWNI_SME_SCAN_REQ)
5285 {
5286 limSendSmeScanRsp(pMac,
5287 offsetof(tSirSmeScanRsp,bssDescription[0]),
5288 eSIR_SME_INVALID_PARAMETERS,
5289 pScanReq->sessionId,
5290 pScanReq->transactionId);
5291
5292 bufConsumed = TRUE;
5293 }
5294 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5295 {
5296 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5297 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5298 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5299
5300 /*
5301 * limRemainOnChnRsp will free the buffer this change is to
5302 * avoid "double free"
5303 */
5304 bufConsumed = FALSE;
5305 }
5306
5307 return bufConsumed;
5308 }
5309 /*
5310 * Do not add BREAK here
5311 */
5312 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005313 case eWNI_SME_JOIN_REQ:
5314 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5315 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5316 {
5317 tANI_U32 noaDuration;
5318 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
5319 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf);
5320 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5321 return bufConsumed;
5322 }
5323 }
5324 /* If no insert NOA required then execute the code below */
5325
Jeff Johnson295189b2012-06-20 16:38:30 -07005326 switch (pMsg->type)
5327 {
5328 case eWNI_SME_START_REQ:
5329 __limProcessSmeStartReq(pMac, pMsgBuf);
5330 break;
5331
5332 case eWNI_SME_SYS_READY_IND:
5333 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5334 break;
5335
Jeff Johnson295189b2012-06-20 16:38:30 -07005336 case eWNI_SME_START_BSS_REQ:
5337 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5338 break;
5339
5340 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005341 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005342 break;
5343
Jeff Johnsone7245742012-09-05 17:12:55 -07005344#ifdef FEATURE_OEM_DATA_SUPPORT
5345 case eWNI_SME_OEM_DATA_REQ:
5346 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005347 break;
5348#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005349 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5350 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5351 break;
5352
5353 case eWNI_SME_UPDATE_NOA:
5354 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5355 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305356 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5357 __limProcessClearDfsChannelList(pMac, pMsg);
5358 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005359 case eWNI_SME_JOIN_REQ:
5360 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005361 break;
5362
5363 case eWNI_SME_AUTH_REQ:
5364 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5365
5366 break;
5367
5368 case eWNI_SME_REASSOC_REQ:
5369 __limProcessSmeReassocReq(pMac, pMsgBuf);
5370
5371 break;
5372
5373 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5374 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5375
5376 break;
5377
5378 case eWNI_SME_DISASSOC_REQ:
5379 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5380
5381 break;
5382
5383 case eWNI_SME_DISASSOC_CNF:
5384 case eWNI_SME_DEAUTH_CNF:
5385 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5386
5387 break;
5388
5389 case eWNI_SME_DEAUTH_REQ:
5390 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5391
5392 break;
5393
Jeff Johnson295189b2012-06-20 16:38:30 -07005394
5395
5396 case eWNI_SME_SETCONTEXT_REQ:
5397 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5398
5399 break;
5400
5401 case eWNI_SME_REMOVEKEY_REQ:
5402 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5403
5404 break;
5405
5406 case eWNI_SME_STOP_BSS_REQ:
5407 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5408 break;
5409
5410 case eWNI_SME_ASSOC_CNF:
5411 case eWNI_SME_REASSOC_CNF:
5412 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005413 PELOG1(limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005414 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005415 PELOG1(limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005416 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5417 break;
5418
5419 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005420 PELOG1(limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005421 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5422 break;
5423
5424 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005425 PELOG1(limLog(pMac, LOG1, FL("Received DELTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005426 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5427 break;
5428
5429 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005430 PELOG1(limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005431 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5432 break;
5433
5434 case eWNI_SME_STA_STAT_REQ:
5435 case eWNI_SME_AGGR_STAT_REQ:
5436 case eWNI_SME_GLOBAL_STAT_REQ:
5437 case eWNI_SME_STAT_SUMM_REQ:
5438 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5439 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5440 bufConsumed = FALSE;
5441 break;
5442 case eWNI_SME_GET_STATISTICS_REQ:
5443 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5444 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5445 bufConsumed = FALSE;
5446 break;
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005447#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
5448 case eWNI_SME_GET_ROAM_RSSI_REQ:
5449 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5450 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5451 bufConsumed = FALSE;
5452 break;
5453#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005454 case eWNI_SME_DEL_BA_PEER_IND:
5455 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5456 break;
5457 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5458 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5459 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005460 case eWNI_SME_GET_ASSOC_STAS_REQ:
5461 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5462 break;
5463 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5464 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5465 break;
5466
5467 case eWNI_SME_HIDE_SSID_REQ:
5468 __limProcessSmeHideSSID(pMac, pMsgBuf);
5469 break;
5470 case eWNI_SME_UPDATE_APWPSIE_REQ:
5471 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5472 break;
5473 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5474 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5475 break;
5476
5477 case eWNI_SME_SET_APWPARSNIEs_REQ:
5478 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5479 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005480
5481 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5482 //Update the beaconInterval
5483 __limProcessSmeChangeBI(pMac, pMsgBuf );
5484 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005485
5486#if defined WLAN_FEATURE_VOWIFI
5487 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5488 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5489 __limProcessReportMessage(pMac, pMsg);
5490 break;
5491#endif
5492
5493#if defined WLAN_FEATURE_VOWIFI_11R
5494 case eWNI_SME_FT_PRE_AUTH_REQ:
5495 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5496 break;
5497 case eWNI_SME_FT_UPDATE_KEY:
5498 limProcessFTUpdateKey(pMac, pMsgBuf);
5499 break;
5500
5501 case eWNI_SME_FT_AGGR_QOS_REQ:
5502 limProcessFTAggrQosReq(pMac, pMsgBuf);
5503 break;
5504#endif
5505
5506#if defined FEATURE_WLAN_CCX
5507 case eWNI_SME_CCX_ADJACENT_AP_REPORT:
5508 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5509 break;
5510#endif
5511 case eWNI_SME_ADD_STA_SELF_REQ:
5512 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5513 break;
5514 case eWNI_SME_DEL_STA_SELF_REQ:
5515 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5516 break;
5517
Jeff Johnson295189b2012-06-20 16:38:30 -07005518 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5519 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5520 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005521#ifdef FEATURE_WLAN_TDLS
5522 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5523 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5524 break;
5525 case eWNI_SME_TDLS_ADD_STA_REQ:
5526 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5527 break;
5528 case eWNI_SME_TDLS_DEL_STA_REQ:
5529 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5530 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305531 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5532 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5533 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005534#endif
5535#ifdef FEATURE_WLAN_TDLS_INTERNAL
5536 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
5537 limProcessSmeDisStartReq(pMac, pMsgBuf);
5538 break ;
5539 case eWNI_SME_TDLS_LINK_START_REQ:
5540 limProcessSmeLinkStartReq(pMac, pMsgBuf);
5541 break ;
5542 case eWNI_SME_TDLS_TEARDOWN_REQ:
5543 limProcessSmeTeardownReq(pMac, pMsgBuf);
5544 break ;
5545#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305546 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5547 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5548 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005549
schang86c22c42013-03-13 18:41:24 -07005550 case eWNI_SME_SET_TX_POWER_REQ:
5551 limSendSetTxPowerReq(pMac, pMsgBuf);
5552 break ;
5553
Jeff Johnson295189b2012-06-20 16:38:30 -07005554 default:
5555 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5556 pMsg->bodyptr = NULL;
5557 break;
5558 } // switch (msgType)
5559
5560 return bufConsumed;
5561} /*** end limProcessSmeReqMessages() ***/