blob: 2bc146faf539cf5dbff33eb89fa06ffea40eb6ca [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
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070079#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -070080#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 */
Sandeep Puligilla33ccf332013-12-19 16:06:42 +053090#define MIN_TX_PWR_CAP 8
91#define MAX_TX_PWR_CAP 22
Jeff Johnson295189b2012-06-20 16:38:30 -070092
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 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530191 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
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530549 /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 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
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530555 pSmeStartBssReq = vos_mem_malloc(size);
556 if ( NULL == pSmeStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530558 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory 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
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530564 vos_mem_set((void *)pSmeStartBssReq, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700565
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.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530580 * If session is not existed, then create a new session */
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 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 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530613 vos_mem_copy( (tANI_U8 *)&psessionEntry->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 (tANI_U8 *)&pSmeStartBssReq->ssId,
615 (pSmeStartBssReq->ssId.length + 1));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530616
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 psessionEntry->bssType = pSmeStartBssReq->bssType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530618
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 psessionEntry->nwType = pSmeStartBssReq->nwType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530620
Jeff Johnson295189b2012-06-20 16:38:30 -0700621 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
622
623 /* Store the channel number in session Table */
624 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
625
626 /*Store Persona */
627 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700628 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 psessionEntry->pePersona);
630
631 /*Update the phymode*/
632 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
633
634 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
635 psessionEntry->currentOperChannel );
636 /* Store the dot 11 mode in to the session Table*/
637
638 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700639 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
640#ifdef WLAN_FEATURE_11AC
641 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700642 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
643 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700644#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800645
646 psessionEntry->txLdpcIniFeatureEnabled =
647 pSmeStartBssReq->txLdpcIniFeatureEnabled;
648
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530649 vos_mem_copy((void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 (void*)&pSmeStartBssReq->operationalRateSet,
651 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530652 vos_mem_copy((void*)&psessionEntry->extRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 (void*)&pSmeStartBssReq->extendedRateSet,
654 sizeof(tSirMacRateSet));
655
656 switch(pSmeStartBssReq->bssType)
657 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 case eSIR_INFRA_AP_MODE:
659 psessionEntry->limSystemRole = eLIM_AP_ROLE;
660 psessionEntry->privacy = pSmeStartBssReq->privacy;
661 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
662 psessionEntry->authType = pSmeStartBssReq->authType;
663 /* Store the DTIM period */
664 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
665 /*Enable/disable UAPSD*/
666 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
667 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
668 {
669 psessionEntry->proxyProbeRspEn = 0;
670 }
671 else
672 {
673 /* To detect PBC overlap in SAP WPS mode, Host handles
674 * Probe Requests.
675 */
676 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
677 {
678 psessionEntry->proxyProbeRspEn = 1;
679 }
680 else
681 {
682 psessionEntry->proxyProbeRspEn = 0;
683 }
684 }
685 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
686 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -0700687 psessionEntry->shortSlotTimeSupported = limGetShortSlotFromPhyMode(pMac, psessionEntry, psessionEntry->gLimPhyMode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 case eSIR_IBSS_MODE:
690 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Ravi Joshi27216f12013-10-19 17:04:39 -0700691 psessionEntry->shortSlotTimeSupported =
692 limGetShortSlotFromPhyMode(pMac, psessionEntry,
693 psessionEntry->gLimPhyMode);
krunal sonie9002db2013-11-25 14:24:17 -0800694 psessionEntry->isCoalesingInIBSSAllowed =
695 pSmeStartBssReq->isCoalesingInIBSSAllowed;
Jeff Johnson295189b2012-06-20 16:38:30 -0700696 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 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530721 psessionEntry->parsedAssocReq = vos_mem_malloc(
722 psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq));
723 if ( NULL == psessionEntry->parsedAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530725 limLog(pMac, LOGW, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700726 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
727 goto free;
728 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530729 vos_mem_set(psessionEntry->parsedAssocReq,
730 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)),
731 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 }
733
734 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
735 if (pSmeStartBssReq->channelId)
736 {
737 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700738 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
739 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
740 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700741 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700742 FL("cbMode %u"), pSmeStartBssReq->cbMode);
743#ifdef WLAN_FEATURE_11AC
744 if(psessionEntry->vhtCapability)
745 {
746 tANI_U32 centerChan;
747 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700748
Jeff Johnsone7245742012-09-05 17:12:55 -0700749 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
750 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700752 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700753 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700754 }
755
756 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ || chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
757 {
758 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
759 != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700760 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700761 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700762 retCode = eSIR_LOGP_EXCEPTION;
Jeff Johnsone7245742012-09-05 17:12:55 -0700763 goto free;
Jeff Johnson295189b2012-06-20 16:38:30 -0700764 }
765 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700766 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
767 {
768 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
769 != eSIR_SUCCESS)
770 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700771 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700772 retCode = eSIR_LOGP_EXCEPTION;
773 goto free;
774 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700775
Jeff Johnsone7245742012-09-05 17:12:55 -0700776 centerChan = limGetCenterChannel(pMac,channelNumber,pSmeStartBssReq->cbMode,WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
777 if(centerChan != eSIR_CFG_INVALID_ID)
778 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800779 limLog(pMac, LOGW, FL("***Center Channel for 80MHZ channel width = %d"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700780 psessionEntry->apCenterChan = centerChan;
Jeff Johnsone7245742012-09-05 17:12:55 -0700781 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1, centerChan)
782 != eSIR_SUCCESS)
783 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700784 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700785 retCode = eSIR_LOGP_EXCEPTION;
786 goto free;
787 }
788 }
789 }
790
791 /* All the translation is done by now for gVhtChannelWidth from .ini file to
792 * the actual values as defined in spec. So, grabing the spec value which is
793 * updated in .dat file by the above logic */
794 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
795 &chanWidth) != eSIR_SUCCESS)
796 {
797 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700798 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700799 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700800 /*For Sta+p2p-Go concurrency
801 vhtTxChannelWidthSet is used for storing p2p-GO channel width
802 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
803 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
804 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700805 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700806 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700807 }
808 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
809#endif
810 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 else
812 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700813 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700814 retCode = eSIR_SME_INVALID_PARAMETERS;
815 goto free;
816 }
817
818 // Delete pre-auth list if any
819 limDeletePreAuthList(pMac);
820
821 // Delete IBSS peer BSSdescription list if any
822 //limIbssDelete(pMac); sep 26 review
823
824
825
826#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
827 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 limInitMlm(pMac);
829#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700830
Jeff Johnsone7245742012-09-05 17:12:55 -0700831 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700832
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 /* keep the RSN/WPA IE information in PE Session Entry
834 * later will be using this to check when received (Re)Assoc req
835 * */
836 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
837
Jeff Johnson295189b2012-06-20 16:38:30 -0700838
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 //Taken care for only softAP case rest need to be done
840 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
841 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
842 /*each byte will have the following info
843 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
844 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530845 vos_mem_copy( (void *) &psessionEntry->cfgProtection,
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700847 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
849 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700850
851 // Prepare and Issue LIM_MLM_START_REQ to MLM
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530852 pMlmStartReq = vos_mem_malloc(sizeof(tLimMlmStartReq));
853 if ( NULL == pMlmStartReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700854 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530855 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700856 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
857 goto free;
858 }
859
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530860 vos_mem_set((void *) pMlmStartReq, sizeof(tLimMlmStartReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700861
862 /* Copy SSID to the MLM start structure */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530863 vos_mem_copy( (tANI_U8 *) &pMlmStartReq->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700864 (tANI_U8 *) &pSmeStartBssReq->ssId,
865 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700866 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
867 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700868
869
870 pMlmStartReq->bssType = psessionEntry->bssType;
871
872 /* Fill PE session Id from the session Table */
873 pMlmStartReq->sessionId = psessionEntry->peSessionId;
874
875 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700876 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700877 )
878 {
879 //len = sizeof(tSirMacAddr);
880 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
881 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700882 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700883
884 /* Copy the BSSId from sessionTable to mlmStartReq struct */
885 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
886 }
887
888 else // ibss mode
889 {
890 pMac->lim.gLimIbssCoalescingHappened = false;
891
892 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
893 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700894 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 retCode = eSIR_LOGP_EXCEPTION;
896 goto free;
897 }
898
899 if(!autoGenBssId)
900 {
901 // We're not auto generating BSSID. Instead, get it from session entry
902 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
903
904 if(pMlmStartReq->bssId[0] & 0x01)
905 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700906 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 autoGenBssId = TRUE;
908 }
909 }
910
911 if( autoGenBssId )
912 { //if BSSID is not any uc id. then use locally generated BSSID.
913 //Autogenerate the BSSID
914 limGetRandomBssid( pMac, pMlmStartReq->bssId);
915 pMlmStartReq->bssId[0]= 0x02;
916
917 /* Copy randomly generated BSSID to the session Table */
918 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
919 }
920 }
921 /* store the channel num in mlmstart req structure */
922 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
923 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
924 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
925
Jeff Johnson295189b2012-06-20 16:38:30 -0700926 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
927 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
928 pMlmStartReq->wps_state = psessionEntry->wps_state;
929
930 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700931 {
932 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700933 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700934 pMlmStartReq->dtimPeriod = (tANI_U8)val;
935 }
936
937 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700938 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700939 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
940
941 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700942 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700943 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
944
945 //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530946 vos_mem_copy((void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700947 sizeof(tSirMacRateSet));
948
Jeff Johnson295189b2012-06-20 16:38:30 -0700949 // Now populate the 11n related parameters
950 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700951 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700952 //
953 // FIXME_GEN4 - Determine the appropriate defaults...
954 //
955 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
956 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700957 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700958
959 /* sep26 review */
960 psessionEntry->limRFBand = limGetRFBand(channelNumber);
961
962 // Initialize 11h Enable Flag
963 psessionEntry->lim11hEnable = 0;
964 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
965 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
966 {
967 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700968 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700969 psessionEntry->lim11hEnable = val;
970 }
971
972 if (!psessionEntry->lim11hEnable)
973 {
974 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700975 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700976 }
977
Jeff Johnson295189b2012-06-20 16:38:30 -0700978 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
979 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700980 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700981
982 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
983 return;
984 }
985 else
986 {
987
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700988 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700989 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
990 goto end;
991 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
992
993free:
Jeff Johnsonace91102013-04-05 08:03:18 -0700994 if ((psessionEntry != NULL) &&
995 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
996 {
997 psessionEntry->pLimStartBssReq = NULL;
998 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530999 vos_mem_free( pSmeStartBssReq);
1000 vos_mem_free( pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001001
1002end:
1003
1004 /* This routine should return the sme sessionId and SME transaction Id */
1005 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1006
1007 if(NULL != psessionEntry)
1008 {
1009 peDeleteSession(pMac,psessionEntry);
1010 psessionEntry = NULL;
1011 }
1012 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
1013} /*** end __limHandleSmeStartBssRequest() ***/
1014
1015
1016/**--------------------------------------------------------------
1017\fn __limProcessSmeStartBssReq
1018
1019\brief Wrapper for the function __limHandleSmeStartBssRequest
1020 This message will be defered until softmac come out of
1021 scan mode or if we have detected radar on the current
1022 operating channel.
1023\param pMac
1024\param pMsg
1025
1026\return TRUE - If we consumed the buffer
1027 FALSE - If have defered the message.
1028 ---------------------------------------------------------------*/
1029static tANI_BOOLEAN
1030__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1031{
1032 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1033 __limIsDeferedMsgForRadar(pMac, pMsg))
1034 {
1035 /**
1036 * If message defered, buffer is not consumed yet.
1037 * So return false
1038 */
1039 return eANI_BOOLEAN_FALSE;
1040 }
1041
1042 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1043 return eANI_BOOLEAN_TRUE;
1044}
1045
1046
1047/**
1048 * limGetRandomBssid()
1049 *
1050 * FUNCTION:This function is called to process generate the random number for bssid
1051 * This function is called to process SME_SCAN_REQ message
1052 * from HDD or upper layer application.
1053 *
1054 * LOGIC:
1055 *
1056 * ASSUMPTIONS:
1057 *
1058 * NOTE:
1059 * 1. geneartes the unique random number for bssid in ibss
1060 *
1061 * @param pMac Pointer to Global MAC structure
1062 * @param *data Pointer to bssid buffer
1063 * @return None
1064 */
1065void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1066{
1067 tANI_U32 random[2] ;
1068 random[0] = tx_time_get();
1069 random[0] |= (random[0] << 15) ;
1070 random[1] = random[0] >> 1;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301071 vos_mem_copy( data, (tANI_U8*)random, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001072}
1073
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301074static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
1075 tpSirSmeScanReq pScanReq)
1076{
1077 tSirScanOffloadReq *pScanOffloadReq;
1078 tANI_U8 *p;
1079 tSirMsgQ msg;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301080 tANI_U16 i, len;
1081 tSirRetStatus rc = eSIR_SUCCESS;
1082
1083 /* The tSirScanOffloadReq will reserve the space for first channel,
1084 so allocate the memory for (numChannels - 1) and uIEFieldLen */
1085 len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
1086 pScanReq->uIEFieldLen;
1087
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301088 pScanOffloadReq = vos_mem_malloc(len);
1089 if ( NULL == pScanOffloadReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301090 {
1091 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301092 FL("AllocateMemory failed for pScanOffloadReq"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301093 return eHAL_STATUS_FAILURE;
1094 }
1095
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301096 vos_mem_set( (tANI_U8 *) pScanOffloadReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301097
1098 msg.type = WDA_START_SCAN_OFFLOAD_REQ;
1099 msg.bodyptr = pScanOffloadReq;
1100 msg.bodyval = 0;
1101
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301102 vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301103 (tANI_U8*) pScanReq->bssId,
1104 sizeof(tSirMacAddr));
1105
1106 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
1107 {
1108 limLog(pMac, LOGE,
1109 FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
Kiet Lamb1233192013-11-28 13:38:20 +05301110 vos_mem_free (pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301111 return eHAL_STATUS_FAILURE;
1112 }
1113
1114 pScanOffloadReq->numSsid = pScanReq->numSsid;
1115 for (i = 0; i < pScanOffloadReq->numSsid; i++)
1116 {
1117 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301118 vos_mem_copy((tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301119 (tANI_U8 *) pScanReq->ssId[i].ssId,
1120 pScanOffloadReq->ssId[i].length);
1121 }
1122
1123 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301124 vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301125 (tANI_U8 *) pScanReq->selfMacAddr,
1126 sizeof(tSirMacAddr));
1127 pScanOffloadReq->bssType = pScanReq->bssType;
1128 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1129 pScanOffloadReq->scanType = pScanReq->scanType;
1130 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1131 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1132 pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
1133 pScanOffloadReq->sessionId = pScanReq->sessionId;
1134 pScanOffloadReq->channelList.numChannels =
1135 pScanReq->channelList.numChannels;
1136 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1137 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1138 p[i] = pScanReq->channelList.channelNumber[i];
1139
1140 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1141 pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301142 vos_mem_copy((tANI_U8 *) p + i,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301143 (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
1144 pScanOffloadReq->uIEFieldLen);
1145
1146 rc = wdaPostCtrlMsg(pMac, &msg);
1147 if (rc != eSIR_SUCCESS)
1148 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001149 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301150 vos_mem_free(pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301151 return eHAL_STATUS_FAILURE;
1152 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301153 limLog(pMac, LOG1, FL("Processed Offload Scan Request Successfully"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301154
1155 return eHAL_STATUS_SUCCESS;
1156}
Jeff Johnson295189b2012-06-20 16:38:30 -07001157
1158/**
1159 * __limProcessSmeScanReq()
1160 *
1161 *FUNCTION:
1162 * This function is called to process SME_SCAN_REQ message
1163 * from HDD or upper layer application.
1164 *
1165 *LOGIC:
1166 *
1167 *ASSUMPTIONS:
1168 *
1169 *NOTE:
1170 * 1. Periodic scanning should be requesting to return unique
1171 * scan results.
1172 *
1173 * @param pMac Pointer to Global MAC structure
1174 * @param *pMsgBuf A pointer to the SME message buffer
1175 * @return None
1176 */
1177
Viral Modid440e682013-03-06 02:25:31 -08001178static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001179__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1180{
1181 tANI_U32 len;
1182 tLimMlmScanReq *pMlmScanReq;
1183 tpSirSmeScanReq pScanReq;
1184 tANI_U8 i = 0;
1185
1186#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1187 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1188#endif //FEATURE_WLAN_DIAG_SUPPORT
1189
1190 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301191 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 -07001192 pScanReq->channelList.numChannels,
1193 pScanReq->minChannelTime,
1194 pScanReq->maxChannelTime,
1195 pScanReq->uIEFieldLen,
1196 pScanReq->returnAfterFirstMatch,
1197 pScanReq->returnFreshResults,
1198 pScanReq->returnUniqueResults,
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001199 pScanReq->scanType,
1200 pScanReq->backgroundScanMode,
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301201 pMac->lim.gLimRspReqd ? 1 : 0);
Viral Modid86bde22012-12-10 13:09:21 -08001202
1203 /* Since scan req always requires a response, we will overwrite response required here.
1204 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1205 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1206 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1207 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1208 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1209 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1210 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1211 * the global flag gLimRspReqd to TRUE here.
1212 */
1213 pMac->lim.gLimRspReqd = TRUE;
1214
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301215 /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001216 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1217
1218 /* This routine should return the sme sessionId and SME transaction Id */
1219
1220 if (!limIsSmeScanReqValid(pMac, pScanReq))
1221 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301222 limLog(pMac, LOGE, FL("Received SME_SCAN_REQ with invalid parameters"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001223
1224 if (pMac->lim.gLimRspReqd)
1225 {
1226 pMac->lim.gLimRspReqd = false;
1227
1228 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1229
1230 } // if (pMac->lim.gLimRspReqd)
1231
1232 return;
1233 }
1234
1235 //if scan is disabled then return as invalid scan request.
1236 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1237 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1238 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301239 limLog(pMac, LOGE, FL("SCAN is disabled or SCAN in power save"
1240 " is disabled and system is in power save."));
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001241 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001242 return;
1243 }
1244
1245
1246 /**
1247 * If scan request is received in idle, joinFailed
1248 * states or in link established state (in STA role)
1249 * or in normal state (in STA-in-IBSS/AP role) with
1250 * 'return fresh scan results' request from HDD or
1251 * it is periodic background scanning request,
1252 * trigger fresh scan request to MLM
1253 */
1254 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1255 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301256 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1257 {
1258 // Discard previously cached scan results
1259 limReInitScanResults(pMac);
1260 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001261
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301262 pMac->lim.gLim24Band11dScanDone = 0;
1263 pMac->lim.gLim50Band11dScanDone = 0;
1264 pMac->lim.gLimReturnAfterFirstMatch =
1265 pScanReq->returnAfterFirstMatch;
1266 pMac->lim.gLimBackgroundScanMode =
1267 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001268
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301269 pMac->lim.gLimReturnUniqueResults =
1270 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1271 /* De-activate Heartbeat timers for connected sessions while
1272 * scan is in progress if the system is in Active mode *
1273 * AND it is not a ROAMING ("background") scan */
1274 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1275 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1276 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1277 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1278 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001279 for(i=0;i<pMac->lim.maxBssId;i++)
1280 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301281 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1282 (pMac->lim.gpSession[i].valid == TRUE) &&
1283 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1284 {
1285 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1286 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001287 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301288 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001289
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301290 if (pMac->fScanOffload)
1291 {
1292 if (eHAL_STATUS_SUCCESS !=
1293 limSendHalStartScanOffloadReq(pMac, pScanReq))
1294 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301295 limLog(pMac, LOGE, FL("Couldn't send Offload scan request"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301296 limSendSmeScanRsp(pMac,
1297 offsetof(tSirSmeScanRsp, bssDescription[0]),
1298 eSIR_SME_INVALID_PARAMETERS,
1299 pScanReq->sessionId,
1300 pScanReq->transactionId);
1301 return;
1302 }
1303 }
1304 else
1305 {
1306
1307 /*Change Global SME state */
1308 /* Store the previous SME state */
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301309 limLog(pMac, LOG1, FL("Non Offload SCAN request "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301310 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1311 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1312 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1313
1314 if (pScanReq->channelList.numChannels == 0)
1315 {
1316 tANI_U32 cfg_len;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301317
1318 limLog(pMac, LOG1,
1319 FL("Scan all channels as Number of channels is 0"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301320 // Scan all channels
1321 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001322 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1323 pScanReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301324 pMlmScanReq = vos_mem_malloc(len);
1325 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301326 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301327 // Log error
1328 limLog(pMac, LOGP,
1329 FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001330
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301331 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301332 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001333
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301334 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301335 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001336
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301337 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1338 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001339 pMlmScanReq->channelList.channelNumber,
1340 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301341 {
1342 /**
1343 * Could not get Valid channel list from CFG.
1344 * Log error.
1345 */
1346 limLog(pMac, LOGP,
1347 FL("could not retrieve Valid channel list"));
1348 }
1349 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
1350 }
1351 else
1352 {
1353 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1354 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1355 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001356
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301357 pMlmScanReq = vos_mem_malloc(len);
1358 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301359 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301360 // Log error
1361 limLog(pMac, LOGP,
1362 FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001363
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301364 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301365 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001366
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301367 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301368 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301369 pMlmScanReq->channelList.numChannels =
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301370 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001371
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301372 vos_mem_copy( pMlmScanReq->channelList.channelNumber,
1373 pScanReq->channelList.channelNumber,
1374 pScanReq->channelList.numChannels);
1375 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001376
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301377 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1378 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1379 if(pScanReq->uIEFieldLen)
1380 {
1381 vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1382 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1383 pScanReq->uIEFieldLen);
1384 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001385
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301386 pMlmScanReq->bssType = pScanReq->bssType;
1387 vos_mem_copy( pMlmScanReq->bssId,
1388 pScanReq->bssId,
1389 sizeof(tSirMacAddr));
1390 pMlmScanReq->numSsid = pScanReq->numSsid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001391
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301392 i = 0;
1393 while (i < pMlmScanReq->numSsid)
1394 {
1395 vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 (tANI_U8 *) &pScanReq->ssId[i],
1397 pScanReq->ssId[i].length + 1);
1398
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301399 i++;
1400 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001401
Jeff Johnson295189b2012-06-20 16:38:30 -07001402
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301403 pMlmScanReq->scanType = pScanReq->scanType;
1404 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
1405 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1406 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1407 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1408 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
1409 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1410 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001411
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301412 //Store the smeSessionID and transaction ID for later use.
1413 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1414 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001415
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301416 // Issue LIM_MLM_SCAN_REQ to MLM
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301417 limLog(pMac, LOG1, FL("Issue Scan request command to MLM "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301418 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1419 }
1420 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001421
1422 else
1423 {
1424 /// In all other cases return 'cached' scan results
1425 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1426 {
1427 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1428
1429 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001430#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1431 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001432 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001433 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1434 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1435 {
1436 limSendSmeLfrScanRsp(pMac, scanRspLen,
1437 eSIR_SME_SUCCESS,
1438 pScanReq->sessionId,
1439 pScanReq->transactionId);
1440 }
1441 else
1442 {
1443 scanRspLen = sizeof(tSirSmeScanRsp) +
1444 pMac->lim.gLimSmeLfrScanResultLength -
1445 sizeof(tSirBssDescription);
1446 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1447 pScanReq->sessionId, pScanReq->transactionId);
1448 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001449 }
1450 else
1451 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001452#endif
1453 if (pMac->lim.gLimSmeScanResultLength == 0)
1454 {
1455 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1456 pScanReq->sessionId, pScanReq->transactionId);
1457 }
1458 else
1459 {
1460 scanRspLen = sizeof(tSirSmeScanRsp) +
1461 pMac->lim.gLimSmeScanResultLength -
1462 sizeof(tSirBssDescription);
1463 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1464 pScanReq->sessionId, pScanReq->transactionId);
1465 }
1466#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001467 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001468#endif
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301469 limLog(pMac, LOG1, FL("Cached scan results are returned "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001470
1471 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1472 {
1473 // Discard previously cached scan results
1474 limReInitScanResults(pMac);
1475 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001476#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1477 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1478 {
1479 // Discard previously cached scan results
1480 limReInitLfrScanResults(pMac);
1481 }
1482#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001483
1484 } // if (pMac->lim.gLimRspReqd)
1485 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1486
Jeff Johnson295189b2012-06-20 16:38:30 -07001487#ifdef BACKGROUND_SCAN_ENABLED
1488 // start background scans if needed
1489 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1490 __limBackgroundScanInitiate(pMac);
1491#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001492
1493} /*** end __limProcessSmeScanReq() ***/
1494
Jeff Johnsone7245742012-09-05 17:12:55 -07001495#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001496
Jeff Johnsone7245742012-09-05 17:12:55 -07001497static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1498{
1499 tpSirOemDataReq pOemDataReq;
1500 tLimMlmOemDataReq* pMlmOemDataReq;
1501
1502 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1503
1504 //post the lim mlm message now
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301505 pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq));
1506 if ( NULL == pMlmOemDataReq )
Jeff Johnsone7245742012-09-05 17:12:55 -07001507 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301508 limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001509 return;
1510 }
1511
1512 //Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301513 vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001514
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301515 vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr,
1516 sizeof(tSirMacAddr));
1517 vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq,
1518 OEM_DATA_REQ_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001519
1520 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1521 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1522
1523 return;
1524
1525} /*** end __limProcessSmeOemDataReq() ***/
1526
1527#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001528
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301529/**
1530 * __limProcessClearDfsChannelList()
1531 *
1532 *FUNCTION:
1533 *Clear DFS channel list when country is changed/aquired.
1534.*This message is sent from SME.
1535 *
1536 *LOGIC:
1537 *
1538 *ASSUMPTIONS:
1539 *
1540 *NOTE:
1541 *
1542 * @param pMac Pointer to Global MAC structure
1543 * @param *pMsgBuf A pointer to the SME message buffer
1544 * @return None
1545 */
1546static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1547 tpSirMsgQ pMsg)
1548{
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301549 vos_mem_set( &pMac->lim.dfschannelList,
1550 sizeof(tSirDFSChannelList), 0);
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301551}
Jeff Johnson295189b2012-06-20 16:38:30 -07001552
1553/**
1554 * __limProcessSmeJoinReq()
1555 *
1556 *FUNCTION:
1557 * This function is called to process SME_JOIN_REQ message
1558 * from HDD or upper layer application.
1559 *
1560 *LOGIC:
1561 *
1562 *ASSUMPTIONS:
1563 *
1564 *NOTE:
1565 *
1566 * @param pMac Pointer to Global MAC structure
1567 * @param *pMsgBuf A pointer to the SME message buffer
1568 * @return None
1569 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001570static void
1571__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1572{
1573 // tANI_U8 *pBuf;
1574 //tANI_U32 len;
1575// tSirMacAddr currentBssId;
1576 tpSirSmeJoinReq pSmeJoinReq = NULL;
1577 tLimMlmJoinReq *pMlmJoinReq;
1578 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1579 tANI_U32 val = 0;
1580 tANI_U16 nSize;
1581 tANI_U8 sessionId;
1582 tpPESession psessionEntry = NULL;
1583 tANI_U8 smesessionId;
1584 tANI_U16 smetransactionId;
1585 tPowerdBm localPowerConstraint = 0, regMax = 0;
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301586 tANI_U16 ieLen;
1587 v_U8_t *vendorIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001588
1589#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1590 //Not sending any session, since it is not created yet. The response whould have correct state.
1591 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1592#endif //FEATURE_WLAN_DIAG_SUPPORT
1593
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001594 PELOG1(limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001595
1596#ifdef WLAN_FEATURE_VOWIFI
1597 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1598 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1599 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1600 * like not honoring power constraint on 1st association after driver loading. */
1601 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001602 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001603 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1604 val = 0;
1605#endif /* WLAN_FEATURE_VOWIFI */
1606
1607 /**
1608 * Expect Join request in idle state.
1609 * Reassociate request is expected in link established state.
1610 */
1611
1612 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1613 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1614 {
1615 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301616
1617 pSmeJoinReq = vos_mem_malloc(nSize);
1618 if ( NULL == pSmeJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001619 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301620 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1621 "pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001622 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1623 goto end;
1624 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301625 (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001626
Jeff Johnson295189b2012-06-20 16:38:30 -07001627 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1628 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1629 {
1630 /// Received invalid eWNI_SME_JOIN_REQ
1631 // Log the event
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001632 limLog(pMac, LOGW, FL("received SME_JOIN_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001633 retCode = eSIR_SME_INVALID_PARAMETERS;
1634 goto end;
1635 }
1636
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301637 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23
Jeff Johnson295189b2012-06-20 16:38:30 -07001638
1639 /* check for the existence of start BSS session */
1640#ifdef FIXME_GEN6
1641 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1642 {
1643 if(peValidateBtJoinRequest(pMac)!= TRUE)
1644 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301645 limLog(pMac, LOGW, FL("Start Bss session not present::"
1646 "SME_JOIN_REQ in unexpected state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1648 psessionEntry = NULL;
1649 goto end;
1650 }
1651 }
1652
1653#endif
1654
1655
1656 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1657 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301658 limLog(pMac, LOGE, FL("Session(%d) Already exists for BSSID: "
1659 MAC_ADDRESS_STR" in limSmeState = %X"),sessionId,
1660 MAC_ADDR_ARRAY(pSmeJoinReq->bssDescription.bssId),
1661 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001662
1663 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1664 {
1665 // Received eWNI_SME_JOIN_REQ for same
1666 // BSS as currently associated.
1667 // Log the event and send success
Abhishek Singh57aebef2014-02-03 18:47:44 +05301668 PELOGW(limLog(pMac, LOGW, FL("Received SME_JOIN_REQ for "
1669 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001670 /// Send Join success response to host
Deepthi Gowrif3e27252013-12-11 20:50:01 +05301671 retCode = eSIR_SME_ALREADY_JOINED_A_BSS;
1672 psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001673 goto end;
1674 }
1675 else
1676 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301677 PELOGE(limLog(pMac, LOGE, FL("SME_JOIN_REQ not for"
1678 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001679 retCode = eSIR_SME_REFUSED;
1680 psessionEntry = NULL;
1681 goto end;
1682 }
1683 }
1684 else /* Session Entry does not exist for given BSSId */
1685 {
1686 /* Try to Create a new session */
1687 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1688 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001689 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001690 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1691 goto end;
1692 }
1693 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001694 handleHTCapabilityandHTInfo(pMac, psessionEntry);
krunal soni5afa96c2013-09-06 22:19:02 -07001695 psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
Jeff Johnsone7245742012-09-05 17:12:55 -07001696
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 /* Store Session related parameters */
1698 /* Store PE session Id in session Table */
1699 psessionEntry->peSessionId = sessionId;
1700
1701 /* store the smejoin req handle in session table */
1702 psessionEntry->pLimJoinReq = pSmeJoinReq;
1703
1704 /* Store SME session Id in sessionTable */
1705 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1706
1707 /* Store SME transaction Id in session Table */
1708 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1709
1710 /* Store beaconInterval */
1711 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1712
1713 /* Copying of bssId is already done, while creating session */
1714 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1715 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1716 psessionEntry->bssType = pSmeJoinReq->bsstype;
1717
1718 psessionEntry->statypeForBss = STA_ENTRY_PEER;
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301719 psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled;
1720 psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001721
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301722 /* Store vendor specfic IE for CISCO AP */
1723 ieLen = (pSmeJoinReq->bssDescription.length +
1724 sizeof( pSmeJoinReq->bssDescription.length ) -
1725 GET_FIELD_OFFSET( tSirBssDescription, ieFields ));
1726
1727 vendorIE = limGetVendorIEOuiPtr(pMac, SIR_MAC_CISCO_OUI,
1728 SIR_MAC_CISCO_OUI_SIZE,
1729 ((tANI_U8 *)&pSmeJoinReq->bssDescription.ieFields) , ieLen);
1730
1731 if ( NULL != vendorIE )
1732 {
1733 limLog(pMac, LOGE,
1734 FL("DUT is trying to connect to Cisco AP"));
1735 psessionEntry->isCiscoVendorAP = TRUE;
1736 }
1737 else
1738 {
1739 psessionEntry->isCiscoVendorAP = FALSE;
1740 }
1741
Jeff Johnson295189b2012-06-20 16:38:30 -07001742 /* Copy the dot 11 mode in to the session table */
1743
1744 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1745 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001746#ifdef WLAN_FEATURE_11AC
1747 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001748 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001749 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001750 if (psessionEntry->vhtCapability )
1751 {
1752 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1753
1754 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001755 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001756 psessionEntry->txBFIniFeatureEnabled);
1757
1758 if( psessionEntry->txBFIniFeatureEnabled )
1759 {
1760 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1761 != eSIR_SUCCESS)
1762 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301763 limLog(pMac, LOGP, FL("could not set "
1764 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001765 retCode = eSIR_LOGP_EXCEPTION;
1766 goto end;
1767 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001768 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301769 "***__limProcessSmeJoinReq: txBFCsnValue=%d****",
1770 pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001771
1772 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001773 != eSIR_SUCCESS)
1774 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301775 limLog(pMac, LOGP, FL("could not set "
1776 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001777 retCode = eSIR_LOGP_EXCEPTION;
1778 goto end;
1779 }
1780 }
1781 }
1782
Jeff Johnsone7245742012-09-05 17:12:55 -07001783#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001784
1785 /*Phy mode*/
1786 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1787
1788 /* Copy The channel Id to the session Table */
1789 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001790 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1791 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1792 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001793
Chet Lanctot186b5732013-03-18 10:26:30 -07001794 /* Record if management frames need to be protected */
1795#ifdef WLAN_FEATURE_11W
1796 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1797 {
1798 psessionEntry->limRmfEnabled = 1;
1799 }
1800 else
1801 {
1802 psessionEntry->limRmfEnabled = 0;
1803 }
1804#endif
1805
krunal soni8d13b092013-07-19 13:23:29 -07001806#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1807 psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi;
1808#endif
1809
Jeff Johnson295189b2012-06-20 16:38:30 -07001810 /*Store Persona */
1811 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1812 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301813 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona,
1814 pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001815
1816 /* Copy the SSID from smejoinreq to session entry */
1817 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301818 vos_mem_copy( psessionEntry->ssId.ssId,
1819 pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length);
1820
1821 // Determin 11r or CCX connection based on input from SME
1822 // which inturn is dependent on the profile the user wants to connect
1823 // to, So input is coming from supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07001824#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301825 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001826#endif
1827#ifdef FEATURE_WLAN_CCX
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301828 psessionEntry->isCCXconnection = pSmeJoinReq->isCCXconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001829#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001830#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301831 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001832#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301833
Jeff Johnson43971f52012-07-17 12:26:56 -07001834#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301835 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
Jeff Johnson43971f52012-07-17 12:26:56 -07001836#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301837 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001838
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301839 if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001840 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301841 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1842 }
1843 else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1844 {
1845 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1846 }
1847 else
1848 {
1849 /* Throw an error and return and make sure to delete the session.*/
Abhishek Singh57aebef2014-02-03 18:47:44 +05301850 limLog(pMac, LOGE, FL("received SME_JOIN_REQ with invalid"
1851 " bss type %d"), psessionEntry->bssType);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301852 retCode = eSIR_SME_INVALID_PARAMETERS;
1853 goto end;
1854 }
1855
1856 if (pSmeJoinReq->addIEScan.length)
1857 {
1858 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan,
Jeff Johnson295189b2012-06-20 16:38:30 -07001859 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
1860 }
1861
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301862 if (pSmeJoinReq->addIEAssoc.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07001863 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301864 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc,
Jeff Johnson295189b2012-06-20 16:38:30 -07001865 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
1866 }
1867
Jeff Johnson295189b2012-06-20 16:38:30 -07001868 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301869 pMlmJoinReq = vos_mem_malloc(val);
1870 if ( NULL == pMlmJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001871 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301872 limLog(pMac, LOGP, FL("call to AllocateMemory "
1873 "failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001874 return;
1875 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301876 (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001877
1878 /* PE SessionId is stored as a part of JoinReq*/
1879 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
1880
1881 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
1882 != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001883 limLog(pMac, LOGP, FL("could not retrieve JoinFailureTimer value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001884
1885 /* copy operational rate from psessionEntry*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301886 vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001887 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301888 vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001889 sizeof(tSirMacRateSet));
1890 //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301891 vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001892 sizeof(tSirMacRateSet));
1893
1894 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
1895
Jeff Johnson295189b2012-06-20 16:38:30 -07001896 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
1897
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301898 vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001899 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
1900 psessionEntry->pLimJoinReq->bssDescription.length + 2);
1901
Jeff Johnson295189b2012-06-20 16:38:30 -07001902 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07001903 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001904
Jeff Johnsone7245742012-09-05 17:12:55 -07001905 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
1906 localPowerConstraint = regMax;
1907 limExtractApCapability( pMac,
1908 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
1909 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
1910 &psessionEntry->limCurrentBssQosCaps,
1911 &psessionEntry->limCurrentBssPropCap,
1912 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07001913 , &localPowerConstraint,
1914 psessionEntry
Jeff Johnsone7245742012-09-05 17:12:55 -07001915 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001916#ifdef FEATURE_WLAN_CCX
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001917 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07001918#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301919 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001920#endif
1921#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05301922 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d,"
1923 " max tx = %d", regMax, localPowerConstraint,
1924 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07001925#endif
1926
1927 if (pMac->lim.gLimCurrentBssUapsd)
1928 {
1929 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301930 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
1931 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07001932
1933 // resetting the dynamic uapsd mask
1934 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
1935 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
1936 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001937
1938 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
1939
1940 // Initialize 11h Enable Flag
1941 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
1942 {
1943 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001944 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 psessionEntry->lim11hEnable = val;
1946 }
1947 else
1948 psessionEntry->lim11hEnable = 0;
1949
1950 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
1951 pMac->lim.gLimIbssCoalescingHappened = false;
1952
Jeff Johnsone7245742012-09-05 17:12:55 -07001953 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
1954 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
1955 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001956
Abhishek Singh57aebef2014-02-03 18:47:44 +05301957 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
1958 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
1959 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
1960 psessionEntry->currentOperChannel,
1961 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07001962
1963 /* Indicate whether spectrum management is enabled*/
1964 psessionEntry->spectrumMgtEnabled =
1965 pSmeJoinReq->spectrumMgtIndicator;
1966 /* Issue LIM_MLM_JOIN_REQ to MLM */
1967 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
1968 return;
1969
1970 }
1971 else
1972 {
1973 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05301974 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
1975 "in state %X"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001976 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
1977 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1978 psessionEntry = NULL;
1979 goto end;
1980
1981 }
1982
1983end:
1984 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1985
1986 if(pSmeJoinReq)
1987 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301988 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001989 pSmeJoinReq = NULL;
1990 if (NULL != psessionEntry)
1991 {
1992 psessionEntry->pLimJoinReq = NULL;
1993 }
1994 }
1995
1996 if(retCode != eSIR_SME_SUCCESS)
1997 {
1998 if(NULL != psessionEntry)
1999 {
2000 peDeleteSession(pMac,psessionEntry);
2001 psessionEntry = NULL;
2002 }
2003 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05302004 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
2005 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07002006 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
2007} /*** end __limProcessSmeJoinReq() ***/
2008
2009
2010#ifdef FEATURE_WLAN_CCX
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08002011tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07002012{
2013 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302014 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002015 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
2017 maxTxPower = txPower;
2018 else if (txPower < MIN_TX_PWR_CAP)
2019 maxTxPower = MIN_TX_PWR_CAP;
2020 else
2021 maxTxPower = MAX_TX_PWR_CAP;
2022
2023 return (maxTxPower);
2024}
2025#endif
2026
Jeff Johnson295189b2012-06-20 16:38:30 -07002027/**
2028 * __limProcessSmeReassocReq()
2029 *
2030 *FUNCTION:
2031 * This function is called to process SME_REASSOC_REQ message
2032 * from HDD or upper layer application.
2033 *
2034 *LOGIC:
2035 *
2036 *ASSUMPTIONS:
2037 *
2038 *NOTE:
2039 *
2040 * @param pMac Pointer to Global MAC structure
2041 * @param *pMsgBuf A pointer to the SME message buffer
2042 * @return None
2043 */
2044
2045static void
2046__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2047{
2048 tANI_U16 caps;
2049 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002050 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002051 tLimMlmReassocReq *pMlmReassocReq;
2052 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2053 tpPESession psessionEntry = NULL;
2054 tANI_U8 sessionId;
2055 tANI_U8 smeSessionId;
2056 tANI_U16 transactionId;
2057 tPowerdBm localPowerConstraint = 0, regMax = 0;
2058 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002059 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002060
2061
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002062 PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002063
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002064 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302065 pReassocReq = vos_mem_malloc(nSize);
2066 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002067 {
2068 // Log error
2069 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302070 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002071
2072 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2073 goto end;
2074 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302075 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002076 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2077 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2078 (!limIsSmeJoinReqValid(pMac,
2079 (tpSirSmeJoinReq) pReassocReq)))
2080 {
2081 /// Received invalid eWNI_SME_REASSOC_REQ
2082 // Log the event
2083 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002084 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002085
2086 retCode = eSIR_SME_INVALID_PARAMETERS;
2087 goto end;
2088 }
2089
2090 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2091 {
2092 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002093 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002094 retCode = eSIR_SME_INVALID_PARAMETERS;
2095 goto end;
2096 }
2097
2098#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2099 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2100#endif //FEATURE_WLAN_DIAG_SUPPORT
2101 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2102
2103 /* Store the reassoc handle in the session Table.. 23rd sep review */
2104 psessionEntry->pLimReAssocReq = pReassocReq;
2105
2106 /**
2107 * Reassociate request is expected
2108 * in link established state only.
2109 */
2110
2111 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2112 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002113#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2115 {
2116 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002117 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002118 psessionEntry->peSessionId);
2119
2120 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302121 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2123 {
2124 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2125 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002126 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002127 retCode = eSIR_SME_INVALID_PARAMETERS;
2128 goto end;
2129 }
2130
2131 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2132 return;
2133 }
2134#endif
2135 /// Should not have received eWNI_SME_REASSOC_REQ
2136 // Log the event
2137 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002138 FL("received unexpected SME_REASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002139 psessionEntry->limSmeState);
2140 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2141
2142 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2143 goto end;
2144 }
2145
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302146 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002147 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2148 sizeof(tSirMacAddr));
2149
2150 psessionEntry->limReassocChannelId =
2151 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2152
Jeff Johnsone7245742012-09-05 17:12:55 -07002153 psessionEntry->reAssocHtSupportedChannelWidthSet =
2154 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2155 psessionEntry->reAssocHtRecommendedTxWidthSet =
2156 psessionEntry->reAssocHtSupportedChannelWidthSet;
2157 psessionEntry->reAssocHtSecondaryChannelOffset =
2158 psessionEntry->pLimReAssocReq->cbMode;
2159
Jeff Johnson295189b2012-06-20 16:38:30 -07002160 psessionEntry->limReassocBssCaps =
2161 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002162 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2163 localPowerConstraint = regMax;
2164 limExtractApCapability( pMac,
2165 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2166 limGetIElenFromBssDescription(
2167 &psessionEntry->pLimReAssocReq->bssDescription),
2168 &psessionEntry->limReassocBssQosCaps,
2169 &psessionEntry->limReassocBssPropCap,
2170 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002171 , &localPowerConstraint,
2172 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002173 );
2174
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302175 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002176#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302177 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2178 "= %d, max tx = %d", regMax, localPowerConstraint,
2179 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002180#endif
2181 {
2182 #if 0
2183 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2184 &cfgLen) != eSIR_SUCCESS)
2185 {
2186 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002187 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002188 }
2189 #endif//TO SUPPORT BT-AMP
2190
2191 /* Copy the SSID from sessio entry to local variable */
2192 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302193 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 psessionEntry->ssId.ssId,
2195 psessionEntry->ssId.length);
2196 #endif
2197 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302198 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2200
2201 }
2202
2203 if (pMac->lim.gLimCurrentBssUapsd)
2204 {
2205 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302206 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2207 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002208 }
2209
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302210 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2211 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 {
2213 // Log error
2214 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302215 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002216
2217 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2218 goto end;
2219 }
2220
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302221 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002222 psessionEntry->limReAssocbssId,
2223 sizeof(tSirMacAddr));
2224
2225 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2226 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2227 != eSIR_SUCCESS)
2228 {
2229 /**
2230 * Could not get ReassocFailureTimeout value
2231 * from CFG. Log error.
2232 */
2233 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002234 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 }
2236
2237 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2238 {
2239 /**
2240 * Could not get Capabilities value
2241 * from CFG. Log error.
2242 */
2243 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002244 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002245 }
2246 pMlmReassocReq->capabilityInfo = caps;
2247
2248 /* Update PE sessionId*/
2249 pMlmReassocReq->sessionId = sessionId;
2250
2251 /* If telescopic beaconing is enabled, set listen interval to
2252 WNI_CFG_TELE_BCN_MAX_LI */
2253 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2254 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002255 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002256
2257 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2258
2259 if(teleBcnEn)
2260 {
2261 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2262 eSIR_SUCCESS)
2263 {
2264 /**
2265 * Could not get ListenInterval value
2266 * from CFG. Log error.
2267 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002268 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002269 }
2270 }
2271 else
2272 {
2273 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2274 {
2275 /**
2276 * Could not get ListenInterval value
2277 * from CFG. Log error.
2278 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002279 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002280 }
2281 }
2282
2283 /* Delete all BA sessions before Re-Assoc.
2284 * BA frames are class 3 frames and the session
2285 * is lost upon disassociation and reassociation.
2286 */
2287
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07002288 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS);
Jeff Johnson295189b2012-06-20 16:38:30 -07002289
2290 pMlmReassocReq->listenInterval = (tANI_U16) val;
2291
2292 /* Indicate whether spectrum management is enabled*/
2293 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2294
2295 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2296 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2297
Jeff Johnsone7245742012-09-05 17:12:55 -07002298 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002299
2300 limPostMlmMessage(pMac,
2301 LIM_MLM_REASSOC_REQ,
2302 (tANI_U32 *) pMlmReassocReq);
2303 return;
2304
2305end:
2306 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302307 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002308
2309 if (psessionEntry)
2310 {
2311 // error occurred after we determined the session so extract
2312 // session and transaction info from there
2313 smeSessionId = psessionEntry->smeSessionId;
2314 transactionId = psessionEntry->transactionId;
2315 }
2316 else
2317 {
2318 // error occurred before or during the time we determined the session
2319 // so extract the session and transaction info from the message
2320 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2321 }
2322
2323 /// Send Reassoc failure response to host
2324 /// (note psessionEntry may be NULL, but that's OK)
2325 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2326 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2327 psessionEntry, smeSessionId, transactionId);
2328
2329} /*** end __limProcessSmeReassocReq() ***/
2330
2331
2332tANI_BOOLEAN sendDisassocFrame = 1;
2333/**
2334 * __limProcessSmeDisassocReq()
2335 *
2336 *FUNCTION:
2337 * This function is called to process SME_DISASSOC_REQ message
2338 * from HDD or upper layer application.
2339 *
2340 *LOGIC:
2341 *
2342 *ASSUMPTIONS:
2343 *
2344 *NOTE:
2345 *
2346 * @param pMac Pointer to Global MAC structure
2347 * @param *pMsgBuf A pointer to the SME message buffer
2348 * @return None
2349 */
2350
2351static void
2352__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2353{
2354 tANI_U16 disassocTrigger, reasonCode;
2355 tLimMlmDisassocReq *pMlmDisassocReq;
2356 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002357 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002358 tSirSmeDisassocReq smeDisassocReq;
2359 tpPESession psessionEntry = NULL;
2360 tANI_U8 sessionId;
2361 tANI_U8 smesessionId;
2362 tANI_U16 smetransactionId;
2363
Jeff Johnson295189b2012-06-20 16:38:30 -07002364
Jeff Johnson43971f52012-07-17 12:26:56 -07002365 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002366 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002367 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002368 return;
2369 }
2370
Jeff Johnson43971f52012-07-17 12:26:56 -07002371 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002372
Jeff Johnson43971f52012-07-17 12:26:56 -07002373 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002374
Jeff Johnson43971f52012-07-17 12:26:56 -07002375 if ( (eSIR_FAILURE == status) ||
2376 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002377 {
2378 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002379 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002380
2381 if (pMac->lim.gLimRspReqd)
2382 {
2383 pMac->lim.gLimRspReqd = false;
2384
2385 retCode = eSIR_SME_INVALID_PARAMETERS;
2386 disassocTrigger = eLIM_HOST_DISASSOC;
2387 goto sendDisassoc;
2388 }
2389
2390 return;
2391 }
2392
Jeff Johnson295189b2012-06-20 16:38:30 -07002393 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2394 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302395 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2396 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002397 retCode = eSIR_SME_INVALID_PARAMETERS;
2398 disassocTrigger = eLIM_HOST_DISASSOC;
2399 goto sendDisassoc;
2400
2401 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302402 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2403 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2404 smesessionId,psessionEntry->limSystemRole,
2405 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2406 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002407
2408#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2409 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2410#endif //FEATURE_WLAN_DIAG_SUPPORT
2411
2412 /* Update SME session Id and SME transaction ID*/
2413
2414 psessionEntry->smeSessionId = smesessionId;
2415 psessionEntry->transactionId = smetransactionId;
2416
2417 switch (psessionEntry->limSystemRole)
2418 {
2419 case eLIM_STA_ROLE:
2420 case eLIM_BT_AMP_STA_ROLE:
2421 switch (psessionEntry->limSmeState)
2422 {
2423 case eLIM_SME_ASSOCIATED_STATE:
2424 case eLIM_SME_LINK_EST_STATE:
2425 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2426 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002427#ifdef FEATURE_WLAN_TDLS
2428 /* Delete all TDLS peers connected before leaving BSS*/
2429 limDeleteTDLSPeers(pMac, psessionEntry);
2430#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002431 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302432 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2433 "limSmeState: %d "),psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002434 break;
2435
2436 case eLIM_SME_WT_DEAUTH_STATE:
2437 /* PE shall still process the DISASSOC_REQ and proceed with
2438 * link tear down even if it had already sent a DEAUTH_IND to
2439 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2440 * its been set when PE entered WT_DEAUTH_STATE.
2441 */
2442 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002443 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302444 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2445 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002446 break;
2447
2448 case eLIM_SME_WT_DISASSOC_STATE:
2449 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2450 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2451 * PE can continue processing DISASSOC_REQ and send the response instead
2452 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2453 * for disassoc frame.
2454 *
2455 * It will send a disassoc, which is ok. However, we can use the global flag
2456 * sendDisassoc to not send disassoc frame.
2457 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302458 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2459 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002460 break;
2461
2462 case eLIM_SME_JOIN_FAILURE_STATE: {
2463 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302464 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2465 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002466 if (pMac->lim.gLimRspReqd) {
2467 retCode = eSIR_SME_SUCCESS;
2468 disassocTrigger = eLIM_HOST_DISASSOC;
2469 goto sendDisassoc;
2470 }
2471 }break;
2472 default:
2473 /**
2474 * STA is not currently associated.
2475 * Log error and send response to host
2476 */
2477 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002478 FL("received unexpected SME_DISASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002479 psessionEntry->limSmeState);
2480 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2481
2482 if (pMac->lim.gLimRspReqd)
2483 {
2484 if (psessionEntry->limSmeState !=
2485 eLIM_SME_WT_ASSOC_STATE)
2486 pMac->lim.gLimRspReqd = false;
2487
2488 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2489 disassocTrigger = eLIM_HOST_DISASSOC;
2490 goto sendDisassoc;
2491 }
2492
2493 return;
2494 }
2495
2496 break;
2497
2498 case eLIM_AP_ROLE:
2499 case eLIM_BT_AMP_AP_ROLE:
2500 // Fall through
2501 break;
2502
2503 case eLIM_STA_IN_IBSS_ROLE:
2504 default: // eLIM_UNKNOWN_ROLE
2505 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002506 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002507 psessionEntry->limSystemRole);
2508
2509 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2510 disassocTrigger = eLIM_HOST_DISASSOC;
2511 goto sendDisassoc;
2512 } // end switch (pMac->lim.gLimSystemRole)
2513
2514 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2515 {
2516 /// Disassociation is triggered by Link Monitoring
Abhishek Singhcd09b562013-12-24 16:02:20 +05302517 limLog(pMac, LOG1, FL("**** Lost link with AP ****"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002518 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2519 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2520 }
2521 else
2522 {
2523 disassocTrigger = eLIM_HOST_DISASSOC;
2524 reasonCode = smeDisassocReq.reasonCode;
2525 }
2526
2527 if (smeDisassocReq.doNotSendOverTheAir)
2528 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302529 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002530 sendDisassocFrame = 0;
2531 }
2532 // Trigger Disassociation frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302533
2534 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2535 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002536 {
2537 // Log error
2538 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302539 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002540
2541 return;
2542 }
2543
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302544 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002545 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2546 sizeof(tSirMacAddr));
2547
2548 pMlmDisassocReq->reasonCode = reasonCode;
2549 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2550
2551 /* Update PE session ID*/
2552 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002553
2554 limPostMlmMessage(pMac,
2555 LIM_MLM_DISASSOC_REQ,
2556 (tANI_U32 *) pMlmDisassocReq);
2557 return;
2558
2559sendDisassoc:
2560 if (psessionEntry)
2561 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2562 retCode,
2563 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002564 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002565 else
2566 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2567 retCode,
2568 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002569 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002570
2571
2572} /*** end __limProcessSmeDisassocReq() ***/
2573
2574
2575/** -----------------------------------------------------------------
2576 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2577
2578 This function is called to process SME_DISASSOC_CNF message
2579 from HDD or upper layer application.
2580
2581 \param pMac - global mac structure
2582 \param pStaDs - station dph hash node
2583 \return none
2584 \sa
2585 ----------------------------------------------------------------- */
2586static void
2587__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2588{
2589 tSirSmeDisassocCnf smeDisassocCnf;
2590 tANI_U16 aid;
2591 tpDphHashNode pStaDs;
2592 tSirRetStatus status = eSIR_SUCCESS;
2593 tpPESession psessionEntry;
2594 tANI_U8 sessionId;
2595
2596
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002597 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002598
2599 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2600
2601 if (status == eSIR_FAILURE)
2602 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002603 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002604 return;
2605 }
2606
2607 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2608 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002609 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002610 return;
2611 }
2612
2613 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2614 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302615 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002616 return;
2617 }
2618
2619#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2620 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2621 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2622 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2623 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2624#endif //FEATURE_WLAN_DIAG_SUPPORT
2625
2626 switch (psessionEntry->limSystemRole)
2627 {
2628 case eLIM_STA_ROLE:
2629 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2630 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2631 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2632 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2633 {
2634 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002635 FL("received unexp SME_DISASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002636 psessionEntry->limSmeState);
2637 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2638 return;
2639 }
2640 break;
2641
2642 case eLIM_AP_ROLE:
2643 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002644 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002645
2646 case eLIM_STA_IN_IBSS_ROLE:
2647 default: // eLIM_UNKNOWN_ROLE
2648 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002649 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002650 psessionEntry->limSystemRole);
2651
2652 return;
2653 }
2654
2655
2656 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2657 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002658 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002659 )
2660 {
2661 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2662 if (pStaDs == NULL)
2663 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302664 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2665 "does not have context, addr= "MAC_ADDRESS_STR),
2666 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002667 return;
2668 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002669 /* Delete FT session if there exists one */
2670 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002671 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002672
2673 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002674 }
2675
2676 return;
2677}
2678
2679
2680/**
2681 * __limProcessSmeDeauthReq()
2682 *
2683 *FUNCTION:
2684 * This function is called to process SME_DEAUTH_REQ message
2685 * from HDD or upper layer application.
2686 *
2687 *LOGIC:
2688 *
2689 *ASSUMPTIONS:
2690 *
2691 *NOTE:
2692 *
2693 * @param pMac Pointer to Global MAC structure
2694 * @param *pMsgBuf A pointer to the SME message buffer
2695 * @return None
2696 */
2697
2698static void
2699__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2700{
2701 tANI_U16 deauthTrigger, reasonCode;
2702 tLimMlmDeauthReq *pMlmDeauthReq;
2703 tSirSmeDeauthReq smeDeauthReq;
2704 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2705 tSirRetStatus status = eSIR_SUCCESS;
2706 tpPESession psessionEntry;
2707 tANI_U8 sessionId; //PE sessionId
2708 tANI_U8 smesessionId;
2709 tANI_U16 smetransactionId;
2710
Jeff Johnson295189b2012-06-20 16:38:30 -07002711
2712 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002713 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2714
2715 //We need to get a session first but we don't even know if the message is correct.
2716 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2717 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002718 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002719 retCode = eSIR_SME_INVALID_PARAMETERS;
2720 deauthTrigger = eLIM_HOST_DEAUTH;
2721 goto sendDeauth;
2722
2723 }
2724
2725 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2726 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002727 PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002728 if (pMac->lim.gLimRspReqd)
2729 {
2730 pMac->lim.gLimRspReqd = false;
2731
2732 retCode = eSIR_SME_INVALID_PARAMETERS;
2733 deauthTrigger = eLIM_HOST_DEAUTH;
2734 goto sendDeauth;
2735 }
2736
2737 return;
2738 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302739 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2740 "Systemrole %d with reasoncode %u in limSmestate %d from "
2741 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2742 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2743 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002744#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2745 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2746#endif //FEATURE_WLAN_DIAG_SUPPORT
2747
2748 /* Update SME session ID and Transaction ID */
2749 psessionEntry->smeSessionId = smesessionId;
2750 psessionEntry->transactionId = smetransactionId;
2751
2752
2753 switch (psessionEntry->limSystemRole)
2754 {
2755 case eLIM_STA_ROLE:
2756 case eLIM_BT_AMP_STA_ROLE:
2757
2758 switch (psessionEntry->limSmeState)
2759 {
2760 case eLIM_SME_ASSOCIATED_STATE:
2761 case eLIM_SME_LINK_EST_STATE:
2762 case eLIM_SME_WT_ASSOC_STATE:
2763 case eLIM_SME_JOIN_FAILURE_STATE:
2764 case eLIM_SME_IDLE_STATE:
2765 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2766 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002767 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002768
2769 // Send Deauthentication request to MLM below
2770
2771 break;
2772
2773 default:
2774 /**
2775 * STA is not in a state to deauthenticate with
2776 * peer. Log error and send response to host.
2777 */
2778 limLog(pMac, LOGE,
Abhishek Singhcd09b562013-12-24 16:02:20 +05302779 FL("received unexp SME_DEAUTH_REQ in state %X"),
2780 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002781 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2782
2783 if (pMac->lim.gLimRspReqd)
2784 {
2785 pMac->lim.gLimRspReqd = false;
2786
2787 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2788 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08002789 /**
2790 *here we received deauth request from AP so sme state is
2791 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
2792 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
2793 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
2794 so the below condition captures the state where delSta
2795 not done and firmware still in connected state.
2796 */
2797 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
2798 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
2799 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
2800 {
2801 retCode = eSIR_SME_DEAUTH_STATUS;
2802 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002803 goto sendDeauth;
2804 }
2805
2806 return;
2807 }
2808
2809 break;
2810
2811 case eLIM_STA_IN_IBSS_ROLE:
2812
2813 return;
2814
2815 case eLIM_AP_ROLE:
2816 // Fall through
2817
2818 break;
2819
2820 default:
2821 limLog(pMac, LOGE,
Abhishek Singhcd09b562013-12-24 16:02:20 +05302822 FL("received unexpected SME_DEAUTH_REQ for role %X"),
2823 psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07002824
2825 return;
2826 } // end switch (pMac->lim.gLimSystemRole)
2827
2828 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
2829 {
2830 /// Deauthentication is triggered by Link Monitoring
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002831 PELOG1(limLog(pMac, LOG1, FL("**** Lost link with AP ****"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002832 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
2833 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
2834 }
2835 else
2836 {
2837 deauthTrigger = eLIM_HOST_DEAUTH;
2838 reasonCode = smeDeauthReq.reasonCode;
2839 }
2840
2841 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302842 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
2843 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002844 {
2845 // Log error
2846 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302847 FL("call to AllocateMemory failed for mlmDeauthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002848
2849 return;
2850 }
2851
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302852 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002853 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
2854 sizeof(tSirMacAddr));
2855
2856 pMlmDeauthReq->reasonCode = reasonCode;
2857 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07002858
2859 /* Update PE session Id*/
2860 pMlmDeauthReq->sessionId = sessionId;
2861
2862 limPostMlmMessage(pMac,
2863 LIM_MLM_DEAUTH_REQ,
2864 (tANI_U32 *) pMlmDeauthReq);
2865 return;
2866
2867sendDeauth:
2868 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
2869 retCode,
2870 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002871 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002872 smesessionId, smetransactionId);
2873} /*** end __limProcessSmeDeauthReq() ***/
2874
2875
2876
2877/**
2878 * __limProcessSmeSetContextReq()
2879 *
2880 *FUNCTION:
2881 * This function is called to process SME_SETCONTEXT_REQ message
2882 * from HDD or upper layer application.
2883 *
2884 *LOGIC:
2885 *
2886 *ASSUMPTIONS:
2887 *
2888 *NOTE:
2889 *
2890 * @param pMac Pointer to Global MAC structure
2891 * @param *pMsgBuf A pointer to the SME message buffer
2892 * @return None
2893 */
2894
2895static void
2896__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2897{
2898 tpSirSmeSetContextReq pSetContextReq;
2899 tLimMlmSetKeysReq *pMlmSetKeysReq;
2900 tpPESession psessionEntry;
2901 tANI_U8 sessionId; //PE sessionID
2902 tANI_U8 smesessionId;
2903 tANI_U16 smetransactionId;
2904
2905
2906 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002907 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07002908
2909
2910 if(pMsgBuf == NULL)
2911 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002912 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002913 return;
2914 }
2915
2916 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302917
2918 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
2919 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002920 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302921 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002922 return;
2923 }
2924
2925 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2926 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
2927 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002928 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002929 goto end;
2930 }
2931
2932 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2933 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002934 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 -07002935 limSendSmeSetContextRsp(pMac,
2936 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002937 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 eSIR_SME_INVALID_PARAMETERS,NULL,
2939 smesessionId,smetransactionId);
2940
2941 goto end;
2942 }
2943
2944
2945 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
2946 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002947 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002948 limSendSmeSetContextRsp(pMac,
2949 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002950 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002951 eSIR_SME_INVALID_PARAMETERS,NULL,
2952 smesessionId,smetransactionId);
2953
2954 goto end;
2955 }
2956
2957#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2958 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
2959#endif //FEATURE_WLAN_DIAG_SUPPORT
2960
2961
2962 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2963 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
2964 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
2965 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
2966 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
2967 {
2968 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302969 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
2970 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002971 {
2972 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302973 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002974 goto end;
2975 }
2976
2977 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
2978 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
2979 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2980 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002981 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002982 goto end;
2983 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302984 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002985 (tANI_U8 *) &pSetContextReq->peerMacAddr,
2986 sizeof(tSirMacAddr));
2987
Jeff Johnson295189b2012-06-20 16:38:30 -07002988
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302989 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07002990 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
2991 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
2992
2993 pMlmSetKeysReq->sessionId = sessionId;
2994#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
2995 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002996 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07002997#endif
2998
Jeff Johnson295189b2012-06-20 16:38:30 -07002999 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
3000 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
3001 {
3002 if(pSetContextReq->keyMaterial.key[0].keyLength)
3003 {
3004 tANI_U8 keyId;
3005 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303006 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07003007 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
3008 }
3009 else {
3010 tANI_U32 i;
3011 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
3012 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303013 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07003014 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
3015 }
3016 }
3017 }
Jeff Johnson295189b2012-06-20 16:38:30 -07003018
3019 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003020 }
3021 else
3022 {
3023 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003024 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003025 psessionEntry->limSystemRole,
3026 psessionEntry->limSmeState);
3027 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3028
3029 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003030 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07003031 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3032 smesessionId,
3033 smetransactionId);
3034 }
3035
3036end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303037 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003038 return;
3039} /*** end __limProcessSmeSetContextReq() ***/
3040
3041/**
3042 * __limProcessSmeRemoveKeyReq()
3043 *
3044 *FUNCTION:
3045 * This function is called to process SME_REMOVEKEY_REQ message
3046 * from HDD or upper layer application.
3047 *
3048 *LOGIC:
3049 *
3050 *ASSUMPTIONS:
3051 *
3052 *NOTE:
3053 *
3054 * @param pMac Pointer to Global MAC structure
3055 * @param *pMsgBuf A pointer to the SME message buffer
3056 * @return None
3057 */
3058
3059static void
3060__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3061{
3062 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3063 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3064 tpPESession psessionEntry;
3065 tANI_U8 sessionId; //PE sessionID
3066 tANI_U8 smesessionId;
3067 tANI_U16 smetransactionId;
3068
3069 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003070 FL("received REMOVEKEY_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003071
3072 if(pMsgBuf == NULL)
3073 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003074 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003075 return;
3076 }
3077
3078
3079 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3080
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303081 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3082 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003083 {
3084 //Log error
3085 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303086 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003087
3088 return;
3089 }
3090
3091 if ((limRemoveKeyReqSerDes(pMac,
3092 pRemoveKeyReq,
3093 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3094 {
3095 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003096 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003097
3098 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3099
3100 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3101 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003102 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003103 //goto end;
3104 }
3105
3106 limSendSmeRemoveKeyRsp(pMac,
3107 pRemoveKeyReq->peerMacAddr,
3108 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3109 smesessionId,smetransactionId);
3110
3111 goto end;
3112 }
3113
3114 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3115 {
3116 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003117 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003118 limSendSmeRemoveKeyRsp(pMac,
3119 pRemoveKeyReq->peerMacAddr,
3120 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3121 smesessionId, smetransactionId);
3122 goto end;
3123 }
3124
3125
3126 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3127 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3128 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3129 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3130 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3131 {
3132 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303133 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3134 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003135 {
3136 // Log error
3137 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303138 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003139
3140 goto end;
3141 }
3142
3143 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3144 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3145 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3146 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3147
3148 /* Update PE session Id */
3149 pMlmRemoveKeyReq->sessionId = sessionId;
3150
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303151 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003152 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3153 sizeof(tSirMacAddr));
3154
3155
3156 limPostMlmMessage(pMac,
3157 LIM_MLM_REMOVEKEY_REQ,
3158 (tANI_U32 *) pMlmRemoveKeyReq);
3159 }
3160 else
3161 {
3162 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003163 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003164 psessionEntry->limSystemRole,
3165 psessionEntry->limSmeState);
3166 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3167
3168 limSendSmeRemoveKeyRsp(pMac,
3169 pRemoveKeyReq->peerMacAddr,
3170 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3171 smesessionId,smetransactionId);
3172 }
3173
3174end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303175 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003176} /*** end __limProcessSmeRemoveKeyReq() ***/
3177
Jeff Johnson295189b2012-06-20 16:38:30 -07003178void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3179{
3180 tSirMsgQ mmhMsg;
3181 tpSmeGetScanChnRsp pSirSmeRsp;
3182 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303183 tANI_U8 sessionId;
3184 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003185
3186 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3187 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003188 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003189 pMac->lim.scanChnInfo.numChnInfo);
3190 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3191 }
3192
3193 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003194 FL("Sending message %s with number of channels %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003195 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);)
3196
3197 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303198 pSirSmeRsp = vos_mem_malloc(len);
3199 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003200 {
3201 /// Buffer not available. Log error
3202 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303203 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003204
3205 return;
3206 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303207 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003208
Jeff Johnson295189b2012-06-20 16:38:30 -07003209 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3210 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303211
3212 if (pMac->fScanOffload)
3213 {
3214 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3215 pSirSmeRsp->sessionId = sessionId;
3216 }
3217 else
3218 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003219
3220 if(pMac->lim.scanChnInfo.numChnInfo)
3221 {
3222 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303223 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3224 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003225 }
3226 //Clear the list
3227 limRessetScanChannelInfo(pMac);
3228
3229 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3230 mmhMsg.bodyptr = pSirSmeRsp;
3231 mmhMsg.bodyval = 0;
3232
3233 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003234 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003235 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3236}
3237
3238
Jeff Johnson295189b2012-06-20 16:38:30 -07003239void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3240{
3241 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3242 tpDphHashNode pStaDs = NULL;
3243 tpPESession psessionEntry = NULL;
3244 tSap_Event sapEvent;
3245 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3246 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3247 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3248 tANI_U8 assocId = 0;
3249 tANI_U8 staCount = 0;
3250
3251 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3252 {
3253 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003254 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003255 goto limAssocStaEnd;
3256 }
3257
3258 switch (getAssocSTAsReq.modId)
3259 {
3260/**
3261 case VOS_MODULE_ID_HAL:
3262 wdaPostCtrlMsg( pMac, &msgQ );
3263 return;
3264
3265 case VOS_MODULE_ID_TL:
3266 Post msg TL
3267 return;
3268*/
3269 case VOS_MODULE_ID_PE:
3270 default:
3271 break;
3272 }
3273
Jeff Johnson1250df42012-12-10 14:31:52 -08003274 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003275 // Find PE session Entry
3276 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3277 {
3278 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003279 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003280 goto limAssocStaEnd;
3281 }
3282
3283 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3284 {
3285 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003286 FL("Received unexpected message in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303287 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003288 goto limAssocStaEnd;
3289 }
3290
3291 // Retrieve values obtained in the request message
3292 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3293 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3294
3295 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3296 {
3297 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3298
3299 if (NULL == pStaDs)
3300 continue;
3301
3302 if (pStaDs->valid)
3303 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303304 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3305 (tANI_U8 *)&pStaDs->staAddr,
3306 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003307 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3308 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3309
Kiet Lamb1233192013-11-28 13:38:20 +05303310 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003311 (tANI_U8 *)&pStaDs->supportedRates,
3312 sizeof(tSirSupportedRates));
3313 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3314 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3315 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3316
Jeff Johnson295189b2012-06-20 16:38:30 -07003317 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003318 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3319 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003320 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3321 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3322
3323 pAssocStasTemp++;
3324 staCount++;
3325 }
3326 }
3327
3328limAssocStaEnd:
3329 // Call hdd callback with sap event to send the list of associated stations from PE
3330 if (pSapEventCallback != NULL)
3331 {
3332 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3333 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3334 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3335 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3336 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3337 }
3338}
3339
3340
3341/**
3342 * limProcessSmeGetWPSPBCSessions
3343 *
3344 *FUNCTION:
3345 * This function is called when query the WPS PBC overlap message is received
3346 *
3347 *LOGIC:
3348 * This function parses get WPS PBC overlap information message and call callback to pass
3349 * WPS PBC overlap information back to hdd.
3350 *ASSUMPTIONS:
3351 *
3352 *
3353 *NOTE:
3354 *
3355 * @param pMac Pointer to Global MAC structure
3356 * @param pMsgBuf A pointer to WPS PBC overlap query message
3357*
3358 * @return None
3359 */
3360void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3361{
3362 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3363 tpPESession psessionEntry = NULL;
3364 tSap_Event sapEvent;
3365 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3366 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3367 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3368
3369 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3370
3371 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3372 {
3373 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003374 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003375 goto limGetWPSPBCSessionsEnd;
3376 }
3377
Jeff Johnson1250df42012-12-10 14:31:52 -08003378 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003379 // Find PE session Entry
3380 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3381 {
3382 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003383 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003384 goto limGetWPSPBCSessionsEnd;
3385 }
3386
3387 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3388 {
3389 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003390 FL("Received unexpected message in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003391 psessionEntry->limSystemRole);
3392 goto limGetWPSPBCSessionsEnd;
3393 }
3394
Jeff Johnson1250df42012-12-10 14:31:52 -08003395 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003396 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3397 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3398
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303399 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 { //This is GetWpsSession call
3401
3402 limGetWPSPBCSessions(pMac,
3403 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3404 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3405 }
3406 else
3407 {
3408 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3409 /* don't have to inform the HDD/Host */
3410 return;
3411 }
3412
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003413 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003414 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3415
3416 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3417
3418limGetWPSPBCSessionsEnd:
3419 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
3420 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
3421}
3422
Jeff Johnson295189b2012-06-20 16:38:30 -07003423
3424
3425/**
3426 * __limCounterMeasures()
3427 *
3428 * FUNCTION:
3429 * This function is called to "implement" MIC counter measure
3430 * and is *temporary* only
3431 *
3432 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3433 * we don't do the proper STA disassoc sequence since the
3434 * BSS will be stoped anyway
3435 *
3436 *ASSUMPTIONS:
3437 *
3438 *NOTE:
3439 *
3440 * @param pMac Pointer to Global MAC structure
3441 * @return None
3442 */
3443
3444static void
3445__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3446{
3447 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3448 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
3449 || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
3450
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003451 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003452
Jeff Johnson295189b2012-06-20 16:38:30 -07003453};
3454
3455
Jeff Johnson295189b2012-06-20 16:38:30 -07003456void
3457limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3458{
3459 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3460 tpPESession psessionEntry;
3461 tANI_U8 sessionId; //PE sessionId
3462
3463 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3464 {
3465 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003466 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003467 return;
3468 }
3469
3470 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3471 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003472 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003473 return;
3474 }
3475
3476 if ( tkipCntrMeasReq.bEnable )
3477 {
3478 __limCounterMeasures( pMac, psessionEntry );
3479 }
3480
3481 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3482}
Jeff Johnson295189b2012-06-20 16:38:30 -07003483
3484
3485static void
3486__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3487{
3488 tSirSmeStopBssReq stopBssReq;
3489 tSirRetStatus status;
3490 tLimSmeStates prevState;
3491 tANI_U8 sessionId; //PE sessionId
3492 tpPESession psessionEntry;
3493 tANI_U8 smesessionId;
3494 tANI_U16 smetransactionId;
3495
3496 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3497
3498
3499
3500 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3501 !limIsSmeStopBssReqValid(pMsgBuf))
3502 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003503 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003504 /// Send Stop BSS response to host
3505 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3506 return;
3507 }
3508
3509
3510 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3511 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003512 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003513 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3514 return;
3515 }
3516
3517#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3518 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3519#endif //FEATURE_WLAN_DIAG_SUPPORT
3520
3521
3522 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3523 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3524 {
3525 /**
3526 * Should not have received STOP_BSS_REQ in states
3527 * other than 'normal' state or on STA in Infrastructure
3528 * mode. Log error and return response to host.
3529 */
3530 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003531 FL("received unexpected SME_STOP_BSS_REQ in state %X, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003532 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3533 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3534 /// Send Stop BSS response to host
3535 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3536 return;
3537 }
3538
Jeff Johnson295189b2012-06-20 16:38:30 -07003539 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3540 {
3541 limWPSPBCClose(pMac, psessionEntry);
3542 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003543 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003544
3545 prevState = psessionEntry->limSmeState;
3546
3547 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003548 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003549
3550 /* Update SME session Id and Transaction Id */
3551 psessionEntry->smeSessionId = smesessionId;
3552 psessionEntry->transactionId = smetransactionId;
3553
3554 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame */
3555 if ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) && (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3556 {
3557 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3558 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3559 // Send disassoc all stations associated thru TKIP
3560 __limCounterMeasures(pMac,psessionEntry);
3561 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303562 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003563 }
3564
3565 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3566 pMac->lim.gLimIbssCoalescingHappened = false;
3567
3568 /* send a delBss to HAL and wait for a response */
3569 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3570
3571 if (status != eSIR_SUCCESS)
3572 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003573 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003574 psessionEntry->limSmeState= prevState;
3575
Jeff Johnsone7245742012-09-05 17:12:55 -07003576 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003577
3578 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3579 }
3580}
3581
3582
3583/**--------------------------------------------------------------
3584\fn __limProcessSmeStopBssReq
3585
3586\brief Wrapper for the function __limHandleSmeStopBssRequest
3587 This message will be defered until softmac come out of
3588 scan mode. Message should be handled even if we have
3589 detected radar in the current operating channel.
3590\param pMac
3591\param pMsg
3592
3593\return TRUE - If we consumed the buffer
3594 FALSE - If have defered the message.
3595 ---------------------------------------------------------------*/
3596static tANI_BOOLEAN
3597__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3598{
3599 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3600 {
3601 /**
3602 * If message defered, buffer is not consumed yet.
3603 * So return false
3604 */
3605 return eANI_BOOLEAN_FALSE;
3606 }
3607 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3608 return eANI_BOOLEAN_TRUE;
3609} /*** end __limProcessSmeStopBssReq() ***/
3610
3611
3612void limProcessSmeDelBssRsp(
3613 tpAniSirGlobal pMac,
3614 tANI_U32 body,tpPESession psessionEntry)
3615{
3616
3617 (void) body;
3618 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3619 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003620 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003621 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3622 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003623 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3624 return;
3625}
3626
3627
Jeff Johnson295189b2012-06-20 16:38:30 -07003628/**---------------------------------------------------------------
3629\fn __limProcessSmeAssocCnfNew
3630\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3631\ in BTAMP AP.
3632\
3633\param pMac
3634\param msgType - message type
3635\param pMsgBuf - a pointer to the SME message buffer
3636\return None
3637------------------------------------------------------------------*/
3638
3639 void
3640__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3641{
3642 tSirSmeAssocCnf assocCnf;
3643 tpDphHashNode pStaDs = NULL;
3644 tpPESession psessionEntry= NULL;
3645 tANI_U8 sessionId;
3646
3647
3648 if(pMsgBuf == NULL)
3649 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003650 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003651 goto end;
3652 }
3653
3654 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3655 !__limIsSmeAssocCnfValid(&assocCnf))
3656 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003657 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003658 goto end;
3659 }
3660
3661 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3662 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003663 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003664 goto end;
3665 }
3666
3667 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3668 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3669 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003670 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303671 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003672 goto end;
3673 }
3674
3675 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3676
3677 if (pStaDs == NULL)
3678 {
3679 limLog(pMac, LOG1,
3680 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
3681 msgType, assocCnf.aid);
3682 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3683
3684 /*
3685 ** send a DISASSOC_IND message to WSM to make sure
3686 ** the state in WSM and LIM is the same
3687 **/
3688 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3689 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3690 goto end;
3691 }
3692 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303693 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003694 (tANI_U8 *) assocCnf.peerMacAddr,
3695 sizeof(tSirMacAddr)) ) ||
3696 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3697 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3698 (msgType != eWNI_SME_ASSOC_CNF)) ||
3699 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003700 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003701 {
3702 limLog(pMac, LOG1,
3703 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
3704 msgType, assocCnf.aid);
3705 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3706 goto end;
3707 }
3708
3709 /*
3710 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3711 ** has been received
3712 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003713 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003714 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3715
3716 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3717 {
3718 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3719 * when it had received Assoc Request frame. Now, PE just needs to send
3720 * Association Response frame to the requesting BTAMP-STA.
3721 */
3722 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003723 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003724 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3725 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3726 goto end;
3727 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3728 else
3729 {
3730 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3731 /*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*/
3732 if(!pStaDs->mlmStaContext.updateContext)
3733 pStaDs->mlmStaContext.updateContext = 1;
3734 limRejectAssociation(pMac, pStaDs->staAddr,
3735 pStaDs->mlmStaContext.subType,
3736 true, pStaDs->mlmStaContext.authType,
3737 pStaDs->assocId, true,
3738 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003739 }
3740
3741end:
3742 if((psessionEntry != NULL) && (pStaDs != NULL))
3743 {
3744 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3745 {
3746 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3747 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303748 vos_mem_free(((tpSirAssocReq)
3749 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07003750 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
3751 }
3752
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303753 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003754 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
3755 }
3756 }
3757
3758} /*** end __limProcessSmeAssocCnfNew() ***/
3759
3760
Jeff Johnson295189b2012-06-20 16:38:30 -07003761
3762
3763static void
3764__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3765{
3766 tpDphHashNode pStaDs;
3767 tSirMacAddr peerMac;
3768 tpSirAddtsReq pSirAddts;
3769 tANI_U32 timeout;
3770 tpPESession psessionEntry;
3771 tANI_U8 sessionId; //PE sessionId
3772 tANI_U8 smesessionId;
3773 tANI_U16 smetransactionId;
3774
3775
3776 if(pMsgBuf == NULL)
3777 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003778 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003779 return;
3780 }
3781
3782 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3783
3784 pSirAddts = (tpSirAddtsReq) pMsgBuf;
3785
3786 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
3787 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003788 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003789 return;
3790 }
3791#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3792 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
3793#endif //FEATURE_WLAN_DIAG_SUPPORT
3794
3795
3796
3797 /* if sta
3798 * - verify assoc state
3799 * - send addts request to ap
3800 * - wait for addts response from ap
3801 * if ap, just ignore with error log
3802 */
3803 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003804 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003805 pSirAddts->req.tspec.tsinfo.traffic.tsid,
3806 pSirAddts->req.tspec.tsinfo.traffic.userPrio);)
3807
3808 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
3809 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003810 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003811 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3812 smesessionId,smetransactionId);
3813 return;
3814 }
3815
3816 //Ignore the request if STA is in 11B mode.
3817 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
3818 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003819 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003820 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3821 smesessionId,smetransactionId);
3822 return;
3823 }
3824
3825
3826 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3827
3828 if(pStaDs == NULL)
3829 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003830 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003831 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3832 smesessionId,smetransactionId);
3833 return;
3834 }
3835
3836 if ((! pStaDs->valid) ||
3837 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
3838 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003839 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003840 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3841 smesessionId,smetransactionId);
3842 return;
3843 }
3844
3845 pSirAddts->req.wsmTspecPresent = 0;
3846 pSirAddts->req.wmeTspecPresent = 0;
3847 pSirAddts->req.lleTspecPresent = 0;
3848
3849 if ((pStaDs->wsmEnabled) &&
3850 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
3851 pSirAddts->req.wsmTspecPresent = 1;
3852 else if (pStaDs->wmeEnabled)
3853 pSirAddts->req.wmeTspecPresent = 1;
3854 else if (pStaDs->lleEnabled)
3855 pSirAddts->req.lleTspecPresent = 1;
3856 else
3857 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003858 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003859 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3860 smesessionId,smetransactionId);
3861 return;
3862 }
3863
3864 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
3865 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
3866 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003867 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07003868 psessionEntry->limSmeState);
3869 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3870 smesessionId,smetransactionId);
3871 return;
3872 }
3873
3874 if (pMac->lim.gLimAddtsSent)
3875 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003876 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07003877 pMac->lim.gLimAddtsReq.req.dialogToken,
3878 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
3879 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
3880 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3881 smesessionId,smetransactionId);
3882 return;
3883 }
3884
3885 #if 0
3886 val = sizeof(tSirMacAddr);
3887 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
3888 {
3889 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003890 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003891 return;
3892 }
3893 #endif
3894 sirCopyMacAddr(peerMac,psessionEntry->bssId);
3895
3896 // save the addts request
3897 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303898 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07003899
3900 // ship out the message now
3901 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
3902 psessionEntry);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003903 PELOG1(limLog(pMac, LOG1, "Sent ADDTS request");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003904
3905 // start a timer to wait for the response
3906 if (pSirAddts->timeout)
3907 timeout = pSirAddts->timeout;
3908 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
3909 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003910 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003911 WNI_CFG_ADDTS_RSP_TIMEOUT);
3912 return;
3913 }
3914
3915 timeout = SYS_MS_TO_TICKS(timeout);
3916 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
3917 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003918 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003919 return;
3920 }
3921 pMac->lim.gLimAddtsRspTimerCount++;
3922 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
3923 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
3924 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003925 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003926 return;
3927 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003928 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003929
3930 //add the sessionId to the timer object
3931 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
3932 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
3933 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003934 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003935 return;
3936 }
3937 return;
3938}
3939
3940
3941static void
3942__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3943{
3944 tSirMacAddr peerMacAddr;
3945 tANI_U8 ac;
3946 tSirMacTSInfo *pTsinfo;
3947 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
3948 tpDphHashNode pStaDs = NULL;
3949 tpPESession psessionEntry;
3950 tANI_U8 sessionId;
3951 tANI_U32 status = eSIR_SUCCESS;
3952 tANI_U8 smesessionId;
3953 tANI_U16 smetransactionId;
3954
3955 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3956
3957 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
3958 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003959 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003960 status = eSIR_FAILURE;
3961 goto end;
3962 }
3963#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3964 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
3965#endif //FEATURE_WLAN_DIAG_SUPPORT
3966
3967
3968 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
3969 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003970 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003971 status = eSIR_FAILURE;
3972 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
3973 return;
3974 }
3975
Arif Hussaina7c8e412013-11-20 11:06:42 -08003976 PELOG1(limLog(pMac, LOG1, FL("Sent DELTS request to station with "
3977 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
3978 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003979
3980 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
3981 psessionEntry);
3982
3983 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
3984
3985 /* We've successfully send DELTS frame to AP. Update the
3986 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
3987 * is no longer trigger enabled or delivery enabled
3988 */
3989 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
3990
3991 /* We're deleting the TSPEC, so this particular AC is no longer
3992 * admitted. PE needs to downgrade the EDCA
3993 * parameters(for the AC for which TS is being deleted) to the
3994 * next best AC for which ACM is not enabled, and send the
3995 * updated values to HAL.
3996 */
3997 ac = upToAc(pTsinfo->traffic.userPrio);
3998
3999 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4000 {
4001 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4002 }
4003 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4004 {
4005 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4006 }
4007 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4008 {
4009 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4010 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4011 }
4012
4013 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4014
4015 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4016 if (pStaDs != NULL)
4017 {
4018 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4019 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4020 else
4021 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4022 status = eSIR_SUCCESS;
4023 }
4024 else
4025 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004026 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07004027 status = eSIR_FAILURE;
4028 }
4029#ifdef FEATURE_WLAN_CCX
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004030#ifdef FEATURE_WLAN_CCX_UPLOAD
4031 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
4032#else
Jeff Johnson295189b2012-06-20 16:38:30 -07004033 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004034#endif /* FEATURE_WLAN_CCX_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07004035#endif
4036
4037 // send an sme response back
4038 end:
4039 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4040}
4041
4042
4043void
4044limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4045{
4046 //fetch the sessionEntry based on the sessionId
4047 tpPESession psessionEntry;
4048 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4049 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004050 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004051 return;
4052 }
4053
4054 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4055 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004056 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004057 pMac->lim.gLimAddtsSent = false;
4058 return;
4059 }
4060
4061 if (! pMac->lim.gLimAddtsSent)
4062 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004063 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004064 return;
4065 }
4066
4067 if (param != pMac->lim.gLimAddtsRspTimerCount)
4068 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004069 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004070 param, pMac->lim.gLimAddtsRspTimerCount);
4071 return;
4072 }
4073
4074 // this a real response timeout
4075 pMac->lim.gLimAddtsSent = false;
4076 pMac->lim.gLimAddtsRspTimerCount++;
4077
4078 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4079 psessionEntry->smeSessionId, psessionEntry->transactionId);
4080}
4081
4082
4083/**
4084 * __limProcessSmeStatsRequest()
4085 *
4086 *FUNCTION:
4087 *
4088 *
4089 *NOTE:
4090 *
4091 * @param pMac Pointer to Global MAC structure
4092 * @param *pMsgBuf A pointer to the SME message buffer
4093 * @return None
4094 */
4095static void
4096__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4097{
4098 tpAniGetStatsReq pStatsReq;
4099 tSirMsgQ msgQ;
4100 tpPESession psessionEntry;
4101 tANI_U8 sessionId;
4102
4103
4104 if(pMsgBuf == NULL)
4105 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004106 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 return;
4108 }
4109
4110 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4111
4112 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4113 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004114 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304115 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004116 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004117 return;
4118 }
4119
4120
4121
4122 switch(pStatsReq->msgType)
4123 {
4124 //Add Lim stats here. and send reqsponse.
4125
4126 //HAL maintained Stats.
4127 case eWNI_SME_STA_STAT_REQ:
4128 msgQ.type = WDA_STA_STAT_REQ;
4129 break;
4130 case eWNI_SME_AGGR_STAT_REQ:
4131 msgQ.type = WDA_AGGR_STAT_REQ;
4132 break;
4133 case eWNI_SME_GLOBAL_STAT_REQ:
4134 msgQ.type = WDA_GLOBAL_STAT_REQ;
4135 break;
4136 case eWNI_SME_STAT_SUMM_REQ:
4137 msgQ.type = WDA_STAT_SUMM_REQ;
4138 break;
4139 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004140 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304141 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004142 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004143 return;
4144 }
4145
Jeff Johnson295189b2012-06-20 16:38:30 -07004146 msgQ.reserved = 0;
4147 msgQ.bodyptr = pMsgBuf;
4148 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004149 if(NULL == psessionEntry)
4150 {
4151 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4152 }
4153 else
4154 {
4155 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4156 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004157 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004158 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304159 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004160 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004161 return;
4162 }
4163
4164 return;
4165}
4166
4167
4168/**
4169 * __limProcessSmeGetStatisticsRequest()
4170 *
4171 *FUNCTION:
4172 *
4173 *
4174 *NOTE:
4175 *
4176 * @param pMac Pointer to Global MAC structure
4177 * @param *pMsgBuf A pointer to the SME message buffer
4178 * @return None
4179 */
4180static void
4181__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4182{
4183 tpAniGetPEStatsReq pPEStatsReq;
4184 tSirMsgQ msgQ;
4185
4186 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4187
4188 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4189
4190 msgQ.type = WDA_GET_STATISTICS_REQ;
4191
Jeff Johnson295189b2012-06-20 16:38:30 -07004192 msgQ.reserved = 0;
4193 msgQ.bodyptr = pMsgBuf;
4194 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004195 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004196
4197 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304198 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004199 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004200 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004201 return;
4202 }
4203
4204 return;
4205}
4206
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004207#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
4208/**
4209 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4210 *
4211 *NOTE:
4212 *
4213 * @param pMac Pointer to Global MAC structure
4214 * @param *pMsgBuf A pointer to the SME message buffer
4215 * @return None
4216 */
4217static void
4218__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4219{
4220 tSirMsgQ msgQ;
4221
4222 msgQ.type = WDA_TSM_STATS_REQ;
4223 msgQ.reserved = 0;
4224 msgQ.bodyptr = pMsgBuf;
4225 msgQ.bodyval = 0;
4226 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4227
4228 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4229 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004230 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004231 limLog(pMac, LOGP, "Unable to forward request");
4232 return;
4233 }
4234}
4235#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
4236
4237
Jeff Johnson295189b2012-06-20 16:38:30 -07004238
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004239#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
4240/**
4241 * __limProcessSmeGetRoamRssiRequest()
4242 *
4243 *FUNCTION:
4244 *
4245 *
4246 *NOTE:
4247 *
4248 * @param pMac Pointer to Global MAC structure
4249 * @param *pMsgBuf A pointer to the SME message buffer
4250 * @return None
4251 */
4252static void
4253__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4254{
4255 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4256 tSirMsgQ msgQ;
4257
4258 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4259 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4260
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004261 msgQ.reserved = 0;
4262 msgQ.bodyptr = pMsgBuf;
4263 msgQ.bodyval = 0;
4264 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4265
4266 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304267 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004268 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004269 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004270 return;
4271 }
4272
4273 return;
4274}
4275#endif
4276
4277
Jeff Johnson295189b2012-06-20 16:38:30 -07004278static void
4279__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4280{
4281 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4282 tpPESession psessionEntry;
4283 tANI_U8 sessionId; //PE sessionID
4284
4285 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004286 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004287
4288 if(pMsgBuf == NULL)
4289 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004290 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004291 return;
4292 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004293
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304294 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4295 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004296 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304297 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004298 return;
4299 }
4300
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004301 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004302 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004303 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004304 goto end;
4305 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004306
Jeff Johnson295189b2012-06-20 16:38:30 -07004307 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4308 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004309 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004310 goto end;
4311 }
4312
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304313 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004314
Jeff Johnson295189b2012-06-20 16:38:30 -07004315 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004316 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004317
4318end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304319 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004320 return;
4321} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4322
4323static void
4324__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4325{
4326 tpSirUpdateParams pUpdateParams;
4327 tpPESession psessionEntry;
4328
4329 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004330 FL("received HIDE_SSID message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004331
4332 if(pMsgBuf == NULL)
4333 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004334 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004335 return;
4336 }
4337
4338 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4339
4340 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4341 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004342 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004343 pUpdateParams->sessionId);
4344 return;
4345 }
4346
4347 /* Update the session entry */
4348 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4349
4350 /* Update beacon */
4351 schSetFixedBeaconFields(pMac, psessionEntry);
4352 limSendBeaconInd(pMac, psessionEntry);
4353
4354 return;
4355} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4356
4357static void
4358__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4359{
4360 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4361 tpPESession psessionEntry;
4362 tANI_U8 sessionId; //PE sessionID
4363
4364 if(pMsgBuf == NULL)
4365 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004366 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004367 return;
4368 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304369
4370 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4371 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004372 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304373 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004374 return;
4375 }
4376
4377 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4378 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004379 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004380 goto end;
4381 }
4382
4383 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4384 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004385 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004386 goto end;
4387 }
4388
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304389 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4390 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004391
4392 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4393
4394 psessionEntry->pLimStartBssReq->privacy = 1;
4395 psessionEntry->privacy = 1;
4396
4397 schSetFixedBeaconFields(pMac, psessionEntry);
4398 limSendBeaconInd(pMac, psessionEntry);
4399
4400end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304401 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004402 return;
4403} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4404
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004405/*
4406Update the beacon Interval dynamically if beaconInterval is different in MCC
4407*/
4408static void
4409__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4410{
4411 tpSirChangeBIParams pChangeBIParams;
4412 tpPESession psessionEntry;
4413 tANI_U8 sessionId = 0;
4414 tUpdateBeaconParams beaconParams;
4415
4416 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004417 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004418
4419 if(pMsgBuf == NULL)
4420 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004421 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004422 return;
4423 }
4424
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304425 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004426 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4427
4428 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4429 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004430 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004431 return;
4432 }
4433
4434 /*Update sessionEntry Beacon Interval*/
4435 if(psessionEntry->beaconParams.beaconInterval !=
4436 pChangeBIParams->beaconInterval )
4437 {
4438 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4439 }
4440
4441 /*Update sch beaconInterval*/
4442 if(pMac->sch.schObject.gSchBeaconInterval !=
4443 pChangeBIParams->beaconInterval )
4444 {
4445 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4446
4447 PELOG1(limLog(pMac, LOG1,
4448 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4449
4450 /* Update beacon */
4451 schSetFixedBeaconFields(pMac, psessionEntry);
4452
Sunil Ravib96f7b52013-05-22 21:40:05 -07004453 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004454 //Set change in beacon Interval
4455 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004456 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004457 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4458 }
4459
4460 return;
4461} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4462
Jeff Johnson295189b2012-06-20 16:38:30 -07004463
4464
4465/** -------------------------------------------------------------
4466\fn limProcessSmeDelBaPeerInd
4467\brief handles indication message from HDD to send delete BA request
4468\param tpAniSirGlobal pMac
4469\param tANI_U32 pMsgBuf
4470\return None
4471-------------------------------------------------------------*/
4472void
4473limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4474{
4475 tANI_U16 assocId =0;
4476 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4477 tpDphHashNode pSta;
4478 tpPESession psessionEntry;
4479 tANI_U8 sessionId;
4480
4481
4482
4483 if(NULL == pSmeDelBAPeerInd)
4484 return;
4485
4486 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4487 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004488 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004489 return;
4490 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004491 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004492 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4493
4494 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4495 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4496 pSta,
4497 pSmeDelBAPeerInd->baDirection,
4498 pSmeDelBAPeerInd->baTID,
4499 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4500 {
4501 limLog( pMac, LOGW,
4502 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4503 if (pSta)
4504 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4505 }
4506}
4507
4508// --------------------------------------------------------------------
4509/**
4510 * __limProcessReportMessage
4511 *
4512 * FUNCTION: Processes the next received Radio Resource Management message
4513 *
4514 * LOGIC:
4515 *
4516 * ASSUMPTIONS:
4517 *
4518 * NOTE:
4519 *
4520 * @param None
4521 * @return None
4522 */
4523
4524void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4525{
4526#ifdef WLAN_FEATURE_VOWIFI
4527 switch (pMsg->type)
4528 {
4529 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4530 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4531 break;
4532 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4533 {
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004534#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004535 tpSirBeaconReportXmitInd pBcnReport=NULL;
4536 tpPESession psessionEntry=NULL;
4537 tANI_U8 sessionId;
4538
4539 if(pMsg->bodyptr == NULL)
4540 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004541 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004542 return;
4543 }
4544 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4545 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4546 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004547 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004548 return;
4549 }
4550 if (psessionEntry->isCCXconnection)
4551 ccxProcessBeaconReportXmit( pMac, pMsg->bodyptr);
4552 else
4553#endif
4554 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4555 }
4556 break;
4557 }
4558#endif
4559}
4560
4561#if defined(FEATURE_WLAN_CCX) || defined(WLAN_FEATURE_VOWIFI)
4562// --------------------------------------------------------------------
4563/**
4564 * limSendSetMaxTxPowerReq
4565 *
4566 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4567 *
4568 * LOGIC:
4569 *
4570 * ASSUMPTIONS:
4571 *
4572 * NOTE:
4573 *
4574 * @param txPower txPower to be set.
4575 * @param pSessionEntry session entry.
4576 * @return None
4577 */
4578tSirRetStatus
4579limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4580{
4581 tpMaxTxPowerParams pMaxTxParams = NULL;
4582 tSirRetStatus retCode = eSIR_SUCCESS;
4583 tSirMsgQ msgQ;
4584
4585 if( pSessionEntry == NULL )
4586 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004587 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004588 return eSIR_FAILURE;
4589 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304590
4591 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4592 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004593 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004594 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004595 return eSIR_MEM_ALLOC_FAILED;
4596
4597 }
4598#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_CCX)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004599 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 -07004600#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004601 if( pMaxTxParams == NULL )
4602 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004603 limLog( pMac, LOGE, "%s:%d: pMaxTxParams is NULL", __func__, __LINE__);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004604 return eSIR_FAILURE;
4605 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004606 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304607 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4608 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004609
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004610 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4611 msgQ.bodyptr = pMaxTxParams;
4612 msgQ.bodyval = 0;
4613 PELOG1(limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));)
4614 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
4615 retCode = wdaPostCtrlMsg(pMac, &msgQ);
4616 if (eSIR_SUCCESS != retCode)
4617 {
4618 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304619 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004620 }
4621 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004622}
4623#endif
4624
4625/**
4626 * __limProcessSmeAddStaSelfReq()
4627 *
4628 *FUNCTION:
4629 * This function is called to process SME_ADD_STA_SELF_REQ message
4630 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4631 *
4632 *LOGIC:
4633 *
4634 *ASSUMPTIONS:
4635 *
4636 *NOTE:
4637 *
4638 * @param pMac Pointer to Global MAC structure
4639 * @param *pMsgBuf A pointer to the SME message buffer
4640 * @return None
4641 */
4642
4643static void
4644__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4645{
4646 tSirMsgQ msg;
4647 tpAddStaSelfParams pAddStaSelfParams;
4648 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
4649
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304650 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
4651 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004652 {
4653 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
4654 return;
4655 }
4656
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304657 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07004658 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004659 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
4660 msg.reserved = 0;
4661 msg.bodyptr = pAddStaSelfParams;
4662 msg.bodyval = 0;
4663
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004664 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004665 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004666
4667 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4668 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004669 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004670 }
4671 return;
4672} /*** end __limProcessAddStaSelfReq() ***/
4673
4674
4675/**
4676 * __limProcessSmeDelStaSelfReq()
4677 *
4678 *FUNCTION:
4679 * This function is called to process SME_DEL_STA_SELF_REQ message
4680 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
4681 *
4682 *LOGIC:
4683 *
4684 *ASSUMPTIONS:
4685 *
4686 *NOTE:
4687 *
4688 * @param pMac Pointer to Global MAC structure
4689 * @param *pMsgBuf A pointer to the SME message buffer
4690 * @return None
4691 */
4692
4693static void
4694__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4695{
4696 tSirMsgQ msg;
4697 tpDelStaSelfParams pDelStaSelfParams;
4698 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
4699
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304700 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
4701 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004702 {
4703 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
4704 return;
4705 }
4706
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304707 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004708
4709 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
4710 msg.reserved = 0;
4711 msg.bodyptr = pDelStaSelfParams;
4712 msg.bodyval = 0;
4713
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004714 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004715 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004716
4717 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4718 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004719 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004720 }
4721 return;
4722} /*** end __limProcessSmeDelStaSelfReq() ***/
4723
4724
Jeff Johnson295189b2012-06-20 16:38:30 -07004725/**
4726 * __limProcessSmeRegisterMgmtFrameReq()
4727 *
4728 *FUNCTION:
4729 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
4730 * from SME. It Register this information within PE.
4731 *
4732 *LOGIC:
4733 *
4734 *ASSUMPTIONS:
4735 *
4736 *NOTE:
4737 *
4738 * @param pMac Pointer to Global MAC structure
4739 * @param *pMsgBuf A pointer to the SME message buffer
4740 * @return None
4741 */
4742static void
4743__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4744{
4745 VOS_STATUS vosStatus;
4746 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
4747 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004748 tANI_BOOLEAN match = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004749 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004750 FL("registerFrame %d, frameType %d, matchLen %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07004751 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004752
Jeff Johnsond13512a2012-07-17 11:42:19 -07004753 /* First check whether entry exists already*/
4754
4755 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4756 (vos_list_node_t**)&pLimMgmtRegistration);
4757
4758 while(pLimMgmtRegistration != NULL)
4759 {
4760 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
4761 {
4762 if(pSmeReq->matchLen)
4763 {
4764 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
4765 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304766 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07004767 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
4768 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004769 /* found match! */
4770 match = VOS_TRUE;
4771 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004772 }
4773 }
4774 }
4775 else
4776 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004777 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07004778 match = VOS_TRUE;
4779 break;
4780 }
4781 }
4782 vosStatus = vos_list_peek_next (
4783 &pMac->lim.gLimMgmtFrameRegistratinQueue,
4784 (vos_list_node_t*) pLimMgmtRegistration,
4785 (vos_list_node_t**) &pNext );
4786
4787 pLimMgmtRegistration = pNext;
4788 pNext = NULL;
4789
4790 }
4791
4792 if (match)
4793 {
4794 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4795 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304796 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07004797 }
4798
Jeff Johnson295189b2012-06-20 16:38:30 -07004799 if(pSmeReq->registerFrame)
4800 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304801 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
4802 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07004803 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304804 vos_mem_set((void*)pLimMgmtRegistration,
4805 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004806 pLimMgmtRegistration->frameType = pSmeReq->frameType;
4807 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
4808 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
4809 if(pSmeReq->matchLen)
4810 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304811 vos_mem_copy(pLimMgmtRegistration->matchData,
4812 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07004813 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004814 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4815 &pLimMgmtRegistration->node);
4816 }
4817 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004818
4819 return;
4820} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08004821
4822static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08004823__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08004824{
4825 tpP2pPsParams pMsgNoA;
4826 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08004827
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304828 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
4829 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08004830 {
4831 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004832 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08004833 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004834 }
4835
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304836 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08004837 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
4838 pMsgNoA->opp_ps = 0;
4839 pMsgNoA->ctWindow = 0;
4840 pMsgNoA->duration = 0;
4841 pMsgNoA->interval = 0;
4842 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08004843
Vinay Malekal62757362012-12-17 12:15:51 -08004844 /* Below params used for Single Shot NOA - so assign proper values */
4845 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08004846 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08004847
Viral Modid86bde22012-12-10 13:09:21 -08004848 /* Start Insert NOA timer
4849 * 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 -08004850 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
4851 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08004852 */
4853 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
4854 == TX_TIMER_ERROR)
4855 {
4856 /// Could not activate Insert NOA timer.
4857 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004858 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08004859
4860 // send the scan response back with status failure and do not even call insert NOA
4861 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304862 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08004863 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004864 }
4865
Viral Modid440e682013-03-06 02:25:31 -08004866 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
4867
Viral Modid86bde22012-12-10 13:09:21 -08004868 msg.type = WDA_SET_P2P_GO_NOA_REQ;
4869 msg.reserved = 0;
4870 msg.bodyptr = pMsgNoA;
4871 msg.bodyval = 0;
4872
4873 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4874 {
4875 /* 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 -07004876 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08004877 /* Deactivate the NOA timer in failure case */
4878 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
4879 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004880 }
Viral Modid440e682013-03-06 02:25:31 -08004881 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08004882
Viral Modid440e682013-03-06 02:25:31 -08004883error:
4884 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
4885 * worrying about the NOA
4886 */
4887 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
4888 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08004889 return FALSE;
4890
4891}
4892
Viral Modid440e682013-03-06 02:25:31 -08004893static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4894{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004895 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08004896 pMac->lim.gDeferMsgTypeForNOA = msgType;
4897 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
4898}
4899
4900static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4901{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004902 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08004903 pMac->lim.gDeferMsgTypeForNOA = 0;
4904 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
4905 {
4906 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304907 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004908 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4909 }
4910}
4911
4912static
4913tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4914{
4915 tANI_U32 noaDuration = 0;
4916
4917 switch (msgType)
4918 {
4919 case eWNI_SME_SCAN_REQ:
4920 {
4921 tANI_U32 val;
4922 tANI_U8 i;
4923 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
4924 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
4925 {
4926 /*
4927 * Could not get max channel value
4928 * from CFG. Log error.
4929 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004930 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08004931
4932 /* use a default value of 110ms */
4933 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
4934 }
4935
4936 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
4937 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
4938
4939 if (limActiveScanAllowed(pMac, channelNum)) {
4940 /* Use min + max channel time to calculate the total duration of scan */
4941 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
4942 } else {
4943 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
4944 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
4945 */
4946 noaDuration += val;
4947 }
4948 }
4949
4950 /* Adding an overhead of 20ms to account for the scan messaging delays */
4951 noaDuration += SCAN_MESSAGING_OVERHEAD;
4952 noaDuration *= CONV_MS_TO_US;
4953
4954 break;
4955 }
4956
4957 case eWNI_SME_OEM_DATA_REQ:
4958 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
4959 break;
4960
4961 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
4962 {
4963 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
4964 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
4965 break;
4966 }
4967
4968 case eWNI_SME_JOIN_REQ:
4969 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
4970 break;
4971
4972 default:
4973 noaDuration = 0;
4974 break;
4975
4976 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004977 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08004978 return noaDuration;
4979}
4980
4981void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4982{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05304983 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08004984
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004985 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004986 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
4987 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
4988 {
4989 switch (pMac->lim.gDeferMsgTypeForNOA)
4990 {
4991 case eWNI_SME_SCAN_REQ:
4992 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4993 break;
4994 case eWNI_SME_OEM_DATA_REQ:
4995 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4996 break;
4997 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05304998 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4999 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
5000 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
5001 */
5002 if (FALSE == bufConsumed)
5003 {
5004 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5005 }
Viral Modid440e682013-03-06 02:25:31 -08005006 break;
5007 case eWNI_SME_JOIN_REQ:
5008 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
5009 break;
5010 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005011 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08005012 break;
5013 }
5014 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
5015 }
5016 else
5017 {
5018 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005019 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08005020 }
5021}
Jeff Johnson295189b2012-06-20 16:38:30 -07005022
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005023#ifdef FEATURE_WLAN_TDLS_INTERNAL
5024/*
5025 * Process Discovery request recieved from SME and transmit to AP.
5026 */
5027static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
5028 tANI_U32 *pMsgBuf)
5029{
5030 /* get all discovery request parameters */
5031 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
5032 tpPESession psessionEntry;
5033 tANI_U8 sessionId;
5034
5035 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005036 ("Discovery Req Recieved")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005037
5038 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
5039 == NULL)
5040 {
5041 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005042 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005043 disReq->sessionId);
5044 goto lim_tdls_dis_start_error;
5045 }
5046
5047 /* check if we are in proper state to work as TDLS client */
5048 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5049 {
5050 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005051 "dis req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005052 psessionEntry->limSystemRole);
5053 goto lim_tdls_dis_start_error;
5054 }
5055
5056 /*
5057 * if we are still good, go ahead and check if we are in proper state to
5058 * do TDLS discovery procedure.
5059 */
5060 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5061 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5062 {
5063
5064 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005065 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005066 goto lim_tdls_dis_start_error;
5067 }
5068
5069 /*
5070 * if we are still good, go ahead and transmit TDLS discovery request,
5071 * and save Dis Req info for future reference.
5072 */
5073
5074#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
5075 /*
5076 * send message to HAL to set RXP filters to receieve frame on
5077 * direct link..
5078 */
5079 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
5080 // psessionEntry->bssId) ;
5081#endif
5082
5083 /* save dis request message for matching dialog token */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305084 vos_mem_copy((tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
5085 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005086
5087 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005088 "Transmit Discovery Request Frame") ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005089 /* format TDLS discovery request frame and transmit it */
5090 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
5091 psessionEntry) ;
5092
5093 /* prepare for response */
5094 pMac->lim.gLimTdlsDisStaCount = 0 ;
5095 pMac->lim.gLimTdlsDisResultList = NULL ;
5096
5097 /*
5098 * start TDLS discovery request timer to wait for discovery responses
5099 * from all TDLS enabled clients in BSS.
5100 */
5101
5102 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005103 ("Start Discovery request Timeout Timer")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005104 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
5105 eLIM_TDLS_DISCOVERY_RSP_WAIT));
5106
5107 /* assign appropriate sessionId to the timer object */
5108 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
5109 psessionEntry->peSessionId;
5110
5111 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
5112 != TX_SUCCESS)
5113 {
5114 limLog(pMac, LOGP, FL("TDLS discovery response timer \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005115 activation failed!"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005116 goto lim_tdls_dis_start_error;
5117 }
5118 /*
5119 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
5120 * back to SME
5121 */
5122 return (eSIR_SUCCESS) ;
5123lim_tdls_dis_start_error:
5124 /* in error case, PE has to sent the response SME immediately with error code */
5125 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
5126 eWNI_SME_TDLS_DISCOVERY_START_RSP);
5127 return eSIR_FAILURE;
5128}
5129/*
5130 * Process link start request recieved from SME and transmit to AP.
5131 */
5132eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5133{
5134 /* get all discovery request parameters */
5135 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
5136 tLimTdlsLinkSetupInfo *linkSetupInfo;
5137 //tLimTdlsLinkSetupPeer *setupPeer;
5138 tpPESession psessionEntry;
5139 tANI_U8 sessionId;
5140 eHalStatus status;
5141
5142 if((psessionEntry = peFindSessionByBssid(pMac,
5143 setupReq->bssid, &sessionId)) == NULL)
5144 {
5145 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005146 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005147 setupReq->sessionId);
5148 goto lim_tdls_link_start_error;
5149 }
5150
5151 /* check if we are in proper state to work as TDLS client */
5152 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5153 {
5154 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005155 "TDLS link setup req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005156 psessionEntry->limSystemRole);
5157 goto lim_tdls_link_start_error;
5158 }
5159
5160 /*
5161 * if we are still good, go ahead and check if we are in proper state to
5162 * do TDLS setup procedure.
5163 */
5164 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5165 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5166 {
5167 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005168 state (%d)", pMac->lim.gLimSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005169 goto lim_tdls_link_start_error;
5170 }
5171
5172 /*
5173 * Now, go ahead and transmit TDLS discovery request, and save setup Req
5174 * info for future reference.
5175 */
5176 /* create node for Link setup */
5177 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
5178 //setupPeer = NULL ;
5179
5180 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
5181 setupReq->peerMac, psessionEntry) ;
5182 if(eHAL_STATUS_SUCCESS == status)
5183 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5184 TDLS setup cnf TX complete is successful. */
5185 return eSIR_SUCCESS;
5186#if 0
5187
5188 /*
5189 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005190 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005191 * free this memory if any timeout is happen in link setup procedure
5192 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305193 setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
5194 if ( NULL == setupPeer )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005195 {
5196 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005197 FL( "Unable to allocate memory during ADD_STA" ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005198 VOS_ASSERT(0) ;
5199 return eSIR_MEM_ALLOC_FAILED;
5200 }
5201 setupPeer->dialog = setupReq->dialog ;
5202 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
5203 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
5204 /* TDLS_sessionize: remember sessionId for future */
5205 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
5206 setupPeer->tdls_bIsResponder = 1;
5207
5208 /*
5209 * we only populate peer MAC, so it can assit us to find the
5210 * TDLS peer after response/or after response timeout
5211 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305212 vos_mem_copy(setupPeer->peerMac, setupReq->peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005213 sizeof(tSirMacAddr)) ;
5214 /* format TDLS discovery request frame and transmit it */
5215 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
5216 setupReq->dialog, psessionEntry, NULL, 0) ;
5217
5218 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
5219 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
5220 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
5221 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
5222 /* update setup peer list */
5223 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
5224 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
5225 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5226 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
5227 return eSIR_SUCCESS ;
5228#endif
5229lim_tdls_link_start_error:
5230 /* in case of error, return immediately to SME */
5231 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
5232 eWNI_SME_TDLS_LINK_START_RSP);
5233 return eSIR_FAILURE ;
5234}
5235
5236/*
5237 * Process link teardown request recieved from SME and transmit to AP.
5238 */
5239eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5240{
5241 /* get all discovery request parameters */
5242 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
5243 tLimTdlsLinkSetupPeer *setupPeer;
5244 tpPESession psessionEntry;
5245 tANI_U8 sessionId;
5246
5247 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
5248 {
5249 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005250 "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005251 goto lim_tdls_teardown_req_error;
5252 }
5253
5254 /* check if we are in proper state to work as TDLS client */
5255 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5256 {
5257 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005258 "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005259 goto lim_tdls_teardown_req_error;
5260 }
5261
5262 /*
5263 * if we are still good, go ahead and check if we are in proper state to
5264 * do TDLS setup procedure.
5265 */
5266 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5267 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5268 {
5269 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005270 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005271 goto lim_tdls_teardown_req_error;
5272 }
5273
5274 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Arif Hussain24bafea2013-11-15 15:10:03 -08005275 "Teardown for peer = " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(teardownReq->peerMac));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005276 /*
5277 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5278 * info for future reference.
5279 */
5280 /* Verify if this link is setup */
5281 setupPeer = NULL ;
5282 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5283 if(NULL == setupPeer)
5284 {
5285 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005286 ("invalid Peer on teardown ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005287 goto lim_tdls_teardown_req_error;
5288 }
5289
5290
5291 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5292 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5293 /* TDLS_sessionize: check sessionId in case */
5294 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5295 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005296 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005297 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5298 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5299 }
5300
5301 /* format TDLS teardown request frame and transmit it */
5302 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5303 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5304 {
5305 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005306 ("couldn't send teardown frame ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005307 goto lim_tdls_teardown_req_error;
5308 }
5309 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5310 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5311 return eSIR_SUCCESS;
5312lim_tdls_teardown_req_error:
5313 /* in case of error, return immediately to SME */
5314 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5315 eWNI_SME_TDLS_TEARDOWN_RSP);
5316 return eSIR_FAILURE;
5317}
5318
5319
5320#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005321
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305322static void
5323__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5324{
5325 tpSirResetAPCapsChange pResetCapsChange;
5326 tpPESession psessionEntry;
5327 tANI_U8 sessionId = 0;
5328 if (pMsgBuf == NULL)
5329 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005330 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305331 return;
5332 }
5333
5334 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5335 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5336 if (psessionEntry == NULL)
5337 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005338 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305339 return;
5340 }
5341
5342 psessionEntry->limSentCapsChangeNtf = false;
5343 return;
5344}
5345
Jeff Johnson295189b2012-06-20 16:38:30 -07005346/**
5347 * limProcessSmeReqMessages()
5348 *
5349 *FUNCTION:
5350 * This function is called by limProcessMessageQueue(). This
5351 * function processes SME request messages from HDD or upper layer
5352 * application.
5353 *
5354 *LOGIC:
5355 *
5356 *ASSUMPTIONS:
5357 *
5358 *NOTE:
5359 *
5360 * @param pMac Pointer to Global MAC structure
5361 * @param msgType Indicates the SME message type
5362 * @param *pMsgBuf A pointer to the SME message buffer
5363 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5364 * FALSE - if pMsgBuf is not to be freed.
5365 */
5366
5367tANI_BOOLEAN
5368limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5369{
5370 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5371 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005372 tpSirSmeScanReq pScanReq;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005373 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 -07005374 limMsgStr(pMsg->type), pMsg->type,
5375 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5376 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5377
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005378 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005379 /* Special handling of some SME Req msgs where we have an existing GO session and
5380 * want to insert NOA before processing those msgs. These msgs will be processed later when
5381 * start event happens
5382 */
5383 switch (pMsg->type)
5384 {
5385 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005386 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005387
5388 /* If scan is disabled return from here
5389 */
5390 if (pMac->lim.fScanDisabled)
5391 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005392 if (pMsg->type == eWNI_SME_SCAN_REQ)
5393 {
5394 limSendSmeScanRsp(pMac,
5395 offsetof(tSirSmeScanRsp,bssDescription[0]),
5396 eSIR_SME_INVALID_PARAMETERS,
5397 pScanReq->sessionId,
5398 pScanReq->transactionId);
5399
5400 bufConsumed = TRUE;
5401 }
5402 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5403 {
5404 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5405 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5406 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5407
5408 /*
5409 * limRemainOnChnRsp will free the buffer this change is to
5410 * avoid "double free"
5411 */
5412 bufConsumed = FALSE;
5413 }
5414
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305415 limLog(pMac, LOGE,
5416 FL("Error: Scan Disabled."
5417 " Return with error status for SME Message %s(%d)"),
5418 limMsgStr(pMsg->type), pMsg->type);
5419
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005420 return bufConsumed;
5421 }
5422 /*
5423 * Do not add BREAK here
5424 */
5425 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005426 case eWNI_SME_JOIN_REQ:
5427 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5428 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5429 {
5430 tANI_U32 noaDuration;
5431 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
5432 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf);
5433 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5434 return bufConsumed;
5435 }
5436 }
5437 /* If no insert NOA required then execute the code below */
5438
Jeff Johnson295189b2012-06-20 16:38:30 -07005439 switch (pMsg->type)
5440 {
5441 case eWNI_SME_START_REQ:
5442 __limProcessSmeStartReq(pMac, pMsgBuf);
5443 break;
5444
5445 case eWNI_SME_SYS_READY_IND:
5446 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5447 break;
5448
Jeff Johnson295189b2012-06-20 16:38:30 -07005449 case eWNI_SME_START_BSS_REQ:
5450 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5451 break;
5452
5453 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005454 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005455 break;
5456
Jeff Johnsone7245742012-09-05 17:12:55 -07005457#ifdef FEATURE_OEM_DATA_SUPPORT
5458 case eWNI_SME_OEM_DATA_REQ:
5459 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005460 break;
5461#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005462 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5463 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5464 break;
5465
5466 case eWNI_SME_UPDATE_NOA:
5467 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5468 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305469 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5470 __limProcessClearDfsChannelList(pMac, pMsg);
5471 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005472 case eWNI_SME_JOIN_REQ:
5473 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005474 break;
5475
5476 case eWNI_SME_AUTH_REQ:
5477 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5478
5479 break;
5480
5481 case eWNI_SME_REASSOC_REQ:
5482 __limProcessSmeReassocReq(pMac, pMsgBuf);
5483
5484 break;
5485
5486 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5487 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5488
5489 break;
5490
5491 case eWNI_SME_DISASSOC_REQ:
5492 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5493
5494 break;
5495
5496 case eWNI_SME_DISASSOC_CNF:
5497 case eWNI_SME_DEAUTH_CNF:
5498 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5499
5500 break;
5501
5502 case eWNI_SME_DEAUTH_REQ:
5503 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5504
5505 break;
5506
Jeff Johnson295189b2012-06-20 16:38:30 -07005507
5508
5509 case eWNI_SME_SETCONTEXT_REQ:
5510 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5511
5512 break;
5513
5514 case eWNI_SME_REMOVEKEY_REQ:
5515 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5516
5517 break;
5518
5519 case eWNI_SME_STOP_BSS_REQ:
5520 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5521 break;
5522
5523 case eWNI_SME_ASSOC_CNF:
5524 case eWNI_SME_REASSOC_CNF:
5525 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005526 PELOG1(limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005527 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005528 PELOG1(limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005529 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5530 break;
5531
5532 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005533 PELOG1(limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005534 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5535 break;
5536
5537 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005538 PELOG1(limLog(pMac, LOG1, FL("Received DELTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005539 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5540 break;
5541
5542 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005543 PELOG1(limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005544 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5545 break;
5546
5547 case eWNI_SME_STA_STAT_REQ:
5548 case eWNI_SME_AGGR_STAT_REQ:
5549 case eWNI_SME_GLOBAL_STAT_REQ:
5550 case eWNI_SME_STAT_SUMM_REQ:
5551 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5552 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5553 bufConsumed = FALSE;
5554 break;
5555 case eWNI_SME_GET_STATISTICS_REQ:
5556 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5557 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5558 bufConsumed = FALSE;
5559 break;
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005560#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
5561 case eWNI_SME_GET_ROAM_RSSI_REQ:
5562 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5563 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5564 bufConsumed = FALSE;
5565 break;
5566#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005567#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
5568 case eWNI_SME_GET_TSM_STATS_REQ:
5569 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5570 bufConsumed = FALSE;
5571 break;
5572#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005573 case eWNI_SME_DEL_BA_PEER_IND:
5574 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5575 break;
5576 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5577 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5578 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005579 case eWNI_SME_GET_ASSOC_STAS_REQ:
5580 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5581 break;
5582 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5583 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5584 break;
5585
5586 case eWNI_SME_HIDE_SSID_REQ:
5587 __limProcessSmeHideSSID(pMac, pMsgBuf);
5588 break;
5589 case eWNI_SME_UPDATE_APWPSIE_REQ:
5590 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5591 break;
5592 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5593 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5594 break;
5595
5596 case eWNI_SME_SET_APWPARSNIEs_REQ:
5597 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5598 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005599
5600 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5601 //Update the beaconInterval
5602 __limProcessSmeChangeBI(pMac, pMsgBuf );
5603 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005604
5605#if defined WLAN_FEATURE_VOWIFI
5606 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5607 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5608 __limProcessReportMessage(pMac, pMsg);
5609 break;
5610#endif
5611
5612#if defined WLAN_FEATURE_VOWIFI_11R
5613 case eWNI_SME_FT_PRE_AUTH_REQ:
5614 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5615 break;
5616 case eWNI_SME_FT_UPDATE_KEY:
5617 limProcessFTUpdateKey(pMac, pMsgBuf);
5618 break;
5619
5620 case eWNI_SME_FT_AGGR_QOS_REQ:
5621 limProcessFTAggrQosReq(pMac, pMsgBuf);
5622 break;
5623#endif
5624
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005625#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07005626 case eWNI_SME_CCX_ADJACENT_AP_REPORT:
5627 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5628 break;
5629#endif
5630 case eWNI_SME_ADD_STA_SELF_REQ:
5631 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5632 break;
5633 case eWNI_SME_DEL_STA_SELF_REQ:
5634 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5635 break;
5636
Jeff Johnson295189b2012-06-20 16:38:30 -07005637 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5638 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5639 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005640#ifdef FEATURE_WLAN_TDLS
5641 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5642 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5643 break;
5644 case eWNI_SME_TDLS_ADD_STA_REQ:
5645 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5646 break;
5647 case eWNI_SME_TDLS_DEL_STA_REQ:
5648 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5649 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305650 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5651 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5652 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005653#endif
5654#ifdef FEATURE_WLAN_TDLS_INTERNAL
5655 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
5656 limProcessSmeDisStartReq(pMac, pMsgBuf);
5657 break ;
5658 case eWNI_SME_TDLS_LINK_START_REQ:
5659 limProcessSmeLinkStartReq(pMac, pMsgBuf);
5660 break ;
5661 case eWNI_SME_TDLS_TEARDOWN_REQ:
5662 limProcessSmeTeardownReq(pMac, pMsgBuf);
5663 break ;
5664#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305665 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5666 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5667 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005668
schang86c22c42013-03-13 18:41:24 -07005669 case eWNI_SME_SET_TX_POWER_REQ:
5670 limSendSetTxPowerReq(pMac, pMsgBuf);
5671 break ;
5672
Jeff Johnson295189b2012-06-20 16:38:30 -07005673 default:
5674 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5675 pMsg->bodyptr = NULL;
5676 break;
5677 } // switch (msgType)
5678
5679 return bufConsumed;
5680} /*** end limProcessSmeReqMessages() ***/