blob: 4cd651685e06055509019427405bbbb6b4845b9a [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lamaa8e15a2014-02-11 23:30:06 -08002 * Copyright (c) 2012-2013 Qualcomm Atheros, Inc.
3 * All Rights Reserved.
4 * Qualcomm Atheros Confidential and Proprietary.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08005 */
6/*
Jeff Johnson295189b2012-06-20 16:38:30 -07007 * Airgo Networks, Inc proprietary. All rights reserved.
8 * This file limProcessSmeReqMessages.cc contains the code
9 * for processing SME request messages.
10 * Author: Chandra Modumudi
11 * Date: 02/11/02
12 * History:-
13 * Date Modified by Modification Information
14 * --------------------------------------------------------------------
15 *
16 */
17
18#include "palTypes.h"
19#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070020#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070021#include "cfgApi.h"
22#include "sirApi.h"
23#include "schApi.h"
24#include "utilsApi.h"
25#include "limTypes.h"
26#include "limUtils.h"
27#include "limAssocUtils.h"
28#include "limSecurityUtils.h"
29#include "limSerDesUtils.h"
30#include "limSmeReqUtils.h"
31#include "limIbssPeerMgmt.h"
32#include "limAdmitControl.h"
33#include "dphHashTable.h"
34#include "limSendMessages.h"
35#include "limApi.h"
36#include "wmmApsd.h"
37
Jeff Johnson295189b2012-06-20 16:38:30 -070038#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070039
40#if defined WLAN_FEATURE_VOWIFI
41#include "rrmApi.h"
42#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070043#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -070044#include "ccxApi.h"
45#endif
46
47#if defined WLAN_FEATURE_VOWIFI_11R
48#include <limFT.h>
49#endif
50
51#ifdef FEATURE_WLAN_CCX
52/* These are the min/max tx power (non virtual rates) range
53 supported by prima hardware */
Sandeep Puligilla33ccf332013-12-19 16:06:42 +053054#define MIN_TX_PWR_CAP 8
55#define MAX_TX_PWR_CAP 22
Jeff Johnson295189b2012-06-20 16:38:30 -070056
57#endif
58
Viral Modid86bde22012-12-10 13:09:21 -080059/* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK
60 * 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 -080061 * taking care of sending null data and receiving ACK to/from AP/Also SetChannel with calibration is taking
62 * around 7ms .
Viral Modid86bde22012-12-10 13:09:21 -080063 */
Viral Modid440e682013-03-06 02:25:31 -080064#define SCAN_MESSAGING_OVERHEAD 20 // in msecs
65#define JOIN_NOA_DURATION 2000 // in msecs
66#define OEM_DATA_NOA_DURATION 60 // in msecs
67#define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 // in msecs
Jeff Johnson295189b2012-06-20 16:38:30 -070068
Gopichand Nakkala096a1052012-12-21 07:05:34 -080069#define CONV_MS_TO_US 1024 //conversion factor from ms to us
70
Jeff Johnson295189b2012-06-20 16:38:30 -070071// SME REQ processing function templates
72static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *);
73static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *);
74static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
Viral Modid440e682013-03-06 02:25:31 -080075static void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *);
Jeff Johnson295189b2012-06-20 16:38:30 -070076static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *);
77static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *);
78static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *);
79static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *);
80static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *);
81static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *);
82static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
83
Jeff Johnson295189b2012-06-20 16:38:30 -070084void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *);
85
Jeff Johnson295189b2012-06-20 16:38:30 -070086extern void peRegisterTLHandle(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -070087
Jeff Johnson295189b2012-06-20 16:38:30 -070088
Jeff Johnson295189b2012-06-20 16:38:30 -070089#ifdef BACKGROUND_SCAN_ENABLED
90
91// start the background scan timers if it hasn't already started
92static void
93__limBackgroundScanInitiate(tpAniSirGlobal pMac)
94{
95 if (pMac->lim.gLimBackgroundScanStarted)
96 return;
97
98 //make sure timer is created first
99 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
100 {
101 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -0700102 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700103 if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700104 limLog(pMac, LOGP, FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700105 pMac->lim.gLimBackgroundScanStarted = true;
106 pMac->lim.gLimBackgroundScanChannelId = 0;
107 }
108}
109
110#endif // BACKGROUND_SCAN_ENABLED
Jeff Johnson295189b2012-06-20 16:38:30 -0700111
112// determine if a fresh scan request must be issued or not
113/*
114* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
115* If one of the sessions is not in one of the above states, then PE does not do fresh scan
116* If no session exists (scanning very first time), then PE will always do fresh scan if SME
117* asks it to do that.
118*/
119static tANI_U8
120__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
121{
122
123 tANI_U8 validState = TRUE;
124 int i;
125
126 if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
127 {
128 return FALSE;
129 }
130 for(i =0; i < pMac->lim.maxBssId; i++)
131 {
132
133 if(pMac->lim.gpSession[i].valid == TRUE)
134 {
135 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
136 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
137 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
138
139 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
140 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
141 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
142 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700143 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
144 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
145 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
146 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700147 ))
148 {
149 validState = FALSE;
150 break;
151 }
152
153 }
154 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530155 limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700156
157 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
158 return TRUE;
159
160 return FALSE;
161}
162
Jeff Johnson295189b2012-06-20 16:38:30 -0700163
164
165/**
166 * __limIsSmeAssocCnfValid()
167 *
168 *FUNCTION:
169 * This function is called by limProcessLmmMessages() upon
170 * receiving SME_ASSOC_CNF.
171 *
172 *LOGIC:
173 * Message validity checks are performed in this function
174 *
175 *ASSUMPTIONS:
176 *
177 *NOTE:
178 *
179 * @param pMeasReq Pointer to Received ASSOC_CNF message
180 * @return true When received SME_ASSOC_CNF is formatted
181 * correctly
182 * false otherwise
183 */
184
185inline static tANI_U8
186__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
187{
188 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
189 return false;
190 else
191 return true;
192} /*** end __limIsSmeAssocCnfValid() ***/
193
194
195/**
196 * __limGetSmeJoinReqSizeForAlloc()
197 *
198 *FUNCTION:
199 * This function is called in various places to get IE length
200 * from tSirBssDescription structure
201 * number being scanned.
202 *
203 *PARAMS:
204 *
205 *LOGIC:
206 *
207 *ASSUMPTIONS:
208 * NA
209 *
210 *NOTE:
211 * NA
212 *
213 * @param pBssDescr
214 * @return Total IE length
215 */
216
217static tANI_U16
218__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
219{
220 tANI_U16 len = 0;
221
222 if (!pBuf)
223 return len;
224
225 pBuf += sizeof(tANI_U16);
226 len = limGetU16( pBuf );
227 return (len + sizeof( tANI_U16 ));
228} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
229
230
231/**----------------------------------------------------------------
232\fn __limIsDeferedMsgForLearn
233
234\brief Has role only if 11h is enabled. Not used on STA side.
235 Defers the message if SME is in learn state and brings
236 the LIM back to normal mode.
237
238\param pMac
239\param pMsg - Pointer to message posted from SME to LIM.
240\return TRUE - If defered
241 FALSE - Otherwise
242------------------------------------------------------------------*/
243static tANI_BOOLEAN
244__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
245{
246 if (limIsSystemInScanState(pMac))
247 {
248 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
249 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700250 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 return eANI_BOOLEAN_FALSE;
252 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700253 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700254 pMsg->type);)
255
256 /** Send finish scan req to HAL only if LIM is not waiting for any response
257 * from HAL like init scan rsp, start scan rsp etc.
258 */
259 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
260 {
261 //Set the resume channel to Any valid channel (invalid).
262 //This will instruct HAL to set it to any previous valid channel.
263 peSetResumeChannel(pMac, 0, 0);
264 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
265 }
266
267 return eANI_BOOLEAN_TRUE;
268 }
269 return eANI_BOOLEAN_FALSE;
270}
271
272/**----------------------------------------------------------------
273\fn __limIsDeferedMsgForRadar
274
275\brief Has role only if 11h is enabled. Not used on STA side.
276 Defers the message if radar is detected.
277
278\param pMac
279\param pMsg - Pointer to message posted from SME to LIM.
280\return TRUE - If defered
281 FALSE - Otherwise
282------------------------------------------------------------------*/
283static tANI_BOOLEAN
284__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
285{
286 /** fRadarDetCurOperChan will be set only if we detect radar in current
287 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700288 //TODO: Need to take care radar detection.
289 //if (LIM_IS_RADAR_DETECTED(pMac))
290 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 {
292 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
293 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700294 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 return eANI_BOOLEAN_FALSE;
296 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700297 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700298 pMsg->type);)
299 return eANI_BOOLEAN_TRUE;
300 }
301 return eANI_BOOLEAN_FALSE;
302}
303
304
305/**
306 * __limProcessSmeStartReq()
307 *
308 *FUNCTION:
309 * This function is called to process SME_START_REQ message
310 * from HDD or upper layer application.
311 *
312 *LOGIC:
313 *
314 *ASSUMPTIONS:
315 *
316 *NOTE:
317 *
318 * @param pMac Pointer to Global MAC structure
319 * @param *pMsgBuf A pointer to the SME message buffer
320 * @return None
321 */
322
323static void
324__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
325{
326 tSirResultCodes retCode = eSIR_SME_SUCCESS;
327 tANI_U8 smesessionId;
328 tANI_U16 smetransactionId;
329
330
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700331 PELOG1(limLog(pMac, LOG1, FL("Received START_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700332
333 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
334
335 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
336 {
337 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
338
Jeff Johnsone7245742012-09-05 17:12:55 -0700339 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700340
341 /// By default do not return after first scan match
342 pMac->lim.gLimReturnAfterFirstMatch = 0;
343
344 /// Initialize MLM state machine
345 limInitMlm(pMac);
346
347 /// By default return unique scan results
348 pMac->lim.gLimReturnUniqueResults = true;
349 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700350#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
351 pMac->lim.gLimSmeLfrScanResultLength = 0;
352#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700353
Jeff Johnson295189b2012-06-20 16:38:30 -0700354 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
355 {
356 /*
357 * Need to indicate new BSSs found during background scanning to
358 * host. Update this parameter at CFG
359 */
360 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
361 != eSIR_SUCCESS)
362 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700363 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700364 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
365 }
366 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 }
368 else
369 {
370 /**
371 * Should not have received eWNI_SME_START_REQ in states
372 * other than OFFLINE. Return response to host and
373 * log error
374 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700375 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700376 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
377 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
378 }
379 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
380} /*** end __limProcessSmeStartReq() ***/
381
382
383/** -------------------------------------------------------------
384\fn __limProcessSmeSysReadyInd
385\brief handles the notification from HDD. PE just forwards this message to HAL.
386\param tpAniSirGlobal pMac
387\param tANI_U32* pMsgBuf
388\return TRUE-Posting to HAL failed, so PE will consume the buffer.
389\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
390 -------------------------------------------------------------*/
391static tANI_BOOLEAN
392__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
393{
394 tSirMsgQ msg;
395
396 msg.type = WDA_SYS_READY_IND;
397 msg.reserved = 0;
398 msg.bodyptr = pMsgBuf;
399 msg.bodyval = 0;
400
Jeff Johnson92751692013-03-06 16:00:33 -0800401 if (pMac->gDriverType != eDRIVER_TYPE_MFG)
Jeff Johnson295189b2012-06-20 16:38:30 -0700402 {
Jeff Johnson92751692013-03-06 16:00:33 -0800403 peRegisterTLHandle(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700405 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700406 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700407
Jeff Johnson92751692013-03-06 16:00:33 -0800408 if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
Jeff Johnson295189b2012-06-20 16:38:30 -0700409 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700410 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 return eANI_BOOLEAN_TRUE;
412 }
413 return eANI_BOOLEAN_FALSE;
414}
415
Jeff Johnsone7245742012-09-05 17:12:55 -0700416#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700417
Jeff Johnsone7245742012-09-05 17:12:55 -0700418tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
419{
420 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
421 {
422 switch(secondaryChanOffset)
423 {
424 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
425 return primarychanNum;
426 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
427 return primarychanNum + 2;
428 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
429 return primarychanNum - 2;
430 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
431 return primarychanNum + 6;
432 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
433 return primarychanNum + 2;
434 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
435 return primarychanNum - 2;
436 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
437 return primarychanNum - 6;
438 default :
439 return eSIR_CFG_INVALID_ID;
440 }
441 }
442 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
443 {
444 switch(secondaryChanOffset)
445 {
446 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
447 return primarychanNum + 2;
448 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
449 return primarychanNum - 2;
450 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
451 return primarychanNum;
452 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
453 return primarychanNum + 2;
454 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
455 return primarychanNum - 2;
456 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
457 return primarychanNum + 2;
458 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
459 return primarychanNum - 2;
460 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
461 return primarychanNum + 2;
462 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
463 return primarychanNum - 2;
464 default :
465 return eSIR_CFG_INVALID_ID;
466 }
467 }
468 return primarychanNum;
469}
470
471#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700472/**
473 * __limHandleSmeStartBssRequest()
474 *
475 *FUNCTION:
476 * This function is called to process SME_START_BSS_REQ message
477 * from HDD or upper layer application.
478 *
479 *LOGIC:
480 *
481 *ASSUMPTIONS:
482 *
483 *NOTE:
484 *
485 * @param pMac Pointer to Global MAC structure
486 * @param *pMsgBuf A pointer to the SME message buffer
487 * @return None
488 */
489
490static void
491__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
492{
493 tANI_U16 size;
494 tANI_U32 val = 0;
495 tSirRetStatus retStatus;
496 tSirMacChanNum channelNumber;
Jeff Johnsonace91102013-04-05 08:03:18 -0700497 tLimMlmStartReq *pMlmStartReq = NULL;
498 tpSirSmeStartBssReq pSmeStartBssReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700499 tSirResultCodes retCode = eSIR_SME_SUCCESS;
500 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700501 tANI_U8 sessionId;
502 tpPESession psessionEntry = NULL;
503 tANI_U8 smesessionId;
504 tANI_U16 smetransactionId;
505
506#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
507 //Since the session is not created yet, sending NULL. The response should have the correct state.
508 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
509#endif //FEATURE_WLAN_DIAG_SUPPORT
510
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700511 PELOG1(limLog(pMac, LOG1, FL("Received START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700512
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530513 /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */
Jeff Johnson295189b2012-06-20 16:38:30 -0700514 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
515 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
516 {
517 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
518
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530519 pSmeStartBssReq = vos_mem_malloc(size);
520 if ( NULL == pSmeStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700521 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530522 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pMac->lim.gpLimStartBssReq"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700523 /// Send failure response to host
524 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
525 goto end;
526 }
527
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530528 vos_mem_set((void *)pSmeStartBssReq, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700529
530 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
531 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
532 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700533 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700534 retCode = eSIR_SME_INVALID_PARAMETERS;
535 goto free;
536 }
537#if 0
538 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700539 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700540 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
541#endif
542
543 /* This is the place where PE is going to create a session.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530544 * If session is not existed, then create a new session */
Jeff Johnson295189b2012-06-20 16:38:30 -0700545 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
546 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700547 limLog(pMac, LOGW, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700548 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
549 psessionEntry = NULL;
550 goto free;
551 }
552 else
553 {
554 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
555 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700556 limLog(pMac, LOGW, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
558 goto free;
559 }
560
561 }
562
563 /* Store the session related parameters in newly created session */
564 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
565
566 /* Store PE sessionId in session Table */
567 psessionEntry->peSessionId = sessionId;
568
569 /* Store SME session Id in sessionTable */
570 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
571
572 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
573
574 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
575
576 /* Copy SSID to session table */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530577 vos_mem_copy( (tANI_U8 *)&psessionEntry->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700578 (tANI_U8 *)&pSmeStartBssReq->ssId,
579 (pSmeStartBssReq->ssId.length + 1));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530580
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 psessionEntry->bssType = pSmeStartBssReq->bssType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530582
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 psessionEntry->nwType = pSmeStartBssReq->nwType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530584
Jeff Johnson295189b2012-06-20 16:38:30 -0700585 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
586
587 /* Store the channel number in session Table */
588 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
589
590 /*Store Persona */
591 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700592 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 psessionEntry->pePersona);
594
595 /*Update the phymode*/
596 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
597
598 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
599 psessionEntry->currentOperChannel );
600 /* Store the dot 11 mode in to the session Table*/
601
602 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700603 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
604#ifdef WLAN_FEATURE_11AC
605 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700606 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
607 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700608#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800609
610 psessionEntry->txLdpcIniFeatureEnabled =
611 pSmeStartBssReq->txLdpcIniFeatureEnabled;
612
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530613 vos_mem_copy((void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 (void*)&pSmeStartBssReq->operationalRateSet,
615 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530616 vos_mem_copy((void*)&psessionEntry->extRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 (void*)&pSmeStartBssReq->extendedRateSet,
618 sizeof(tSirMacRateSet));
619
620 switch(pSmeStartBssReq->bssType)
621 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 case eSIR_INFRA_AP_MODE:
623 psessionEntry->limSystemRole = eLIM_AP_ROLE;
624 psessionEntry->privacy = pSmeStartBssReq->privacy;
625 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
626 psessionEntry->authType = pSmeStartBssReq->authType;
627 /* Store the DTIM period */
628 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
629 /*Enable/disable UAPSD*/
630 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
631 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
632 {
633 psessionEntry->proxyProbeRspEn = 0;
634 }
635 else
636 {
637 /* To detect PBC overlap in SAP WPS mode, Host handles
638 * Probe Requests.
639 */
640 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
641 {
642 psessionEntry->proxyProbeRspEn = 1;
643 }
644 else
645 {
646 psessionEntry->proxyProbeRspEn = 0;
647 }
648 }
649 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
650 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -0700651 psessionEntry->shortSlotTimeSupported = limGetShortSlotFromPhyMode(pMac, psessionEntry, psessionEntry->gLimPhyMode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 case eSIR_IBSS_MODE:
654 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
Ravi Joshi27216f12013-10-19 17:04:39 -0700655 psessionEntry->shortSlotTimeSupported =
656 limGetShortSlotFromPhyMode(pMac, psessionEntry,
657 psessionEntry->gLimPhyMode);
krunal sonie9002db2013-11-25 14:24:17 -0800658 psessionEntry->isCoalesingInIBSSAllowed =
659 pSmeStartBssReq->isCoalesingInIBSSAllowed;
Jeff Johnson295189b2012-06-20 16:38:30 -0700660 break;
661
662 case eSIR_BTAMP_AP_MODE:
663 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
664 break;
665
666 case eSIR_BTAMP_STA_MODE:
667 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
668 break;
669
670 /* There is one more mode called auto mode. which is used no where */
671
672 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
673
674
675 default:
676 //not used anywhere...used in scan function
677 break;
678 }
679
680 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
681 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 )
684 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530685 psessionEntry->parsedAssocReq = vos_mem_malloc(
686 psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq));
687 if ( NULL == psessionEntry->parsedAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530689 limLog(pMac, LOGW, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700690 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
691 goto free;
692 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530693 vos_mem_set(psessionEntry->parsedAssocReq,
694 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)),
695 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700696 }
697
698 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
699 if (pSmeStartBssReq->channelId)
700 {
701 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700702 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
703 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
704 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700705 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700706 FL("cbMode %u"), pSmeStartBssReq->cbMode);
707#ifdef WLAN_FEATURE_11AC
708 if(psessionEntry->vhtCapability)
709 {
710 tANI_U32 centerChan;
711 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700712
Jeff Johnsone7245742012-09-05 17:12:55 -0700713 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
714 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700715 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700716 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700717 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700718 }
719
720 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ || chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
721 {
722 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
723 != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700725 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700726 retCode = eSIR_LOGP_EXCEPTION;
Jeff Johnsone7245742012-09-05 17:12:55 -0700727 goto free;
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 }
729 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700730 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
731 {
732 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
733 != eSIR_SUCCESS)
734 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700735 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700736 retCode = eSIR_LOGP_EXCEPTION;
737 goto free;
738 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700739
Jeff Johnsone7245742012-09-05 17:12:55 -0700740 centerChan = limGetCenterChannel(pMac,channelNumber,pSmeStartBssReq->cbMode,WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
741 if(centerChan != eSIR_CFG_INVALID_ID)
742 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800743 limLog(pMac, LOGW, FL("***Center Channel for 80MHZ channel width = %d"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700744 psessionEntry->apCenterChan = centerChan;
Jeff Johnsone7245742012-09-05 17:12:55 -0700745 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1, centerChan)
746 != eSIR_SUCCESS)
747 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700748 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700749 retCode = eSIR_LOGP_EXCEPTION;
750 goto free;
751 }
752 }
753 }
754
755 /* All the translation is done by now for gVhtChannelWidth from .ini file to
756 * the actual values as defined in spec. So, grabing the spec value which is
757 * updated in .dat file by the above logic */
758 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
759 &chanWidth) != eSIR_SUCCESS)
760 {
761 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700762 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700763 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700764 /*For Sta+p2p-Go concurrency
765 vhtTxChannelWidthSet is used for storing p2p-GO channel width
766 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
767 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
768 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700769 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700770 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700771 }
772 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
773#endif
774 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 else
776 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700777 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700778 retCode = eSIR_SME_INVALID_PARAMETERS;
779 goto free;
780 }
781
782 // Delete pre-auth list if any
783 limDeletePreAuthList(pMac);
784
785 // Delete IBSS peer BSSdescription list if any
786 //limIbssDelete(pMac); sep 26 review
787
788
789
790#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
791 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 limInitMlm(pMac);
793#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700794
Jeff Johnsone7245742012-09-05 17:12:55 -0700795 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700796
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 /* keep the RSN/WPA IE information in PE Session Entry
798 * later will be using this to check when received (Re)Assoc req
799 * */
800 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
801
Jeff Johnson295189b2012-06-20 16:38:30 -0700802
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 //Taken care for only softAP case rest need to be done
804 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
805 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
806 /*each byte will have the following info
807 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
808 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530809 vos_mem_copy( (void *) &psessionEntry->cfgProtection,
Jeff Johnson295189b2012-06-20 16:38:30 -0700810 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700811 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700812 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
813 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700814
815 // Prepare and Issue LIM_MLM_START_REQ to MLM
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530816 pMlmStartReq = vos_mem_malloc(sizeof(tLimMlmStartReq));
817 if ( NULL == pMlmStartReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530819 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700820 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
821 goto free;
822 }
823
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530824 vos_mem_set((void *) pMlmStartReq, sizeof(tLimMlmStartReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700825
826 /* Copy SSID to the MLM start structure */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530827 vos_mem_copy( (tANI_U8 *) &pMlmStartReq->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 (tANI_U8 *) &pSmeStartBssReq->ssId,
829 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700830 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
831 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700832
833
834 pMlmStartReq->bssType = psessionEntry->bssType;
835
836 /* Fill PE session Id from the session Table */
837 pMlmStartReq->sessionId = psessionEntry->peSessionId;
838
839 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700840 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 )
842 {
843 //len = sizeof(tSirMacAddr);
844 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
845 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700846 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700847
848 /* Copy the BSSId from sessionTable to mlmStartReq struct */
849 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
850 }
851
852 else // ibss mode
853 {
854 pMac->lim.gLimIbssCoalescingHappened = false;
855
856 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
857 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700858 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 retCode = eSIR_LOGP_EXCEPTION;
860 goto free;
861 }
862
863 if(!autoGenBssId)
864 {
865 // We're not auto generating BSSID. Instead, get it from session entry
866 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
867
868 if(pMlmStartReq->bssId[0] & 0x01)
869 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700870 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 autoGenBssId = TRUE;
872 }
873 }
874
875 if( autoGenBssId )
876 { //if BSSID is not any uc id. then use locally generated BSSID.
877 //Autogenerate the BSSID
878 limGetRandomBssid( pMac, pMlmStartReq->bssId);
879 pMlmStartReq->bssId[0]= 0x02;
880
881 /* Copy randomly generated BSSID to the session Table */
882 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
883 }
884 }
885 /* store the channel num in mlmstart req structure */
886 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
887 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
888 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
889
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
891 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
892 pMlmStartReq->wps_state = psessionEntry->wps_state;
893
894 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700895 {
896 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700897 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700898 pMlmStartReq->dtimPeriod = (tANI_U8)val;
899 }
900
901 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700902 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700903 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
904
905 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700906 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700907 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
908
909 //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 +0530910 vos_mem_copy((void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700911 sizeof(tSirMacRateSet));
912
Jeff Johnson295189b2012-06-20 16:38:30 -0700913 // Now populate the 11n related parameters
914 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700915 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700916 //
917 // FIXME_GEN4 - Determine the appropriate defaults...
918 //
919 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
920 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700921 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700922
923 /* sep26 review */
924 psessionEntry->limRFBand = limGetRFBand(channelNumber);
925
926 // Initialize 11h Enable Flag
927 psessionEntry->lim11hEnable = 0;
928 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
929 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
930 {
931 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700932 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700933 psessionEntry->lim11hEnable = val;
934 }
935
936 if (!psessionEntry->lim11hEnable)
937 {
938 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700939 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700940 }
941
Jeff Johnson295189b2012-06-20 16:38:30 -0700942 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
943 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700944 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700945
946 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
947 return;
948 }
949 else
950 {
951
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700952 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700953 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
954 goto end;
955 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
956
957free:
Jeff Johnsonace91102013-04-05 08:03:18 -0700958 if ((psessionEntry != NULL) &&
959 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
960 {
961 psessionEntry->pLimStartBssReq = NULL;
962 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530963 vos_mem_free( pSmeStartBssReq);
964 vos_mem_free( pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700965
966end:
967
968 /* This routine should return the sme sessionId and SME transaction Id */
969 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
970
971 if(NULL != psessionEntry)
972 {
973 peDeleteSession(pMac,psessionEntry);
974 psessionEntry = NULL;
975 }
976 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
977} /*** end __limHandleSmeStartBssRequest() ***/
978
979
980/**--------------------------------------------------------------
981\fn __limProcessSmeStartBssReq
982
983\brief Wrapper for the function __limHandleSmeStartBssRequest
984 This message will be defered until softmac come out of
985 scan mode or if we have detected radar on the current
986 operating channel.
987\param pMac
988\param pMsg
989
990\return TRUE - If we consumed the buffer
991 FALSE - If have defered the message.
992 ---------------------------------------------------------------*/
993static tANI_BOOLEAN
994__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
995{
996 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
997 __limIsDeferedMsgForRadar(pMac, pMsg))
998 {
999 /**
1000 * If message defered, buffer is not consumed yet.
1001 * So return false
1002 */
1003 return eANI_BOOLEAN_FALSE;
1004 }
1005
1006 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1007 return eANI_BOOLEAN_TRUE;
1008}
1009
1010
1011/**
1012 * limGetRandomBssid()
1013 *
1014 * FUNCTION:This function is called to process generate the random number for bssid
1015 * This function is called to process SME_SCAN_REQ message
1016 * from HDD or upper layer application.
1017 *
1018 * LOGIC:
1019 *
1020 * ASSUMPTIONS:
1021 *
1022 * NOTE:
1023 * 1. geneartes the unique random number for bssid in ibss
1024 *
1025 * @param pMac Pointer to Global MAC structure
1026 * @param *data Pointer to bssid buffer
1027 * @return None
1028 */
1029void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1030{
1031 tANI_U32 random[2] ;
1032 random[0] = tx_time_get();
1033 random[0] |= (random[0] << 15) ;
1034 random[1] = random[0] >> 1;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301035 vos_mem_copy( data, (tANI_U8*)random, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001036}
1037
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301038static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
1039 tpSirSmeScanReq pScanReq)
1040{
1041 tSirScanOffloadReq *pScanOffloadReq;
1042 tANI_U8 *p;
1043 tSirMsgQ msg;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301044 tANI_U16 i, len;
1045 tSirRetStatus rc = eSIR_SUCCESS;
1046
1047 /* The tSirScanOffloadReq will reserve the space for first channel,
1048 so allocate the memory for (numChannels - 1) and uIEFieldLen */
1049 len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
1050 pScanReq->uIEFieldLen;
1051
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301052 pScanOffloadReq = vos_mem_malloc(len);
1053 if ( NULL == pScanOffloadReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301054 {
1055 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301056 FL("AllocateMemory failed for pScanOffloadReq"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301057 return eHAL_STATUS_FAILURE;
1058 }
1059
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301060 vos_mem_set( (tANI_U8 *) pScanOffloadReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301061
1062 msg.type = WDA_START_SCAN_OFFLOAD_REQ;
1063 msg.bodyptr = pScanOffloadReq;
1064 msg.bodyval = 0;
1065
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301066 vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301067 (tANI_U8*) pScanReq->bssId,
1068 sizeof(tSirMacAddr));
1069
1070 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
1071 {
1072 limLog(pMac, LOGE,
1073 FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
Kiet Lamb1233192013-11-28 13:38:20 +05301074 vos_mem_free (pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301075 return eHAL_STATUS_FAILURE;
1076 }
1077
1078 pScanOffloadReq->numSsid = pScanReq->numSsid;
1079 for (i = 0; i < pScanOffloadReq->numSsid; i++)
1080 {
1081 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301082 vos_mem_copy((tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301083 (tANI_U8 *) pScanReq->ssId[i].ssId,
1084 pScanOffloadReq->ssId[i].length);
1085 }
1086
1087 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301088 vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301089 (tANI_U8 *) pScanReq->selfMacAddr,
1090 sizeof(tSirMacAddr));
1091 pScanOffloadReq->bssType = pScanReq->bssType;
1092 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1093 pScanOffloadReq->scanType = pScanReq->scanType;
1094 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1095 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1096 pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
1097 pScanOffloadReq->sessionId = pScanReq->sessionId;
1098 pScanOffloadReq->channelList.numChannels =
1099 pScanReq->channelList.numChannels;
1100 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1101 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1102 p[i] = pScanReq->channelList.channelNumber[i];
1103
1104 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1105 pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301106 vos_mem_copy((tANI_U8 *) p + i,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301107 (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
1108 pScanOffloadReq->uIEFieldLen);
1109
1110 rc = wdaPostCtrlMsg(pMac, &msg);
1111 if (rc != eSIR_SUCCESS)
1112 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001113 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301114 vos_mem_free(pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301115 return eHAL_STATUS_FAILURE;
1116 }
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301117 limLog(pMac, LOG1, FL("Processed Offload Scan Request Successfully"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301118
1119 return eHAL_STATUS_SUCCESS;
1120}
Jeff Johnson295189b2012-06-20 16:38:30 -07001121
1122/**
1123 * __limProcessSmeScanReq()
1124 *
1125 *FUNCTION:
1126 * This function is called to process SME_SCAN_REQ message
1127 * from HDD or upper layer application.
1128 *
1129 *LOGIC:
1130 *
1131 *ASSUMPTIONS:
1132 *
1133 *NOTE:
1134 * 1. Periodic scanning should be requesting to return unique
1135 * scan results.
1136 *
1137 * @param pMac Pointer to Global MAC structure
1138 * @param *pMsgBuf A pointer to the SME message buffer
1139 * @return None
1140 */
1141
Viral Modid440e682013-03-06 02:25:31 -08001142static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001143__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1144{
1145 tANI_U32 len;
1146 tLimMlmScanReq *pMlmScanReq;
1147 tpSirSmeScanReq pScanReq;
1148 tANI_U8 i = 0;
1149
1150#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1151 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1152#endif //FEATURE_WLAN_DIAG_SUPPORT
1153
1154 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301155 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 -07001156 pScanReq->channelList.numChannels,
1157 pScanReq->minChannelTime,
1158 pScanReq->maxChannelTime,
1159 pScanReq->uIEFieldLen,
1160 pScanReq->returnAfterFirstMatch,
1161 pScanReq->returnFreshResults,
1162 pScanReq->returnUniqueResults,
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001163 pScanReq->scanType,
1164 pScanReq->backgroundScanMode,
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301165 pMac->lim.gLimRspReqd ? 1 : 0);
Viral Modid86bde22012-12-10 13:09:21 -08001166
1167 /* Since scan req always requires a response, we will overwrite response required here.
1168 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1169 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1170 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1171 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1172 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1173 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1174 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1175 * the global flag gLimRspReqd to TRUE here.
1176 */
1177 pMac->lim.gLimRspReqd = TRUE;
1178
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301179 /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001180 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1181
1182 /* This routine should return the sme sessionId and SME transaction Id */
1183
1184 if (!limIsSmeScanReqValid(pMac, pScanReq))
1185 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301186 limLog(pMac, LOGE, FL("Received SME_SCAN_REQ with invalid parameters"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001187
1188 if (pMac->lim.gLimRspReqd)
1189 {
1190 pMac->lim.gLimRspReqd = false;
1191
1192 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1193
1194 } // if (pMac->lim.gLimRspReqd)
1195
1196 return;
1197 }
1198
1199 //if scan is disabled then return as invalid scan request.
1200 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1201 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1202 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301203 limLog(pMac, LOGE, FL("SCAN is disabled or SCAN in power save"
1204 " is disabled and system is in power save."));
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001205 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001206 return;
1207 }
1208
1209
1210 /**
1211 * If scan request is received in idle, joinFailed
1212 * states or in link established state (in STA role)
1213 * or in normal state (in STA-in-IBSS/AP role) with
1214 * 'return fresh scan results' request from HDD or
1215 * it is periodic background scanning request,
1216 * trigger fresh scan request to MLM
1217 */
1218 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1219 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301220 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1221 {
1222 // Discard previously cached scan results
1223 limReInitScanResults(pMac);
1224 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001225
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301226 pMac->lim.gLim24Band11dScanDone = 0;
1227 pMac->lim.gLim50Band11dScanDone = 0;
1228 pMac->lim.gLimReturnAfterFirstMatch =
1229 pScanReq->returnAfterFirstMatch;
1230 pMac->lim.gLimBackgroundScanMode =
1231 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001232
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301233 pMac->lim.gLimReturnUniqueResults =
1234 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1235 /* De-activate Heartbeat timers for connected sessions while
1236 * scan is in progress if the system is in Active mode *
1237 * AND it is not a ROAMING ("background") scan */
1238 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1239 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1240 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1241 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1242 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001243 for(i=0;i<pMac->lim.maxBssId;i++)
1244 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301245 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1246 (pMac->lim.gpSession[i].valid == TRUE) &&
1247 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1248 {
1249 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1250 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001251 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301252 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001253
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301254 if (pMac->fScanOffload)
1255 {
1256 if (eHAL_STATUS_SUCCESS !=
1257 limSendHalStartScanOffloadReq(pMac, pScanReq))
1258 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301259 limLog(pMac, LOGE, FL("Couldn't send Offload scan request"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301260 limSendSmeScanRsp(pMac,
1261 offsetof(tSirSmeScanRsp, bssDescription[0]),
1262 eSIR_SME_INVALID_PARAMETERS,
1263 pScanReq->sessionId,
1264 pScanReq->transactionId);
1265 return;
1266 }
1267 }
1268 else
1269 {
1270
1271 /*Change Global SME state */
1272 /* Store the previous SME state */
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301273 limLog(pMac, LOG1, FL("Non Offload SCAN request "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301274 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1275 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1276 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1277
1278 if (pScanReq->channelList.numChannels == 0)
1279 {
1280 tANI_U32 cfg_len;
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301281
1282 limLog(pMac, LOG1,
1283 FL("Scan all channels as Number of channels is 0"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301284 // Scan all channels
1285 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001286 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1287 pScanReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301288 pMlmScanReq = vos_mem_malloc(len);
1289 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301290 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301291 // Log error
1292 limLog(pMac, LOGP,
1293 FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001294
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301295 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301296 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001297
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301298 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301299 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001300
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301301 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1302 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001303 pMlmScanReq->channelList.channelNumber,
1304 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301305 {
1306 /**
1307 * Could not get Valid channel list from CFG.
1308 * Log error.
1309 */
1310 limLog(pMac, LOGP,
1311 FL("could not retrieve Valid channel list"));
1312 }
1313 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
1314 }
1315 else
1316 {
1317 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1318 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1319 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001320
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301321 pMlmScanReq = vos_mem_malloc(len);
1322 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301323 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301324 // Log error
1325 limLog(pMac, LOGP,
1326 FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001327
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301328 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301329 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001330
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301331 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301332 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301333 pMlmScanReq->channelList.numChannels =
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301334 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001335
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301336 vos_mem_copy( pMlmScanReq->channelList.channelNumber,
1337 pScanReq->channelList.channelNumber,
1338 pScanReq->channelList.numChannels);
1339 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001340
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301341 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1342 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1343 if(pScanReq->uIEFieldLen)
1344 {
1345 vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1346 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1347 pScanReq->uIEFieldLen);
1348 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001349
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301350 pMlmScanReq->bssType = pScanReq->bssType;
1351 vos_mem_copy( pMlmScanReq->bssId,
1352 pScanReq->bssId,
1353 sizeof(tSirMacAddr));
1354 pMlmScanReq->numSsid = pScanReq->numSsid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001355
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301356 i = 0;
1357 while (i < pMlmScanReq->numSsid)
1358 {
1359 vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001360 (tANI_U8 *) &pScanReq->ssId[i],
1361 pScanReq->ssId[i].length + 1);
1362
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301363 i++;
1364 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001365
Jeff Johnson295189b2012-06-20 16:38:30 -07001366
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301367 pMlmScanReq->scanType = pScanReq->scanType;
1368 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
1369 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1370 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1371 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1372 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
1373 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1374 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001375
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301376 //Store the smeSessionID and transaction ID for later use.
1377 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1378 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001379
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301380 // Issue LIM_MLM_SCAN_REQ to MLM
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301381 limLog(pMac, LOG1, FL("Issue Scan request command to MLM "));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301382 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1383 }
1384 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001385
1386 else
1387 {
1388 /// In all other cases return 'cached' scan results
1389 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1390 {
1391 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1392
1393 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001394#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1395 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001397 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1398 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1399 {
1400 limSendSmeLfrScanRsp(pMac, scanRspLen,
1401 eSIR_SME_SUCCESS,
1402 pScanReq->sessionId,
1403 pScanReq->transactionId);
1404 }
1405 else
1406 {
1407 scanRspLen = sizeof(tSirSmeScanRsp) +
1408 pMac->lim.gLimSmeLfrScanResultLength -
1409 sizeof(tSirBssDescription);
1410 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1411 pScanReq->sessionId, pScanReq->transactionId);
1412 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001413 }
1414 else
1415 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001416#endif
1417 if (pMac->lim.gLimSmeScanResultLength == 0)
1418 {
1419 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1420 pScanReq->sessionId, pScanReq->transactionId);
1421 }
1422 else
1423 {
1424 scanRspLen = sizeof(tSirSmeScanRsp) +
1425 pMac->lim.gLimSmeScanResultLength -
1426 sizeof(tSirBssDescription);
1427 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1428 pScanReq->sessionId, pScanReq->transactionId);
1429 }
1430#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001431 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001432#endif
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301433 limLog(pMac, LOG1, FL("Cached scan results are returned "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001434
1435 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1436 {
1437 // Discard previously cached scan results
1438 limReInitScanResults(pMac);
1439 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001440#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1441 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1442 {
1443 // Discard previously cached scan results
1444 limReInitLfrScanResults(pMac);
1445 }
1446#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001447
1448 } // if (pMac->lim.gLimRspReqd)
1449 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1450
Jeff Johnson295189b2012-06-20 16:38:30 -07001451#ifdef BACKGROUND_SCAN_ENABLED
1452 // start background scans if needed
1453 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1454 __limBackgroundScanInitiate(pMac);
1455#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001456
1457} /*** end __limProcessSmeScanReq() ***/
1458
Jeff Johnsone7245742012-09-05 17:12:55 -07001459#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001460
Jeff Johnsone7245742012-09-05 17:12:55 -07001461static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1462{
1463 tpSirOemDataReq pOemDataReq;
1464 tLimMlmOemDataReq* pMlmOemDataReq;
1465
1466 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1467
1468 //post the lim mlm message now
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301469 pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq));
1470 if ( NULL == pMlmOemDataReq )
Jeff Johnsone7245742012-09-05 17:12:55 -07001471 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301472 limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001473 return;
1474 }
1475
1476 //Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301477 vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001478
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301479 vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr,
1480 sizeof(tSirMacAddr));
1481 vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq,
1482 OEM_DATA_REQ_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001483
1484 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1485 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1486
1487 return;
1488
1489} /*** end __limProcessSmeOemDataReq() ***/
1490
1491#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001492
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301493/**
1494 * __limProcessClearDfsChannelList()
1495 *
1496 *FUNCTION:
1497 *Clear DFS channel list when country is changed/aquired.
1498.*This message is sent from SME.
1499 *
1500 *LOGIC:
1501 *
1502 *ASSUMPTIONS:
1503 *
1504 *NOTE:
1505 *
1506 * @param pMac Pointer to Global MAC structure
1507 * @param *pMsgBuf A pointer to the SME message buffer
1508 * @return None
1509 */
1510static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1511 tpSirMsgQ pMsg)
1512{
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301513 vos_mem_set( &pMac->lim.dfschannelList,
1514 sizeof(tSirDFSChannelList), 0);
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301515}
Jeff Johnson295189b2012-06-20 16:38:30 -07001516
1517/**
1518 * __limProcessSmeJoinReq()
1519 *
1520 *FUNCTION:
1521 * This function is called to process SME_JOIN_REQ message
1522 * from HDD or upper layer application.
1523 *
1524 *LOGIC:
1525 *
1526 *ASSUMPTIONS:
1527 *
1528 *NOTE:
1529 *
1530 * @param pMac Pointer to Global MAC structure
1531 * @param *pMsgBuf A pointer to the SME message buffer
1532 * @return None
1533 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001534static void
1535__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1536{
1537 // tANI_U8 *pBuf;
1538 //tANI_U32 len;
1539// tSirMacAddr currentBssId;
1540 tpSirSmeJoinReq pSmeJoinReq = NULL;
1541 tLimMlmJoinReq *pMlmJoinReq;
1542 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1543 tANI_U32 val = 0;
1544 tANI_U16 nSize;
1545 tANI_U8 sessionId;
1546 tpPESession psessionEntry = NULL;
1547 tANI_U8 smesessionId;
1548 tANI_U16 smetransactionId;
1549 tPowerdBm localPowerConstraint = 0, regMax = 0;
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301550 tANI_U16 ieLen;
1551 v_U8_t *vendorIE;
Jeff Johnson295189b2012-06-20 16:38:30 -07001552
1553#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1554 //Not sending any session, since it is not created yet. The response whould have correct state.
1555 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1556#endif //FEATURE_WLAN_DIAG_SUPPORT
1557
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001558 PELOG1(limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001559
1560#ifdef WLAN_FEATURE_VOWIFI
1561 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1562 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1563 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1564 * like not honoring power constraint on 1st association after driver loading. */
1565 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001566 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001567 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1568 val = 0;
1569#endif /* WLAN_FEATURE_VOWIFI */
1570
1571 /**
1572 * Expect Join request in idle state.
1573 * Reassociate request is expected in link established state.
1574 */
1575
1576 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1577 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1578 {
1579 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301580
1581 pSmeJoinReq = vos_mem_malloc(nSize);
1582 if ( NULL == pSmeJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001583 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301584 limLog(pMac, LOGP, FL("call to AllocateMemory failed for "
1585 "pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1587 goto end;
1588 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301589 (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001590
Jeff Johnson295189b2012-06-20 16:38:30 -07001591 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1592 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1593 {
1594 /// Received invalid eWNI_SME_JOIN_REQ
1595 // Log the event
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001596 limLog(pMac, LOGW, FL("received SME_JOIN_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001597 retCode = eSIR_SME_INVALID_PARAMETERS;
1598 goto end;
1599 }
1600
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301601 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23
Jeff Johnson295189b2012-06-20 16:38:30 -07001602
1603 /* check for the existence of start BSS session */
1604#ifdef FIXME_GEN6
1605 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1606 {
1607 if(peValidateBtJoinRequest(pMac)!= TRUE)
1608 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301609 limLog(pMac, LOGW, FL("Start Bss session not present::"
1610 "SME_JOIN_REQ in unexpected state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001611 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1612 psessionEntry = NULL;
1613 goto end;
1614 }
1615 }
1616
1617#endif
1618
1619
1620 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1621 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301622 limLog(pMac, LOGE, FL("Session(%d) Already exists for BSSID: "
1623 MAC_ADDRESS_STR" in limSmeState = %X"),sessionId,
1624 MAC_ADDR_ARRAY(pSmeJoinReq->bssDescription.bssId),
1625 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001626
1627 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1628 {
1629 // Received eWNI_SME_JOIN_REQ for same
1630 // BSS as currently associated.
1631 // Log the event and send success
Abhishek Singh57aebef2014-02-03 18:47:44 +05301632 PELOGW(limLog(pMac, LOGW, FL("Received SME_JOIN_REQ for "
1633 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 /// Send Join success response to host
Deepthi Gowrif3e27252013-12-11 20:50:01 +05301635 retCode = eSIR_SME_ALREADY_JOINED_A_BSS;
1636 psessionEntry = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001637 goto end;
1638 }
1639 else
1640 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301641 PELOGE(limLog(pMac, LOGE, FL("SME_JOIN_REQ not for"
1642 "currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001643 retCode = eSIR_SME_REFUSED;
1644 psessionEntry = NULL;
1645 goto end;
1646 }
1647 }
1648 else /* Session Entry does not exist for given BSSId */
1649 {
1650 /* Try to Create a new session */
1651 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1652 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001653 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001654 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1655 goto end;
1656 }
1657 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001658 handleHTCapabilityandHTInfo(pMac, psessionEntry);
krunal soni5afa96c2013-09-06 22:19:02 -07001659 psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
Jeff Johnsone7245742012-09-05 17:12:55 -07001660
Jeff Johnson295189b2012-06-20 16:38:30 -07001661 /* Store Session related parameters */
1662 /* Store PE session Id in session Table */
1663 psessionEntry->peSessionId = sessionId;
1664
1665 /* store the smejoin req handle in session table */
1666 psessionEntry->pLimJoinReq = pSmeJoinReq;
1667
1668 /* Store SME session Id in sessionTable */
1669 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1670
1671 /* Store SME transaction Id in session Table */
1672 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1673
1674 /* Store beaconInterval */
1675 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1676
1677 /* Copying of bssId is already done, while creating session */
1678 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1679 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1680 psessionEntry->bssType = pSmeJoinReq->bsstype;
1681
1682 psessionEntry->statypeForBss = STA_ENTRY_PEER;
Sandeep Puligillaaea98a22013-12-04 13:36:32 +05301683 psessionEntry->limWmeEnabled = pSmeJoinReq->isWMEenabled;
1684 psessionEntry->limQosEnabled = pSmeJoinReq->isQosEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001685
Agarwal Ashish87039eb2014-01-15 14:13:15 +05301686 /* Store vendor specfic IE for CISCO AP */
1687 ieLen = (pSmeJoinReq->bssDescription.length +
1688 sizeof( pSmeJoinReq->bssDescription.length ) -
1689 GET_FIELD_OFFSET( tSirBssDescription, ieFields ));
1690
1691 vendorIE = limGetVendorIEOuiPtr(pMac, SIR_MAC_CISCO_OUI,
1692 SIR_MAC_CISCO_OUI_SIZE,
1693 ((tANI_U8 *)&pSmeJoinReq->bssDescription.ieFields) , ieLen);
1694
1695 if ( NULL != vendorIE )
1696 {
1697 limLog(pMac, LOGE,
1698 FL("DUT is trying to connect to Cisco AP"));
1699 psessionEntry->isCiscoVendorAP = TRUE;
1700 }
1701 else
1702 {
1703 psessionEntry->isCiscoVendorAP = FALSE;
1704 }
1705
Jeff Johnson295189b2012-06-20 16:38:30 -07001706 /* Copy the dot 11 mode in to the session table */
1707
1708 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1709 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001710#ifdef WLAN_FEATURE_11AC
1711 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001712 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001713 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001714 if (psessionEntry->vhtCapability )
1715 {
1716 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1717
1718 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001719 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001720 psessionEntry->txBFIniFeatureEnabled);
1721
1722 if( psessionEntry->txBFIniFeatureEnabled )
1723 {
1724 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1725 != eSIR_SUCCESS)
1726 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301727 limLog(pMac, LOGP, FL("could not set "
1728 "WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001729 retCode = eSIR_LOGP_EXCEPTION;
1730 goto end;
1731 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001732 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301733 "***__limProcessSmeJoinReq: txBFCsnValue=%d****",
1734 pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001735
1736 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001737 != eSIR_SUCCESS)
1738 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301739 limLog(pMac, LOGP, FL("could not set "
1740 "WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001741 retCode = eSIR_LOGP_EXCEPTION;
1742 goto end;
1743 }
1744 }
1745 }
1746
Jeff Johnsone7245742012-09-05 17:12:55 -07001747#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001748
1749 /*Phy mode*/
1750 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1751
1752 /* Copy The channel Id to the session Table */
1753 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001754 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1755 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1756 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001757
Chet Lanctot186b5732013-03-18 10:26:30 -07001758 /* Record if management frames need to be protected */
1759#ifdef WLAN_FEATURE_11W
1760 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1761 {
1762 psessionEntry->limRmfEnabled = 1;
1763 }
1764 else
1765 {
1766 psessionEntry->limRmfEnabled = 0;
1767 }
1768#endif
1769
krunal soni8d13b092013-07-19 13:23:29 -07001770#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1771 psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi;
1772#endif
1773
Jeff Johnson295189b2012-06-20 16:38:30 -07001774 /*Store Persona */
1775 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1776 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Abhishek Singh57aebef2014-02-03 18:47:44 +05301777 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona,
1778 pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001779
1780 /* Copy the SSID from smejoinreq to session entry */
1781 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301782 vos_mem_copy( psessionEntry->ssId.ssId,
1783 pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length);
1784
1785 // Determin 11r or CCX connection based on input from SME
1786 // which inturn is dependent on the profile the user wants to connect
1787 // to, So input is coming from supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07001788#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301789 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001790#endif
1791#ifdef FEATURE_WLAN_CCX
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301792 psessionEntry->isCCXconnection = pSmeJoinReq->isCCXconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001793#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001794#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301795 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001796#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301797
Jeff Johnson43971f52012-07-17 12:26:56 -07001798#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301799 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
Jeff Johnson43971f52012-07-17 12:26:56 -07001800#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301801 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001802
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301803 if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001804 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301805 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1806 }
1807 else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1808 {
1809 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1810 }
1811 else
1812 {
1813 /* Throw an error and return and make sure to delete the session.*/
Abhishek Singh57aebef2014-02-03 18:47:44 +05301814 limLog(pMac, LOGE, FL("received SME_JOIN_REQ with invalid"
1815 " bss type %d"), psessionEntry->bssType);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301816 retCode = eSIR_SME_INVALID_PARAMETERS;
1817 goto end;
1818 }
1819
1820 if (pSmeJoinReq->addIEScan.length)
1821 {
1822 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan,
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
1824 }
1825
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301826 if (pSmeJoinReq->addIEAssoc.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07001827 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301828 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc,
Jeff Johnson295189b2012-06-20 16:38:30 -07001829 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
1830 }
1831
Jeff Johnson295189b2012-06-20 16:38:30 -07001832 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301833 pMlmJoinReq = vos_mem_malloc(val);
1834 if ( NULL == pMlmJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 {
Abhishek Singh57aebef2014-02-03 18:47:44 +05301836 limLog(pMac, LOGP, FL("call to AllocateMemory "
1837 "failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001838 return;
1839 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301840 (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001841
1842 /* PE SessionId is stored as a part of JoinReq*/
1843 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
1844
1845 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
1846 != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001847 limLog(pMac, LOGP, FL("could not retrieve JoinFailureTimer value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001848
1849 /* copy operational rate from psessionEntry*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301850 vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001851 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301852 vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001853 sizeof(tSirMacRateSet));
1854 //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 +05301855 vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001856 sizeof(tSirMacRateSet));
1857
1858 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
1859
Jeff Johnson295189b2012-06-20 16:38:30 -07001860 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
1861
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301862 vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001863 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
1864 psessionEntry->pLimJoinReq->bssDescription.length + 2);
1865
Jeff Johnson295189b2012-06-20 16:38:30 -07001866 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07001867 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001868
Jeff Johnsone7245742012-09-05 17:12:55 -07001869 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
1870 localPowerConstraint = regMax;
1871 limExtractApCapability( pMac,
1872 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
1873 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
1874 &psessionEntry->limCurrentBssQosCaps,
1875 &psessionEntry->limCurrentBssPropCap,
1876 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07001877 , &localPowerConstraint,
1878 psessionEntry
Jeff Johnsone7245742012-09-05 17:12:55 -07001879 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001880#ifdef FEATURE_WLAN_CCX
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001881 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07001882#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301883 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001884#endif
1885#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05301886 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d,"
1887 " max tx = %d", regMax, localPowerConstraint,
1888 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07001889#endif
1890
1891 if (pMac->lim.gLimCurrentBssUapsd)
1892 {
1893 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05301894 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
1895 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07001896
1897 // resetting the dynamic uapsd mask
1898 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
1899 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
1900 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001901
1902 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
1903
1904 // Initialize 11h Enable Flag
1905 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
1906 {
1907 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001908 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001909 psessionEntry->lim11hEnable = val;
1910 }
1911 else
1912 psessionEntry->lim11hEnable = 0;
1913
1914 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
1915 pMac->lim.gLimIbssCoalescingHappened = false;
1916
Jeff Johnsone7245742012-09-05 17:12:55 -07001917 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
1918 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
1919 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001920
Abhishek Singh57aebef2014-02-03 18:47:44 +05301921 limLog(pMac, LOG1, FL("SME JoinReq:Sessionid %d SSID len %d SSID : %s "
1922 "Channel %d, BSSID "MAC_ADDRESS_STR), pMlmJoinReq->sessionId,
1923 psessionEntry->ssId.length,psessionEntry->ssId.ssId,
1924 psessionEntry->currentOperChannel,
1925 MAC_ADDR_ARRAY(psessionEntry->bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07001926
1927 /* Indicate whether spectrum management is enabled*/
1928 psessionEntry->spectrumMgtEnabled =
1929 pSmeJoinReq->spectrumMgtIndicator;
1930 /* Issue LIM_MLM_JOIN_REQ to MLM */
1931 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
1932 return;
1933
1934 }
1935 else
1936 {
1937 /* Received eWNI_SME_JOIN_REQ un expected state */
Abhishek Singh57aebef2014-02-03 18:47:44 +05301938 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ "
1939 "in state %X"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001940 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
1941 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1942 psessionEntry = NULL;
1943 goto end;
1944
1945 }
1946
1947end:
1948 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1949
1950 if(pSmeJoinReq)
1951 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301952 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001953 pSmeJoinReq = NULL;
1954 if (NULL != psessionEntry)
1955 {
1956 psessionEntry->pLimJoinReq = NULL;
1957 }
1958 }
1959
1960 if(retCode != eSIR_SME_SUCCESS)
1961 {
1962 if(NULL != psessionEntry)
1963 {
1964 peDeleteSession(pMac,psessionEntry);
1965 psessionEntry = NULL;
1966 }
1967 }
Abhishek Singh57aebef2014-02-03 18:47:44 +05301968 limLog(pMac, LOG1, FL("Sending failure status limSendSmeJoinReassocRsp"
1969 "on sessionid: %d with retCode = %d"),smesessionId, retCode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001970 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
1971} /*** end __limProcessSmeJoinReq() ***/
1972
1973
1974#ifdef FEATURE_WLAN_CCX
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08001975tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07001976{
1977 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301978 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001979 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07001980 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
1981 maxTxPower = txPower;
1982 else if (txPower < MIN_TX_PWR_CAP)
1983 maxTxPower = MIN_TX_PWR_CAP;
1984 else
1985 maxTxPower = MAX_TX_PWR_CAP;
1986
1987 return (maxTxPower);
1988}
1989#endif
1990
Jeff Johnson295189b2012-06-20 16:38:30 -07001991/**
1992 * __limProcessSmeReassocReq()
1993 *
1994 *FUNCTION:
1995 * This function is called to process SME_REASSOC_REQ message
1996 * from HDD or upper layer application.
1997 *
1998 *LOGIC:
1999 *
2000 *ASSUMPTIONS:
2001 *
2002 *NOTE:
2003 *
2004 * @param pMac Pointer to Global MAC structure
2005 * @param *pMsgBuf A pointer to the SME message buffer
2006 * @return None
2007 */
2008
2009static void
2010__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2011{
2012 tANI_U16 caps;
2013 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002014 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002015 tLimMlmReassocReq *pMlmReassocReq;
2016 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2017 tpPESession psessionEntry = NULL;
2018 tANI_U8 sessionId;
2019 tANI_U8 smeSessionId;
2020 tANI_U16 transactionId;
2021 tPowerdBm localPowerConstraint = 0, regMax = 0;
2022 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002023 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002024
2025
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002026 PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002027
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002028 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302029 pReassocReq = vos_mem_malloc(nSize);
2030 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002031 {
2032 // Log error
2033 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302034 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002035
2036 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2037 goto end;
2038 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302039 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002040 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2041 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2042 (!limIsSmeJoinReqValid(pMac,
2043 (tpSirSmeJoinReq) pReassocReq)))
2044 {
2045 /// Received invalid eWNI_SME_REASSOC_REQ
2046 // Log the event
2047 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002048 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002049
2050 retCode = eSIR_SME_INVALID_PARAMETERS;
2051 goto end;
2052 }
2053
2054 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2055 {
2056 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002057 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002058 retCode = eSIR_SME_INVALID_PARAMETERS;
2059 goto end;
2060 }
2061
2062#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2063 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2064#endif //FEATURE_WLAN_DIAG_SUPPORT
2065 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2066
2067 /* Store the reassoc handle in the session Table.. 23rd sep review */
2068 psessionEntry->pLimReAssocReq = pReassocReq;
2069
2070 /**
2071 * Reassociate request is expected
2072 * in link established state only.
2073 */
2074
2075 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2076 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002077#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002078 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2079 {
2080 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002081 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002082 psessionEntry->peSessionId);
2083
2084 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302085 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002086 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2087 {
2088 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2089 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002090 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 retCode = eSIR_SME_INVALID_PARAMETERS;
2092 goto end;
2093 }
2094
2095 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2096 return;
2097 }
2098#endif
2099 /// Should not have received eWNI_SME_REASSOC_REQ
2100 // Log the event
2101 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002102 FL("received unexpected SME_REASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002103 psessionEntry->limSmeState);
2104 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2105
2106 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2107 goto end;
2108 }
2109
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302110 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002111 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2112 sizeof(tSirMacAddr));
2113
2114 psessionEntry->limReassocChannelId =
2115 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2116
Jeff Johnsone7245742012-09-05 17:12:55 -07002117 psessionEntry->reAssocHtSupportedChannelWidthSet =
2118 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2119 psessionEntry->reAssocHtRecommendedTxWidthSet =
2120 psessionEntry->reAssocHtSupportedChannelWidthSet;
2121 psessionEntry->reAssocHtSecondaryChannelOffset =
2122 psessionEntry->pLimReAssocReq->cbMode;
2123
Jeff Johnson295189b2012-06-20 16:38:30 -07002124 psessionEntry->limReassocBssCaps =
2125 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002126 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2127 localPowerConstraint = regMax;
2128 limExtractApCapability( pMac,
2129 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2130 limGetIElenFromBssDescription(
2131 &psessionEntry->pLimReAssocReq->bssDescription),
2132 &psessionEntry->limReassocBssQosCaps,
2133 &psessionEntry->limReassocBssPropCap,
2134 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002135 , &localPowerConstraint,
2136 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002137 );
2138
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302139 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002140#if defined WLAN_VOWIFI_DEBUG
Abhishek Singh57aebef2014-02-03 18:47:44 +05302141 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint "
2142 "= %d, max tx = %d", regMax, localPowerConstraint,
2143 psessionEntry->maxTxPower );
Jeff Johnson295189b2012-06-20 16:38:30 -07002144#endif
2145 {
2146 #if 0
2147 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2148 &cfgLen) != eSIR_SUCCESS)
2149 {
2150 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002151 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002152 }
2153 #endif//TO SUPPORT BT-AMP
2154
2155 /* Copy the SSID from sessio entry to local variable */
2156 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302157 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002158 psessionEntry->ssId.ssId,
2159 psessionEntry->ssId.length);
2160 #endif
2161 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302162 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002163 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2164
2165 }
2166
2167 if (pMac->lim.gLimCurrentBssUapsd)
2168 {
2169 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Abhishek Singh57aebef2014-02-03 18:47:44 +05302170 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"),
2171 pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002172 }
2173
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302174 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2175 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002176 {
2177 // Log error
2178 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302179 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002180
2181 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2182 goto end;
2183 }
2184
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302185 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002186 psessionEntry->limReAssocbssId,
2187 sizeof(tSirMacAddr));
2188
2189 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2190 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2191 != eSIR_SUCCESS)
2192 {
2193 /**
2194 * Could not get ReassocFailureTimeout value
2195 * from CFG. Log error.
2196 */
2197 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002198 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002199 }
2200
2201 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2202 {
2203 /**
2204 * Could not get Capabilities value
2205 * from CFG. Log error.
2206 */
2207 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002208 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 }
2210 pMlmReassocReq->capabilityInfo = caps;
2211
2212 /* Update PE sessionId*/
2213 pMlmReassocReq->sessionId = sessionId;
2214
2215 /* If telescopic beaconing is enabled, set listen interval to
2216 WNI_CFG_TELE_BCN_MAX_LI */
2217 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2218 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002219 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002220
2221 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2222
2223 if(teleBcnEn)
2224 {
2225 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2226 eSIR_SUCCESS)
2227 {
2228 /**
2229 * Could not get ListenInterval value
2230 * from CFG. Log error.
2231 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002232 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002233 }
2234 }
2235 else
2236 {
2237 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2238 {
2239 /**
2240 * Could not get ListenInterval value
2241 * from CFG. Log error.
2242 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002243 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002244 }
2245 }
2246
2247 /* Delete all BA sessions before Re-Assoc.
2248 * BA frames are class 3 frames and the session
2249 * is lost upon disassociation and reassociation.
2250 */
2251
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07002252 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS);
Jeff Johnson295189b2012-06-20 16:38:30 -07002253
2254 pMlmReassocReq->listenInterval = (tANI_U16) val;
2255
2256 /* Indicate whether spectrum management is enabled*/
2257 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2258
2259 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2260 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2261
Jeff Johnsone7245742012-09-05 17:12:55 -07002262 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002263
2264 limPostMlmMessage(pMac,
2265 LIM_MLM_REASSOC_REQ,
2266 (tANI_U32 *) pMlmReassocReq);
2267 return;
2268
2269end:
2270 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302271 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002272
2273 if (psessionEntry)
2274 {
2275 // error occurred after we determined the session so extract
2276 // session and transaction info from there
2277 smeSessionId = psessionEntry->smeSessionId;
2278 transactionId = psessionEntry->transactionId;
2279 }
2280 else
2281 {
2282 // error occurred before or during the time we determined the session
2283 // so extract the session and transaction info from the message
2284 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2285 }
2286
2287 /// Send Reassoc failure response to host
2288 /// (note psessionEntry may be NULL, but that's OK)
2289 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2290 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2291 psessionEntry, smeSessionId, transactionId);
2292
2293} /*** end __limProcessSmeReassocReq() ***/
2294
2295
2296tANI_BOOLEAN sendDisassocFrame = 1;
2297/**
2298 * __limProcessSmeDisassocReq()
2299 *
2300 *FUNCTION:
2301 * This function is called to process SME_DISASSOC_REQ message
2302 * from HDD or upper layer application.
2303 *
2304 *LOGIC:
2305 *
2306 *ASSUMPTIONS:
2307 *
2308 *NOTE:
2309 *
2310 * @param pMac Pointer to Global MAC structure
2311 * @param *pMsgBuf A pointer to the SME message buffer
2312 * @return None
2313 */
2314
2315static void
2316__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2317{
2318 tANI_U16 disassocTrigger, reasonCode;
2319 tLimMlmDisassocReq *pMlmDisassocReq;
2320 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002321 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002322 tSirSmeDisassocReq smeDisassocReq;
2323 tpPESession psessionEntry = NULL;
2324 tANI_U8 sessionId;
2325 tANI_U8 smesessionId;
2326 tANI_U16 smetransactionId;
2327
Jeff Johnson295189b2012-06-20 16:38:30 -07002328
Jeff Johnson43971f52012-07-17 12:26:56 -07002329 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002330 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002331 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002332 return;
2333 }
2334
Jeff Johnson43971f52012-07-17 12:26:56 -07002335 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002336
Jeff Johnson43971f52012-07-17 12:26:56 -07002337 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002338
Jeff Johnson43971f52012-07-17 12:26:56 -07002339 if ( (eSIR_FAILURE == status) ||
2340 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002341 {
2342 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002343 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002344
2345 if (pMac->lim.gLimRspReqd)
2346 {
2347 pMac->lim.gLimRspReqd = false;
2348
2349 retCode = eSIR_SME_INVALID_PARAMETERS;
2350 disassocTrigger = eLIM_HOST_DISASSOC;
2351 goto sendDisassoc;
2352 }
2353
2354 return;
2355 }
2356
Jeff Johnson295189b2012-06-20 16:38:30 -07002357 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2358 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302359 limLog(pMac, LOGE,FL("session does not exist for given bssId "MAC_ADDRESS_STR),
2360 MAC_ADDR_ARRAY(smeDisassocReq.bssId));
Jeff Johnson295189b2012-06-20 16:38:30 -07002361 retCode = eSIR_SME_INVALID_PARAMETERS;
2362 disassocTrigger = eLIM_HOST_DISASSOC;
2363 goto sendDisassoc;
2364
2365 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302366 limLog(pMac, LOG1, FL("received DISASSOC_REQ message on sessionid %d"
2367 "Systemrole %d Reason: %u SmeState: %d from: "MAC_ADDRESS_STR),
2368 smesessionId,psessionEntry->limSystemRole,
2369 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState,
2370 MAC_ADDR_ARRAY(smeDisassocReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002371
2372#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2373 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2374#endif //FEATURE_WLAN_DIAG_SUPPORT
2375
2376 /* Update SME session Id and SME transaction ID*/
2377
2378 psessionEntry->smeSessionId = smesessionId;
2379 psessionEntry->transactionId = smetransactionId;
2380
2381 switch (psessionEntry->limSystemRole)
2382 {
2383 case eLIM_STA_ROLE:
2384 case eLIM_BT_AMP_STA_ROLE:
2385 switch (psessionEntry->limSmeState)
2386 {
2387 case eLIM_SME_ASSOCIATED_STATE:
2388 case eLIM_SME_LINK_EST_STATE:
2389 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2390 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002391#ifdef FEATURE_WLAN_TDLS
2392 /* Delete all TDLS peers connected before leaving BSS*/
2393 limDeleteTDLSPeers(pMac, psessionEntry);
2394#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002395 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302396 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2397 "limSmeState: %d "),psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002398 break;
2399
2400 case eLIM_SME_WT_DEAUTH_STATE:
2401 /* PE shall still process the DISASSOC_REQ and proceed with
2402 * link tear down even if it had already sent a DEAUTH_IND to
2403 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2404 * its been set when PE entered WT_DEAUTH_STATE.
2405 */
2406 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002407 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Abhishek Singhcd09b562013-12-24 16:02:20 +05302408 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2409 "SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002410 break;
2411
2412 case eLIM_SME_WT_DISASSOC_STATE:
2413 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2414 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2415 * PE can continue processing DISASSOC_REQ and send the response instead
2416 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2417 * for disassoc frame.
2418 *
2419 * It will send a disassoc, which is ok. However, we can use the global flag
2420 * sendDisassoc to not send disassoc frame.
2421 */
Abhishek Singhcd09b562013-12-24 16:02:20 +05302422 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2423 "SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 break;
2425
2426 case eLIM_SME_JOIN_FAILURE_STATE: {
2427 /** Return Success as we are already in Disconnected State*/
Abhishek Singhcd09b562013-12-24 16:02:20 +05302428 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in "
2429 "eLIM_SME_JOIN_FAILURE_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002430 if (pMac->lim.gLimRspReqd) {
2431 retCode = eSIR_SME_SUCCESS;
2432 disassocTrigger = eLIM_HOST_DISASSOC;
2433 goto sendDisassoc;
2434 }
2435 }break;
2436 default:
2437 /**
2438 * STA is not currently associated.
2439 * Log error and send response to host
2440 */
2441 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002442 FL("received unexpected SME_DISASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002443 psessionEntry->limSmeState);
2444 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2445
2446 if (pMac->lim.gLimRspReqd)
2447 {
2448 if (psessionEntry->limSmeState !=
2449 eLIM_SME_WT_ASSOC_STATE)
2450 pMac->lim.gLimRspReqd = false;
2451
2452 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2453 disassocTrigger = eLIM_HOST_DISASSOC;
2454 goto sendDisassoc;
2455 }
2456
2457 return;
2458 }
2459
2460 break;
2461
2462 case eLIM_AP_ROLE:
2463 case eLIM_BT_AMP_AP_ROLE:
2464 // Fall through
2465 break;
2466
2467 case eLIM_STA_IN_IBSS_ROLE:
2468 default: // eLIM_UNKNOWN_ROLE
2469 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002470 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002471 psessionEntry->limSystemRole);
2472
2473 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2474 disassocTrigger = eLIM_HOST_DISASSOC;
2475 goto sendDisassoc;
2476 } // end switch (pMac->lim.gLimSystemRole)
2477
2478 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2479 {
2480 /// Disassociation is triggered by Link Monitoring
Abhishek Singhcd09b562013-12-24 16:02:20 +05302481 limLog(pMac, LOG1, FL("**** Lost link with AP ****"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002482 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2483 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2484 }
2485 else
2486 {
2487 disassocTrigger = eLIM_HOST_DISASSOC;
2488 reasonCode = smeDisassocReq.reasonCode;
2489 }
2490
2491 if (smeDisassocReq.doNotSendOverTheAir)
2492 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302493 limLog(pMac, LOG1, FL("do not send dissoc over the air"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002494 sendDisassocFrame = 0;
2495 }
2496 // Trigger Disassociation frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302497
2498 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2499 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002500 {
2501 // Log error
2502 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302503 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002504
2505 return;
2506 }
2507
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302508 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002509 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2510 sizeof(tSirMacAddr));
2511
2512 pMlmDisassocReq->reasonCode = reasonCode;
2513 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2514
2515 /* Update PE session ID*/
2516 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002517
2518 limPostMlmMessage(pMac,
2519 LIM_MLM_DISASSOC_REQ,
2520 (tANI_U32 *) pMlmDisassocReq);
2521 return;
2522
2523sendDisassoc:
2524 if (psessionEntry)
2525 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2526 retCode,
2527 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002528 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002529 else
2530 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2531 retCode,
2532 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002533 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002534
2535
2536} /*** end __limProcessSmeDisassocReq() ***/
2537
2538
2539/** -----------------------------------------------------------------
2540 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2541
2542 This function is called to process SME_DISASSOC_CNF message
2543 from HDD or upper layer application.
2544
2545 \param pMac - global mac structure
2546 \param pStaDs - station dph hash node
2547 \return none
2548 \sa
2549 ----------------------------------------------------------------- */
2550static void
2551__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2552{
2553 tSirSmeDisassocCnf smeDisassocCnf;
2554 tANI_U16 aid;
2555 tpDphHashNode pStaDs;
2556 tSirRetStatus status = eSIR_SUCCESS;
2557 tpPESession psessionEntry;
2558 tANI_U8 sessionId;
2559
2560
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002561 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002562
2563 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2564
2565 if (status == eSIR_FAILURE)
2566 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002567 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002568 return;
2569 }
2570
2571 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2572 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002573 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002574 return;
2575 }
2576
2577 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2578 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302579 limLog(pMac, LOGE, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002580 return;
2581 }
2582
2583#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2584 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2585 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2586 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2587 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2588#endif //FEATURE_WLAN_DIAG_SUPPORT
2589
2590 switch (psessionEntry->limSystemRole)
2591 {
2592 case eLIM_STA_ROLE:
2593 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2594 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2595 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2596 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2597 {
2598 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002599 FL("received unexp SME_DISASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002600 psessionEntry->limSmeState);
2601 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2602 return;
2603 }
2604 break;
2605
2606 case eLIM_AP_ROLE:
2607 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002608 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002609
2610 case eLIM_STA_IN_IBSS_ROLE:
2611 default: // eLIM_UNKNOWN_ROLE
2612 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002613 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002614 psessionEntry->limSystemRole);
2615
2616 return;
2617 }
2618
2619
2620 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2621 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002622 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002623 )
2624 {
2625 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2626 if (pStaDs == NULL)
2627 {
Abhishek Singhcd09b562013-12-24 16:02:20 +05302628 PELOGE(limLog(pMac, LOGE, FL("received DISASSOC_CNF for a STA that "
2629 "does not have context, addr= "MAC_ADDRESS_STR),
2630 MAC_ADDR_ARRAY(smeDisassocCnf.peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002631 return;
2632 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002633 /* Delete FT session if there exists one */
2634 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002635 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002636
2637 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002638 }
2639
2640 return;
2641}
2642
2643
2644/**
2645 * __limProcessSmeDeauthReq()
2646 *
2647 *FUNCTION:
2648 * This function is called to process SME_DEAUTH_REQ message
2649 * from HDD or upper layer application.
2650 *
2651 *LOGIC:
2652 *
2653 *ASSUMPTIONS:
2654 *
2655 *NOTE:
2656 *
2657 * @param pMac Pointer to Global MAC structure
2658 * @param *pMsgBuf A pointer to the SME message buffer
2659 * @return None
2660 */
2661
2662static void
2663__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2664{
2665 tANI_U16 deauthTrigger, reasonCode;
2666 tLimMlmDeauthReq *pMlmDeauthReq;
2667 tSirSmeDeauthReq smeDeauthReq;
2668 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2669 tSirRetStatus status = eSIR_SUCCESS;
2670 tpPESession psessionEntry;
2671 tANI_U8 sessionId; //PE sessionId
2672 tANI_U8 smesessionId;
2673 tANI_U16 smetransactionId;
2674
Jeff Johnson295189b2012-06-20 16:38:30 -07002675
2676 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002677 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2678
2679 //We need to get a session first but we don't even know if the message is correct.
2680 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2681 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002682 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002683 retCode = eSIR_SME_INVALID_PARAMETERS;
2684 deauthTrigger = eLIM_HOST_DEAUTH;
2685 goto sendDeauth;
2686
2687 }
2688
2689 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2690 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002691 PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002692 if (pMac->lim.gLimRspReqd)
2693 {
2694 pMac->lim.gLimRspReqd = false;
2695
2696 retCode = eSIR_SME_INVALID_PARAMETERS;
2697 deauthTrigger = eLIM_HOST_DEAUTH;
2698 goto sendDeauth;
2699 }
2700
2701 return;
2702 }
Abhishek Singhcd09b562013-12-24 16:02:20 +05302703 limLog(pMac, LOG1,FL("received DEAUTH_REQ message on sessionid %d "
2704 "Systemrole %d with reasoncode %u in limSmestate %d from "
2705 MAC_ADDRESS_STR), smesessionId, psessionEntry->limSystemRole,
2706 smeDeauthReq.reasonCode, psessionEntry->limSmeState,
2707 MAC_ADDR_ARRAY(smeDeauthReq.peerMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07002708#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2709 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2710#endif //FEATURE_WLAN_DIAG_SUPPORT
2711
2712 /* Update SME session ID and Transaction ID */
2713 psessionEntry->smeSessionId = smesessionId;
2714 psessionEntry->transactionId = smetransactionId;
2715
2716
2717 switch (psessionEntry->limSystemRole)
2718 {
2719 case eLIM_STA_ROLE:
2720 case eLIM_BT_AMP_STA_ROLE:
2721
2722 switch (psessionEntry->limSmeState)
2723 {
2724 case eLIM_SME_ASSOCIATED_STATE:
2725 case eLIM_SME_LINK_EST_STATE:
2726 case eLIM_SME_WT_ASSOC_STATE:
2727 case eLIM_SME_JOIN_FAILURE_STATE:
2728 case eLIM_SME_IDLE_STATE:
2729 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2730 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002731 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002732
2733 // Send Deauthentication request to MLM below
2734
2735 break;
2736
2737 default:
2738 /**
2739 * STA is not in a state to deauthenticate with
2740 * peer. Log error and send response to host.
2741 */
2742 limLog(pMac, LOGE,
Abhishek Singhcd09b562013-12-24 16:02:20 +05302743 FL("received unexp SME_DEAUTH_REQ in state %X"),
2744 psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002745 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2746
2747 if (pMac->lim.gLimRspReqd)
2748 {
2749 pMac->lim.gLimRspReqd = false;
2750
2751 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2752 deauthTrigger = eLIM_HOST_DEAUTH;
Leela Venkata Kiran Kumar Reddy Chirala56df73f2014-01-30 14:18:00 -08002753 /**
2754 *here we received deauth request from AP so sme state is
2755 eLIM_SME_WT_DEAUTH_STATE.if we have ISSUED delSta then
2756 mlm state should be eLIM_MLM_WT_DEL_STA_RSP_STATE and if
2757 we got delBSS rsp then mlm state should be eLIM_MLM_IDLE_STATE
2758 so the below condition captures the state where delSta
2759 not done and firmware still in connected state.
2760 */
2761 if (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE &&
2762 psessionEntry->limMlmState != eLIM_MLM_IDLE_STATE &&
2763 psessionEntry->limMlmState != eLIM_MLM_WT_DEL_STA_RSP_STATE)
2764 {
2765 retCode = eSIR_SME_DEAUTH_STATUS;
2766 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002767 goto sendDeauth;
2768 }
2769
2770 return;
2771 }
2772
2773 break;
2774
2775 case eLIM_STA_IN_IBSS_ROLE:
2776
2777 return;
2778
2779 case eLIM_AP_ROLE:
2780 // Fall through
2781
2782 break;
2783
2784 default:
2785 limLog(pMac, LOGE,
Abhishek Singhcd09b562013-12-24 16:02:20 +05302786 FL("received unexpected SME_DEAUTH_REQ for role %X"),
2787 psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07002788
2789 return;
2790 } // end switch (pMac->lim.gLimSystemRole)
2791
2792 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
2793 {
2794 /// Deauthentication is triggered by Link Monitoring
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002795 PELOG1(limLog(pMac, LOG1, FL("**** Lost link with AP ****"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002796 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
2797 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
2798 }
2799 else
2800 {
2801 deauthTrigger = eLIM_HOST_DEAUTH;
2802 reasonCode = smeDeauthReq.reasonCode;
2803 }
2804
2805 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302806 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
2807 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002808 {
2809 // Log error
2810 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302811 FL("call to AllocateMemory failed for mlmDeauthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002812
2813 return;
2814 }
2815
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302816 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002817 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
2818 sizeof(tSirMacAddr));
2819
2820 pMlmDeauthReq->reasonCode = reasonCode;
2821 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07002822
2823 /* Update PE session Id*/
2824 pMlmDeauthReq->sessionId = sessionId;
2825
2826 limPostMlmMessage(pMac,
2827 LIM_MLM_DEAUTH_REQ,
2828 (tANI_U32 *) pMlmDeauthReq);
2829 return;
2830
2831sendDeauth:
2832 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
2833 retCode,
2834 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002835 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002836 smesessionId, smetransactionId);
2837} /*** end __limProcessSmeDeauthReq() ***/
2838
2839
2840
2841/**
2842 * __limProcessSmeSetContextReq()
2843 *
2844 *FUNCTION:
2845 * This function is called to process SME_SETCONTEXT_REQ message
2846 * from HDD or upper layer application.
2847 *
2848 *LOGIC:
2849 *
2850 *ASSUMPTIONS:
2851 *
2852 *NOTE:
2853 *
2854 * @param pMac Pointer to Global MAC structure
2855 * @param *pMsgBuf A pointer to the SME message buffer
2856 * @return None
2857 */
2858
2859static void
2860__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2861{
2862 tpSirSmeSetContextReq pSetContextReq;
2863 tLimMlmSetKeysReq *pMlmSetKeysReq;
2864 tpPESession psessionEntry;
2865 tANI_U8 sessionId; //PE sessionID
2866 tANI_U8 smesessionId;
2867 tANI_U16 smetransactionId;
2868
2869
2870 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002871 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07002872
2873
2874 if(pMsgBuf == NULL)
2875 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002876 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002877 return;
2878 }
2879
2880 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302881
2882 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
2883 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002884 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302885 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002886 return;
2887 }
2888
2889 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2890 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
2891 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002892 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002893 goto end;
2894 }
2895
2896 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2897 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002898 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 -07002899 limSendSmeSetContextRsp(pMac,
2900 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002901 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002902 eSIR_SME_INVALID_PARAMETERS,NULL,
2903 smesessionId,smetransactionId);
2904
2905 goto end;
2906 }
2907
2908
2909 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
2910 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002911 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002912 limSendSmeSetContextRsp(pMac,
2913 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002914 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002915 eSIR_SME_INVALID_PARAMETERS,NULL,
2916 smesessionId,smetransactionId);
2917
2918 goto end;
2919 }
2920
2921#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2922 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
2923#endif //FEATURE_WLAN_DIAG_SUPPORT
2924
2925
2926 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2927 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
2928 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
2929 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
2930 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
2931 {
2932 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302933 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
2934 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002935 {
2936 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302937 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002938 goto end;
2939 }
2940
2941 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
2942 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
2943 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2944 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002945 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002946 goto end;
2947 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302948 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002949 (tANI_U8 *) &pSetContextReq->peerMacAddr,
2950 sizeof(tSirMacAddr));
2951
Jeff Johnson295189b2012-06-20 16:38:30 -07002952
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302953 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07002954 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
2955 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
2956
2957 pMlmSetKeysReq->sessionId = sessionId;
2958#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
2959 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002960 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07002961#endif
2962
Jeff Johnson295189b2012-06-20 16:38:30 -07002963 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
2964 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
2965 {
2966 if(pSetContextReq->keyMaterial.key[0].keyLength)
2967 {
2968 tANI_U8 keyId;
2969 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302970 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07002971 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
2972 }
2973 else {
2974 tANI_U32 i;
2975 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
2976 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302977 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07002978 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
2979 }
2980 }
2981 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002982
2983 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002984 }
2985 else
2986 {
2987 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002988 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002989 psessionEntry->limSystemRole,
2990 psessionEntry->limSmeState);
2991 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2992
2993 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002994 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002995 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
2996 smesessionId,
2997 smetransactionId);
2998 }
2999
3000end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303001 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003002 return;
3003} /*** end __limProcessSmeSetContextReq() ***/
3004
3005/**
3006 * __limProcessSmeRemoveKeyReq()
3007 *
3008 *FUNCTION:
3009 * This function is called to process SME_REMOVEKEY_REQ message
3010 * from HDD or upper layer application.
3011 *
3012 *LOGIC:
3013 *
3014 *ASSUMPTIONS:
3015 *
3016 *NOTE:
3017 *
3018 * @param pMac Pointer to Global MAC structure
3019 * @param *pMsgBuf A pointer to the SME message buffer
3020 * @return None
3021 */
3022
3023static void
3024__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3025{
3026 tpSirSmeRemoveKeyReq pRemoveKeyReq;
3027 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
3028 tpPESession psessionEntry;
3029 tANI_U8 sessionId; //PE sessionID
3030 tANI_U8 smesessionId;
3031 tANI_U16 smetransactionId;
3032
3033 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003034 FL("received REMOVEKEY_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003035
3036 if(pMsgBuf == NULL)
3037 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003038 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003039 return;
3040 }
3041
3042
3043 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3044
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303045 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3046 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003047 {
3048 //Log error
3049 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303050 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003051
3052 return;
3053 }
3054
3055 if ((limRemoveKeyReqSerDes(pMac,
3056 pRemoveKeyReq,
3057 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3058 {
3059 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003060 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003061
3062 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3063
3064 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3065 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003066 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003067 //goto end;
3068 }
3069
3070 limSendSmeRemoveKeyRsp(pMac,
3071 pRemoveKeyReq->peerMacAddr,
3072 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3073 smesessionId,smetransactionId);
3074
3075 goto end;
3076 }
3077
3078 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3079 {
3080 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003081 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003082 limSendSmeRemoveKeyRsp(pMac,
3083 pRemoveKeyReq->peerMacAddr,
3084 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3085 smesessionId, smetransactionId);
3086 goto end;
3087 }
3088
3089
3090 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3091 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3092 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3093 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3094 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3095 {
3096 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303097 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3098 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003099 {
3100 // Log error
3101 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303102 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003103
3104 goto end;
3105 }
3106
3107 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3108 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3109 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3110 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3111
3112 /* Update PE session Id */
3113 pMlmRemoveKeyReq->sessionId = sessionId;
3114
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303115 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003116 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3117 sizeof(tSirMacAddr));
3118
3119
3120 limPostMlmMessage(pMac,
3121 LIM_MLM_REMOVEKEY_REQ,
3122 (tANI_U32 *) pMlmRemoveKeyReq);
3123 }
3124 else
3125 {
3126 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003127 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003128 psessionEntry->limSystemRole,
3129 psessionEntry->limSmeState);
3130 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3131
3132 limSendSmeRemoveKeyRsp(pMac,
3133 pRemoveKeyReq->peerMacAddr,
3134 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3135 smesessionId,smetransactionId);
3136 }
3137
3138end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303139 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003140} /*** end __limProcessSmeRemoveKeyReq() ***/
3141
Jeff Johnson295189b2012-06-20 16:38:30 -07003142void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3143{
3144 tSirMsgQ mmhMsg;
3145 tpSmeGetScanChnRsp pSirSmeRsp;
3146 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303147 tANI_U8 sessionId;
3148 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003149
3150 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3151 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003152 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003153 pMac->lim.scanChnInfo.numChnInfo);
3154 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3155 }
3156
3157 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003158 FL("Sending message %s with number of channels %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003159 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);)
3160
3161 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303162 pSirSmeRsp = vos_mem_malloc(len);
3163 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003164 {
3165 /// Buffer not available. Log error
3166 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303167 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003168
3169 return;
3170 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303171 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003172
Jeff Johnson295189b2012-06-20 16:38:30 -07003173 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3174 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303175
3176 if (pMac->fScanOffload)
3177 {
3178 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3179 pSirSmeRsp->sessionId = sessionId;
3180 }
3181 else
3182 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003183
3184 if(pMac->lim.scanChnInfo.numChnInfo)
3185 {
3186 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303187 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3188 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003189 }
3190 //Clear the list
3191 limRessetScanChannelInfo(pMac);
3192
3193 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3194 mmhMsg.bodyptr = pSirSmeRsp;
3195 mmhMsg.bodyval = 0;
3196
3197 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003198 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003199 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3200}
3201
3202
Jeff Johnson295189b2012-06-20 16:38:30 -07003203void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3204{
3205 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3206 tpDphHashNode pStaDs = NULL;
3207 tpPESession psessionEntry = NULL;
3208 tSap_Event sapEvent;
3209 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3210 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3211 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3212 tANI_U8 assocId = 0;
3213 tANI_U8 staCount = 0;
3214
3215 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3216 {
3217 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003218 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003219 goto limAssocStaEnd;
3220 }
3221
3222 switch (getAssocSTAsReq.modId)
3223 {
3224/**
3225 case VOS_MODULE_ID_HAL:
3226 wdaPostCtrlMsg( pMac, &msgQ );
3227 return;
3228
3229 case VOS_MODULE_ID_TL:
3230 Post msg TL
3231 return;
3232*/
3233 case VOS_MODULE_ID_PE:
3234 default:
3235 break;
3236 }
3237
Jeff Johnson1250df42012-12-10 14:31:52 -08003238 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003239 // Find PE session Entry
3240 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3241 {
3242 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003243 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003244 goto limAssocStaEnd;
3245 }
3246
3247 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3248 {
3249 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003250 FL("Received unexpected message in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303251 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003252 goto limAssocStaEnd;
3253 }
3254
3255 // Retrieve values obtained in the request message
3256 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3257 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3258
3259 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3260 {
3261 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3262
3263 if (NULL == pStaDs)
3264 continue;
3265
3266 if (pStaDs->valid)
3267 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303268 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3269 (tANI_U8 *)&pStaDs->staAddr,
3270 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003271 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3272 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3273
Kiet Lamb1233192013-11-28 13:38:20 +05303274 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->supportedRates,
Leo Chang614d2072013-08-22 14:59:44 -07003275 (tANI_U8 *)&pStaDs->supportedRates,
3276 sizeof(tSirSupportedRates));
3277 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3278 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3279 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3280
Jeff Johnson295189b2012-06-20 16:38:30 -07003281 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
Arif Hussain24bafea2013-11-15 15:10:03 -08003282 limLog(pMac, LOG1, FL("MAC = " MAC_ADDRESS_STR),
3283 MAC_ADDR_ARRAY(pStaDs->staAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07003284 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3285 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3286
3287 pAssocStasTemp++;
3288 staCount++;
3289 }
3290 }
3291
3292limAssocStaEnd:
3293 // Call hdd callback with sap event to send the list of associated stations from PE
3294 if (pSapEventCallback != NULL)
3295 {
3296 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3297 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3298 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3299 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3300 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3301 }
3302}
3303
3304
3305/**
3306 * limProcessSmeGetWPSPBCSessions
3307 *
3308 *FUNCTION:
3309 * This function is called when query the WPS PBC overlap message is received
3310 *
3311 *LOGIC:
3312 * This function parses get WPS PBC overlap information message and call callback to pass
3313 * WPS PBC overlap information back to hdd.
3314 *ASSUMPTIONS:
3315 *
3316 *
3317 *NOTE:
3318 *
3319 * @param pMac Pointer to Global MAC structure
3320 * @param pMsgBuf A pointer to WPS PBC overlap query message
3321*
3322 * @return None
3323 */
3324void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3325{
3326 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3327 tpPESession psessionEntry = NULL;
3328 tSap_Event sapEvent;
3329 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3330 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3331 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3332
3333 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3334
3335 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3336 {
3337 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003338 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003339 goto limGetWPSPBCSessionsEnd;
3340 }
3341
Jeff Johnson1250df42012-12-10 14:31:52 -08003342 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003343 // Find PE session Entry
3344 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3345 {
3346 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003347 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003348 goto limGetWPSPBCSessionsEnd;
3349 }
3350
3351 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3352 {
3353 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003354 FL("Received unexpected message in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003355 psessionEntry->limSystemRole);
3356 goto limGetWPSPBCSessionsEnd;
3357 }
3358
Jeff Johnson1250df42012-12-10 14:31:52 -08003359 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003360 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3361 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3362
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303363 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003364 { //This is GetWpsSession call
3365
3366 limGetWPSPBCSessions(pMac,
3367 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3368 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3369 }
3370 else
3371 {
3372 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3373 /* don't have to inform the HDD/Host */
3374 return;
3375 }
3376
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003377 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003378 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3379
3380 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3381
3382limGetWPSPBCSessionsEnd:
3383 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
3384 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
3385}
3386
Jeff Johnson295189b2012-06-20 16:38:30 -07003387
3388
3389/**
3390 * __limCounterMeasures()
3391 *
3392 * FUNCTION:
3393 * This function is called to "implement" MIC counter measure
3394 * and is *temporary* only
3395 *
3396 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3397 * we don't do the proper STA disassoc sequence since the
3398 * BSS will be stoped anyway
3399 *
3400 *ASSUMPTIONS:
3401 *
3402 *NOTE:
3403 *
3404 * @param pMac Pointer to Global MAC structure
3405 * @return None
3406 */
3407
3408static void
3409__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3410{
3411 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3412 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
3413 || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
3414
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003415 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003416
Jeff Johnson295189b2012-06-20 16:38:30 -07003417};
3418
3419
Jeff Johnson295189b2012-06-20 16:38:30 -07003420void
3421limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3422{
3423 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3424 tpPESession psessionEntry;
3425 tANI_U8 sessionId; //PE sessionId
3426
3427 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3428 {
3429 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003430 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003431 return;
3432 }
3433
3434 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3435 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003436 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003437 return;
3438 }
3439
3440 if ( tkipCntrMeasReq.bEnable )
3441 {
3442 __limCounterMeasures( pMac, psessionEntry );
3443 }
3444
3445 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3446}
Jeff Johnson295189b2012-06-20 16:38:30 -07003447
3448
3449static void
3450__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3451{
3452 tSirSmeStopBssReq stopBssReq;
3453 tSirRetStatus status;
3454 tLimSmeStates prevState;
3455 tANI_U8 sessionId; //PE sessionId
3456 tpPESession psessionEntry;
3457 tANI_U8 smesessionId;
3458 tANI_U16 smetransactionId;
3459
3460 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3461
3462
3463
3464 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3465 !limIsSmeStopBssReqValid(pMsgBuf))
3466 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003467 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003468 /// Send Stop BSS response to host
3469 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3470 return;
3471 }
3472
3473
3474 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3475 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003476 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003477 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3478 return;
3479 }
3480
3481#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3482 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3483#endif //FEATURE_WLAN_DIAG_SUPPORT
3484
3485
3486 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3487 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3488 {
3489 /**
3490 * Should not have received STOP_BSS_REQ in states
3491 * other than 'normal' state or on STA in Infrastructure
3492 * mode. Log error and return response to host.
3493 */
3494 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003495 FL("received unexpected SME_STOP_BSS_REQ in state %X, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003496 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3497 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3498 /// Send Stop BSS response to host
3499 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3500 return;
3501 }
3502
Jeff Johnson295189b2012-06-20 16:38:30 -07003503 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3504 {
3505 limWPSPBCClose(pMac, psessionEntry);
3506 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003507 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003508
3509 prevState = psessionEntry->limSmeState;
3510
3511 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003512 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003513
3514 /* Update SME session Id and Transaction Id */
3515 psessionEntry->smeSessionId = smesessionId;
3516 psessionEntry->transactionId = smetransactionId;
3517
3518 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame */
3519 if ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) && (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3520 {
3521 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3522 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3523 // Send disassoc all stations associated thru TKIP
3524 __limCounterMeasures(pMac,psessionEntry);
3525 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303526 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003527 }
3528
3529 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3530 pMac->lim.gLimIbssCoalescingHappened = false;
3531
3532 /* send a delBss to HAL and wait for a response */
3533 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3534
3535 if (status != eSIR_SUCCESS)
3536 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003537 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003538 psessionEntry->limSmeState= prevState;
3539
Jeff Johnsone7245742012-09-05 17:12:55 -07003540 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003541
3542 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3543 }
3544}
3545
3546
3547/**--------------------------------------------------------------
3548\fn __limProcessSmeStopBssReq
3549
3550\brief Wrapper for the function __limHandleSmeStopBssRequest
3551 This message will be defered until softmac come out of
3552 scan mode. Message should be handled even if we have
3553 detected radar in the current operating channel.
3554\param pMac
3555\param pMsg
3556
3557\return TRUE - If we consumed the buffer
3558 FALSE - If have defered the message.
3559 ---------------------------------------------------------------*/
3560static tANI_BOOLEAN
3561__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3562{
3563 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3564 {
3565 /**
3566 * If message defered, buffer is not consumed yet.
3567 * So return false
3568 */
3569 return eANI_BOOLEAN_FALSE;
3570 }
3571 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3572 return eANI_BOOLEAN_TRUE;
3573} /*** end __limProcessSmeStopBssReq() ***/
3574
3575
3576void limProcessSmeDelBssRsp(
3577 tpAniSirGlobal pMac,
3578 tANI_U32 body,tpPESession psessionEntry)
3579{
3580
3581 (void) body;
3582 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3583 //TBD: get the sessionEntry
Ravi Joshib58ca0d2013-10-29 09:50:23 -07003584 limIbssDelete(pMac,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003585 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3586 limDeletePreAuthList(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07003587 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3588 return;
3589}
3590
3591
Jeff Johnson295189b2012-06-20 16:38:30 -07003592/**---------------------------------------------------------------
3593\fn __limProcessSmeAssocCnfNew
3594\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3595\ in BTAMP AP.
3596\
3597\param pMac
3598\param msgType - message type
3599\param pMsgBuf - a pointer to the SME message buffer
3600\return None
3601------------------------------------------------------------------*/
3602
3603 void
3604__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3605{
3606 tSirSmeAssocCnf assocCnf;
3607 tpDphHashNode pStaDs = NULL;
3608 tpPESession psessionEntry= NULL;
3609 tANI_U8 sessionId;
3610
3611
3612 if(pMsgBuf == NULL)
3613 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003614 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003615 goto end;
3616 }
3617
3618 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3619 !__limIsSmeAssocCnfValid(&assocCnf))
3620 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003621 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003622 goto end;
3623 }
3624
3625 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3626 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003627 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003628 goto end;
3629 }
3630
3631 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3632 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3633 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003634 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303635 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003636 goto end;
3637 }
3638
3639 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3640
3641 if (pStaDs == NULL)
3642 {
3643 limLog(pMac, LOG1,
3644 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
3645 msgType, assocCnf.aid);
3646 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3647
3648 /*
3649 ** send a DISASSOC_IND message to WSM to make sure
3650 ** the state in WSM and LIM is the same
3651 **/
3652 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3653 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3654 goto end;
3655 }
3656 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303657 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003658 (tANI_U8 *) assocCnf.peerMacAddr,
3659 sizeof(tSirMacAddr)) ) ||
3660 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3661 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3662 (msgType != eWNI_SME_ASSOC_CNF)) ||
3663 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003664 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003665 {
3666 limLog(pMac, LOG1,
3667 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
3668 msgType, assocCnf.aid);
3669 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3670 goto end;
3671 }
3672
3673 /*
3674 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3675 ** has been received
3676 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003677 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003678 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3679
3680 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3681 {
3682 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3683 * when it had received Assoc Request frame. Now, PE just needs to send
3684 * Association Response frame to the requesting BTAMP-STA.
3685 */
3686 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003687 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003688 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3689 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3690 goto end;
3691 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3692 else
3693 {
3694 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3695 /*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*/
3696 if(!pStaDs->mlmStaContext.updateContext)
3697 pStaDs->mlmStaContext.updateContext = 1;
3698 limRejectAssociation(pMac, pStaDs->staAddr,
3699 pStaDs->mlmStaContext.subType,
3700 true, pStaDs->mlmStaContext.authType,
3701 pStaDs->assocId, true,
3702 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07003703 }
3704
3705end:
3706 if((psessionEntry != NULL) && (pStaDs != NULL))
3707 {
3708 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3709 {
3710 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3711 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303712 vos_mem_free(((tpSirAssocReq)
3713 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07003714 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
3715 }
3716
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303717 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003718 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
3719 }
3720 }
3721
3722} /*** end __limProcessSmeAssocCnfNew() ***/
3723
3724
Jeff Johnson295189b2012-06-20 16:38:30 -07003725
3726
3727static void
3728__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3729{
3730 tpDphHashNode pStaDs;
3731 tSirMacAddr peerMac;
3732 tpSirAddtsReq pSirAddts;
3733 tANI_U32 timeout;
3734 tpPESession psessionEntry;
3735 tANI_U8 sessionId; //PE sessionId
3736 tANI_U8 smesessionId;
3737 tANI_U16 smetransactionId;
3738
3739
3740 if(pMsgBuf == NULL)
3741 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003742 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003743 return;
3744 }
3745
3746 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3747
3748 pSirAddts = (tpSirAddtsReq) pMsgBuf;
3749
3750 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
3751 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003752 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003753 return;
3754 }
3755#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3756 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
3757#endif //FEATURE_WLAN_DIAG_SUPPORT
3758
3759
3760
3761 /* if sta
3762 * - verify assoc state
3763 * - send addts request to ap
3764 * - wait for addts response from ap
3765 * if ap, just ignore with error log
3766 */
3767 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003768 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003769 pSirAddts->req.tspec.tsinfo.traffic.tsid,
3770 pSirAddts->req.tspec.tsinfo.traffic.userPrio);)
3771
3772 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
3773 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003774 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003775 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3776 smesessionId,smetransactionId);
3777 return;
3778 }
3779
3780 //Ignore the request if STA is in 11B mode.
3781 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
3782 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003783 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003784 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3785 smesessionId,smetransactionId);
3786 return;
3787 }
3788
3789
3790 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3791
3792 if(pStaDs == NULL)
3793 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003794 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003795 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3796 smesessionId,smetransactionId);
3797 return;
3798 }
3799
3800 if ((! pStaDs->valid) ||
3801 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
3802 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003803 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003804 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3805 smesessionId,smetransactionId);
3806 return;
3807 }
3808
3809 pSirAddts->req.wsmTspecPresent = 0;
3810 pSirAddts->req.wmeTspecPresent = 0;
3811 pSirAddts->req.lleTspecPresent = 0;
3812
3813 if ((pStaDs->wsmEnabled) &&
3814 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
3815 pSirAddts->req.wsmTspecPresent = 1;
3816 else if (pStaDs->wmeEnabled)
3817 pSirAddts->req.wmeTspecPresent = 1;
3818 else if (pStaDs->lleEnabled)
3819 pSirAddts->req.lleTspecPresent = 1;
3820 else
3821 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003822 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003823 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3824 smesessionId,smetransactionId);
3825 return;
3826 }
3827
3828 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
3829 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
3830 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003831 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07003832 psessionEntry->limSmeState);
3833 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3834 smesessionId,smetransactionId);
3835 return;
3836 }
3837
3838 if (pMac->lim.gLimAddtsSent)
3839 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003840 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07003841 pMac->lim.gLimAddtsReq.req.dialogToken,
3842 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
3843 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
3844 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3845 smesessionId,smetransactionId);
3846 return;
3847 }
3848
3849 #if 0
3850 val = sizeof(tSirMacAddr);
3851 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
3852 {
3853 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003854 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003855 return;
3856 }
3857 #endif
3858 sirCopyMacAddr(peerMac,psessionEntry->bssId);
3859
3860 // save the addts request
3861 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303862 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07003863
3864 // ship out the message now
3865 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
3866 psessionEntry);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003867 PELOG1(limLog(pMac, LOG1, "Sent ADDTS request");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003868
3869 // start a timer to wait for the response
3870 if (pSirAddts->timeout)
3871 timeout = pSirAddts->timeout;
3872 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
3873 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003874 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003875 WNI_CFG_ADDTS_RSP_TIMEOUT);
3876 return;
3877 }
3878
3879 timeout = SYS_MS_TO_TICKS(timeout);
3880 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
3881 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003882 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003883 return;
3884 }
3885 pMac->lim.gLimAddtsRspTimerCount++;
3886 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
3887 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
3888 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003889 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003890 return;
3891 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003892 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003893
3894 //add the sessionId to the timer object
3895 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
3896 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
3897 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003898 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003899 return;
3900 }
3901 return;
3902}
3903
3904
3905static void
3906__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3907{
3908 tSirMacAddr peerMacAddr;
3909 tANI_U8 ac;
3910 tSirMacTSInfo *pTsinfo;
3911 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
3912 tpDphHashNode pStaDs = NULL;
3913 tpPESession psessionEntry;
3914 tANI_U8 sessionId;
3915 tANI_U32 status = eSIR_SUCCESS;
3916 tANI_U8 smesessionId;
3917 tANI_U16 smetransactionId;
3918
3919 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3920
3921 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
3922 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003923 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003924 status = eSIR_FAILURE;
3925 goto end;
3926 }
3927#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3928 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
3929#endif //FEATURE_WLAN_DIAG_SUPPORT
3930
3931
3932 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
3933 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003934 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003935 status = eSIR_FAILURE;
3936 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
3937 return;
3938 }
3939
Arif Hussaina7c8e412013-11-20 11:06:42 -08003940 PELOG1(limLog(pMac, LOG1, FL("Sent DELTS request to station with "
3941 "assocId = %d MacAddr = "MAC_ADDRESS_STR),
3942 pDeltsReq->aid, MAC_ADDR_ARRAY(peerMacAddr));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003943
3944 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
3945 psessionEntry);
3946
3947 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
3948
3949 /* We've successfully send DELTS frame to AP. Update the
3950 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
3951 * is no longer trigger enabled or delivery enabled
3952 */
3953 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
3954
3955 /* We're deleting the TSPEC, so this particular AC is no longer
3956 * admitted. PE needs to downgrade the EDCA
3957 * parameters(for the AC for which TS is being deleted) to the
3958 * next best AC for which ACM is not enabled, and send the
3959 * updated values to HAL.
3960 */
3961 ac = upToAc(pTsinfo->traffic.userPrio);
3962
3963 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
3964 {
3965 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
3966 }
3967 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
3968 {
3969 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
3970 }
3971 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
3972 {
3973 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
3974 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
3975 }
3976
3977 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3978
3979 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3980 if (pStaDs != NULL)
3981 {
3982 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
3983 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3984 else
3985 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3986 status = eSIR_SUCCESS;
3987 }
3988 else
3989 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003990 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003991 status = eSIR_FAILURE;
3992 }
3993#ifdef FEATURE_WLAN_CCX
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07003994#ifdef FEATURE_WLAN_CCX_UPLOAD
3995 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
3996#else
Jeff Johnson295189b2012-06-20 16:38:30 -07003997 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07003998#endif /* FEATURE_WLAN_CCX_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07003999#endif
4000
4001 // send an sme response back
4002 end:
4003 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4004}
4005
4006
4007void
4008limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4009{
4010 //fetch the sessionEntry based on the sessionId
4011 tpPESession psessionEntry;
4012 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4013 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004014 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004015 return;
4016 }
4017
4018 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4019 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004020 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07004021 pMac->lim.gLimAddtsSent = false;
4022 return;
4023 }
4024
4025 if (! pMac->lim.gLimAddtsSent)
4026 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004027 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07004028 return;
4029 }
4030
4031 if (param != pMac->lim.gLimAddtsRspTimerCount)
4032 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004033 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004034 param, pMac->lim.gLimAddtsRspTimerCount);
4035 return;
4036 }
4037
4038 // this a real response timeout
4039 pMac->lim.gLimAddtsSent = false;
4040 pMac->lim.gLimAddtsRspTimerCount++;
4041
4042 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4043 psessionEntry->smeSessionId, psessionEntry->transactionId);
4044}
4045
4046
4047/**
4048 * __limProcessSmeStatsRequest()
4049 *
4050 *FUNCTION:
4051 *
4052 *
4053 *NOTE:
4054 *
4055 * @param pMac Pointer to Global MAC structure
4056 * @param *pMsgBuf A pointer to the SME message buffer
4057 * @return None
4058 */
4059static void
4060__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4061{
4062 tpAniGetStatsReq pStatsReq;
4063 tSirMsgQ msgQ;
4064 tpPESession psessionEntry;
4065 tANI_U8 sessionId;
4066
4067
4068 if(pMsgBuf == NULL)
4069 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004070 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004071 return;
4072 }
4073
4074 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4075
4076 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4077 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004078 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304079 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004080 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004081 return;
4082 }
4083
4084
4085
4086 switch(pStatsReq->msgType)
4087 {
4088 //Add Lim stats here. and send reqsponse.
4089
4090 //HAL maintained Stats.
4091 case eWNI_SME_STA_STAT_REQ:
4092 msgQ.type = WDA_STA_STAT_REQ;
4093 break;
4094 case eWNI_SME_AGGR_STAT_REQ:
4095 msgQ.type = WDA_AGGR_STAT_REQ;
4096 break;
4097 case eWNI_SME_GLOBAL_STAT_REQ:
4098 msgQ.type = WDA_GLOBAL_STAT_REQ;
4099 break;
4100 case eWNI_SME_STAT_SUMM_REQ:
4101 msgQ.type = WDA_STAT_SUMM_REQ;
4102 break;
4103 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004104 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304105 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004106 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004107 return;
4108 }
4109
Jeff Johnson295189b2012-06-20 16:38:30 -07004110 msgQ.reserved = 0;
4111 msgQ.bodyptr = pMsgBuf;
4112 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004113 if(NULL == psessionEntry)
4114 {
4115 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4116 }
4117 else
4118 {
4119 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4120 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004121 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004122 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304123 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004124 pMsgBuf = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07004125 return;
4126 }
4127
4128 return;
4129}
4130
4131
4132/**
4133 * __limProcessSmeGetStatisticsRequest()
4134 *
4135 *FUNCTION:
4136 *
4137 *
4138 *NOTE:
4139 *
4140 * @param pMac Pointer to Global MAC structure
4141 * @param *pMsgBuf A pointer to the SME message buffer
4142 * @return None
4143 */
4144static void
4145__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4146{
4147 tpAniGetPEStatsReq pPEStatsReq;
4148 tSirMsgQ msgQ;
4149
4150 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4151
4152 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4153
4154 msgQ.type = WDA_GET_STATISTICS_REQ;
4155
Jeff Johnson295189b2012-06-20 16:38:30 -07004156 msgQ.reserved = 0;
4157 msgQ.bodyptr = pMsgBuf;
4158 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004159 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004160
4161 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304162 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004163 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004164 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004165 return;
4166 }
4167
4168 return;
4169}
4170
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004171#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
4172/**
4173 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4174 *
4175 *NOTE:
4176 *
4177 * @param pMac Pointer to Global MAC structure
4178 * @param *pMsgBuf A pointer to the SME message buffer
4179 * @return None
4180 */
4181static void
4182__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4183{
4184 tSirMsgQ msgQ;
4185
4186 msgQ.type = WDA_TSM_STATS_REQ;
4187 msgQ.reserved = 0;
4188 msgQ.bodyptr = pMsgBuf;
4189 msgQ.bodyval = 0;
4190 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4191
4192 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4193 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004194 pMsgBuf = NULL;
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004195 limLog(pMac, LOGP, "Unable to forward request");
4196 return;
4197 }
4198}
4199#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
4200
4201
Jeff Johnson295189b2012-06-20 16:38:30 -07004202
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004203#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
4204/**
4205 * __limProcessSmeGetRoamRssiRequest()
4206 *
4207 *FUNCTION:
4208 *
4209 *
4210 *NOTE:
4211 *
4212 * @param pMac Pointer to Global MAC structure
4213 * @param *pMsgBuf A pointer to the SME message buffer
4214 * @return None
4215 */
4216static void
4217__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4218{
4219 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4220 tSirMsgQ msgQ;
4221
4222 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4223 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4224
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004225 msgQ.reserved = 0;
4226 msgQ.bodyptr = pMsgBuf;
4227 msgQ.bodyval = 0;
4228 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4229
4230 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304231 vos_mem_free( pMsgBuf );
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08004232 pMsgBuf = NULL;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004233 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004234 return;
4235 }
4236
4237 return;
4238}
4239#endif
4240
4241
Jeff Johnson295189b2012-06-20 16:38:30 -07004242static void
4243__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4244{
4245 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4246 tpPESession psessionEntry;
4247 tANI_U8 sessionId; //PE sessionID
4248
4249 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004250 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004251
4252 if(pMsgBuf == NULL)
4253 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004254 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004255 return;
4256 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004257
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304258 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4259 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004260 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304261 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004262 return;
4263 }
4264
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004265 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004266 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004267 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004268 goto end;
4269 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004270
Jeff Johnson295189b2012-06-20 16:38:30 -07004271 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4272 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004273 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004274 goto end;
4275 }
4276
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304277 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004278
Jeff Johnson295189b2012-06-20 16:38:30 -07004279 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004280 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004281
4282end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304283 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004284 return;
4285} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4286
4287static void
4288__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4289{
4290 tpSirUpdateParams pUpdateParams;
4291 tpPESession psessionEntry;
4292
4293 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004294 FL("received HIDE_SSID message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004295
4296 if(pMsgBuf == NULL)
4297 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004298 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004299 return;
4300 }
4301
4302 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4303
4304 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4305 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004306 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004307 pUpdateParams->sessionId);
4308 return;
4309 }
4310
4311 /* Update the session entry */
4312 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4313
4314 /* Update beacon */
4315 schSetFixedBeaconFields(pMac, psessionEntry);
4316 limSendBeaconInd(pMac, psessionEntry);
4317
4318 return;
4319} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4320
4321static void
4322__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4323{
4324 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4325 tpPESession psessionEntry;
4326 tANI_U8 sessionId; //PE sessionID
4327
4328 if(pMsgBuf == NULL)
4329 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004330 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004331 return;
4332 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304333
4334 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4335 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004336 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304337 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004338 return;
4339 }
4340
4341 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4342 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004343 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004344 goto end;
4345 }
4346
4347 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4348 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004349 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004350 goto end;
4351 }
4352
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304353 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4354 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004355
4356 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4357
4358 psessionEntry->pLimStartBssReq->privacy = 1;
4359 psessionEntry->privacy = 1;
4360
4361 schSetFixedBeaconFields(pMac, psessionEntry);
4362 limSendBeaconInd(pMac, psessionEntry);
4363
4364end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304365 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004366 return;
4367} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4368
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004369/*
4370Update the beacon Interval dynamically if beaconInterval is different in MCC
4371*/
4372static void
4373__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4374{
4375 tpSirChangeBIParams pChangeBIParams;
4376 tpPESession psessionEntry;
4377 tANI_U8 sessionId = 0;
4378 tUpdateBeaconParams beaconParams;
4379
4380 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004381 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004382
4383 if(pMsgBuf == NULL)
4384 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004385 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004386 return;
4387 }
4388
Kaushik, Sushantfb156732014-01-07 15:36:03 +05304389 vos_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004390 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4391
4392 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4393 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004394 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004395 return;
4396 }
4397
4398 /*Update sessionEntry Beacon Interval*/
4399 if(psessionEntry->beaconParams.beaconInterval !=
4400 pChangeBIParams->beaconInterval )
4401 {
4402 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4403 }
4404
4405 /*Update sch beaconInterval*/
4406 if(pMac->sch.schObject.gSchBeaconInterval !=
4407 pChangeBIParams->beaconInterval )
4408 {
4409 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4410
4411 PELOG1(limLog(pMac, LOG1,
4412 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4413
4414 /* Update beacon */
4415 schSetFixedBeaconFields(pMac, psessionEntry);
4416
Sunil Ravib96f7b52013-05-22 21:40:05 -07004417 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004418 //Set change in beacon Interval
4419 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004420 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004421 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4422 }
4423
4424 return;
4425} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4426
Jeff Johnson295189b2012-06-20 16:38:30 -07004427
4428
4429/** -------------------------------------------------------------
4430\fn limProcessSmeDelBaPeerInd
4431\brief handles indication message from HDD to send delete BA request
4432\param tpAniSirGlobal pMac
4433\param tANI_U32 pMsgBuf
4434\return None
4435-------------------------------------------------------------*/
4436void
4437limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4438{
4439 tANI_U16 assocId =0;
4440 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4441 tpDphHashNode pSta;
4442 tpPESession psessionEntry;
4443 tANI_U8 sessionId;
4444
4445
4446
4447 if(NULL == pSmeDelBAPeerInd)
4448 return;
4449
4450 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4451 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004452 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004453 return;
4454 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004455 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004456 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4457
4458 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4459 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4460 pSta,
4461 pSmeDelBAPeerInd->baDirection,
4462 pSmeDelBAPeerInd->baTID,
4463 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4464 {
4465 limLog( pMac, LOGW,
4466 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4467 if (pSta)
4468 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4469 }
4470}
4471
4472// --------------------------------------------------------------------
4473/**
4474 * __limProcessReportMessage
4475 *
4476 * FUNCTION: Processes the next received Radio Resource Management message
4477 *
4478 * LOGIC:
4479 *
4480 * ASSUMPTIONS:
4481 *
4482 * NOTE:
4483 *
4484 * @param None
4485 * @return None
4486 */
4487
4488void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4489{
4490#ifdef WLAN_FEATURE_VOWIFI
4491 switch (pMsg->type)
4492 {
4493 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4494 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4495 break;
4496 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4497 {
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004498#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004499 tpSirBeaconReportXmitInd pBcnReport=NULL;
4500 tpPESession psessionEntry=NULL;
4501 tANI_U8 sessionId;
4502
4503 if(pMsg->bodyptr == NULL)
4504 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004505 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004506 return;
4507 }
4508 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4509 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4510 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004511 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004512 return;
4513 }
4514 if (psessionEntry->isCCXconnection)
4515 ccxProcessBeaconReportXmit( pMac, pMsg->bodyptr);
4516 else
4517#endif
4518 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4519 }
4520 break;
4521 }
4522#endif
4523}
4524
4525#if defined(FEATURE_WLAN_CCX) || defined(WLAN_FEATURE_VOWIFI)
4526// --------------------------------------------------------------------
4527/**
4528 * limSendSetMaxTxPowerReq
4529 *
4530 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4531 *
4532 * LOGIC:
4533 *
4534 * ASSUMPTIONS:
4535 *
4536 * NOTE:
4537 *
4538 * @param txPower txPower to be set.
4539 * @param pSessionEntry session entry.
4540 * @return None
4541 */
4542tSirRetStatus
4543limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4544{
4545 tpMaxTxPowerParams pMaxTxParams = NULL;
4546 tSirRetStatus retCode = eSIR_SUCCESS;
4547 tSirMsgQ msgQ;
4548
4549 if( pSessionEntry == NULL )
4550 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004551 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004552 return eSIR_FAILURE;
4553 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304554
4555 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4556 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004557 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004558 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004559 return eSIR_MEM_ALLOC_FAILED;
4560
4561 }
4562#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_CCX)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004563 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 -07004564#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004565 if( pMaxTxParams == NULL )
4566 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004567 limLog( pMac, LOGE, "%s:%d: pMaxTxParams is NULL", __func__, __LINE__);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004568 return eSIR_FAILURE;
4569 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004570 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304571 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4572 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004573
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004574 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4575 msgQ.bodyptr = pMaxTxParams;
4576 msgQ.bodyval = 0;
4577 PELOG1(limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));)
4578 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
4579 retCode = wdaPostCtrlMsg(pMac, &msgQ);
4580 if (eSIR_SUCCESS != retCode)
4581 {
4582 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304583 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004584 }
4585 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004586}
4587#endif
4588
4589/**
4590 * __limProcessSmeAddStaSelfReq()
4591 *
4592 *FUNCTION:
4593 * This function is called to process SME_ADD_STA_SELF_REQ message
4594 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4595 *
4596 *LOGIC:
4597 *
4598 *ASSUMPTIONS:
4599 *
4600 *NOTE:
4601 *
4602 * @param pMac Pointer to Global MAC structure
4603 * @param *pMsgBuf A pointer to the SME message buffer
4604 * @return None
4605 */
4606
4607static void
4608__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4609{
4610 tSirMsgQ msg;
4611 tpAddStaSelfParams pAddStaSelfParams;
4612 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
4613
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304614 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
4615 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004616 {
4617 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
4618 return;
4619 }
4620
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304621 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07004622 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004623 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
4624 msg.reserved = 0;
4625 msg.bodyptr = pAddStaSelfParams;
4626 msg.bodyval = 0;
4627
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004628 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004629 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004630
4631 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4632 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004633 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004634 }
4635 return;
4636} /*** end __limProcessAddStaSelfReq() ***/
4637
4638
4639/**
4640 * __limProcessSmeDelStaSelfReq()
4641 *
4642 *FUNCTION:
4643 * This function is called to process SME_DEL_STA_SELF_REQ message
4644 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
4645 *
4646 *LOGIC:
4647 *
4648 *ASSUMPTIONS:
4649 *
4650 *NOTE:
4651 *
4652 * @param pMac Pointer to Global MAC structure
4653 * @param *pMsgBuf A pointer to the SME message buffer
4654 * @return None
4655 */
4656
4657static void
4658__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4659{
4660 tSirMsgQ msg;
4661 tpDelStaSelfParams pDelStaSelfParams;
4662 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
4663
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304664 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
4665 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004666 {
4667 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
4668 return;
4669 }
4670
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304671 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004672
4673 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
4674 msg.reserved = 0;
4675 msg.bodyptr = pDelStaSelfParams;
4676 msg.bodyval = 0;
4677
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004678 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004679 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004680
4681 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4682 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004683 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004684 }
4685 return;
4686} /*** end __limProcessSmeDelStaSelfReq() ***/
4687
4688
Jeff Johnson295189b2012-06-20 16:38:30 -07004689/**
4690 * __limProcessSmeRegisterMgmtFrameReq()
4691 *
4692 *FUNCTION:
4693 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
4694 * from SME. It Register this information within PE.
4695 *
4696 *LOGIC:
4697 *
4698 *ASSUMPTIONS:
4699 *
4700 *NOTE:
4701 *
4702 * @param pMac Pointer to Global MAC structure
4703 * @param *pMsgBuf A pointer to the SME message buffer
4704 * @return None
4705 */
4706static void
4707__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4708{
4709 VOS_STATUS vosStatus;
4710 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
4711 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004712 tANI_BOOLEAN match = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004713 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004714 FL("registerFrame %d, frameType %d, matchLen %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07004715 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004716
Jeff Johnsond13512a2012-07-17 11:42:19 -07004717 /* First check whether entry exists already*/
4718
4719 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4720 (vos_list_node_t**)&pLimMgmtRegistration);
4721
4722 while(pLimMgmtRegistration != NULL)
4723 {
4724 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
4725 {
4726 if(pSmeReq->matchLen)
4727 {
4728 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
4729 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304730 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07004731 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
4732 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004733 /* found match! */
4734 match = VOS_TRUE;
4735 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004736 }
4737 }
4738 }
4739 else
4740 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004741 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07004742 match = VOS_TRUE;
4743 break;
4744 }
4745 }
4746 vosStatus = vos_list_peek_next (
4747 &pMac->lim.gLimMgmtFrameRegistratinQueue,
4748 (vos_list_node_t*) pLimMgmtRegistration,
4749 (vos_list_node_t**) &pNext );
4750
4751 pLimMgmtRegistration = pNext;
4752 pNext = NULL;
4753
4754 }
4755
4756 if (match)
4757 {
4758 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4759 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304760 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07004761 }
4762
Jeff Johnson295189b2012-06-20 16:38:30 -07004763 if(pSmeReq->registerFrame)
4764 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304765 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
4766 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07004767 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304768 vos_mem_set((void*)pLimMgmtRegistration,
4769 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004770 pLimMgmtRegistration->frameType = pSmeReq->frameType;
4771 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
4772 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
4773 if(pSmeReq->matchLen)
4774 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304775 vos_mem_copy(pLimMgmtRegistration->matchData,
4776 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07004777 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004778 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4779 &pLimMgmtRegistration->node);
4780 }
4781 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004782
4783 return;
4784} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08004785
4786static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08004787__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08004788{
4789 tpP2pPsParams pMsgNoA;
4790 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08004791
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304792 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
4793 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08004794 {
4795 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004796 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08004797 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004798 }
4799
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304800 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08004801 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
4802 pMsgNoA->opp_ps = 0;
4803 pMsgNoA->ctWindow = 0;
4804 pMsgNoA->duration = 0;
4805 pMsgNoA->interval = 0;
4806 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08004807
Vinay Malekal62757362012-12-17 12:15:51 -08004808 /* Below params used for Single Shot NOA - so assign proper values */
4809 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08004810 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08004811
Viral Modid86bde22012-12-10 13:09:21 -08004812 /* Start Insert NOA timer
4813 * 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 -08004814 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
4815 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08004816 */
4817 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
4818 == TX_TIMER_ERROR)
4819 {
4820 /// Could not activate Insert NOA timer.
4821 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004822 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08004823
4824 // send the scan response back with status failure and do not even call insert NOA
4825 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304826 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08004827 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004828 }
4829
Viral Modid440e682013-03-06 02:25:31 -08004830 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
4831
Viral Modid86bde22012-12-10 13:09:21 -08004832 msg.type = WDA_SET_P2P_GO_NOA_REQ;
4833 msg.reserved = 0;
4834 msg.bodyptr = pMsgNoA;
4835 msg.bodyval = 0;
4836
4837 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4838 {
4839 /* 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 -07004840 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08004841 /* Deactivate the NOA timer in failure case */
4842 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
4843 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004844 }
Viral Modid440e682013-03-06 02:25:31 -08004845 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08004846
Viral Modid440e682013-03-06 02:25:31 -08004847error:
4848 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
4849 * worrying about the NOA
4850 */
4851 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
4852 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08004853 return FALSE;
4854
4855}
4856
Viral Modid440e682013-03-06 02:25:31 -08004857static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4858{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004859 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08004860 pMac->lim.gDeferMsgTypeForNOA = msgType;
4861 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
4862}
4863
4864static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4865{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004866 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08004867 pMac->lim.gDeferMsgTypeForNOA = 0;
4868 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
4869 {
4870 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304871 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004872 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4873 }
4874}
4875
4876static
4877tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4878{
4879 tANI_U32 noaDuration = 0;
4880
4881 switch (msgType)
4882 {
4883 case eWNI_SME_SCAN_REQ:
4884 {
4885 tANI_U32 val;
4886 tANI_U8 i;
4887 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
4888 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
4889 {
4890 /*
4891 * Could not get max channel value
4892 * from CFG. Log error.
4893 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004894 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08004895
4896 /* use a default value of 110ms */
4897 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
4898 }
4899
4900 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
4901 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
4902
4903 if (limActiveScanAllowed(pMac, channelNum)) {
4904 /* Use min + max channel time to calculate the total duration of scan */
4905 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
4906 } else {
4907 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
4908 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
4909 */
4910 noaDuration += val;
4911 }
4912 }
4913
4914 /* Adding an overhead of 20ms to account for the scan messaging delays */
4915 noaDuration += SCAN_MESSAGING_OVERHEAD;
4916 noaDuration *= CONV_MS_TO_US;
4917
4918 break;
4919 }
4920
4921 case eWNI_SME_OEM_DATA_REQ:
4922 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
4923 break;
4924
4925 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
4926 {
4927 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
4928 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
4929 break;
4930 }
4931
4932 case eWNI_SME_JOIN_REQ:
4933 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
4934 break;
4935
4936 default:
4937 noaDuration = 0;
4938 break;
4939
4940 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004941 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08004942 return noaDuration;
4943}
4944
4945void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4946{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05304947 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08004948
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004949 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004950 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
4951 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
4952 {
4953 switch (pMac->lim.gDeferMsgTypeForNOA)
4954 {
4955 case eWNI_SME_SCAN_REQ:
4956 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4957 break;
4958 case eWNI_SME_OEM_DATA_REQ:
4959 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4960 break;
4961 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05304962 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4963 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
4964 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
4965 */
4966 if (FALSE == bufConsumed)
4967 {
4968 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4969 }
Viral Modid440e682013-03-06 02:25:31 -08004970 break;
4971 case eWNI_SME_JOIN_REQ:
4972 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4973 break;
4974 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004975 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004976 break;
4977 }
4978 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
4979 }
4980 else
4981 {
4982 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004983 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08004984 }
4985}
Jeff Johnson295189b2012-06-20 16:38:30 -07004986
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004987#ifdef FEATURE_WLAN_TDLS_INTERNAL
4988/*
4989 * Process Discovery request recieved from SME and transmit to AP.
4990 */
4991static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
4992 tANI_U32 *pMsgBuf)
4993{
4994 /* get all discovery request parameters */
4995 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
4996 tpPESession psessionEntry;
4997 tANI_U8 sessionId;
4998
4999 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005000 ("Discovery Req Recieved")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005001
5002 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
5003 == NULL)
5004 {
5005 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005006 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005007 disReq->sessionId);
5008 goto lim_tdls_dis_start_error;
5009 }
5010
5011 /* check if we are in proper state to work as TDLS client */
5012 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5013 {
5014 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005015 "dis req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005016 psessionEntry->limSystemRole);
5017 goto lim_tdls_dis_start_error;
5018 }
5019
5020 /*
5021 * if we are still good, go ahead and check if we are in proper state to
5022 * do TDLS discovery procedure.
5023 */
5024 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5025 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5026 {
5027
5028 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005029 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005030 goto lim_tdls_dis_start_error;
5031 }
5032
5033 /*
5034 * if we are still good, go ahead and transmit TDLS discovery request,
5035 * and save Dis Req info for future reference.
5036 */
5037
5038#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
5039 /*
5040 * send message to HAL to set RXP filters to receieve frame on
5041 * direct link..
5042 */
5043 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
5044 // psessionEntry->bssId) ;
5045#endif
5046
5047 /* save dis request message for matching dialog token */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305048 vos_mem_copy((tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
5049 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005050
5051 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005052 "Transmit Discovery Request Frame") ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005053 /* format TDLS discovery request frame and transmit it */
5054 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
5055 psessionEntry) ;
5056
5057 /* prepare for response */
5058 pMac->lim.gLimTdlsDisStaCount = 0 ;
5059 pMac->lim.gLimTdlsDisResultList = NULL ;
5060
5061 /*
5062 * start TDLS discovery request timer to wait for discovery responses
5063 * from all TDLS enabled clients in BSS.
5064 */
5065
5066 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005067 ("Start Discovery request Timeout Timer")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005068 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
5069 eLIM_TDLS_DISCOVERY_RSP_WAIT));
5070
5071 /* assign appropriate sessionId to the timer object */
5072 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
5073 psessionEntry->peSessionId;
5074
5075 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
5076 != TX_SUCCESS)
5077 {
5078 limLog(pMac, LOGP, FL("TDLS discovery response timer \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005079 activation failed!"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005080 goto lim_tdls_dis_start_error;
5081 }
5082 /*
5083 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
5084 * back to SME
5085 */
5086 return (eSIR_SUCCESS) ;
5087lim_tdls_dis_start_error:
5088 /* in error case, PE has to sent the response SME immediately with error code */
5089 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
5090 eWNI_SME_TDLS_DISCOVERY_START_RSP);
5091 return eSIR_FAILURE;
5092}
5093/*
5094 * Process link start request recieved from SME and transmit to AP.
5095 */
5096eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5097{
5098 /* get all discovery request parameters */
5099 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
5100 tLimTdlsLinkSetupInfo *linkSetupInfo;
5101 //tLimTdlsLinkSetupPeer *setupPeer;
5102 tpPESession psessionEntry;
5103 tANI_U8 sessionId;
5104 eHalStatus status;
5105
5106 if((psessionEntry = peFindSessionByBssid(pMac,
5107 setupReq->bssid, &sessionId)) == NULL)
5108 {
5109 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005110 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005111 setupReq->sessionId);
5112 goto lim_tdls_link_start_error;
5113 }
5114
5115 /* check if we are in proper state to work as TDLS client */
5116 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5117 {
5118 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005119 "TDLS link setup req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005120 psessionEntry->limSystemRole);
5121 goto lim_tdls_link_start_error;
5122 }
5123
5124 /*
5125 * if we are still good, go ahead and check if we are in proper state to
5126 * do TDLS setup procedure.
5127 */
5128 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5129 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5130 {
5131 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005132 state (%d)", pMac->lim.gLimSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005133 goto lim_tdls_link_start_error;
5134 }
5135
5136 /*
5137 * Now, go ahead and transmit TDLS discovery request, and save setup Req
5138 * info for future reference.
5139 */
5140 /* create node for Link setup */
5141 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
5142 //setupPeer = NULL ;
5143
5144 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
5145 setupReq->peerMac, psessionEntry) ;
5146 if(eHAL_STATUS_SUCCESS == status)
5147 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5148 TDLS setup cnf TX complete is successful. */
5149 return eSIR_SUCCESS;
5150#if 0
5151
5152 /*
5153 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005154 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005155 * free this memory if any timeout is happen in link setup procedure
5156 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305157 setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
5158 if ( NULL == setupPeer )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005159 {
5160 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005161 FL( "Unable to allocate memory during ADD_STA" ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005162 VOS_ASSERT(0) ;
5163 return eSIR_MEM_ALLOC_FAILED;
5164 }
5165 setupPeer->dialog = setupReq->dialog ;
5166 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
5167 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
5168 /* TDLS_sessionize: remember sessionId for future */
5169 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
5170 setupPeer->tdls_bIsResponder = 1;
5171
5172 /*
5173 * we only populate peer MAC, so it can assit us to find the
5174 * TDLS peer after response/or after response timeout
5175 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305176 vos_mem_copy(setupPeer->peerMac, setupReq->peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005177 sizeof(tSirMacAddr)) ;
5178 /* format TDLS discovery request frame and transmit it */
5179 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
5180 setupReq->dialog, psessionEntry, NULL, 0) ;
5181
5182 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
5183 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
5184 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
5185 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
5186 /* update setup peer list */
5187 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
5188 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
5189 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5190 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
5191 return eSIR_SUCCESS ;
5192#endif
5193lim_tdls_link_start_error:
5194 /* in case of error, return immediately to SME */
5195 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
5196 eWNI_SME_TDLS_LINK_START_RSP);
5197 return eSIR_FAILURE ;
5198}
5199
5200/*
5201 * Process link teardown request recieved from SME and transmit to AP.
5202 */
5203eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5204{
5205 /* get all discovery request parameters */
5206 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
5207 tLimTdlsLinkSetupPeer *setupPeer;
5208 tpPESession psessionEntry;
5209 tANI_U8 sessionId;
5210
5211 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
5212 {
5213 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005214 "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005215 goto lim_tdls_teardown_req_error;
5216 }
5217
5218 /* check if we are in proper state to work as TDLS client */
5219 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5220 {
5221 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005222 "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005223 goto lim_tdls_teardown_req_error;
5224 }
5225
5226 /*
5227 * if we are still good, go ahead and check if we are in proper state to
5228 * do TDLS setup procedure.
5229 */
5230 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5231 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5232 {
5233 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005234 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005235 goto lim_tdls_teardown_req_error;
5236 }
5237
5238 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Arif Hussain24bafea2013-11-15 15:10:03 -08005239 "Teardown for peer = " MAC_ADDRESS_STR, MAC_ADDR_ARRAY(teardownReq->peerMac));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005240 /*
5241 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5242 * info for future reference.
5243 */
5244 /* Verify if this link is setup */
5245 setupPeer = NULL ;
5246 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5247 if(NULL == setupPeer)
5248 {
5249 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005250 ("invalid Peer on teardown ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005251 goto lim_tdls_teardown_req_error;
5252 }
5253
5254
5255 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5256 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5257 /* TDLS_sessionize: check sessionId in case */
5258 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5259 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005260 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005261 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5262 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5263 }
5264
5265 /* format TDLS teardown request frame and transmit it */
5266 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5267 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5268 {
5269 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005270 ("couldn't send teardown frame ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005271 goto lim_tdls_teardown_req_error;
5272 }
5273 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5274 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5275 return eSIR_SUCCESS;
5276lim_tdls_teardown_req_error:
5277 /* in case of error, return immediately to SME */
5278 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5279 eWNI_SME_TDLS_TEARDOWN_RSP);
5280 return eSIR_FAILURE;
5281}
5282
5283
5284#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005285
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305286static void
5287__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5288{
5289 tpSirResetAPCapsChange pResetCapsChange;
5290 tpPESession psessionEntry;
5291 tANI_U8 sessionId = 0;
5292 if (pMsgBuf == NULL)
5293 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005294 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305295 return;
5296 }
5297
5298 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5299 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5300 if (psessionEntry == NULL)
5301 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005302 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305303 return;
5304 }
5305
5306 psessionEntry->limSentCapsChangeNtf = false;
5307 return;
5308}
5309
Jeff Johnson295189b2012-06-20 16:38:30 -07005310/**
5311 * limProcessSmeReqMessages()
5312 *
5313 *FUNCTION:
5314 * This function is called by limProcessMessageQueue(). This
5315 * function processes SME request messages from HDD or upper layer
5316 * application.
5317 *
5318 *LOGIC:
5319 *
5320 *ASSUMPTIONS:
5321 *
5322 *NOTE:
5323 *
5324 * @param pMac Pointer to Global MAC structure
5325 * @param msgType Indicates the SME message type
5326 * @param *pMsgBuf A pointer to the SME message buffer
5327 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5328 * FALSE - if pMsgBuf is not to be freed.
5329 */
5330
5331tANI_BOOLEAN
5332limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5333{
5334 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5335 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005336 tpSirSmeScanReq pScanReq;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005337 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 -07005338 limMsgStr(pMsg->type), pMsg->type,
5339 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5340 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5341
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005342 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005343 /* Special handling of some SME Req msgs where we have an existing GO session and
5344 * want to insert NOA before processing those msgs. These msgs will be processed later when
5345 * start event happens
5346 */
5347 switch (pMsg->type)
5348 {
5349 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005350 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005351
5352 /* If scan is disabled return from here
5353 */
5354 if (pMac->lim.fScanDisabled)
5355 {
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005356 if (pMsg->type == eWNI_SME_SCAN_REQ)
5357 {
5358 limSendSmeScanRsp(pMac,
5359 offsetof(tSirSmeScanRsp,bssDescription[0]),
5360 eSIR_SME_INVALID_PARAMETERS,
5361 pScanReq->sessionId,
5362 pScanReq->transactionId);
5363
5364 bufConsumed = TRUE;
5365 }
5366 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5367 {
5368 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5369 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5370 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5371
5372 /*
5373 * limRemainOnChnRsp will free the buffer this change is to
5374 * avoid "double free"
5375 */
5376 bufConsumed = FALSE;
5377 }
5378
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05305379 limLog(pMac, LOGE,
5380 FL("Error: Scan Disabled."
5381 " Return with error status for SME Message %s(%d)"),
5382 limMsgStr(pMsg->type), pMsg->type);
5383
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005384 return bufConsumed;
5385 }
5386 /*
5387 * Do not add BREAK here
5388 */
5389 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005390 case eWNI_SME_JOIN_REQ:
5391 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5392 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5393 {
5394 tANI_U32 noaDuration;
5395 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
5396 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf);
5397 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5398 return bufConsumed;
5399 }
5400 }
5401 /* If no insert NOA required then execute the code below */
5402
Jeff Johnson295189b2012-06-20 16:38:30 -07005403 switch (pMsg->type)
5404 {
5405 case eWNI_SME_START_REQ:
5406 __limProcessSmeStartReq(pMac, pMsgBuf);
5407 break;
5408
5409 case eWNI_SME_SYS_READY_IND:
5410 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5411 break;
5412
Jeff Johnson295189b2012-06-20 16:38:30 -07005413 case eWNI_SME_START_BSS_REQ:
5414 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5415 break;
5416
5417 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005418 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005419 break;
5420
Jeff Johnsone7245742012-09-05 17:12:55 -07005421#ifdef FEATURE_OEM_DATA_SUPPORT
5422 case eWNI_SME_OEM_DATA_REQ:
5423 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005424 break;
5425#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005426 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5427 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5428 break;
5429
5430 case eWNI_SME_UPDATE_NOA:
5431 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5432 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305433 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5434 __limProcessClearDfsChannelList(pMac, pMsg);
5435 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005436 case eWNI_SME_JOIN_REQ:
5437 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005438 break;
5439
5440 case eWNI_SME_AUTH_REQ:
5441 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5442
5443 break;
5444
5445 case eWNI_SME_REASSOC_REQ:
5446 __limProcessSmeReassocReq(pMac, pMsgBuf);
5447
5448 break;
5449
5450 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5451 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5452
5453 break;
5454
5455 case eWNI_SME_DISASSOC_REQ:
5456 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5457
5458 break;
5459
5460 case eWNI_SME_DISASSOC_CNF:
5461 case eWNI_SME_DEAUTH_CNF:
5462 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5463
5464 break;
5465
5466 case eWNI_SME_DEAUTH_REQ:
5467 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5468
5469 break;
5470
Jeff Johnson295189b2012-06-20 16:38:30 -07005471
5472
5473 case eWNI_SME_SETCONTEXT_REQ:
5474 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5475
5476 break;
5477
5478 case eWNI_SME_REMOVEKEY_REQ:
5479 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5480
5481 break;
5482
5483 case eWNI_SME_STOP_BSS_REQ:
5484 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5485 break;
5486
5487 case eWNI_SME_ASSOC_CNF:
5488 case eWNI_SME_REASSOC_CNF:
5489 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005490 PELOG1(limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005491 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005492 PELOG1(limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005493 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5494 break;
5495
5496 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005497 PELOG1(limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005498 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5499 break;
5500
5501 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005502 PELOG1(limLog(pMac, LOG1, FL("Received DELTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005503 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5504 break;
5505
5506 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005507 PELOG1(limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005508 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5509 break;
5510
5511 case eWNI_SME_STA_STAT_REQ:
5512 case eWNI_SME_AGGR_STAT_REQ:
5513 case eWNI_SME_GLOBAL_STAT_REQ:
5514 case eWNI_SME_STAT_SUMM_REQ:
5515 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5516 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5517 bufConsumed = FALSE;
5518 break;
5519 case eWNI_SME_GET_STATISTICS_REQ:
5520 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5521 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5522 bufConsumed = FALSE;
5523 break;
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005524#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
5525 case eWNI_SME_GET_ROAM_RSSI_REQ:
5526 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5527 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5528 bufConsumed = FALSE;
5529 break;
5530#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005531#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
5532 case eWNI_SME_GET_TSM_STATS_REQ:
5533 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5534 bufConsumed = FALSE;
5535 break;
5536#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005537 case eWNI_SME_DEL_BA_PEER_IND:
5538 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5539 break;
5540 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5541 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5542 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005543 case eWNI_SME_GET_ASSOC_STAS_REQ:
5544 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5545 break;
5546 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5547 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5548 break;
5549
5550 case eWNI_SME_HIDE_SSID_REQ:
5551 __limProcessSmeHideSSID(pMac, pMsgBuf);
5552 break;
5553 case eWNI_SME_UPDATE_APWPSIE_REQ:
5554 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5555 break;
5556 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5557 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5558 break;
5559
5560 case eWNI_SME_SET_APWPARSNIEs_REQ:
5561 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5562 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005563
5564 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5565 //Update the beaconInterval
5566 __limProcessSmeChangeBI(pMac, pMsgBuf );
5567 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005568
5569#if defined WLAN_FEATURE_VOWIFI
5570 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5571 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5572 __limProcessReportMessage(pMac, pMsg);
5573 break;
5574#endif
5575
5576#if defined WLAN_FEATURE_VOWIFI_11R
5577 case eWNI_SME_FT_PRE_AUTH_REQ:
5578 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5579 break;
5580 case eWNI_SME_FT_UPDATE_KEY:
5581 limProcessFTUpdateKey(pMac, pMsgBuf);
5582 break;
5583
5584 case eWNI_SME_FT_AGGR_QOS_REQ:
5585 limProcessFTAggrQosReq(pMac, pMsgBuf);
5586 break;
5587#endif
5588
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005589#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07005590 case eWNI_SME_CCX_ADJACENT_AP_REPORT:
5591 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5592 break;
5593#endif
5594 case eWNI_SME_ADD_STA_SELF_REQ:
5595 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5596 break;
5597 case eWNI_SME_DEL_STA_SELF_REQ:
5598 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5599 break;
5600
Jeff Johnson295189b2012-06-20 16:38:30 -07005601 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5602 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5603 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005604#ifdef FEATURE_WLAN_TDLS
5605 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5606 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5607 break;
5608 case eWNI_SME_TDLS_ADD_STA_REQ:
5609 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5610 break;
5611 case eWNI_SME_TDLS_DEL_STA_REQ:
5612 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5613 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305614 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5615 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5616 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005617#endif
5618#ifdef FEATURE_WLAN_TDLS_INTERNAL
5619 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
5620 limProcessSmeDisStartReq(pMac, pMsgBuf);
5621 break ;
5622 case eWNI_SME_TDLS_LINK_START_REQ:
5623 limProcessSmeLinkStartReq(pMac, pMsgBuf);
5624 break ;
5625 case eWNI_SME_TDLS_TEARDOWN_REQ:
5626 limProcessSmeTeardownReq(pMac, pMsgBuf);
5627 break ;
5628#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305629 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5630 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5631 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005632
schang86c22c42013-03-13 18:41:24 -07005633 case eWNI_SME_SET_TX_POWER_REQ:
5634 limSendSetTxPowerReq(pMac, pMsgBuf);
5635 break ;
5636
Jeff Johnson295189b2012-06-20 16:38:30 -07005637 default:
5638 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5639 pMsg->bodyptr = NULL;
5640 break;
5641 } // switch (msgType)
5642
5643 return bufConsumed;
5644} /*** end limProcessSmeReqMessages() ***/