blob: 03e76afe7f01600a5411a523e6d07a686022bfba [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala92f07d82013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
41
42/*
43 * Airgo Networks, Inc proprietary. All rights reserved.
44 * This file limProcessSmeReqMessages.cc contains the code
45 * for processing SME request messages.
46 * Author: Chandra Modumudi
47 * Date: 02/11/02
48 * History:-
49 * Date Modified by Modification Information
50 * --------------------------------------------------------------------
51 *
52 */
53
54#include "palTypes.h"
55#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070056#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070057#include "cfgApi.h"
58#include "sirApi.h"
59#include "schApi.h"
60#include "utilsApi.h"
61#include "limTypes.h"
62#include "limUtils.h"
63#include "limAssocUtils.h"
64#include "limSecurityUtils.h"
65#include "limSerDesUtils.h"
66#include "limSmeReqUtils.h"
67#include "limIbssPeerMgmt.h"
68#include "limAdmitControl.h"
69#include "dphHashTable.h"
70#include "limSendMessages.h"
71#include "limApi.h"
72#include "wmmApsd.h"
73
Jeff Johnson295189b2012-06-20 16:38:30 -070074#include "sapApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070075
76#if defined WLAN_FEATURE_VOWIFI
77#include "rrmApi.h"
78#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -070079#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -070080#include "ccxApi.h"
81#endif
82
83#if defined WLAN_FEATURE_VOWIFI_11R
84#include <limFT.h>
85#endif
86
87#ifdef FEATURE_WLAN_CCX
88/* These are the min/max tx power (non virtual rates) range
89 supported by prima hardware */
90#define MIN_TX_PWR_CAP 12
91#define MAX_TX_PWR_CAP 19
92
93#endif
94
Viral Modid86bde22012-12-10 13:09:21 -080095/* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK
96 * in case of P2P Client and starting actual scanning with init scan req/rsp plus in case of concurrency,
Sunil Ravi24fd3aa2013-01-21 22:12:06 -080097 * taking care of sending null data and receiving ACK to/from AP/Also SetChannel with calibration is taking
98 * around 7ms .
Viral Modid86bde22012-12-10 13:09:21 -080099 */
Viral Modid440e682013-03-06 02:25:31 -0800100#define SCAN_MESSAGING_OVERHEAD 20 // in msecs
101#define JOIN_NOA_DURATION 2000 // in msecs
102#define OEM_DATA_NOA_DURATION 60 // in msecs
103#define DEFAULT_PASSIVE_MAX_CHANNEL_TIME 110 // in msecs
Jeff Johnson295189b2012-06-20 16:38:30 -0700104
Gopichand Nakkala096a1052012-12-21 07:05:34 -0800105#define CONV_MS_TO_US 1024 //conversion factor from ms to us
106
Jeff Johnson295189b2012-06-20 16:38:30 -0700107// SME REQ processing function templates
108static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *);
109static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *);
110static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
Viral Modid440e682013-03-06 02:25:31 -0800111static void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *);
Jeff Johnson295189b2012-06-20 16:38:30 -0700112static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *);
113static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *);
114static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *);
115static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *);
116static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *);
117static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *);
118static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
119
Jeff Johnson295189b2012-06-20 16:38:30 -0700120void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *);
121
Jeff Johnson295189b2012-06-20 16:38:30 -0700122extern void peRegisterTLHandle(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700123
Jeff Johnson295189b2012-06-20 16:38:30 -0700124
Jeff Johnson295189b2012-06-20 16:38:30 -0700125#ifdef BACKGROUND_SCAN_ENABLED
126
127// start the background scan timers if it hasn't already started
128static void
129__limBackgroundScanInitiate(tpAniSirGlobal pMac)
130{
131 if (pMac->lim.gLimBackgroundScanStarted)
132 return;
133
134 //make sure timer is created first
135 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
136 {
137 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -0700138 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700139 if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700140 limLog(pMac, LOGP, FL("could not activate background scan timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700141 pMac->lim.gLimBackgroundScanStarted = true;
142 pMac->lim.gLimBackgroundScanChannelId = 0;
143 }
144}
145
146#endif // BACKGROUND_SCAN_ENABLED
Jeff Johnson295189b2012-06-20 16:38:30 -0700147
148// determine if a fresh scan request must be issued or not
149/*
150* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
151* If one of the sessions is not in one of the above states, then PE does not do fresh scan
152* If no session exists (scanning very first time), then PE will always do fresh scan if SME
153* asks it to do that.
154*/
155static tANI_U8
156__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
157{
158
159 tANI_U8 validState = TRUE;
160 int i;
161
162 if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
163 {
164 return FALSE;
165 }
166 for(i =0; i < pMac->lim.maxBssId; i++)
167 {
168
169 if(pMac->lim.gpSession[i].valid == TRUE)
170 {
171 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
172 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
173 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
174
175 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
176 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
177 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
178 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700179 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
180 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
181 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
182 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
Jeff Johnson295189b2012-06-20 16:38:30 -0700183 ))
184 {
185 validState = FALSE;
186 break;
187 }
188
189 }
190 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700191 PELOG1(limLog(pMac, LOG1, FL("FreshScanReqd: %d "), validState);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700192
193 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
194 return TRUE;
195
196 return FALSE;
197}
198
Jeff Johnson295189b2012-06-20 16:38:30 -0700199
200
201/**
202 * __limIsSmeAssocCnfValid()
203 *
204 *FUNCTION:
205 * This function is called by limProcessLmmMessages() upon
206 * receiving SME_ASSOC_CNF.
207 *
208 *LOGIC:
209 * Message validity checks are performed in this function
210 *
211 *ASSUMPTIONS:
212 *
213 *NOTE:
214 *
215 * @param pMeasReq Pointer to Received ASSOC_CNF message
216 * @return true When received SME_ASSOC_CNF is formatted
217 * correctly
218 * false otherwise
219 */
220
221inline static tANI_U8
222__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
223{
224 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
225 return false;
226 else
227 return true;
228} /*** end __limIsSmeAssocCnfValid() ***/
229
230
231/**
232 * __limGetSmeJoinReqSizeForAlloc()
233 *
234 *FUNCTION:
235 * This function is called in various places to get IE length
236 * from tSirBssDescription structure
237 * number being scanned.
238 *
239 *PARAMS:
240 *
241 *LOGIC:
242 *
243 *ASSUMPTIONS:
244 * NA
245 *
246 *NOTE:
247 * NA
248 *
249 * @param pBssDescr
250 * @return Total IE length
251 */
252
253static tANI_U16
254__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
255{
256 tANI_U16 len = 0;
257
258 if (!pBuf)
259 return len;
260
261 pBuf += sizeof(tANI_U16);
262 len = limGetU16( pBuf );
263 return (len + sizeof( tANI_U16 ));
264} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
265
266
267/**----------------------------------------------------------------
268\fn __limIsDeferedMsgForLearn
269
270\brief Has role only if 11h is enabled. Not used on STA side.
271 Defers the message if SME is in learn state and brings
272 the LIM back to normal mode.
273
274\param pMac
275\param pMsg - Pointer to message posted from SME to LIM.
276\return TRUE - If defered
277 FALSE - Otherwise
278------------------------------------------------------------------*/
279static tANI_BOOLEAN
280__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
281{
282 if (limIsSystemInScanState(pMac))
283 {
284 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
285 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700286 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700287 return eANI_BOOLEAN_FALSE;
288 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700289 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700290 pMsg->type);)
291
292 /** Send finish scan req to HAL only if LIM is not waiting for any response
293 * from HAL like init scan rsp, start scan rsp etc.
294 */
295 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
296 {
297 //Set the resume channel to Any valid channel (invalid).
298 //This will instruct HAL to set it to any previous valid channel.
299 peSetResumeChannel(pMac, 0, 0);
300 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
301 }
302
303 return eANI_BOOLEAN_TRUE;
304 }
305 return eANI_BOOLEAN_FALSE;
306}
307
308/**----------------------------------------------------------------
309\fn __limIsDeferedMsgForRadar
310
311\brief Has role only if 11h is enabled. Not used on STA side.
312 Defers the message if radar is detected.
313
314\param pMac
315\param pMsg - Pointer to message posted from SME to LIM.
316\return TRUE - If defered
317 FALSE - Otherwise
318------------------------------------------------------------------*/
319static tANI_BOOLEAN
320__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
321{
322 /** fRadarDetCurOperChan will be set only if we detect radar in current
323 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700324 //TODO: Need to take care radar detection.
325 //if (LIM_IS_RADAR_DETECTED(pMac))
326 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 {
328 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
329 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700330 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d"), pMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -0700331 return eANI_BOOLEAN_FALSE;
332 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700333 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 pMsg->type);)
335 return eANI_BOOLEAN_TRUE;
336 }
337 return eANI_BOOLEAN_FALSE;
338}
339
340
341/**
342 * __limProcessSmeStartReq()
343 *
344 *FUNCTION:
345 * This function is called to process SME_START_REQ message
346 * from HDD or upper layer application.
347 *
348 *LOGIC:
349 *
350 *ASSUMPTIONS:
351 *
352 *NOTE:
353 *
354 * @param pMac Pointer to Global MAC structure
355 * @param *pMsgBuf A pointer to the SME message buffer
356 * @return None
357 */
358
359static void
360__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
361{
362 tSirResultCodes retCode = eSIR_SME_SUCCESS;
363 tANI_U8 smesessionId;
364 tANI_U16 smetransactionId;
365
366
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700367 PELOG1(limLog(pMac, LOG1, FL("Received START_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700368
369 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
370
371 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
372 {
373 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
374
Jeff Johnsone7245742012-09-05 17:12:55 -0700375 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700376
377 /// By default do not return after first scan match
378 pMac->lim.gLimReturnAfterFirstMatch = 0;
379
380 /// Initialize MLM state machine
381 limInitMlm(pMac);
382
383 /// By default return unique scan results
384 pMac->lim.gLimReturnUniqueResults = true;
385 pMac->lim.gLimSmeScanResultLength = 0;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700386#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
387 pMac->lim.gLimSmeLfrScanResultLength = 0;
388#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700389
Jeff Johnson295189b2012-06-20 16:38:30 -0700390 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
391 {
392 /*
393 * Need to indicate new BSSs found during background scanning to
394 * host. Update this parameter at CFG
395 */
396 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
397 != eSIR_SUCCESS)
398 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700399 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700400 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
401 }
402 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700403 }
404 else
405 {
406 /**
407 * Should not have received eWNI_SME_START_REQ in states
408 * other than OFFLINE. Return response to host and
409 * log error
410 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700411 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %X"),pMac->lim.gLimSmeState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700412 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
413 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
414 }
415 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
416} /*** end __limProcessSmeStartReq() ***/
417
418
419/** -------------------------------------------------------------
420\fn __limProcessSmeSysReadyInd
421\brief handles the notification from HDD. PE just forwards this message to HAL.
422\param tpAniSirGlobal pMac
423\param tANI_U32* pMsgBuf
424\return TRUE-Posting to HAL failed, so PE will consume the buffer.
425\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
426 -------------------------------------------------------------*/
427static tANI_BOOLEAN
428__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
429{
430 tSirMsgQ msg;
431
432 msg.type = WDA_SYS_READY_IND;
433 msg.reserved = 0;
434 msg.bodyptr = pMsgBuf;
435 msg.bodyval = 0;
436
Jeff Johnson92751692013-03-06 16:00:33 -0800437 if (pMac->gDriverType != eDRIVER_TYPE_MFG)
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 {
Jeff Johnson92751692013-03-06 16:00:33 -0800439 peRegisterTLHandle(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700440 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700441 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700442 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700443
Jeff Johnson92751692013-03-06 16:00:33 -0800444 if (eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
Jeff Johnson295189b2012-06-20 16:38:30 -0700445 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700446 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700447 return eANI_BOOLEAN_TRUE;
448 }
449 return eANI_BOOLEAN_FALSE;
450}
451
Jeff Johnsone7245742012-09-05 17:12:55 -0700452#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700453
Jeff Johnsone7245742012-09-05 17:12:55 -0700454tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
455{
456 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
457 {
458 switch(secondaryChanOffset)
459 {
460 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
461 return primarychanNum;
462 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
463 return primarychanNum + 2;
464 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
465 return primarychanNum - 2;
466 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
467 return primarychanNum + 6;
468 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
469 return primarychanNum + 2;
470 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
471 return primarychanNum - 2;
472 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
473 return primarychanNum - 6;
474 default :
475 return eSIR_CFG_INVALID_ID;
476 }
477 }
478 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
479 {
480 switch(secondaryChanOffset)
481 {
482 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
483 return primarychanNum + 2;
484 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
485 return primarychanNum - 2;
486 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
487 return primarychanNum;
488 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
489 return primarychanNum + 2;
490 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
491 return primarychanNum - 2;
492 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
493 return primarychanNum + 2;
494 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
495 return primarychanNum - 2;
496 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
497 return primarychanNum + 2;
498 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
499 return primarychanNum - 2;
500 default :
501 return eSIR_CFG_INVALID_ID;
502 }
503 }
504 return primarychanNum;
505}
506
507#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700508/**
509 * __limHandleSmeStartBssRequest()
510 *
511 *FUNCTION:
512 * This function is called to process SME_START_BSS_REQ message
513 * from HDD or upper layer application.
514 *
515 *LOGIC:
516 *
517 *ASSUMPTIONS:
518 *
519 *NOTE:
520 *
521 * @param pMac Pointer to Global MAC structure
522 * @param *pMsgBuf A pointer to the SME message buffer
523 * @return None
524 */
525
526static void
527__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
528{
529 tANI_U16 size;
530 tANI_U32 val = 0;
531 tSirRetStatus retStatus;
532 tSirMacChanNum channelNumber;
Jeff Johnsonace91102013-04-05 08:03:18 -0700533 tLimMlmStartReq *pMlmStartReq = NULL;
534 tpSirSmeStartBssReq pSmeStartBssReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -0700535 tSirResultCodes retCode = eSIR_SME_SUCCESS;
536 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700537 tANI_U8 sessionId;
538 tpPESession psessionEntry = NULL;
539 tANI_U8 smesessionId;
540 tANI_U16 smetransactionId;
541
542#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
543 //Since the session is not created yet, sending NULL. The response should have the correct state.
544 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
545#endif //FEATURE_WLAN_DIAG_SUPPORT
546
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700547 PELOG1(limLog(pMac, LOG1, FL("Received START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700548
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530549 /* Global Sme state and mlm states are not defined yet, for BT-AMP Suppoprt . TO BE DONE */
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
551 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
552 {
553 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
554
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530555 pSmeStartBssReq = vos_mem_malloc(size);
556 if ( NULL == pSmeStartBssReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700557 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530558 PELOGE(limLog(pMac, LOGE, FL("AllocateMemory failed for pMac->lim.gpLimStartBssReq"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700559 /// Send failure response to host
560 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
561 goto end;
562 }
563
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530564 vos_mem_set((void *)pSmeStartBssReq, size, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700565
566 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
567 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
568 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700569 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700570 retCode = eSIR_SME_INVALID_PARAMETERS;
571 goto free;
572 }
573#if 0
574 PELOG3(limLog(pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700575 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700576 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
577#endif
578
579 /* This is the place where PE is going to create a session.
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530580 * If session is not existed, then create a new session */
Jeff Johnson295189b2012-06-20 16:38:30 -0700581 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
582 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700583 limLog(pMac, LOGW, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700584 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
585 psessionEntry = NULL;
586 goto free;
587 }
588 else
589 {
590 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
591 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700592 limLog(pMac, LOGW, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700593 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
594 goto free;
595 }
596
597 }
598
599 /* Store the session related parameters in newly created session */
600 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
601
602 /* Store PE sessionId in session Table */
603 psessionEntry->peSessionId = sessionId;
604
605 /* Store SME session Id in sessionTable */
606 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
607
608 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
609
610 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
611
612 /* Copy SSID to session table */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530613 vos_mem_copy( (tANI_U8 *)&psessionEntry->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700614 (tANI_U8 *)&pSmeStartBssReq->ssId,
615 (pSmeStartBssReq->ssId.length + 1));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530616
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 psessionEntry->bssType = pSmeStartBssReq->bssType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530618
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 psessionEntry->nwType = pSmeStartBssReq->nwType;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530620
Jeff Johnson295189b2012-06-20 16:38:30 -0700621 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
622
623 /* Store the channel number in session Table */
624 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
625
626 /*Store Persona */
627 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700628 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700629 psessionEntry->pePersona);
630
631 /*Update the phymode*/
632 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
633
634 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
635 psessionEntry->currentOperChannel );
636 /* Store the dot 11 mode in to the session Table*/
637
638 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700639 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
640#ifdef WLAN_FEATURE_11AC
641 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700642 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
643 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700644#endif
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -0800645
646 psessionEntry->txLdpcIniFeatureEnabled =
647 pSmeStartBssReq->txLdpcIniFeatureEnabled;
648
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530649 vos_mem_copy((void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 (void*)&pSmeStartBssReq->operationalRateSet,
651 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530652 vos_mem_copy((void*)&psessionEntry->extRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 (void*)&pSmeStartBssReq->extendedRateSet,
654 sizeof(tSirMacRateSet));
655
656 switch(pSmeStartBssReq->bssType)
657 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700658 case eSIR_INFRA_AP_MODE:
659 psessionEntry->limSystemRole = eLIM_AP_ROLE;
660 psessionEntry->privacy = pSmeStartBssReq->privacy;
661 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
662 psessionEntry->authType = pSmeStartBssReq->authType;
663 /* Store the DTIM period */
664 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
665 /*Enable/disable UAPSD*/
666 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
667 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
668 {
669 psessionEntry->proxyProbeRspEn = 0;
670 }
671 else
672 {
673 /* To detect PBC overlap in SAP WPS mode, Host handles
674 * Probe Requests.
675 */
676 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
677 {
678 psessionEntry->proxyProbeRspEn = 1;
679 }
680 else
681 {
682 psessionEntry->proxyProbeRspEn = 0;
683 }
684 }
685 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
686 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -0700687 psessionEntry->shortSlotTimeSupported = limGetShortSlotFromPhyMode(pMac, psessionEntry, psessionEntry->gLimPhyMode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700688 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700689 case eSIR_IBSS_MODE:
690 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
691 break;
692
693 case eSIR_BTAMP_AP_MODE:
694 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
695 break;
696
697 case eSIR_BTAMP_STA_MODE:
698 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
699 break;
700
701 /* There is one more mode called auto mode. which is used no where */
702
703 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
704
705
706 default:
707 //not used anywhere...used in scan function
708 break;
709 }
710
711 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
712 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700714 )
715 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530716 psessionEntry->parsedAssocReq = vos_mem_malloc(
717 psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq));
718 if ( NULL == psessionEntry->parsedAssocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700719 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530720 limLog(pMac, LOGW, FL("AllocateMemory() failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
722 goto free;
723 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530724 vos_mem_set(psessionEntry->parsedAssocReq,
725 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)),
726 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -0700727 }
728
729 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
730 if (pSmeStartBssReq->channelId)
731 {
732 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700733 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
734 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
735 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700736 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700737 FL("cbMode %u"), pSmeStartBssReq->cbMode);
738#ifdef WLAN_FEATURE_11AC
739 if(psessionEntry->vhtCapability)
740 {
741 tANI_U32 centerChan;
742 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700743
Jeff Johnsone7245742012-09-05 17:12:55 -0700744 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
745 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700746 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700747 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700748 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700749 }
750
751 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ || chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
752 {
753 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
754 != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700755 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700756 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700757 retCode = eSIR_LOGP_EXCEPTION;
Jeff Johnsone7245742012-09-05 17:12:55 -0700758 goto free;
Jeff Johnson295189b2012-06-20 16:38:30 -0700759 }
760 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700761 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
762 {
763 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
764 != eSIR_SUCCESS)
765 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700766 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700767 retCode = eSIR_LOGP_EXCEPTION;
768 goto free;
769 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700770
Jeff Johnsone7245742012-09-05 17:12:55 -0700771 centerChan = limGetCenterChannel(pMac,channelNumber,pSmeStartBssReq->cbMode,WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
772 if(centerChan != eSIR_CFG_INVALID_ID)
773 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -0800774 limLog(pMac, LOGW, FL("***Center Channel for 80MHZ channel width = %d"),centerChan);
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700775 psessionEntry->apCenterChan = centerChan;
Jeff Johnsone7245742012-09-05 17:12:55 -0700776 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1, centerChan)
777 != eSIR_SUCCESS)
778 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700779 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700780 retCode = eSIR_LOGP_EXCEPTION;
781 goto free;
782 }
783 }
784 }
785
786 /* All the translation is done by now for gVhtChannelWidth from .ini file to
787 * the actual values as defined in spec. So, grabing the spec value which is
788 * updated in .dat file by the above logic */
789 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
790 &chanWidth) != eSIR_SUCCESS)
791 {
792 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700793 FL("Unable to retrieve Channel Width from CFG"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700794 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700795 /*For Sta+p2p-Go concurrency
796 vhtTxChannelWidthSet is used for storing p2p-GO channel width
797 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
798 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
799 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700800 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700801 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700802 }
803 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
804#endif
805 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700806 else
807 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700808 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 retCode = eSIR_SME_INVALID_PARAMETERS;
810 goto free;
811 }
812
813 // Delete pre-auth list if any
814 limDeletePreAuthList(pMac);
815
816 // Delete IBSS peer BSSdescription list if any
817 //limIbssDelete(pMac); sep 26 review
818
819
820
821#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
822 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 limInitMlm(pMac);
824#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700825
Jeff Johnsone7245742012-09-05 17:12:55 -0700826 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700827
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 /* keep the RSN/WPA IE information in PE Session Entry
829 * later will be using this to check when received (Re)Assoc req
830 * */
831 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
832
Jeff Johnson295189b2012-06-20 16:38:30 -0700833
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 //Taken care for only softAP case rest need to be done
835 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
836 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
837 /*each byte will have the following info
838 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
839 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530840 vos_mem_copy( (void *) &psessionEntry->cfgProtection,
Jeff Johnson295189b2012-06-20 16:38:30 -0700841 (void *) &pSmeStartBssReq->ht_capab,
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -0700842 sizeof( tANI_U16 ));
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
844 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700845
846 // Prepare and Issue LIM_MLM_START_REQ to MLM
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530847 pMlmStartReq = vos_mem_malloc(sizeof(tLimMlmStartReq));
848 if ( NULL == pMlmStartReq )
Jeff Johnson295189b2012-06-20 16:38:30 -0700849 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530850 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmStartReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700851 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
852 goto free;
853 }
854
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530855 vos_mem_set((void *) pMlmStartReq, sizeof(tLimMlmStartReq), 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700856
857 /* Copy SSID to the MLM start structure */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530858 vos_mem_copy( (tANI_U8 *) &pMlmStartReq->ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -0700859 (tANI_U8 *) &pSmeStartBssReq->ssId,
860 pSmeStartBssReq->ssId.length + 1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700861 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
862 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -0700863
864
865 pMlmStartReq->bssType = psessionEntry->bssType;
866
867 /* Fill PE session Id from the session Table */
868 pMlmStartReq->sessionId = psessionEntry->peSessionId;
869
870 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 )
873 {
874 //len = sizeof(tSirMacAddr);
875 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
876 //if (retStatus != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700877 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700878
879 /* Copy the BSSId from sessionTable to mlmStartReq struct */
880 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
881 }
882
883 else // ibss mode
884 {
885 pMac->lim.gLimIbssCoalescingHappened = false;
886
887 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
888 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700889 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d"), retStatus);
Jeff Johnson295189b2012-06-20 16:38:30 -0700890 retCode = eSIR_LOGP_EXCEPTION;
891 goto free;
892 }
893
894 if(!autoGenBssId)
895 {
896 // We're not auto generating BSSID. Instead, get it from session entry
897 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
898
899 if(pMlmStartReq->bssId[0] & 0x01)
900 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700901 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700902 autoGenBssId = TRUE;
903 }
904 }
905
906 if( autoGenBssId )
907 { //if BSSID is not any uc id. then use locally generated BSSID.
908 //Autogenerate the BSSID
909 limGetRandomBssid( pMac, pMlmStartReq->bssId);
910 pMlmStartReq->bssId[0]= 0x02;
911
912 /* Copy randomly generated BSSID to the session Table */
913 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
914 }
915 }
916 /* store the channel num in mlmstart req structure */
917 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
918 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
919 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
920
Jeff Johnson295189b2012-06-20 16:38:30 -0700921 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
922 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
923 pMlmStartReq->wps_state = psessionEntry->wps_state;
924
925 }else
Jeff Johnson295189b2012-06-20 16:38:30 -0700926 {
927 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700928 limLog(pMac, LOGP, FL("could not retrieve DTIM Period"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700929 pMlmStartReq->dtimPeriod = (tANI_U8)val;
930 }
931
932 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700933 limLog(pMac, LOGP, FL("could not retrieve Beacon interval"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700934 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
935
936 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700937 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700938 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
939
940 //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 +0530941 vos_mem_copy((void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -0700942 sizeof(tSirMacRateSet));
943
Jeff Johnson295189b2012-06-20 16:38:30 -0700944 // Now populate the 11n related parameters
945 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700946 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700947 //
948 // FIXME_GEN4 - Determine the appropriate defaults...
949 //
950 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
951 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700952 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700953
954 /* sep26 review */
955 psessionEntry->limRFBand = limGetRFBand(channelNumber);
956
957 // Initialize 11h Enable Flag
958 psessionEntry->lim11hEnable = 0;
959 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
960 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
961 {
962 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700963 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700964 psessionEntry->lim11hEnable = val;
965 }
966
967 if (!psessionEntry->lim11hEnable)
968 {
969 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700970 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -0700971 }
972
Jeff Johnson295189b2012-06-20 16:38:30 -0700973 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
974 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -0700975 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700976
977 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
978 return;
979 }
980 else
981 {
982
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700983 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X"),pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -0700984 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
985 goto end;
986 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
987
988free:
Jeff Johnsonace91102013-04-05 08:03:18 -0700989 if ((psessionEntry != NULL) &&
990 (psessionEntry->pLimStartBssReq == pSmeStartBssReq))
991 {
992 psessionEntry->pLimStartBssReq = NULL;
993 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +0530994 vos_mem_free( pSmeStartBssReq);
995 vos_mem_free( pMlmStartReq);
Jeff Johnson295189b2012-06-20 16:38:30 -0700996
997end:
998
999 /* This routine should return the sme sessionId and SME transaction Id */
1000 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1001
1002 if(NULL != psessionEntry)
1003 {
1004 peDeleteSession(pMac,psessionEntry);
1005 psessionEntry = NULL;
1006 }
1007 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
1008} /*** end __limHandleSmeStartBssRequest() ***/
1009
1010
1011/**--------------------------------------------------------------
1012\fn __limProcessSmeStartBssReq
1013
1014\brief Wrapper for the function __limHandleSmeStartBssRequest
1015 This message will be defered until softmac come out of
1016 scan mode or if we have detected radar on the current
1017 operating channel.
1018\param pMac
1019\param pMsg
1020
1021\return TRUE - If we consumed the buffer
1022 FALSE - If have defered the message.
1023 ---------------------------------------------------------------*/
1024static tANI_BOOLEAN
1025__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1026{
1027 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1028 __limIsDeferedMsgForRadar(pMac, pMsg))
1029 {
1030 /**
1031 * If message defered, buffer is not consumed yet.
1032 * So return false
1033 */
1034 return eANI_BOOLEAN_FALSE;
1035 }
1036
1037 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1038 return eANI_BOOLEAN_TRUE;
1039}
1040
1041
1042/**
1043 * limGetRandomBssid()
1044 *
1045 * FUNCTION:This function is called to process generate the random number for bssid
1046 * This function is called to process SME_SCAN_REQ message
1047 * from HDD or upper layer application.
1048 *
1049 * LOGIC:
1050 *
1051 * ASSUMPTIONS:
1052 *
1053 * NOTE:
1054 * 1. geneartes the unique random number for bssid in ibss
1055 *
1056 * @param pMac Pointer to Global MAC structure
1057 * @param *data Pointer to bssid buffer
1058 * @return None
1059 */
1060void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1061{
1062 tANI_U32 random[2] ;
1063 random[0] = tx_time_get();
1064 random[0] |= (random[0] << 15) ;
1065 random[1] = random[0] >> 1;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301066 vos_mem_copy( data, (tANI_U8*)random, sizeof(tSirMacAddr));
Jeff Johnson295189b2012-06-20 16:38:30 -07001067}
1068
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301069static eHalStatus limSendHalStartScanOffloadReq(tpAniSirGlobal pMac,
1070 tpSirSmeScanReq pScanReq)
1071{
1072 tSirScanOffloadReq *pScanOffloadReq;
1073 tANI_U8 *p;
1074 tSirMsgQ msg;
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301075 tANI_U16 i, len;
1076 tSirRetStatus rc = eSIR_SUCCESS;
1077
1078 /* The tSirScanOffloadReq will reserve the space for first channel,
1079 so allocate the memory for (numChannels - 1) and uIEFieldLen */
1080 len = sizeof(tSirScanOffloadReq) + (pScanReq->channelList.numChannels - 1) +
1081 pScanReq->uIEFieldLen;
1082
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301083 pScanOffloadReq = vos_mem_malloc(len);
1084 if ( NULL == pScanOffloadReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301085 {
1086 limLog(pMac, LOGE,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301087 FL("AllocateMemory failed for pScanOffloadReq"));
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301088 return eHAL_STATUS_FAILURE;
1089 }
1090
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301091 vos_mem_set( (tANI_U8 *) pScanOffloadReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301092
1093 msg.type = WDA_START_SCAN_OFFLOAD_REQ;
1094 msg.bodyptr = pScanOffloadReq;
1095 msg.bodyval = 0;
1096
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301097 vos_mem_copy((tANI_U8 *) pScanOffloadReq->bssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301098 (tANI_U8*) pScanReq->bssId,
1099 sizeof(tSirMacAddr));
1100
1101 if (pScanReq->numSsid > SIR_SCAN_MAX_NUM_SSID)
1102 {
1103 limLog(pMac, LOGE,
1104 FL("Invalid value (%d) for numSsid"), SIR_SCAN_MAX_NUM_SSID);
Kiran Kumar Lokerefdf42412013-07-17 17:40:58 -07001105 palFreeMemory(pMac->hHdd, (void *)pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301106 return eHAL_STATUS_FAILURE;
1107 }
1108
1109 pScanOffloadReq->numSsid = pScanReq->numSsid;
1110 for (i = 0; i < pScanOffloadReq->numSsid; i++)
1111 {
1112 pScanOffloadReq->ssId[i].length = pScanReq->ssId[i].length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301113 vos_mem_copy((tANI_U8 *) pScanOffloadReq->ssId[i].ssId,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301114 (tANI_U8 *) pScanReq->ssId[i].ssId,
1115 pScanOffloadReq->ssId[i].length);
1116 }
1117
1118 pScanOffloadReq->hiddenSsid = pScanReq->hiddenSsid;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301119 vos_mem_copy((tANI_U8 *) pScanOffloadReq->selfMacAddr,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301120 (tANI_U8 *) pScanReq->selfMacAddr,
1121 sizeof(tSirMacAddr));
1122 pScanOffloadReq->bssType = pScanReq->bssType;
1123 pScanOffloadReq->dot11mode = pScanReq->dot11mode;
1124 pScanOffloadReq->scanType = pScanReq->scanType;
1125 pScanOffloadReq->minChannelTime = pScanReq->minChannelTime;
1126 pScanOffloadReq->maxChannelTime = pScanReq->maxChannelTime;
1127 pScanOffloadReq->p2pSearch = pScanReq->p2pSearch;
1128 pScanOffloadReq->sessionId = pScanReq->sessionId;
1129 pScanOffloadReq->channelList.numChannels =
1130 pScanReq->channelList.numChannels;
1131 p = &(pScanOffloadReq->channelList.channelNumber[0]);
1132 for (i = 0; i < pScanOffloadReq->channelList.numChannels; i++)
1133 p[i] = pScanReq->channelList.channelNumber[i];
1134
1135 pScanOffloadReq->uIEFieldLen = pScanReq->uIEFieldLen;
1136 pScanOffloadReq->uIEFieldOffset = len - pScanOffloadReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301137 vos_mem_copy((tANI_U8 *) p + i,
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301138 (tANI_U8 *) pScanReq + pScanReq->uIEFieldOffset,
1139 pScanOffloadReq->uIEFieldLen);
1140
1141 rc = wdaPostCtrlMsg(pMac, &msg);
1142 if (rc != eSIR_SUCCESS)
1143 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001144 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301145 vos_mem_free(pScanOffloadReq);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301146 return eHAL_STATUS_FAILURE;
1147 }
1148
1149 return eHAL_STATUS_SUCCESS;
1150}
Jeff Johnson295189b2012-06-20 16:38:30 -07001151
1152/**
1153 * __limProcessSmeScanReq()
1154 *
1155 *FUNCTION:
1156 * This function is called to process SME_SCAN_REQ message
1157 * from HDD or upper layer application.
1158 *
1159 *LOGIC:
1160 *
1161 *ASSUMPTIONS:
1162 *
1163 *NOTE:
1164 * 1. Periodic scanning should be requesting to return unique
1165 * scan results.
1166 *
1167 * @param pMac Pointer to Global MAC structure
1168 * @param *pMsgBuf A pointer to the SME message buffer
1169 * @return None
1170 */
1171
Viral Modid440e682013-03-06 02:25:31 -08001172static void
Jeff Johnson295189b2012-06-20 16:38:30 -07001173__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1174{
1175 tANI_U32 len;
1176 tLimMlmScanReq *pMlmScanReq;
1177 tpSirSmeScanReq pScanReq;
1178 tANI_U8 i = 0;
1179
1180#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1181 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1182#endif //FEATURE_WLAN_DIAG_SUPPORT
1183
1184 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001185 PELOG1(limLog(pMac, LOG1, FL("SME SCAN REQ numChan %d min %d max %d IELen %d first %d fresh %d unique %d type %d mode %d rsp %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001186 pScanReq->channelList.numChannels,
1187 pScanReq->minChannelTime,
1188 pScanReq->maxChannelTime,
1189 pScanReq->uIEFieldLen,
1190 pScanReq->returnAfterFirstMatch,
1191 pScanReq->returnFreshResults,
1192 pScanReq->returnUniqueResults,
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001193 pScanReq->scanType,
1194 pScanReq->backgroundScanMode,
1195 pMac->lim.gLimRspReqd ? 1 : 0);)
Viral Modid86bde22012-12-10 13:09:21 -08001196
1197 /* Since scan req always requires a response, we will overwrite response required here.
1198 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1199 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1200 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1201 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1202 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1203 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1204 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1205 * the global flag gLimRspReqd to TRUE here.
1206 */
1207 pMac->lim.gLimRspReqd = TRUE;
1208
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301209 /*copy the Self MAC address from SmeReq to the globalplace, used for sending probe req*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001210 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1211
1212 /* This routine should return the sme sessionId and SME transaction Id */
1213
1214 if (!limIsSmeScanReqValid(pMac, pScanReq))
1215 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001216 PELOGW(limLog(pMac, LOGW, FL("Received SME_SCAN_REQ with invalid parameters"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001217
1218 if (pMac->lim.gLimRspReqd)
1219 {
1220 pMac->lim.gLimRspReqd = false;
1221
1222 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1223
1224 } // if (pMac->lim.gLimRspReqd)
1225
1226 return;
1227 }
1228
1229 //if scan is disabled then return as invalid scan request.
1230 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1231 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1232 {
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001233 limSendSmeScanRsp(pMac, offsetof(tSirSmeScanRsp,bssDescription[0]), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001234 return;
1235 }
1236
1237
1238 /**
1239 * If scan request is received in idle, joinFailed
1240 * states or in link established state (in STA role)
1241 * or in normal state (in STA-in-IBSS/AP role) with
1242 * 'return fresh scan results' request from HDD or
1243 * it is periodic background scanning request,
1244 * trigger fresh scan request to MLM
1245 */
1246 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1247 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301248 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1249 {
1250 // Discard previously cached scan results
1251 limReInitScanResults(pMac);
1252 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001253
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301254 pMac->lim.gLim24Band11dScanDone = 0;
1255 pMac->lim.gLim50Band11dScanDone = 0;
1256 pMac->lim.gLimReturnAfterFirstMatch =
1257 pScanReq->returnAfterFirstMatch;
1258 pMac->lim.gLimBackgroundScanMode =
1259 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001260
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301261 pMac->lim.gLimReturnUniqueResults =
1262 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1263 /* De-activate Heartbeat timers for connected sessions while
1264 * scan is in progress if the system is in Active mode *
1265 * AND it is not a ROAMING ("background") scan */
1266 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
1267 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1268 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1269 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
1270 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001271 for(i=0;i<pMac->lim.maxBssId;i++)
1272 {
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301273 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1274 (pMac->lim.gpSession[i].valid == TRUE) &&
1275 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1276 {
1277 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1278 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001279 }
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301280 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001281
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301282 if (pMac->fScanOffload)
1283 {
1284 if (eHAL_STATUS_SUCCESS !=
1285 limSendHalStartScanOffloadReq(pMac, pScanReq))
1286 {
1287 limSendSmeScanRsp(pMac,
1288 offsetof(tSirSmeScanRsp, bssDescription[0]),
1289 eSIR_SME_INVALID_PARAMETERS,
1290 pScanReq->sessionId,
1291 pScanReq->transactionId);
1292 return;
1293 }
1294 }
1295 else
1296 {
1297
1298 /*Change Global SME state */
1299 /* Store the previous SME state */
1300 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1301 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1302 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, pScanReq->sessionId, pMac->lim.gLimSmeState));
1303
1304 if (pScanReq->channelList.numChannels == 0)
1305 {
1306 tANI_U32 cfg_len;
1307 // Scan all channels
1308 len = sizeof(tLimMlmScanReq) +
Jeff Johnson295189b2012-06-20 16:38:30 -07001309 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1310 pScanReq->uIEFieldLen;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301311 pMlmScanReq = vos_mem_malloc(len);
1312 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301313 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301314 // Log error
1315 limLog(pMac, LOGP,
1316 FL("call to AllocateMemory failed for mlmScanReq (%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001317
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301318 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301319 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001320
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301321 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301322 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001323
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301324 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1325 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
Jeff Johnson295189b2012-06-20 16:38:30 -07001326 pMlmScanReq->channelList.channelNumber,
1327 &cfg_len) != eSIR_SUCCESS)
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301328 {
1329 /**
1330 * Could not get Valid channel list from CFG.
1331 * Log error.
1332 */
1333 limLog(pMac, LOGP,
1334 FL("could not retrieve Valid channel list"));
1335 }
1336 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
1337 }
1338 else
1339 {
1340 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1341 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1342 pScanReq->uIEFieldLen;
Jeff Johnson295189b2012-06-20 16:38:30 -07001343
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301344 pMlmScanReq = vos_mem_malloc(len);
1345 if ( NULL == pMlmScanReq )
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301346 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301347 // Log error
1348 limLog(pMac, LOGP,
1349 FL("call to AllocateMemory failed for mlmScanReq(%d)"), len);
Jeff Johnson295189b2012-06-20 16:38:30 -07001350
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301351 return;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301352 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001353
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301354 // Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301355 vos_mem_set( (tANI_U8 *) pMlmScanReq, len, 0);
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301356 pMlmScanReq->channelList.numChannels =
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301357 pScanReq->channelList.numChannels;
Jeff Johnson295189b2012-06-20 16:38:30 -07001358
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301359 vos_mem_copy( pMlmScanReq->channelList.channelNumber,
1360 pScanReq->channelList.channelNumber,
1361 pScanReq->channelList.numChannels);
1362 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001363
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301364 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1365 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1366 if(pScanReq->uIEFieldLen)
1367 {
1368 vos_mem_copy( (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1369 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1370 pScanReq->uIEFieldLen);
1371 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001372
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301373 pMlmScanReq->bssType = pScanReq->bssType;
1374 vos_mem_copy( pMlmScanReq->bssId,
1375 pScanReq->bssId,
1376 sizeof(tSirMacAddr));
1377 pMlmScanReq->numSsid = pScanReq->numSsid;
Jeff Johnson295189b2012-06-20 16:38:30 -07001378
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301379 i = 0;
1380 while (i < pMlmScanReq->numSsid)
1381 {
1382 vos_mem_copy( (tANI_U8 *) &pMlmScanReq->ssId[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07001383 (tANI_U8 *) &pScanReq->ssId[i],
1384 pScanReq->ssId[i].length + 1);
1385
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301386 i++;
1387 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001388
Jeff Johnson295189b2012-06-20 16:38:30 -07001389
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301390 pMlmScanReq->scanType = pScanReq->scanType;
1391 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
1392 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1393 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1394 pMlmScanReq->minChannelTimeBtc = pScanReq->minChannelTimeBtc;
1395 pMlmScanReq->maxChannelTimeBtc = pScanReq->maxChannelTimeBtc;
1396 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1397 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
Jeff Johnson295189b2012-06-20 16:38:30 -07001398
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301399 //Store the smeSessionID and transaction ID for later use.
1400 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1401 pMac->lim.gTransactionId = pScanReq->transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07001402
Ganesh Kondabattinif0fa07c2013-06-11 17:47:49 +05301403 // Issue LIM_MLM_SCAN_REQ to MLM
1404 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1405 }
1406 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
Jeff Johnson295189b2012-06-20 16:38:30 -07001407
1408 else
1409 {
1410 /// In all other cases return 'cached' scan results
1411 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1412 {
1413 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1414
1415 pMac->lim.gLimRspReqd = false;
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001416#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1417 if (pScanReq->returnFreshResults & SIR_BG_SCAN_RETURN_LFR_CACHED_RESULTS)
Jeff Johnson295189b2012-06-20 16:38:30 -07001418 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001419 pMac->lim.gLimSmeLfrScanResultLength = pMac->lim.gLimMlmLfrScanResultLength;
1420 if (pMac->lim.gLimSmeLfrScanResultLength == 0)
1421 {
1422 limSendSmeLfrScanRsp(pMac, scanRspLen,
1423 eSIR_SME_SUCCESS,
1424 pScanReq->sessionId,
1425 pScanReq->transactionId);
1426 }
1427 else
1428 {
1429 scanRspLen = sizeof(tSirSmeScanRsp) +
1430 pMac->lim.gLimSmeLfrScanResultLength -
1431 sizeof(tSirBssDescription);
1432 limSendSmeLfrScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1433 pScanReq->sessionId, pScanReq->transactionId);
1434 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001435 }
1436 else
1437 {
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001438#endif
1439 if (pMac->lim.gLimSmeScanResultLength == 0)
1440 {
1441 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1442 pScanReq->sessionId, pScanReq->transactionId);
1443 }
1444 else
1445 {
1446 scanRspLen = sizeof(tSirSmeScanRsp) +
1447 pMac->lim.gLimSmeScanResultLength -
1448 sizeof(tSirBssDescription);
1449 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS,
1450 pScanReq->sessionId, pScanReq->transactionId);
1451 }
1452#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001453 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001454#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001455
1456 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1457 {
1458 // Discard previously cached scan results
1459 limReInitScanResults(pMac);
1460 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001461#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1462 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_LFR_RESULTS)
1463 {
1464 // Discard previously cached scan results
1465 limReInitLfrScanResults(pMac);
1466 }
1467#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001468
1469 } // if (pMac->lim.gLimRspReqd)
1470 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1471
Jeff Johnson295189b2012-06-20 16:38:30 -07001472#ifdef BACKGROUND_SCAN_ENABLED
1473 // start background scans if needed
1474 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1475 __limBackgroundScanInitiate(pMac);
1476#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001477
1478} /*** end __limProcessSmeScanReq() ***/
1479
Jeff Johnsone7245742012-09-05 17:12:55 -07001480#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001481
Jeff Johnsone7245742012-09-05 17:12:55 -07001482static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1483{
1484 tpSirOemDataReq pOemDataReq;
1485 tLimMlmOemDataReq* pMlmOemDataReq;
1486
1487 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1488
1489 //post the lim mlm message now
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301490 pMlmOemDataReq = vos_mem_malloc(sizeof(tLimMlmOemDataReq));
1491 if ( NULL == pMlmOemDataReq )
Jeff Johnsone7245742012-09-05 17:12:55 -07001492 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301493 limLog(pMac, LOGP, FL("AllocateMemory failed for mlmOemDataReq"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001494 return;
1495 }
1496
1497 //Initialize this buffer
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301498 vos_mem_set( pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)), 0);
Jeff Johnsone7245742012-09-05 17:12:55 -07001499
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301500 vos_mem_copy( pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr,
1501 sizeof(tSirMacAddr));
1502 vos_mem_copy( pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq,
1503 OEM_DATA_REQ_SIZE);
Jeff Johnsone7245742012-09-05 17:12:55 -07001504
1505 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1506 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1507
1508 return;
1509
1510} /*** end __limProcessSmeOemDataReq() ***/
1511
1512#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001513
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301514/**
1515 * __limProcessClearDfsChannelList()
1516 *
1517 *FUNCTION:
1518 *Clear DFS channel list when country is changed/aquired.
1519.*This message is sent from SME.
1520 *
1521 *LOGIC:
1522 *
1523 *ASSUMPTIONS:
1524 *
1525 *NOTE:
1526 *
1527 * @param pMac Pointer to Global MAC structure
1528 * @param *pMsgBuf A pointer to the SME message buffer
1529 * @return None
1530 */
1531static void __limProcessClearDfsChannelList(tpAniSirGlobal pMac,
1532 tpSirMsgQ pMsg)
1533{
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301534 vos_mem_set( &pMac->lim.dfschannelList,
1535 sizeof(tSirDFSChannelList), 0);
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301536}
Jeff Johnson295189b2012-06-20 16:38:30 -07001537
1538/**
1539 * __limProcessSmeJoinReq()
1540 *
1541 *FUNCTION:
1542 * This function is called to process SME_JOIN_REQ message
1543 * from HDD or upper layer application.
1544 *
1545 *LOGIC:
1546 *
1547 *ASSUMPTIONS:
1548 *
1549 *NOTE:
1550 *
1551 * @param pMac Pointer to Global MAC structure
1552 * @param *pMsgBuf A pointer to the SME message buffer
1553 * @return None
1554 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001555static void
1556__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1557{
1558 // tANI_U8 *pBuf;
1559 //tANI_U32 len;
1560// tSirMacAddr currentBssId;
1561 tpSirSmeJoinReq pSmeJoinReq = NULL;
1562 tLimMlmJoinReq *pMlmJoinReq;
1563 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1564 tANI_U32 val = 0;
1565 tANI_U16 nSize;
1566 tANI_U8 sessionId;
1567 tpPESession psessionEntry = NULL;
1568 tANI_U8 smesessionId;
1569 tANI_U16 smetransactionId;
1570 tPowerdBm localPowerConstraint = 0, regMax = 0;
1571
1572#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1573 //Not sending any session, since it is not created yet. The response whould have correct state.
1574 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1575#endif //FEATURE_WLAN_DIAG_SUPPORT
1576
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001577 PELOG1(limLog(pMac, LOG1, FL("Received SME_JOIN_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001578
1579#ifdef WLAN_FEATURE_VOWIFI
1580 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1581 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1582 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1583 * like not honoring power constraint on 1st association after driver loading. */
1584 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001585 limLog(pMac, LOGP, FL("cfg get rrm enabled failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1587 val = 0;
1588#endif /* WLAN_FEATURE_VOWIFI */
1589
1590 /**
1591 * Expect Join request in idle state.
1592 * Reassociate request is expected in link established state.
1593 */
1594
1595 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1596 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1597 {
1598 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301599
1600 pSmeJoinReq = vos_mem_malloc(nSize);
1601 if ( NULL == pSmeJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001602 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301603 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSmeJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001604 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1605 goto end;
1606 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301607 (void) vos_mem_set((void *) pSmeJoinReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001608
Jeff Johnson295189b2012-06-20 16:38:30 -07001609 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1610 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1611 {
1612 /// Received invalid eWNI_SME_JOIN_REQ
1613 // Log the event
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001614 limLog(pMac, LOGW, FL("received SME_JOIN_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001615 retCode = eSIR_SME_INVALID_PARAMETERS;
1616 goto end;
1617 }
1618
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301619 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP, review os sep 23
Jeff Johnson295189b2012-06-20 16:38:30 -07001620
1621 /* check for the existence of start BSS session */
1622#ifdef FIXME_GEN6
1623 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1624 {
1625 if(peValidateBtJoinRequest(pMac)!= TRUE)
1626 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001627 limLog(pMac, LOGW, FL("Start Bss session not present::SME_JOIN_REQ in unexpected state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001628 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1629 psessionEntry = NULL;
1630 goto end;
1631 }
1632 }
1633
1634#endif
1635
1636
1637 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1638 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001639 limLog(pMac, LOGE, FL("Session Already exists for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001640
1641 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1642 {
1643 // Received eWNI_SME_JOIN_REQ for same
1644 // BSS as currently associated.
1645 // Log the event and send success
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001646 PELOGW(limLog(pMac, LOGW, FL("Received SME_JOIN_REQ for currently joined BSS"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001647 /// Send Join success response to host
1648 retCode = eSIR_SME_SUCCESS;
1649 goto end;
1650 }
1651 else
1652 {
1653 retCode = eSIR_SME_REFUSED;
1654 psessionEntry = NULL;
1655 goto end;
1656 }
1657 }
1658 else /* Session Entry does not exist for given BSSId */
1659 {
1660 /* Try to Create a new session */
1661 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1662 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001663 limLog(pMac, LOGE, FL("Session Can not be created "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001664 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1665 goto end;
1666 }
1667 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001668 handleHTCapabilityandHTInfo(pMac, psessionEntry);
krunal soni5afa96c2013-09-06 22:19:02 -07001669 psessionEntry->isAmsduSupportInAMPDU = pSmeJoinReq->isAmsduSupportInAMPDU;
Jeff Johnsone7245742012-09-05 17:12:55 -07001670
Jeff Johnson295189b2012-06-20 16:38:30 -07001671 /* Store Session related parameters */
1672 /* Store PE session Id in session Table */
1673 psessionEntry->peSessionId = sessionId;
1674
1675 /* store the smejoin req handle in session table */
1676 psessionEntry->pLimJoinReq = pSmeJoinReq;
1677
1678 /* Store SME session Id in sessionTable */
1679 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1680
1681 /* Store SME transaction Id in session Table */
1682 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1683
1684 /* Store beaconInterval */
1685 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1686
1687 /* Copying of bssId is already done, while creating session */
1688 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1689 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1690 psessionEntry->bssType = pSmeJoinReq->bsstype;
1691
1692 psessionEntry->statypeForBss = STA_ENTRY_PEER;
1693
1694 /* Copy the dot 11 mode in to the session table */
1695
1696 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1697 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001698#ifdef WLAN_FEATURE_11AC
1699 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001700 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001701 "***__limProcessSmeJoinReq: vhtCapability=%d****",psessionEntry->vhtCapability);
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001702 if (psessionEntry->vhtCapability )
1703 {
1704 psessionEntry->txBFIniFeatureEnabled = pSmeJoinReq->txBFIniFeatureEnabled;
1705
1706 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001707 "***__limProcessSmeJoinReq: txBFIniFeatureEnabled=%d****",
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001708 psessionEntry->txBFIniFeatureEnabled);
1709
1710 if( psessionEntry->txBFIniFeatureEnabled )
1711 {
1712 if (cfgSetInt(pMac, WNI_CFG_VHT_SU_BEAMFORMEE_CAP, psessionEntry->txBFIniFeatureEnabled)
1713 != eSIR_SUCCESS)
1714 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001715 limLog(pMac, LOGP, FL("could not set WNI_CFG_VHT_SU_BEAMFORMEE_CAP at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001716 retCode = eSIR_LOGP_EXCEPTION;
1717 goto end;
1718 }
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001719 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Leela V Kiran Kumar Reddy Chirala6a458752013-02-16 15:41:27 -08001720 "***__limProcessSmeJoinReq: txBFCsnValue=%d****", pSmeJoinReq->txBFCsnValue);
Shailender Karmuchicc3fe442013-02-16 18:18:33 -08001721
1722 if (cfgSetInt(pMac, WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED, pSmeJoinReq->txBFCsnValue)
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001723 != eSIR_SUCCESS)
1724 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001725 limLog(pMac, LOGP, FL("could not set WNI_CFG_VHT_CSN_BEAMFORMEE_ANT_SUPPORTED at CFG"));
Shailender Karmuchi08f87c22013-01-17 12:51:24 -08001726 retCode = eSIR_LOGP_EXCEPTION;
1727 goto end;
1728 }
1729 }
1730 }
1731
Jeff Johnsone7245742012-09-05 17:12:55 -07001732#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001733
1734 /*Phy mode*/
1735 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1736
1737 /* Copy The channel Id to the session Table */
1738 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001739 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1740 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1741 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001742
Chet Lanctot186b5732013-03-18 10:26:30 -07001743 /* Record if management frames need to be protected */
1744#ifdef WLAN_FEATURE_11W
1745 if(eSIR_ED_AES_128_CMAC == pSmeJoinReq->MgmtEncryptionType)
1746 {
1747 psessionEntry->limRmfEnabled = 1;
1748 }
1749 else
1750 {
1751 psessionEntry->limRmfEnabled = 0;
1752 }
1753#endif
1754
krunal soni8d13b092013-07-19 13:23:29 -07001755#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM
1756 psessionEntry->rssi = pSmeJoinReq->bssDescription.rssi;
1757#endif
1758
Jeff Johnson295189b2012-06-20 16:38:30 -07001759 /*Store Persona */
1760 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1761 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -07001762 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona, pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001763
1764 /* Copy the SSID from smejoinreq to session entry */
1765 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301766 vos_mem_copy( psessionEntry->ssId.ssId,
1767 pSmeJoinReq->ssId.ssId, psessionEntry->ssId.length);
1768
1769 // Determin 11r or CCX connection based on input from SME
1770 // which inturn is dependent on the profile the user wants to connect
1771 // to, So input is coming from supplicant
Jeff Johnson295189b2012-06-20 16:38:30 -07001772#ifdef WLAN_FEATURE_VOWIFI_11R
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301773 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001774#endif
1775#ifdef FEATURE_WLAN_CCX
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301776 psessionEntry->isCCXconnection = pSmeJoinReq->isCCXconnection;
Jeff Johnson295189b2012-06-20 16:38:30 -07001777#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001778#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301779 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
Jeff Johnson295189b2012-06-20 16:38:30 -07001780#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301781
Jeff Johnson43971f52012-07-17 12:26:56 -07001782#ifdef FEATURE_WLAN_LFR
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301783 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
Jeff Johnson43971f52012-07-17 12:26:56 -07001784#endif
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301785 psessionEntry->txLdpcIniFeatureEnabled = pSmeJoinReq->txLdpcIniFeatureEnabled;
Gopichand Nakkalab2d2c312013-01-04 11:41:02 -08001786
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301787 if (psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001788 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301789 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1790 }
1791 else if (psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1792 {
1793 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1794 }
1795 else
1796 {
1797 /* Throw an error and return and make sure to delete the session.*/
1798 limLog(pMac, LOGW, FL("received SME_JOIN_REQ with invalid bss type"));
1799 retCode = eSIR_SME_INVALID_PARAMETERS;
1800 goto end;
1801 }
1802
1803 if (pSmeJoinReq->addIEScan.length)
1804 {
1805 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEScan,
Jeff Johnson295189b2012-06-20 16:38:30 -07001806 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
1807 }
1808
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301809 if (pSmeJoinReq->addIEAssoc.length)
Jeff Johnson295189b2012-06-20 16:38:30 -07001810 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301811 vos_mem_copy( &psessionEntry->pLimJoinReq->addIEAssoc,
Jeff Johnson295189b2012-06-20 16:38:30 -07001812 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
1813 }
1814
Jeff Johnson295189b2012-06-20 16:38:30 -07001815 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301816 pMlmJoinReq = vos_mem_malloc(val);
1817 if ( NULL == pMlmJoinReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07001818 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301819 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmJoinReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001820 return;
1821 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301822 (void) vos_mem_set((void *) pMlmJoinReq, val, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07001823
1824 /* PE SessionId is stored as a part of JoinReq*/
1825 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
1826
1827 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
1828 != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001829 limLog(pMac, LOGP, FL("could not retrieve JoinFailureTimer value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001830
1831 /* copy operational rate from psessionEntry*/
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301832 vos_mem_copy((void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 sizeof(tSirMacRateSet));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301834 vos_mem_copy((void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 sizeof(tSirMacRateSet));
1836 //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 +05301837 vos_mem_copy((void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
Jeff Johnson295189b2012-06-20 16:38:30 -07001838 sizeof(tSirMacRateSet));
1839
1840 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
1841
Jeff Johnson295189b2012-06-20 16:38:30 -07001842 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
1843
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301844 vos_mem_copy((tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07001845 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
1846 psessionEntry->pLimJoinReq->bssDescription.length + 2);
1847
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07001849 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001850
Jeff Johnsone7245742012-09-05 17:12:55 -07001851 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
1852 localPowerConstraint = regMax;
1853 limExtractApCapability( pMac,
1854 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
1855 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
1856 &psessionEntry->limCurrentBssQosCaps,
1857 &psessionEntry->limCurrentBssPropCap,
1858 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07001859 , &localPowerConstraint,
1860 psessionEntry
Jeff Johnsone7245742012-09-05 17:12:55 -07001861 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001862#ifdef FEATURE_WLAN_CCX
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001863 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07001864#else
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301865 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07001866#endif
1867#if defined WLAN_VOWIFI_DEBUG
1868 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localPowerConstraint, psessionEntry->maxTxPower );
1869#endif
1870
1871 if (pMac->lim.gLimCurrentBssUapsd)
1872 {
1873 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001874 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"), pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07001875
1876 // resetting the dynamic uapsd mask
1877 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
1878 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
1879 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001880
1881 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
1882
1883 // Initialize 11h Enable Flag
1884 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
1885 {
1886 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001887 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED "));
Jeff Johnson295189b2012-06-20 16:38:30 -07001888 psessionEntry->lim11hEnable = val;
1889 }
1890 else
1891 psessionEntry->lim11hEnable = 0;
1892
1893 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
1894 pMac->lim.gLimIbssCoalescingHappened = false;
1895
Jeff Johnsone7245742012-09-05 17:12:55 -07001896 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
1897 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
1898 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001899
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001900 PELOG1(limLog(pMac, LOG1, FL("SME JoinReq: SSID %d.%c%c%c%c%c%c"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001901 psessionEntry->ssId.length,
1902 psessionEntry->ssId.ssId[0],
1903 psessionEntry->ssId.ssId[1],
1904 psessionEntry->ssId.ssId[2],
1905 psessionEntry->ssId.ssId[3],
1906 psessionEntry->ssId.ssId[4],
1907 psessionEntry->ssId.ssId[5]);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001908 limLog(pMac, LOG1, FL("Channel %d, BSSID %x:%x:%x:%x:%x:%x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001909 psessionEntry->currentOperChannel,
1910 psessionEntry->bssId[0],
1911 psessionEntry->bssId[1],
1912 psessionEntry->bssId[2],
1913 psessionEntry->bssId[3],
1914 psessionEntry->bssId[4],
1915 psessionEntry->bssId[5]);)
1916
1917 /* Indicate whether spectrum management is enabled*/
1918 psessionEntry->spectrumMgtEnabled =
1919 pSmeJoinReq->spectrumMgtIndicator;
1920 /* Issue LIM_MLM_JOIN_REQ to MLM */
1921 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
1922 return;
1923
1924 }
1925 else
1926 {
1927 /* Received eWNI_SME_JOIN_REQ un expected state */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001928 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ in state %X"), pMac->lim.gLimSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07001929 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
1930 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1931 psessionEntry = NULL;
1932 goto end;
1933
1934 }
1935
1936end:
1937 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1938
1939 if(pSmeJoinReq)
1940 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301941 vos_mem_free(pSmeJoinReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07001942 pSmeJoinReq = NULL;
1943 if (NULL != psessionEntry)
1944 {
1945 psessionEntry->pLimJoinReq = NULL;
1946 }
1947 }
1948
1949 if(retCode != eSIR_SME_SUCCESS)
1950 {
1951 if(NULL != psessionEntry)
1952 {
1953 peDeleteSession(pMac,psessionEntry);
1954 psessionEntry = NULL;
1955 }
1956 }
1957
1958 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
1959} /*** end __limProcessSmeJoinReq() ***/
1960
1961
1962#ifdef FEATURE_WLAN_CCX
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08001963tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07001964{
1965 tANI_U8 maxTxPower = 0;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05301966 tANI_U8 txPower = VOS_MIN( regMax, (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001967 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
1969 maxTxPower = txPower;
1970 else if (txPower < MIN_TX_PWR_CAP)
1971 maxTxPower = MIN_TX_PWR_CAP;
1972 else
1973 maxTxPower = MAX_TX_PWR_CAP;
1974
1975 return (maxTxPower);
1976}
1977#endif
1978
Jeff Johnson295189b2012-06-20 16:38:30 -07001979/**
1980 * __limProcessSmeReassocReq()
1981 *
1982 *FUNCTION:
1983 * This function is called to process SME_REASSOC_REQ message
1984 * from HDD or upper layer application.
1985 *
1986 *LOGIC:
1987 *
1988 *ASSUMPTIONS:
1989 *
1990 *NOTE:
1991 *
1992 * @param pMac Pointer to Global MAC structure
1993 * @param *pMsgBuf A pointer to the SME message buffer
1994 * @return None
1995 */
1996
1997static void
1998__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1999{
2000 tANI_U16 caps;
2001 tANI_U32 val;
Srinivas Girigowdac16730e2013-01-16 13:39:39 -08002002 tpSirSmeJoinReq pReassocReq = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002003 tLimMlmReassocReq *pMlmReassocReq;
2004 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2005 tpPESession psessionEntry = NULL;
2006 tANI_U8 sessionId;
2007 tANI_U8 smeSessionId;
2008 tANI_U16 transactionId;
2009 tPowerdBm localPowerConstraint = 0, regMax = 0;
2010 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002011 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07002012
2013
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002014 PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002015
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07002016 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302017 pReassocReq = vos_mem_malloc(nSize);
2018 if ( NULL == pReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 {
2020 // Log error
2021 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302022 FL("call to AllocateMemory failed for pReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002023
2024 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2025 goto end;
2026 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302027 (void) vos_mem_set((void *) pReassocReq, nSize, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002028 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
2029 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2030 (!limIsSmeJoinReqValid(pMac,
2031 (tpSirSmeJoinReq) pReassocReq)))
2032 {
2033 /// Received invalid eWNI_SME_REASSOC_REQ
2034 // Log the event
2035 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002036 FL("received SME_REASSOC_REQ with invalid data"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002037
2038 retCode = eSIR_SME_INVALID_PARAMETERS;
2039 goto end;
2040 }
2041
2042 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
2043 {
2044 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
Srinivas Girigowda2a69dcf2013-09-13 14:48:34 -07002045 limLog(pMac, LOGE, FL("Session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002046 retCode = eSIR_SME_INVALID_PARAMETERS;
2047 goto end;
2048 }
2049
2050#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2051 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
2052#endif //FEATURE_WLAN_DIAG_SUPPORT
2053 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
2054
2055 /* Store the reassoc handle in the session Table.. 23rd sep review */
2056 psessionEntry->pLimReAssocReq = pReassocReq;
2057
2058 /**
2059 * Reassociate request is expected
2060 * in link established state only.
2061 */
2062
2063 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
2064 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07002065#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
2067 {
2068 // May be from 11r FT pre-auth. So lets check it before we bail out
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08002069 limLog(pMac, LOG1, FL("Session in reassoc state is %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002070 psessionEntry->peSessionId);
2071
2072 // Make sure its our preauth bssid
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302073 if (!vos_mem_compare( pReassocReq->bssDescription.bssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002074 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
2075 {
2076 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
2077 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002078 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002079 retCode = eSIR_SME_INVALID_PARAMETERS;
2080 goto end;
2081 }
2082
2083 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
2084 return;
2085 }
2086#endif
2087 /// Should not have received eWNI_SME_REASSOC_REQ
2088 // Log the event
2089 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002090 FL("received unexpected SME_REASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002091 psessionEntry->limSmeState);
2092 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2093
2094 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2095 goto end;
2096 }
2097
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302098 vos_mem_copy( psessionEntry->limReAssocbssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002099 psessionEntry->pLimReAssocReq->bssDescription.bssId,
2100 sizeof(tSirMacAddr));
2101
2102 psessionEntry->limReassocChannelId =
2103 psessionEntry->pLimReAssocReq->bssDescription.channelId;
2104
Jeff Johnsone7245742012-09-05 17:12:55 -07002105 psessionEntry->reAssocHtSupportedChannelWidthSet =
2106 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
2107 psessionEntry->reAssocHtRecommendedTxWidthSet =
2108 psessionEntry->reAssocHtSupportedChannelWidthSet;
2109 psessionEntry->reAssocHtSecondaryChannelOffset =
2110 psessionEntry->pLimReAssocReq->cbMode;
2111
Jeff Johnson295189b2012-06-20 16:38:30 -07002112 psessionEntry->limReassocBssCaps =
2113 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07002114 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
2115 localPowerConstraint = regMax;
2116 limExtractApCapability( pMac,
2117 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
2118 limGetIElenFromBssDescription(
2119 &psessionEntry->pLimReAssocReq->bssDescription),
2120 &psessionEntry->limReassocBssQosCaps,
2121 &psessionEntry->limReassocBssPropCap,
2122 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002123 , &localPowerConstraint,
2124 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002125 );
2126
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302127 psessionEntry->maxTxPower = VOS_MIN( regMax, (localPowerConstraint) );
Jeff Johnson295189b2012-06-20 16:38:30 -07002128#if defined WLAN_VOWIFI_DEBUG
2129 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localPowerConstraint, psessionEntry->maxTxPower );
2130#endif
2131 {
2132 #if 0
2133 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2134 &cfgLen) != eSIR_SUCCESS)
2135 {
2136 /// Could not get SSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002137 limLog(pMac, LOGP, FL("could not retrive SSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002138 }
2139 #endif//TO SUPPORT BT-AMP
2140
2141 /* Copy the SSID from sessio entry to local variable */
2142 #if 0
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302143 vos_mem_copy( pMac->lim.gLimReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 psessionEntry->ssId.ssId,
2145 psessionEntry->ssId.length);
2146 #endif
2147 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302148 vos_mem_copy( psessionEntry->limReassocSSID.ssId,
Jeff Johnson295189b2012-06-20 16:38:30 -07002149 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2150
2151 }
2152
2153 if (pMac->lim.gLimCurrentBssUapsd)
2154 {
2155 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002156 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x"), pMac->lim.gUapsdPerAcBitmask);
Jeff Johnson295189b2012-06-20 16:38:30 -07002157 }
2158
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302159 pMlmReassocReq = vos_mem_malloc(sizeof(tLimMlmReassocReq));
2160 if ( NULL == pMlmReassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002161 {
2162 // Log error
2163 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302164 FL("call to AllocateMemory failed for mlmReassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002165
2166 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2167 goto end;
2168 }
2169
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302170 vos_mem_copy( pMlmReassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002171 psessionEntry->limReAssocbssId,
2172 sizeof(tSirMacAddr));
2173
2174 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2175 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2176 != eSIR_SUCCESS)
2177 {
2178 /**
2179 * Could not get ReassocFailureTimeout value
2180 * from CFG. Log error.
2181 */
2182 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002183 FL("could not retrieve ReassocFailureTimeout value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002184 }
2185
2186 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2187 {
2188 /**
2189 * Could not get Capabilities value
2190 * from CFG. Log error.
2191 */
2192 limLog(pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002193 FL("could not retrieve Capabilities value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002194 }
2195 pMlmReassocReq->capabilityInfo = caps;
2196
2197 /* Update PE sessionId*/
2198 pMlmReassocReq->sessionId = sessionId;
2199
2200 /* If telescopic beaconing is enabled, set listen interval to
2201 WNI_CFG_TELE_BCN_MAX_LI */
2202 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2203 eSIR_SUCCESS)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002204 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002205
2206 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2207
2208 if(teleBcnEn)
2209 {
2210 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2211 eSIR_SUCCESS)
2212 {
2213 /**
2214 * Could not get ListenInterval value
2215 * from CFG. Log error.
2216 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002217 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002218 }
2219 }
2220 else
2221 {
2222 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2223 {
2224 /**
2225 * Could not get ListenInterval value
2226 * from CFG. Log error.
2227 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002228 limLog(pMac, LOGP, FL("could not retrieve ListenInterval"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 }
2230 }
2231
2232 /* Delete all BA sessions before Re-Assoc.
2233 * BA frames are class 3 frames and the session
2234 * is lost upon disassociation and reassociation.
2235 */
2236
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07002237 limDeleteBASessions(pMac, psessionEntry, BA_BOTH_DIRECTIONS);
Jeff Johnson295189b2012-06-20 16:38:30 -07002238
2239 pMlmReassocReq->listenInterval = (tANI_U16) val;
2240
2241 /* Indicate whether spectrum management is enabled*/
2242 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2243
2244 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2245 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2246
Jeff Johnsone7245742012-09-05 17:12:55 -07002247 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002248
2249 limPostMlmMessage(pMac,
2250 LIM_MLM_REASSOC_REQ,
2251 (tANI_U32 *) pMlmReassocReq);
2252 return;
2253
2254end:
2255 if (pReassocReq)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302256 vos_mem_free( pReassocReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002257
2258 if (psessionEntry)
2259 {
2260 // error occurred after we determined the session so extract
2261 // session and transaction info from there
2262 smeSessionId = psessionEntry->smeSessionId;
2263 transactionId = psessionEntry->transactionId;
2264 }
2265 else
2266 {
2267 // error occurred before or during the time we determined the session
2268 // so extract the session and transaction info from the message
2269 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2270 }
2271
2272 /// Send Reassoc failure response to host
2273 /// (note psessionEntry may be NULL, but that's OK)
2274 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2275 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2276 psessionEntry, smeSessionId, transactionId);
2277
2278} /*** end __limProcessSmeReassocReq() ***/
2279
2280
2281tANI_BOOLEAN sendDisassocFrame = 1;
2282/**
2283 * __limProcessSmeDisassocReq()
2284 *
2285 *FUNCTION:
2286 * This function is called to process SME_DISASSOC_REQ message
2287 * from HDD or upper layer application.
2288 *
2289 *LOGIC:
2290 *
2291 *ASSUMPTIONS:
2292 *
2293 *NOTE:
2294 *
2295 * @param pMac Pointer to Global MAC structure
2296 * @param *pMsgBuf A pointer to the SME message buffer
2297 * @return None
2298 */
2299
2300static void
2301__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2302{
2303 tANI_U16 disassocTrigger, reasonCode;
2304 tLimMlmDisassocReq *pMlmDisassocReq;
2305 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002306 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002307 tSirSmeDisassocReq smeDisassocReq;
2308 tpPESession psessionEntry = NULL;
2309 tANI_U8 sessionId;
2310 tANI_U8 smesessionId;
2311 tANI_U16 smetransactionId;
2312
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002313 PELOG1(limLog(pMac, LOG1,FL("received DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002314
Jeff Johnson43971f52012-07-17 12:26:56 -07002315 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002316 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002317 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002318 return;
2319 }
2320
Jeff Johnson43971f52012-07-17 12:26:56 -07002321 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002322
Jeff Johnson43971f52012-07-17 12:26:56 -07002323 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002324
Jeff Johnson43971f52012-07-17 12:26:56 -07002325 if ( (eSIR_FAILURE == status) ||
2326 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002327 {
2328 PELOGE(limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002329 FL("received invalid SME_DISASSOC_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002330
2331 if (pMac->lim.gLimRspReqd)
2332 {
2333 pMac->lim.gLimRspReqd = false;
2334
2335 retCode = eSIR_SME_INVALID_PARAMETERS;
2336 disassocTrigger = eLIM_HOST_DISASSOC;
2337 goto sendDisassoc;
2338 }
2339
2340 return;
2341 }
2342
2343
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002344 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_REQ message. Reason: %d global SmeState: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002345 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState);)
2346
2347
2348 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2349 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002350 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002351 retCode = eSIR_SME_INVALID_PARAMETERS;
2352 disassocTrigger = eLIM_HOST_DISASSOC;
2353 goto sendDisassoc;
2354
2355 }
2356
2357#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2358 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2359#endif //FEATURE_WLAN_DIAG_SUPPORT
2360
2361 /* Update SME session Id and SME transaction ID*/
2362
2363 psessionEntry->smeSessionId = smesessionId;
2364 psessionEntry->transactionId = smetransactionId;
2365
2366 switch (psessionEntry->limSystemRole)
2367 {
2368 case eLIM_STA_ROLE:
2369 case eLIM_BT_AMP_STA_ROLE:
2370 switch (psessionEntry->limSmeState)
2371 {
2372 case eLIM_SME_ASSOCIATED_STATE:
2373 case eLIM_SME_LINK_EST_STATE:
2374 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2375 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Hoonki Lee8c9e99f2013-04-18 22:59:11 -07002376#ifdef FEATURE_WLAN_TDLS
2377 /* Delete all TDLS peers connected before leaving BSS*/
2378 limDeleteTDLSPeers(pMac, psessionEntry);
2379#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07002380 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002381 break;
2382
2383 case eLIM_SME_WT_DEAUTH_STATE:
2384 /* PE shall still process the DISASSOC_REQ and proceed with
2385 * link tear down even if it had already sent a DEAUTH_IND to
2386 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2387 * its been set when PE entered WT_DEAUTH_STATE.
2388 */
2389 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002390 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002391 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DEAUTH_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002392 break;
2393
2394 case eLIM_SME_WT_DISASSOC_STATE:
2395 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2396 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2397 * PE can continue processing DISASSOC_REQ and send the response instead
2398 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2399 * for disassoc frame.
2400 *
2401 * It will send a disassoc, which is ok. However, we can use the global flag
2402 * sendDisassoc to not send disassoc frame.
2403 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002404 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DISASSOC_STATE. "));
Jeff Johnson295189b2012-06-20 16:38:30 -07002405 break;
2406
2407 case eLIM_SME_JOIN_FAILURE_STATE: {
2408 /** Return Success as we are already in Disconnected State*/
2409 if (pMac->lim.gLimRspReqd) {
2410 retCode = eSIR_SME_SUCCESS;
2411 disassocTrigger = eLIM_HOST_DISASSOC;
2412 goto sendDisassoc;
2413 }
2414 }break;
2415 default:
2416 /**
2417 * STA is not currently associated.
2418 * Log error and send response to host
2419 */
2420 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002421 FL("received unexpected SME_DISASSOC_REQ in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002422 psessionEntry->limSmeState);
2423 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2424
2425 if (pMac->lim.gLimRspReqd)
2426 {
2427 if (psessionEntry->limSmeState !=
2428 eLIM_SME_WT_ASSOC_STATE)
2429 pMac->lim.gLimRspReqd = false;
2430
2431 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2432 disassocTrigger = eLIM_HOST_DISASSOC;
2433 goto sendDisassoc;
2434 }
2435
2436 return;
2437 }
2438
2439 break;
2440
2441 case eLIM_AP_ROLE:
2442 case eLIM_BT_AMP_AP_ROLE:
2443 // Fall through
2444 break;
2445
2446 case eLIM_STA_IN_IBSS_ROLE:
2447 default: // eLIM_UNKNOWN_ROLE
2448 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002449 FL("received unexpected SME_DISASSOC_REQ for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002450 psessionEntry->limSystemRole);
2451
2452 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2453 disassocTrigger = eLIM_HOST_DISASSOC;
2454 goto sendDisassoc;
2455 } // end switch (pMac->lim.gLimSystemRole)
2456
2457 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2458 {
2459 /// Disassociation is triggered by Link Monitoring
2460 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2461 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2462 }
2463 else
2464 {
2465 disassocTrigger = eLIM_HOST_DISASSOC;
2466 reasonCode = smeDisassocReq.reasonCode;
2467 }
2468
2469 if (smeDisassocReq.doNotSendOverTheAir)
2470 {
2471 sendDisassocFrame = 0;
2472 }
2473 // Trigger Disassociation frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302474
2475 pMlmDisassocReq = vos_mem_malloc(sizeof(tLimMlmDisassocReq));
2476 if ( NULL == pMlmDisassocReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002477 {
2478 // Log error
2479 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302480 FL("call to AllocateMemory failed for mlmDisassocReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002481
2482 return;
2483 }
2484
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302485 vos_mem_copy( (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002486 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2487 sizeof(tSirMacAddr));
2488
2489 pMlmDisassocReq->reasonCode = reasonCode;
2490 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2491
2492 /* Update PE session ID*/
2493 pMlmDisassocReq->sessionId = sessionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07002494
2495 limPostMlmMessage(pMac,
2496 LIM_MLM_DISASSOC_REQ,
2497 (tANI_U32 *) pMlmDisassocReq);
2498 return;
2499
2500sendDisassoc:
2501 if (psessionEntry)
2502 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2503 retCode,
2504 disassocTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002505 1,smesessionId,smetransactionId,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07002506 else
2507 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2508 retCode,
2509 disassocTrigger,
Sudhir Sattayappa Kohalli5a8ac222013-03-06 12:41:42 -08002510 1, smesessionId, smetransactionId, NULL);
Jeff Johnson295189b2012-06-20 16:38:30 -07002511
2512
2513} /*** end __limProcessSmeDisassocReq() ***/
2514
2515
2516/** -----------------------------------------------------------------
2517 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2518
2519 This function is called to process SME_DISASSOC_CNF message
2520 from HDD or upper layer application.
2521
2522 \param pMac - global mac structure
2523 \param pStaDs - station dph hash node
2524 \return none
2525 \sa
2526 ----------------------------------------------------------------- */
2527static void
2528__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2529{
2530 tSirSmeDisassocCnf smeDisassocCnf;
2531 tANI_U16 aid;
2532 tpDphHashNode pStaDs;
2533 tSirRetStatus status = eSIR_SUCCESS;
2534 tpPESession psessionEntry;
2535 tANI_U8 sessionId;
2536
2537
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002538 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002539
2540 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2541
2542 if (status == eSIR_FAILURE)
2543 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002544 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002545 return;
2546 }
2547
2548 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2549 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002550 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002551 return;
2552 }
2553
2554 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2555 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002556 limLog(pMac, LOGW, FL("received invalid SME_DISASSOC_CNF message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002557 return;
2558 }
2559
2560#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2561 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2562 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2563 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2564 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2565#endif //FEATURE_WLAN_DIAG_SUPPORT
2566
2567 switch (psessionEntry->limSystemRole)
2568 {
2569 case eLIM_STA_ROLE:
2570 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2571 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2572 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2573 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2574 {
2575 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002576 FL("received unexp SME_DISASSOC_CNF in state %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002577 psessionEntry->limSmeState);
2578 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2579 return;
2580 }
2581 break;
2582
2583 case eLIM_AP_ROLE:
2584 // Fall through
Jeff Johnson295189b2012-06-20 16:38:30 -07002585 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002586
2587 case eLIM_STA_IN_IBSS_ROLE:
2588 default: // eLIM_UNKNOWN_ROLE
2589 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002590 FL("received unexpected SME_DISASSOC_CNF role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002591 psessionEntry->limSystemRole);
2592
2593 return;
2594 }
2595
2596
2597 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2598 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -07002599 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002600 )
2601 {
2602 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2603 if (pStaDs == NULL)
2604 {
2605 PELOGW(limLog(pMac, LOGW, FL("received DISASSOC_CNF for a STA that does not have context, addr= "));
2606 limPrintMacAddr(pMac, smeDisassocCnf.peerMacAddr, LOGW);)
2607 return;
2608 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002609 /* Delete FT session if there exists one */
2610 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002611 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002612
2613 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002614 }
2615
2616 return;
2617}
2618
2619
2620/**
2621 * __limProcessSmeDeauthReq()
2622 *
2623 *FUNCTION:
2624 * This function is called to process SME_DEAUTH_REQ message
2625 * from HDD or upper layer application.
2626 *
2627 *LOGIC:
2628 *
2629 *ASSUMPTIONS:
2630 *
2631 *NOTE:
2632 *
2633 * @param pMac Pointer to Global MAC structure
2634 * @param *pMsgBuf A pointer to the SME message buffer
2635 * @return None
2636 */
2637
2638static void
2639__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2640{
2641 tANI_U16 deauthTrigger, reasonCode;
2642 tLimMlmDeauthReq *pMlmDeauthReq;
2643 tSirSmeDeauthReq smeDeauthReq;
2644 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2645 tSirRetStatus status = eSIR_SUCCESS;
2646 tpPESession psessionEntry;
2647 tANI_U8 sessionId; //PE sessionId
2648 tANI_U8 smesessionId;
2649 tANI_U16 smetransactionId;
2650
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002651 PELOG1(limLog(pMac, LOG1,FL("received DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002652
2653 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
2654
2655 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2656
2657 //We need to get a session first but we don't even know if the message is correct.
2658 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2659 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002660 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002661 retCode = eSIR_SME_INVALID_PARAMETERS;
2662 deauthTrigger = eLIM_HOST_DEAUTH;
2663 goto sendDeauth;
2664
2665 }
2666
2667 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2668 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002669 PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002670 if (pMac->lim.gLimRspReqd)
2671 {
2672 pMac->lim.gLimRspReqd = false;
2673
2674 retCode = eSIR_SME_INVALID_PARAMETERS;
2675 deauthTrigger = eLIM_HOST_DEAUTH;
2676 goto sendDeauth;
2677 }
2678
2679 return;
2680 }
2681
2682#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2683 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2684#endif //FEATURE_WLAN_DIAG_SUPPORT
2685
2686 /* Update SME session ID and Transaction ID */
2687 psessionEntry->smeSessionId = smesessionId;
2688 psessionEntry->transactionId = smetransactionId;
2689
2690
2691 switch (psessionEntry->limSystemRole)
2692 {
2693 case eLIM_STA_ROLE:
2694 case eLIM_BT_AMP_STA_ROLE:
2695
2696 switch (psessionEntry->limSmeState)
2697 {
2698 case eLIM_SME_ASSOCIATED_STATE:
2699 case eLIM_SME_LINK_EST_STATE:
2700 case eLIM_SME_WT_ASSOC_STATE:
2701 case eLIM_SME_JOIN_FAILURE_STATE:
2702 case eLIM_SME_IDLE_STATE:
2703 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2704 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Varun Reddy Yeturue3bbf6e2013-02-08 18:50:55 -08002705 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002706
2707 // Send Deauthentication request to MLM below
2708
2709 break;
2710
2711 default:
2712 /**
2713 * STA is not in a state to deauthenticate with
2714 * peer. Log error and send response to host.
2715 */
2716 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002717 FL("received unexp SME_DEAUTH_REQ in state %X"),psessionEntry->limSmeState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002718 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2719
2720 if (pMac->lim.gLimRspReqd)
2721 {
2722 pMac->lim.gLimRspReqd = false;
2723
2724 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2725 deauthTrigger = eLIM_HOST_DEAUTH;
2726 goto sendDeauth;
2727 }
2728
2729 return;
2730 }
2731
2732 break;
2733
2734 case eLIM_STA_IN_IBSS_ROLE:
2735
2736 return;
2737
2738 case eLIM_AP_ROLE:
2739 // Fall through
2740
2741 break;
2742
2743 default:
2744 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002745 FL("received unexpected SME_DEAUTH_REQ for role %X"),psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07002746
2747 return;
2748 } // end switch (pMac->lim.gLimSystemRole)
2749
2750 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
2751 {
2752 /// Deauthentication is triggered by Link Monitoring
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002753 PELOG1(limLog(pMac, LOG1, FL("**** Lost link with AP ****"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002754 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
2755 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
2756 }
2757 else
2758 {
2759 deauthTrigger = eLIM_HOST_DEAUTH;
2760 reasonCode = smeDeauthReq.reasonCode;
2761 }
2762
2763 // Trigger Deauthentication frame to peer MAC entity
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302764 pMlmDeauthReq = vos_mem_malloc(sizeof(tLimMlmDeauthReq));
2765 if ( NULL == pMlmDeauthReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002766 {
2767 // Log error
2768 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302769 FL("call to AllocateMemory failed for mlmDeauthReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002770
2771 return;
2772 }
2773
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302774 vos_mem_copy( (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002775 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
2776 sizeof(tSirMacAddr));
2777
2778 pMlmDeauthReq->reasonCode = reasonCode;
2779 pMlmDeauthReq->deauthTrigger = deauthTrigger;
Jeff Johnson295189b2012-06-20 16:38:30 -07002780
2781 /* Update PE session Id*/
2782 pMlmDeauthReq->sessionId = sessionId;
2783
2784 limPostMlmMessage(pMac,
2785 LIM_MLM_DEAUTH_REQ,
2786 (tANI_U32 *) pMlmDeauthReq);
2787 return;
2788
2789sendDeauth:
2790 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
2791 retCode,
2792 deauthTrigger,
Jeff Johnson295189b2012-06-20 16:38:30 -07002793 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002794 smesessionId, smetransactionId);
2795} /*** end __limProcessSmeDeauthReq() ***/
2796
2797
2798
2799/**
2800 * __limProcessSmeSetContextReq()
2801 *
2802 *FUNCTION:
2803 * This function is called to process SME_SETCONTEXT_REQ message
2804 * from HDD or upper layer application.
2805 *
2806 *LOGIC:
2807 *
2808 *ASSUMPTIONS:
2809 *
2810 *NOTE:
2811 *
2812 * @param pMac Pointer to Global MAC structure
2813 * @param *pMsgBuf A pointer to the SME message buffer
2814 * @return None
2815 */
2816
2817static void
2818__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2819{
2820 tpSirSmeSetContextReq pSetContextReq;
2821 tLimMlmSetKeysReq *pMlmSetKeysReq;
2822 tpPESession psessionEntry;
2823 tANI_U8 sessionId; //PE sessionID
2824 tANI_U8 smesessionId;
2825 tANI_U16 smetransactionId;
2826
2827
2828 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002829 FL("received SETCONTEXT_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07002830
2831
2832 if(pMsgBuf == NULL)
2833 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002834 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002835 return;
2836 }
2837
2838 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302839
2840 pSetContextReq = vos_mem_malloc(sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS);
2841 if ( NULL == pSetContextReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002842 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302843 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pSetContextReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002844 return;
2845 }
2846
2847 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2848 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
2849 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002850 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002851 goto end;
2852 }
2853
2854 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2855 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002856 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 -07002857 limSendSmeSetContextRsp(pMac,
2858 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002859 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002860 eSIR_SME_INVALID_PARAMETERS,NULL,
2861 smesessionId,smetransactionId);
2862
2863 goto end;
2864 }
2865
2866
2867 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
2868 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002869 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002870 limSendSmeSetContextRsp(pMac,
2871 pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002872 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002873 eSIR_SME_INVALID_PARAMETERS,NULL,
2874 smesessionId,smetransactionId);
2875
2876 goto end;
2877 }
2878
2879#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2880 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
2881#endif //FEATURE_WLAN_DIAG_SUPPORT
2882
2883
2884 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2885 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
2886 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
2887 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
2888 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
2889 {
2890 // Trigger MLM_SETKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302891 pMlmSetKeysReq = vos_mem_malloc(sizeof(tLimMlmSetKeysReq));
2892 if ( NULL == pMlmSetKeysReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07002893 {
2894 // Log error
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302895 limLog(pMac, LOGP, FL("call to AllocateMemory failed for mlmSetKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002896 goto end;
2897 }
2898
2899 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
2900 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
2901 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2902 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002903 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002904 goto end;
2905 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302906 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002907 (tANI_U8 *) &pSetContextReq->peerMacAddr,
2908 sizeof(tSirMacAddr));
2909
Jeff Johnson295189b2012-06-20 16:38:30 -07002910
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302911 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key,
Jeff Johnson295189b2012-06-20 16:38:30 -07002912 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
2913 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
2914
2915 pMlmSetKeysReq->sessionId = sessionId;
2916#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
2917 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002918 FL("received SETCONTEXT_REQ message sessionId=%d"), pMlmSetKeysReq->sessionId););
Jeff Johnson295189b2012-06-20 16:38:30 -07002919#endif
2920
Jeff Johnson295189b2012-06-20 16:38:30 -07002921 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
2922 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
2923 {
2924 if(pSetContextReq->keyMaterial.key[0].keyLength)
2925 {
2926 tANI_U8 keyId;
2927 keyId = pSetContextReq->keyMaterial.key[0].keyId;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302928 vos_mem_copy( (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
Jeff Johnson295189b2012-06-20 16:38:30 -07002929 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
2930 }
2931 else {
2932 tANI_U32 i;
2933 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
2934 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302935 vos_mem_copy( (tANI_U8 *) &pMlmSetKeysReq->key[i],
Jeff Johnson295189b2012-06-20 16:38:30 -07002936 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
2937 }
2938 }
2939 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002940
2941 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002942 }
2943 else
2944 {
2945 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002946 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002947 psessionEntry->limSystemRole,
2948 psessionEntry->limSmeState);
2949 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2950
2951 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07002952 1,
Jeff Johnson295189b2012-06-20 16:38:30 -07002953 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
2954 smesessionId,
2955 smetransactionId);
2956 }
2957
2958end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05302959 vos_mem_free( pSetContextReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07002960 return;
2961} /*** end __limProcessSmeSetContextReq() ***/
2962
2963/**
2964 * __limProcessSmeRemoveKeyReq()
2965 *
2966 *FUNCTION:
2967 * This function is called to process SME_REMOVEKEY_REQ message
2968 * from HDD or upper layer application.
2969 *
2970 *LOGIC:
2971 *
2972 *ASSUMPTIONS:
2973 *
2974 *NOTE:
2975 *
2976 * @param pMac Pointer to Global MAC structure
2977 * @param *pMsgBuf A pointer to the SME message buffer
2978 * @return None
2979 */
2980
2981static void
2982__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2983{
2984 tpSirSmeRemoveKeyReq pRemoveKeyReq;
2985 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
2986 tpPESession psessionEntry;
2987 tANI_U8 sessionId; //PE sessionID
2988 tANI_U8 smesessionId;
2989 tANI_U16 smetransactionId;
2990
2991 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002992 FL("received REMOVEKEY_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07002993
2994 if(pMsgBuf == NULL)
2995 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002996 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002997 return;
2998 }
2999
3000
3001 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3002
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303003 pRemoveKeyReq = vos_mem_malloc(sizeof(*pRemoveKeyReq));
3004 if ( NULL == pRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003005 {
3006 //Log error
3007 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303008 FL("call to AllocateMemory failed for pRemoveKeyReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003009
3010 return;
3011 }
3012
3013 if ((limRemoveKeyReqSerDes(pMac,
3014 pRemoveKeyReq,
3015 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
3016 {
3017 limLog(pMac, LOGW,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003018 FL("received invalid SME_REMOVECONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003019
3020 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
3021
3022 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
3023 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003024 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003025 //goto end;
3026 }
3027
3028 limSendSmeRemoveKeyRsp(pMac,
3029 pRemoveKeyReq->peerMacAddr,
3030 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
3031 smesessionId,smetransactionId);
3032
3033 goto end;
3034 }
3035
3036 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
3037 {
3038 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003039 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003040 limSendSmeRemoveKeyRsp(pMac,
3041 pRemoveKeyReq->peerMacAddr,
3042 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
3043 smesessionId, smetransactionId);
3044 goto end;
3045 }
3046
3047
3048 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
3049 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
3050 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
3051 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
3052 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
3053 {
3054 // Trigger MLM_REMOVEKEYS_REQ
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303055 pMlmRemoveKeyReq = vos_mem_malloc(sizeof(tLimMlmRemoveKeyReq));
3056 if ( NULL == pMlmRemoveKeyReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07003057 {
3058 // Log error
3059 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303060 FL("call to AllocateMemory failed for mlmRemoveKeysReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003061
3062 goto end;
3063 }
3064
3065 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
3066 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
3067 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
3068 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
3069
3070 /* Update PE session Id */
3071 pMlmRemoveKeyReq->sessionId = sessionId;
3072
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303073 vos_mem_copy( (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003074 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
3075 sizeof(tSirMacAddr));
3076
3077
3078 limPostMlmMessage(pMac,
3079 LIM_MLM_REMOVEKEY_REQ,
3080 (tANI_U32 *) pMlmRemoveKeyReq);
3081 }
3082 else
3083 {
3084 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003085 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003086 psessionEntry->limSystemRole,
3087 psessionEntry->limSmeState);
3088 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3089
3090 limSendSmeRemoveKeyRsp(pMac,
3091 pRemoveKeyReq->peerMacAddr,
3092 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3093 smesessionId,smetransactionId);
3094 }
3095
3096end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303097 vos_mem_free( pRemoveKeyReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07003098} /*** end __limProcessSmeRemoveKeyReq() ***/
3099
Jeff Johnson295189b2012-06-20 16:38:30 -07003100void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3101{
3102 tSirMsgQ mmhMsg;
3103 tpSmeGetScanChnRsp pSirSmeRsp;
3104 tANI_U16 len = 0;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303105 tANI_U8 sessionId;
3106 tANI_U16 transactionId;
Jeff Johnson295189b2012-06-20 16:38:30 -07003107
3108 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3109 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003110 limLog(pMac, LOGW, FL("numChn is out of bounds %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003111 pMac->lim.scanChnInfo.numChnInfo);
3112 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3113 }
3114
3115 PELOG2(limLog(pMac, LOG2,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003116 FL("Sending message %s with number of channels %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003117 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);)
3118
3119 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303120 pSirSmeRsp = vos_mem_malloc(len);
3121 if ( NULL == pSirSmeRsp )
Jeff Johnson295189b2012-06-20 16:38:30 -07003122 {
3123 /// Buffer not available. Log error
3124 limLog(pMac, LOGP,
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303125 FL("call to AllocateMemory failed for JOIN/REASSOC_RSP"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003126
3127 return;
3128 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303129 vos_mem_set(pSirSmeRsp, len, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07003130
Jeff Johnson295189b2012-06-20 16:38:30 -07003131 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3132 pSirSmeRsp->mesgLen = len;
Madan Mohan Koyyalamudide1b5bc2013-07-12 00:56:04 +05303133
3134 if (pMac->fScanOffload)
3135 {
3136 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&sessionId,&transactionId);
3137 pSirSmeRsp->sessionId = sessionId;
3138 }
3139 else
3140 pSirSmeRsp->sessionId = 0;
Jeff Johnson295189b2012-06-20 16:38:30 -07003141
3142 if(pMac->lim.scanChnInfo.numChnInfo)
3143 {
3144 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303145 vos_mem_copy( pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn,
3146 sizeof(tLimScanChn) * pSirSmeRsp->numChn);
Jeff Johnson295189b2012-06-20 16:38:30 -07003147 }
3148 //Clear the list
3149 limRessetScanChannelInfo(pMac);
3150
3151 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3152 mmhMsg.bodyptr = pSirSmeRsp;
3153 mmhMsg.bodyval = 0;
3154
3155 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003156 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003157 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3158}
3159
3160
Jeff Johnson295189b2012-06-20 16:38:30 -07003161void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3162{
3163 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3164 tpDphHashNode pStaDs = NULL;
3165 tpPESession psessionEntry = NULL;
3166 tSap_Event sapEvent;
3167 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3168 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3169 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3170 tANI_U8 assocId = 0;
3171 tANI_U8 staCount = 0;
3172
3173 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3174 {
3175 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003176 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003177 goto limAssocStaEnd;
3178 }
3179
3180 switch (getAssocSTAsReq.modId)
3181 {
3182/**
3183 case VOS_MODULE_ID_HAL:
3184 wdaPostCtrlMsg( pMac, &msgQ );
3185 return;
3186
3187 case VOS_MODULE_ID_TL:
3188 Post msg TL
3189 return;
3190*/
3191 case VOS_MODULE_ID_PE:
3192 default:
3193 break;
3194 }
3195
Jeff Johnson1250df42012-12-10 14:31:52 -08003196 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003197 // Find PE session Entry
3198 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3199 {
3200 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003201 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003202 goto limAssocStaEnd;
3203 }
3204
3205 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3206 {
3207 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003208 FL("Received unexpected message in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303209 psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003210 goto limAssocStaEnd;
3211 }
3212
3213 // Retrieve values obtained in the request message
3214 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3215 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3216
3217 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3218 {
3219 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3220
3221 if (NULL == pStaDs)
3222 continue;
3223
3224 if (pStaDs->valid)
3225 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303226 vos_mem_copy((tANI_U8 *)&pAssocStasTemp->staMac,
3227 (tANI_U8 *)&pStaDs->staAddr,
3228 sizeof(v_MACADDR_t)); // Mac address
Jeff Johnson295189b2012-06-20 16:38:30 -07003229 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3230 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3231
Leo Chang614d2072013-08-22 14:59:44 -07003232 palCopyMemory(pMac->hHdd, (tANI_U8 *)&pAssocStasTemp->supportedRates,
3233 (tANI_U8 *)&pStaDs->supportedRates,
3234 sizeof(tSirSupportedRates));
3235 pAssocStasTemp->ShortGI40Mhz = pStaDs->htShortGI40Mhz;
3236 pAssocStasTemp->ShortGI20Mhz = pStaDs->htShortGI20Mhz;
3237 pAssocStasTemp->Support40Mhz = pStaDs->htDsssCckRate40MHzSupport;
3238
Jeff Johnson295189b2012-06-20 16:38:30 -07003239 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
3240 limLog(pMac, LOG1, FL("MAC = %02x:%02x:%02x:%02x:%02x:%02x"),
3241 pStaDs->staAddr[0],
3242 pStaDs->staAddr[1],
3243 pStaDs->staAddr[2],
3244 pStaDs->staAddr[3],
3245 pStaDs->staAddr[4],
3246 pStaDs->staAddr[5]);
3247 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3248 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3249
3250 pAssocStasTemp++;
3251 staCount++;
3252 }
3253 }
3254
3255limAssocStaEnd:
3256 // Call hdd callback with sap event to send the list of associated stations from PE
3257 if (pSapEventCallback != NULL)
3258 {
3259 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3260 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3261 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3262 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3263 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3264 }
3265}
3266
3267
3268/**
3269 * limProcessSmeGetWPSPBCSessions
3270 *
3271 *FUNCTION:
3272 * This function is called when query the WPS PBC overlap message is received
3273 *
3274 *LOGIC:
3275 * This function parses get WPS PBC overlap information message and call callback to pass
3276 * WPS PBC overlap information back to hdd.
3277 *ASSUMPTIONS:
3278 *
3279 *
3280 *NOTE:
3281 *
3282 * @param pMac Pointer to Global MAC structure
3283 * @param pMsgBuf A pointer to WPS PBC overlap query message
3284*
3285 * @return None
3286 */
3287void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3288{
3289 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3290 tpPESession psessionEntry = NULL;
3291 tSap_Event sapEvent;
3292 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3293 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3294 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3295
3296 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3297
3298 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3299 {
3300 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003301 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003302 goto limGetWPSPBCSessionsEnd;
3303 }
3304
Jeff Johnson1250df42012-12-10 14:31:52 -08003305 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003306 // Find PE session Entry
3307 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3308 {
3309 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003310 FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003311 goto limGetWPSPBCSessionsEnd;
3312 }
3313
3314 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3315 {
3316 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003317 FL("Received unexpected message in role %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003318 psessionEntry->limSystemRole);
3319 goto limGetWPSPBCSessionsEnd;
3320 }
3321
Jeff Johnson1250df42012-12-10 14:31:52 -08003322 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003323 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3324 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3325
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303326 if (vos_mem_compare( zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
Jeff Johnson295189b2012-06-20 16:38:30 -07003327 { //This is GetWpsSession call
3328
3329 limGetWPSPBCSessions(pMac,
3330 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3331 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3332 }
3333 else
3334 {
3335 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3336 /* don't have to inform the HDD/Host */
3337 return;
3338 }
3339
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003340 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003341 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3342
3343 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3344
3345limGetWPSPBCSessionsEnd:
3346 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
3347 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
3348}
3349
Jeff Johnson295189b2012-06-20 16:38:30 -07003350
3351
3352/**
3353 * __limCounterMeasures()
3354 *
3355 * FUNCTION:
3356 * This function is called to "implement" MIC counter measure
3357 * and is *temporary* only
3358 *
3359 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3360 * we don't do the proper STA disassoc sequence since the
3361 * BSS will be stoped anyway
3362 *
3363 *ASSUMPTIONS:
3364 *
3365 *NOTE:
3366 *
3367 * @param pMac Pointer to Global MAC structure
3368 * @return None
3369 */
3370
3371static void
3372__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3373{
3374 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3375 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
3376 || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
3377
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003378 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003379
Jeff Johnson295189b2012-06-20 16:38:30 -07003380};
3381
3382
Jeff Johnson295189b2012-06-20 16:38:30 -07003383void
3384limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3385{
3386 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3387 tpPESession psessionEntry;
3388 tANI_U8 sessionId; //PE sessionId
3389
3390 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3391 {
3392 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003393 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003394 return;
3395 }
3396
3397 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3398 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003399 limLog(pMac, LOGE, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003400 return;
3401 }
3402
3403 if ( tkipCntrMeasReq.bEnable )
3404 {
3405 __limCounterMeasures( pMac, psessionEntry );
3406 }
3407
3408 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3409}
Jeff Johnson295189b2012-06-20 16:38:30 -07003410
3411
3412static void
3413__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3414{
3415 tSirSmeStopBssReq stopBssReq;
3416 tSirRetStatus status;
3417 tLimSmeStates prevState;
3418 tANI_U8 sessionId; //PE sessionId
3419 tpPESession psessionEntry;
3420 tANI_U8 smesessionId;
3421 tANI_U16 smetransactionId;
3422
3423 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3424
3425
3426
3427 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3428 !limIsSmeStopBssReqValid(pMsgBuf))
3429 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003430 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003431 /// Send Stop BSS response to host
3432 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3433 return;
3434 }
3435
3436
3437 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3438 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003439 limLog(pMac, LOGW, FL("session does not exist for given BSSID "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003440 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3441 return;
3442 }
3443
3444#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3445 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3446#endif //FEATURE_WLAN_DIAG_SUPPORT
3447
3448
3449 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3450 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3451 {
3452 /**
3453 * Should not have received STOP_BSS_REQ in states
3454 * other than 'normal' state or on STA in Infrastructure
3455 * mode. Log error and return response to host.
3456 */
3457 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003458 FL("received unexpected SME_STOP_BSS_REQ in state %X, for role %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003459 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3460 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3461 /// Send Stop BSS response to host
3462 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3463 return;
3464 }
3465
Jeff Johnson295189b2012-06-20 16:38:30 -07003466 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3467 {
3468 limWPSPBCClose(pMac, psessionEntry);
3469 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003470 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d"), stopBssReq.reasonCode);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003471
3472 prevState = psessionEntry->limSmeState;
3473
3474 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003475 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003476
3477 /* Update SME session Id and Transaction Id */
3478 psessionEntry->smeSessionId = smesessionId;
3479 psessionEntry->transactionId = smetransactionId;
3480
3481 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame */
3482 if ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) && (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3483 {
3484 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3485 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3486 // Send disassoc all stations associated thru TKIP
3487 __limCounterMeasures(pMac,psessionEntry);
3488 else
Madan Mohan Koyyalamudi299b4862013-01-30 19:59:23 +05303489 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DEAUTH_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003490 }
3491
3492 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3493 pMac->lim.gLimIbssCoalescingHappened = false;
3494
3495 /* send a delBss to HAL and wait for a response */
3496 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3497
3498 if (status != eSIR_SUCCESS)
3499 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003500 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d"), psessionEntry->bssIdx);)
Jeff Johnson295189b2012-06-20 16:38:30 -07003501 psessionEntry->limSmeState= prevState;
3502
Jeff Johnsone7245742012-09-05 17:12:55 -07003503 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003504
3505 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3506 }
3507}
3508
3509
3510/**--------------------------------------------------------------
3511\fn __limProcessSmeStopBssReq
3512
3513\brief Wrapper for the function __limHandleSmeStopBssRequest
3514 This message will be defered until softmac come out of
3515 scan mode. Message should be handled even if we have
3516 detected radar in the current operating channel.
3517\param pMac
3518\param pMsg
3519
3520\return TRUE - If we consumed the buffer
3521 FALSE - If have defered the message.
3522 ---------------------------------------------------------------*/
3523static tANI_BOOLEAN
3524__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3525{
3526 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3527 {
3528 /**
3529 * If message defered, buffer is not consumed yet.
3530 * So return false
3531 */
3532 return eANI_BOOLEAN_FALSE;
3533 }
3534 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3535 return eANI_BOOLEAN_TRUE;
3536} /*** end __limProcessSmeStopBssReq() ***/
3537
3538
3539void limProcessSmeDelBssRsp(
3540 tpAniSirGlobal pMac,
3541 tANI_U32 body,tpPESession psessionEntry)
3542{
3543
3544 (void) body;
3545 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3546 //TBD: get the sessionEntry
3547 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3548 limDeletePreAuthList(pMac);
3549 limIbssDelete(pMac,psessionEntry);
3550 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3551 return;
3552}
3553
3554
Jeff Johnson295189b2012-06-20 16:38:30 -07003555/**---------------------------------------------------------------
3556\fn __limProcessSmeAssocCnfNew
3557\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3558\ in BTAMP AP.
3559\
3560\param pMac
3561\param msgType - message type
3562\param pMsgBuf - a pointer to the SME message buffer
3563\return None
3564------------------------------------------------------------------*/
3565
3566 void
3567__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3568{
3569 tSirSmeAssocCnf assocCnf;
3570 tpDphHashNode pStaDs = NULL;
3571 tpPESession psessionEntry= NULL;
3572 tANI_U8 sessionId;
3573
3574
3575 if(pMsgBuf == NULL)
3576 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003577 limLog(pMac, LOGE, FL("pMsgBuf is NULL "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003578 goto end;
3579 }
3580
3581 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3582 !__limIsSmeAssocCnfValid(&assocCnf))
3583 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003584 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003585 goto end;
3586 }
3587
3588 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3589 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003590 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003591 goto end;
3592 }
3593
3594 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3595 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3596 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003597 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X"),
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303598 msgType, psessionEntry->limSmeState, psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003599 goto end;
3600 }
3601
3602 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3603
3604 if (pStaDs == NULL)
3605 {
3606 limLog(pMac, LOG1,
3607 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
3608 msgType, assocCnf.aid);
3609 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3610
3611 /*
3612 ** send a DISASSOC_IND message to WSM to make sure
3613 ** the state in WSM and LIM is the same
3614 **/
3615 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3616 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3617 goto end;
3618 }
3619 if ((pStaDs &&
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303620 (( !vos_mem_compare( (tANI_U8 *) pStaDs->staAddr,
Jeff Johnson295189b2012-06-20 16:38:30 -07003621 (tANI_U8 *) assocCnf.peerMacAddr,
3622 sizeof(tSirMacAddr)) ) ||
3623 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3624 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3625 (msgType != eWNI_SME_ASSOC_CNF)) ||
3626 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07003627 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
Jeff Johnson295189b2012-06-20 16:38:30 -07003628 {
3629 limLog(pMac, LOG1,
3630 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
3631 msgType, assocCnf.aid);
3632 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3633 goto end;
3634 }
3635
3636 /*
3637 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3638 ** has been received
3639 **/
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003640 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003641 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3642
3643 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3644 {
3645 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3646 * when it had received Assoc Request frame. Now, PE just needs to send
3647 * Association Response frame to the requesting BTAMP-STA.
3648 */
3649 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003650 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) "), pStaDs->assocId);
Jeff Johnson295189b2012-06-20 16:38:30 -07003651 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3652 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3653 goto end;
3654 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3655 else
3656 {
3657 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3658 /*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*/
3659 if(!pStaDs->mlmStaContext.updateContext)
3660 pStaDs->mlmStaContext.updateContext = 1;
3661 limRejectAssociation(pMac, pStaDs->staAddr,
3662 pStaDs->mlmStaContext.subType,
3663 true, pStaDs->mlmStaContext.authType,
3664 pStaDs->assocId, true,
3665 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
3666 return;
3667 }
3668
3669end:
3670 if((psessionEntry != NULL) && (pStaDs != NULL))
3671 {
3672 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3673 {
3674 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3675 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303676 vos_mem_free(((tpSirAssocReq)
3677 (psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
Jeff Johnson295189b2012-06-20 16:38:30 -07003678 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
3679 }
3680
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303681 vos_mem_free(psessionEntry->parsedAssocReq[pStaDs->assocId]);
Jeff Johnson295189b2012-06-20 16:38:30 -07003682 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
3683 }
3684 }
3685
3686} /*** end __limProcessSmeAssocCnfNew() ***/
3687
3688
Jeff Johnson295189b2012-06-20 16:38:30 -07003689
3690
3691static void
3692__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3693{
3694 tpDphHashNode pStaDs;
3695 tSirMacAddr peerMac;
3696 tpSirAddtsReq pSirAddts;
3697 tANI_U32 timeout;
3698 tpPESession psessionEntry;
3699 tANI_U8 sessionId; //PE sessionId
3700 tANI_U8 smesessionId;
3701 tANI_U16 smetransactionId;
3702
3703
3704 if(pMsgBuf == NULL)
3705 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003706 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003707 return;
3708 }
3709
3710 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3711
3712 pSirAddts = (tpSirAddtsReq) pMsgBuf;
3713
3714 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
3715 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003716 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003717 return;
3718 }
3719#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3720 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
3721#endif //FEATURE_WLAN_DIAG_SUPPORT
3722
3723
3724
3725 /* if sta
3726 * - verify assoc state
3727 * - send addts request to ap
3728 * - wait for addts response from ap
3729 * if ap, just ignore with error log
3730 */
3731 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003732 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003733 pSirAddts->req.tspec.tsinfo.traffic.tsid,
3734 pSirAddts->req.tspec.tsinfo.traffic.userPrio);)
3735
3736 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
3737 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003738 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003739 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3740 smesessionId,smetransactionId);
3741 return;
3742 }
3743
3744 //Ignore the request if STA is in 11B mode.
3745 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
3746 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003747 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003748 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3749 smesessionId,smetransactionId);
3750 return;
3751 }
3752
3753
3754 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3755
3756 if(pStaDs == NULL)
3757 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003758 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003759 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3760 smesessionId,smetransactionId);
3761 return;
3762 }
3763
3764 if ((! pStaDs->valid) ||
3765 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
3766 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003767 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003768 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3769 smesessionId,smetransactionId);
3770 return;
3771 }
3772
3773 pSirAddts->req.wsmTspecPresent = 0;
3774 pSirAddts->req.wmeTspecPresent = 0;
3775 pSirAddts->req.lleTspecPresent = 0;
3776
3777 if ((pStaDs->wsmEnabled) &&
3778 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
3779 pSirAddts->req.wsmTspecPresent = 1;
3780 else if (pStaDs->wmeEnabled)
3781 pSirAddts->req.wmeTspecPresent = 1;
3782 else if (pStaDs->lleEnabled)
3783 pSirAddts->req.lleTspecPresent = 1;
3784 else
3785 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003786 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003787 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3788 smesessionId,smetransactionId);
3789 return;
3790 }
3791
3792 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
3793 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
3794 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003795 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)",
Jeff Johnson295189b2012-06-20 16:38:30 -07003796 psessionEntry->limSmeState);
3797 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3798 smesessionId,smetransactionId);
3799 return;
3800 }
3801
3802 if (pMac->lim.gLimAddtsSent)
3803 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003804 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending",
Jeff Johnson295189b2012-06-20 16:38:30 -07003805 pMac->lim.gLimAddtsReq.req.dialogToken,
3806 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
3807 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
3808 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3809 smesessionId,smetransactionId);
3810 return;
3811 }
3812
3813 #if 0
3814 val = sizeof(tSirMacAddr);
3815 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
3816 {
3817 /// Could not get BSSID from CFG. Log error.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003818 limLog(pMac, LOGP, FL("could not retrieve BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003819 return;
3820 }
3821 #endif
3822 sirCopyMacAddr(peerMac,psessionEntry->bssId);
3823
3824 // save the addts request
3825 pMac->lim.gLimAddtsSent = true;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05303826 vos_mem_copy( (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
Jeff Johnson295189b2012-06-20 16:38:30 -07003827
3828 // ship out the message now
3829 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
3830 psessionEntry);
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003831 PELOG1(limLog(pMac, LOG1, "Sent ADDTS request");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003832
3833 // start a timer to wait for the response
3834 if (pSirAddts->timeout)
3835 timeout = pSirAddts->timeout;
3836 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
3837 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003838 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003839 WNI_CFG_ADDTS_RSP_TIMEOUT);
3840 return;
3841 }
3842
3843 timeout = SYS_MS_TO_TICKS(timeout);
3844 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
3845 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003846 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003847 return;
3848 }
3849 pMac->lim.gLimAddtsRspTimerCount++;
3850 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
3851 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
3852 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003853 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003854 return;
3855 }
Jeff Johnsone7245742012-09-05 17:12:55 -07003856 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07003857
3858 //add the sessionId to the timer object
3859 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
3860 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
3861 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003862 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003863 return;
3864 }
3865 return;
3866}
3867
3868
3869static void
3870__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3871{
3872 tSirMacAddr peerMacAddr;
3873 tANI_U8 ac;
3874 tSirMacTSInfo *pTsinfo;
3875 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
3876 tpDphHashNode pStaDs = NULL;
3877 tpPESession psessionEntry;
3878 tANI_U8 sessionId;
3879 tANI_U32 status = eSIR_SUCCESS;
3880 tANI_U8 smesessionId;
3881 tANI_U16 smetransactionId;
3882
3883 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3884
3885 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
3886 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003887 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07003888 status = eSIR_FAILURE;
3889 goto end;
3890 }
3891#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3892 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
3893#endif //FEATURE_WLAN_DIAG_SUPPORT
3894
3895
3896 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
3897 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003898 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07003899 status = eSIR_FAILURE;
3900 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
3901 return;
3902 }
3903
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003904 PELOG1(limLog(pMac, LOG1, FL("Sent DELTS request to station with assocId = %d MacAddr = %x:%x:%x:%x:%x:%x"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003905 pDeltsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
3906 peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);)
3907
3908 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
3909 psessionEntry);
3910
3911 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
3912
3913 /* We've successfully send DELTS frame to AP. Update the
3914 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
3915 * is no longer trigger enabled or delivery enabled
3916 */
3917 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
3918
3919 /* We're deleting the TSPEC, so this particular AC is no longer
3920 * admitted. PE needs to downgrade the EDCA
3921 * parameters(for the AC for which TS is being deleted) to the
3922 * next best AC for which ACM is not enabled, and send the
3923 * updated values to HAL.
3924 */
3925 ac = upToAc(pTsinfo->traffic.userPrio);
3926
3927 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
3928 {
3929 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
3930 }
3931 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
3932 {
3933 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
3934 }
3935 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
3936 {
3937 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
3938 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
3939 }
3940
3941 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
3942
3943 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3944 if (pStaDs != NULL)
3945 {
3946 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
3947 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
3948 else
3949 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
3950 status = eSIR_SUCCESS;
3951 }
3952 else
3953 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003954 limLog(pMac, LOGE, FL("Self entry missing in Hash Table "));
Jeff Johnson295189b2012-06-20 16:38:30 -07003955 status = eSIR_FAILURE;
3956 }
3957#ifdef FEATURE_WLAN_CCX
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07003958#ifdef FEATURE_WLAN_CCX_UPLOAD
3959 limSendSmeTsmIEInd(pMac, psessionEntry, 0, 0, 0);
3960#else
Jeff Johnson295189b2012-06-20 16:38:30 -07003961 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07003962#endif /* FEATURE_WLAN_CCX_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07003963#endif
3964
3965 // send an sme response back
3966 end:
3967 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
3968}
3969
3970
3971void
3972limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
3973{
3974 //fetch the sessionEntry based on the sessionId
3975 tpPESession psessionEntry;
3976 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
3977 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003978 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07003979 return;
3980 }
3981
3982 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
3983 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003984 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)", psessionEntry->limSystemRole);
Jeff Johnson295189b2012-06-20 16:38:30 -07003985 pMac->lim.gLimAddtsSent = false;
3986 return;
3987 }
3988
3989 if (! pMac->lim.gLimAddtsSent)
3990 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003991 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent");)
Jeff Johnson295189b2012-06-20 16:38:30 -07003992 return;
3993 }
3994
3995 if (param != pMac->lim.gLimAddtsRspTimerCount)
3996 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07003997 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07003998 param, pMac->lim.gLimAddtsRspTimerCount);
3999 return;
4000 }
4001
4002 // this a real response timeout
4003 pMac->lim.gLimAddtsSent = false;
4004 pMac->lim.gLimAddtsRspTimerCount++;
4005
4006 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4007 psessionEntry->smeSessionId, psessionEntry->transactionId);
4008}
4009
4010
4011/**
4012 * __limProcessSmeStatsRequest()
4013 *
4014 *FUNCTION:
4015 *
4016 *
4017 *NOTE:
4018 *
4019 * @param pMac Pointer to Global MAC structure
4020 * @param *pMsgBuf A pointer to the SME message buffer
4021 * @return None
4022 */
4023static void
4024__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4025{
4026 tpAniGetStatsReq pStatsReq;
4027 tSirMsgQ msgQ;
4028 tpPESession psessionEntry;
4029 tANI_U8 sessionId;
4030
4031
4032 if(pMsgBuf == NULL)
4033 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004034 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004035 return;
4036 }
4037
4038 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4039
4040 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4041 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004042 limLog(pMac, LOGE, FL("session does not exist for given bssId"));
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304043 vos_mem_free( pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004044 return;
4045 }
4046
4047
4048
4049 switch(pStatsReq->msgType)
4050 {
4051 //Add Lim stats here. and send reqsponse.
4052
4053 //HAL maintained Stats.
4054 case eWNI_SME_STA_STAT_REQ:
4055 msgQ.type = WDA_STA_STAT_REQ;
4056 break;
4057 case eWNI_SME_AGGR_STAT_REQ:
4058 msgQ.type = WDA_AGGR_STAT_REQ;
4059 break;
4060 case eWNI_SME_GLOBAL_STAT_REQ:
4061 msgQ.type = WDA_GLOBAL_STAT_REQ;
4062 break;
4063 case eWNI_SME_STAT_SUMM_REQ:
4064 msgQ.type = WDA_STAT_SUMM_REQ;
4065 break;
4066 default: //Unknown request.
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004067 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request");)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304068 vos_mem_free( pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004069 return;
4070 }
4071
Jeff Johnson295189b2012-06-20 16:38:30 -07004072 msgQ.reserved = 0;
4073 msgQ.bodyptr = pMsgBuf;
4074 msgQ.bodyval = 0;
Leela Venkata Kiran Kumar Reddy Chirala68a6abe2013-02-28 07:43:16 -08004075 if(NULL == psessionEntry)
4076 {
4077 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4078 }
4079 else
4080 {
4081 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
4082 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004083 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004084 limLog(pMac, LOGP, "Unable to forward request");
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304085 vos_mem_free( pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004086 return;
4087 }
4088
4089 return;
4090}
4091
4092
4093/**
4094 * __limProcessSmeGetStatisticsRequest()
4095 *
4096 *FUNCTION:
4097 *
4098 *
4099 *NOTE:
4100 *
4101 * @param pMac Pointer to Global MAC structure
4102 * @param *pMsgBuf A pointer to the SME message buffer
4103 * @return None
4104 */
4105static void
4106__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4107{
4108 tpAniGetPEStatsReq pPEStatsReq;
4109 tSirMsgQ msgQ;
4110
4111 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4112
4113 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4114
4115 msgQ.type = WDA_GET_STATISTICS_REQ;
4116
Jeff Johnson295189b2012-06-20 16:38:30 -07004117 msgQ.reserved = 0;
4118 msgQ.bodyptr = pMsgBuf;
4119 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004120 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004121
4122 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304123 vos_mem_free( pMsgBuf );
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004124 limLog(pMac, LOGP, "Unable to forward request");
Jeff Johnson295189b2012-06-20 16:38:30 -07004125 return;
4126 }
4127
4128 return;
4129}
4130
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004131#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
4132/**
4133 *FUNCTION: __limProcessSmeGetTsmStatsRequest()
4134 *
4135 *NOTE:
4136 *
4137 * @param pMac Pointer to Global MAC structure
4138 * @param *pMsgBuf A pointer to the SME message buffer
4139 * @return None
4140 */
4141static void
4142__limProcessSmeGetTsmStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4143{
4144 tSirMsgQ msgQ;
4145
4146 msgQ.type = WDA_TSM_STATS_REQ;
4147 msgQ.reserved = 0;
4148 msgQ.bodyptr = pMsgBuf;
4149 msgQ.bodyval = 0;
4150 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4151
4152 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4153 vos_mem_free( pMsgBuf );
4154 limLog(pMac, LOGP, "Unable to forward request");
4155 return;
4156 }
4157}
4158#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
4159
4160
Jeff Johnson295189b2012-06-20 16:38:30 -07004161
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004162#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
4163/**
4164 * __limProcessSmeGetRoamRssiRequest()
4165 *
4166 *FUNCTION:
4167 *
4168 *
4169 *NOTE:
4170 *
4171 * @param pMac Pointer to Global MAC structure
4172 * @param *pMsgBuf A pointer to the SME message buffer
4173 * @return None
4174 */
4175static void
4176__limProcessSmeGetRoamRssiRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4177{
4178 tpAniGetRssiReq pPEGetRoamRssiReq = NULL;
4179 tSirMsgQ msgQ;
4180
4181 pPEGetRoamRssiReq = (tpAniGetRssiReq) pMsgBuf;
4182 msgQ.type = WDA_GET_ROAM_RSSI_REQ;
4183
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004184 msgQ.reserved = 0;
4185 msgQ.bodyptr = pMsgBuf;
4186 msgQ.bodyval = 0;
4187 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
4188
4189 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304190 vos_mem_free( pMsgBuf );
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004191 limLog(pMac, LOGP, "Unable to forward request");
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004192 return;
4193 }
4194
4195 return;
4196}
4197#endif
4198
4199
Jeff Johnson295189b2012-06-20 16:38:30 -07004200static void
4201__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4202{
4203 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4204 tpPESession psessionEntry;
4205 tANI_U8 sessionId; //PE sessionID
4206
4207 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004208 FL("received UPDATE_APWPSIEs_REQ message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004209
4210 if(pMsgBuf == NULL)
4211 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004212 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004213 return;
4214 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004215
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304216 pUpdateAPWPSIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4217 if ( NULL == pUpdateAPWPSIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004218 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304219 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPSIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004220 return;
4221 }
4222
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004223 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
Jeff Johnson295189b2012-06-20 16:38:30 -07004224 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004225 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004226 goto end;
4227 }
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004228
Jeff Johnson295189b2012-06-20 16:38:30 -07004229 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4230 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004231 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004232 goto end;
4233 }
4234
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304235 vos_mem_copy( &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004236
Jeff Johnson295189b2012-06-20 16:38:30 -07004237 schSetFixedBeaconFields(pMac, psessionEntry);
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08004238 limSendBeaconInd(pMac, psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07004239
4240end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304241 vos_mem_free( pUpdateAPWPSIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004242 return;
4243} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4244
4245static void
4246__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4247{
4248 tpSirUpdateParams pUpdateParams;
4249 tpPESession psessionEntry;
4250
4251 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004252 FL("received HIDE_SSID message")););
Jeff Johnson295189b2012-06-20 16:38:30 -07004253
4254 if(pMsgBuf == NULL)
4255 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004256 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004257 return;
4258 }
4259
4260 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4261
4262 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4263 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004264 limLog(pMac, LOGW, "Session does not exist for given sessionId %d",
Jeff Johnson295189b2012-06-20 16:38:30 -07004265 pUpdateParams->sessionId);
4266 return;
4267 }
4268
4269 /* Update the session entry */
4270 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4271
4272 /* Update beacon */
4273 schSetFixedBeaconFields(pMac, psessionEntry);
4274 limSendBeaconInd(pMac, psessionEntry);
4275
4276 return;
4277} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4278
4279static void
4280__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4281{
4282 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4283 tpPESession psessionEntry;
4284 tANI_U8 sessionId; //PE sessionID
4285
4286 if(pMsgBuf == NULL)
4287 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004288 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004289 return;
4290 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304291
4292 pUpdateAPWPARSNIEsReq = vos_mem_malloc(sizeof(tSirUpdateAPWPSIEsReq));
4293 if ( NULL == pUpdateAPWPARSNIEsReq )
Jeff Johnson295189b2012-06-20 16:38:30 -07004294 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304295 limLog(pMac, LOGP, FL("call to AllocateMemory failed for pUpdateAPWPARSNIEsReq"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004296 return;
4297 }
4298
4299 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4300 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004301 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004302 goto end;
4303 }
4304
4305 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4306 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004307 limLog(pMac, LOGW, FL("Session does not exist for given BSSID"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004308 goto end;
4309 }
4310
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304311 vos_mem_copy(&psessionEntry->pLimStartBssReq->rsnIE,
4312 &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
Jeff Johnson295189b2012-06-20 16:38:30 -07004313
4314 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4315
4316 psessionEntry->pLimStartBssReq->privacy = 1;
4317 psessionEntry->privacy = 1;
4318
4319 schSetFixedBeaconFields(pMac, psessionEntry);
4320 limSendBeaconInd(pMac, psessionEntry);
4321
4322end:
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304323 vos_mem_free(pUpdateAPWPARSNIEsReq);
Jeff Johnson295189b2012-06-20 16:38:30 -07004324 return;
4325} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4326
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004327/*
4328Update the beacon Interval dynamically if beaconInterval is different in MCC
4329*/
4330static void
4331__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4332{
4333 tpSirChangeBIParams pChangeBIParams;
4334 tpPESession psessionEntry;
4335 tANI_U8 sessionId = 0;
4336 tUpdateBeaconParams beaconParams;
4337
4338 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004339 FL("received Update Beacon Interval message")););
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004340
4341 if(pMsgBuf == NULL)
4342 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004343 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004344 return;
4345 }
4346
4347 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4348
4349 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4350 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004351 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004352 return;
4353 }
4354
4355 /*Update sessionEntry Beacon Interval*/
4356 if(psessionEntry->beaconParams.beaconInterval !=
4357 pChangeBIParams->beaconInterval )
4358 {
4359 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4360 }
4361
4362 /*Update sch beaconInterval*/
4363 if(pMac->sch.schObject.gSchBeaconInterval !=
4364 pChangeBIParams->beaconInterval )
4365 {
4366 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4367
4368 PELOG1(limLog(pMac, LOG1,
4369 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4370
4371 /* Update beacon */
4372 schSetFixedBeaconFields(pMac, psessionEntry);
4373
Sunil Ravib96f7b52013-05-22 21:40:05 -07004374 beaconParams.bssIdx = psessionEntry->bssIdx;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004375 //Set change in beacon Interval
4376 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
Jeff Johnson312557b2013-04-03 16:27:48 -07004377 beaconParams.paramChangeBitmap = PARAM_BCN_INTERVAL_CHANGED;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004378 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4379 }
4380
4381 return;
4382} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4383
Jeff Johnson295189b2012-06-20 16:38:30 -07004384
4385
4386/** -------------------------------------------------------------
4387\fn limProcessSmeDelBaPeerInd
4388\brief handles indication message from HDD to send delete BA request
4389\param tpAniSirGlobal pMac
4390\param tANI_U32 pMsgBuf
4391\return None
4392-------------------------------------------------------------*/
4393void
4394limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4395{
4396 tANI_U16 assocId =0;
4397 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4398 tpDphHashNode pSta;
4399 tpPESession psessionEntry;
4400 tANI_U8 sessionId;
4401
4402
4403
4404 if(NULL == pSmeDelBAPeerInd)
4405 return;
4406
4407 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4408 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004409 limLog(pMac, LOGE,FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004410 return;
4411 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004412 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07004413 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4414
4415 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4416 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4417 pSta,
4418 pSmeDelBAPeerInd->baDirection,
4419 pSmeDelBAPeerInd->baTID,
4420 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4421 {
4422 limLog( pMac, LOGW,
4423 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4424 if (pSta)
4425 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4426 }
4427}
4428
4429// --------------------------------------------------------------------
4430/**
4431 * __limProcessReportMessage
4432 *
4433 * FUNCTION: Processes the next received Radio Resource Management message
4434 *
4435 * LOGIC:
4436 *
4437 * ASSUMPTIONS:
4438 *
4439 * NOTE:
4440 *
4441 * @param None
4442 * @return None
4443 */
4444
4445void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4446{
4447#ifdef WLAN_FEATURE_VOWIFI
4448 switch (pMsg->type)
4449 {
4450 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4451 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4452 break;
4453 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4454 {
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07004455#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07004456 tpSirBeaconReportXmitInd pBcnReport=NULL;
4457 tpPESession psessionEntry=NULL;
4458 tANI_U8 sessionId;
4459
4460 if(pMsg->bodyptr == NULL)
4461 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004462 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004463 return;
4464 }
4465 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4466 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4467 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004468 limLog(pMac, LOGE, "Session Does not exist for given bssId");
Jeff Johnson295189b2012-06-20 16:38:30 -07004469 return;
4470 }
4471 if (psessionEntry->isCCXconnection)
4472 ccxProcessBeaconReportXmit( pMac, pMsg->bodyptr);
4473 else
4474#endif
4475 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4476 }
4477 break;
4478 }
4479#endif
4480}
4481
4482#if defined(FEATURE_WLAN_CCX) || defined(WLAN_FEATURE_VOWIFI)
4483// --------------------------------------------------------------------
4484/**
4485 * limSendSetMaxTxPowerReq
4486 *
4487 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4488 *
4489 * LOGIC:
4490 *
4491 * ASSUMPTIONS:
4492 *
4493 * NOTE:
4494 *
4495 * @param txPower txPower to be set.
4496 * @param pSessionEntry session entry.
4497 * @return None
4498 */
4499tSirRetStatus
4500limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4501{
4502 tpMaxTxPowerParams pMaxTxParams = NULL;
4503 tSirRetStatus retCode = eSIR_SUCCESS;
4504 tSirMsgQ msgQ;
4505
4506 if( pSessionEntry == NULL )
4507 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004508 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters", __func__, __LINE__ );)
Jeff Johnson295189b2012-06-20 16:38:30 -07004509 return eSIR_FAILURE;
4510 }
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304511
4512 pMaxTxParams = vos_mem_malloc(sizeof(tMaxTxPowerParams));
4513 if ( NULL == pMaxTxParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004514 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004515 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams ", __func__, __LINE__);
Jeff Johnson295189b2012-06-20 16:38:30 -07004516 return eSIR_MEM_ALLOC_FAILED;
4517
4518 }
4519#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_CCX)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004520 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 -07004521#endif
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004522 if( pMaxTxParams == NULL )
4523 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004524 limLog( pMac, LOGE, "%s:%d: pMaxTxParams is NULL", __func__, __LINE__);
Kiran Kumar Lokerea4db3dc2013-03-25 18:05:24 -07004525 return eSIR_FAILURE;
4526 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004527 pMaxTxParams->power = txPower;
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304528 vos_mem_copy( pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4529 vos_mem_copy( pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004530
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004531 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4532 msgQ.bodyptr = pMaxTxParams;
4533 msgQ.bodyval = 0;
4534 PELOG1(limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA"));)
4535 MTRACE(macTraceMsgTx(pMac, pSessionEntry->peSessionId, msgQ.type));
4536 retCode = wdaPostCtrlMsg(pMac, &msgQ);
4537 if (eSIR_SUCCESS != retCode)
4538 {
4539 PELOGE(limLog(pMac, LOGE, FL("wdaPostCtrlMsg() failed"));)
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304540 vos_mem_free(pMaxTxParams);
Jeff Johnson68ce9c42013-04-08 10:33:28 -07004541 }
4542 return retCode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004543}
4544#endif
4545
4546/**
4547 * __limProcessSmeAddStaSelfReq()
4548 *
4549 *FUNCTION:
4550 * This function is called to process SME_ADD_STA_SELF_REQ message
4551 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4552 *
4553 *LOGIC:
4554 *
4555 *ASSUMPTIONS:
4556 *
4557 *NOTE:
4558 *
4559 * @param pMac Pointer to Global MAC structure
4560 * @param *pMsgBuf A pointer to the SME message buffer
4561 * @return None
4562 */
4563
4564static void
4565__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4566{
4567 tSirMsgQ msg;
4568 tpAddStaSelfParams pAddStaSelfParams;
4569 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
4570
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304571 pAddStaSelfParams = vos_mem_malloc(sizeof(tAddStaSelfParams));
4572 if ( NULL == pAddStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004573 {
4574 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
4575 return;
4576 }
4577
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304578 vos_mem_copy( pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Kiran Kumar Lokeread7dbc82013-10-07 20:12:50 -07004579 pAddStaSelfParams->currDeviceMode = pSmeReq->currDeviceMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07004580 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
4581 msg.reserved = 0;
4582 msg.bodyptr = pAddStaSelfParams;
4583 msg.bodyval = 0;
4584
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004585 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004586 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004587
4588 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4589 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004590 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004591 }
4592 return;
4593} /*** end __limProcessAddStaSelfReq() ***/
4594
4595
4596/**
4597 * __limProcessSmeDelStaSelfReq()
4598 *
4599 *FUNCTION:
4600 * This function is called to process SME_DEL_STA_SELF_REQ message
4601 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
4602 *
4603 *LOGIC:
4604 *
4605 *ASSUMPTIONS:
4606 *
4607 *NOTE:
4608 *
4609 * @param pMac Pointer to Global MAC structure
4610 * @param *pMsgBuf A pointer to the SME message buffer
4611 * @return None
4612 */
4613
4614static void
4615__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4616{
4617 tSirMsgQ msg;
4618 tpDelStaSelfParams pDelStaSelfParams;
4619 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
4620
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304621 pDelStaSelfParams = vos_mem_malloc(sizeof( tDelStaSelfParams));
4622 if ( NULL == pDelStaSelfParams )
Jeff Johnson295189b2012-06-20 16:38:30 -07004623 {
4624 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
4625 return;
4626 }
4627
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304628 vos_mem_copy( pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
Jeff Johnson295189b2012-06-20 16:38:30 -07004629
4630 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
4631 msg.reserved = 0;
4632 msg.bodyptr = pDelStaSelfParams;
4633 msg.bodyval = 0;
4634
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004635 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004636 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004637
4638 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4639 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004640 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed"));
Jeff Johnson295189b2012-06-20 16:38:30 -07004641 }
4642 return;
4643} /*** end __limProcessSmeDelStaSelfReq() ***/
4644
4645
Jeff Johnson295189b2012-06-20 16:38:30 -07004646/**
4647 * __limProcessSmeRegisterMgmtFrameReq()
4648 *
4649 *FUNCTION:
4650 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
4651 * from SME. It Register this information within PE.
4652 *
4653 *LOGIC:
4654 *
4655 *ASSUMPTIONS:
4656 *
4657 *NOTE:
4658 *
4659 * @param pMac Pointer to Global MAC structure
4660 * @param *pMsgBuf A pointer to the SME message buffer
4661 * @return None
4662 */
4663static void
4664__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4665{
4666 VOS_STATUS vosStatus;
4667 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
4668 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004669 tANI_BOOLEAN match = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004670 PELOG1(limLog(pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004671 FL("registerFrame %d, frameType %d, matchLen %d"),
Jeff Johnsone7245742012-09-05 17:12:55 -07004672 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004673
Jeff Johnsond13512a2012-07-17 11:42:19 -07004674 /* First check whether entry exists already*/
4675
4676 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4677 (vos_list_node_t**)&pLimMgmtRegistration);
4678
4679 while(pLimMgmtRegistration != NULL)
4680 {
4681 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
4682 {
4683 if(pSmeReq->matchLen)
4684 {
4685 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
4686 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304687 if (vos_mem_compare( pLimMgmtRegistration->matchData,
Jeff Johnsond13512a2012-07-17 11:42:19 -07004688 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
4689 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004690 /* found match! */
4691 match = VOS_TRUE;
4692 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004693 }
4694 }
4695 }
4696 else
4697 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004698 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07004699 match = VOS_TRUE;
4700 break;
4701 }
4702 }
4703 vosStatus = vos_list_peek_next (
4704 &pMac->lim.gLimMgmtFrameRegistratinQueue,
4705 (vos_list_node_t*) pLimMgmtRegistration,
4706 (vos_list_node_t**) &pNext );
4707
4708 pLimMgmtRegistration = pNext;
4709 pNext = NULL;
4710
4711 }
4712
4713 if (match)
4714 {
4715 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4716 (vos_list_node_t*)pLimMgmtRegistration);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304717 vos_mem_free(pLimMgmtRegistration);
Jeff Johnsond13512a2012-07-17 11:42:19 -07004718 }
4719
Jeff Johnson295189b2012-06-20 16:38:30 -07004720 if(pSmeReq->registerFrame)
4721 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304722 pLimMgmtRegistration = vos_mem_malloc(sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
4723 if ( pLimMgmtRegistration != NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07004724 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304725 vos_mem_set((void*)pLimMgmtRegistration,
4726 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen, 0 );
Jeff Johnson295189b2012-06-20 16:38:30 -07004727 pLimMgmtRegistration->frameType = pSmeReq->frameType;
4728 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
4729 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
4730 if(pSmeReq->matchLen)
4731 {
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304732 vos_mem_copy(pLimMgmtRegistration->matchData,
4733 pSmeReq->matchData, pSmeReq->matchLen);
Jeff Johnson295189b2012-06-20 16:38:30 -07004734 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004735 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4736 &pLimMgmtRegistration->node);
4737 }
4738 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004739
4740 return;
4741} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08004742
4743static tANI_BOOLEAN
Viral Modid440e682013-03-06 02:25:31 -08004744__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 noaDuration)
Viral Modid86bde22012-12-10 13:09:21 -08004745{
4746 tpP2pPsParams pMsgNoA;
4747 tSirMsgQ msg;
Vinay Malekal62757362012-12-17 12:15:51 -08004748
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304749 pMsgNoA = vos_mem_malloc(sizeof( tP2pPsConfig ));
4750 if ( NULL == pMsgNoA )
Viral Modid86bde22012-12-10 13:09:21 -08004751 {
4752 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004753 FL( "Unable to allocate memory during NoA Update" ));
Viral Modid440e682013-03-06 02:25:31 -08004754 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004755 }
4756
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304757 vos_mem_set((tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig), 0);
Viral Modid86bde22012-12-10 13:09:21 -08004758 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
4759 pMsgNoA->opp_ps = 0;
4760 pMsgNoA->ctWindow = 0;
4761 pMsgNoA->duration = 0;
4762 pMsgNoA->interval = 0;
4763 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08004764
Vinay Malekal62757362012-12-17 12:15:51 -08004765 /* Below params used for Single Shot NOA - so assign proper values */
4766 pMsgNoA->psSelection = P2P_SINGLE_NOA;
Viral Modid440e682013-03-06 02:25:31 -08004767 pMsgNoA->single_noa_duration = noaDuration;
Gopichand Nakkala096a1052012-12-21 07:05:34 -08004768
Viral Modid86bde22012-12-10 13:09:21 -08004769 /* Start Insert NOA timer
4770 * 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 -08004771 * or any other failure or reason, we still need to process the deferred SME req. The insert NOA
4772 * timer of 500 ms will ensure the stored SME req always gets processed
Viral Modid86bde22012-12-10 13:09:21 -08004773 */
4774 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
4775 == TX_TIMER_ERROR)
4776 {
4777 /// Could not activate Insert NOA timer.
4778 // Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004779 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer"));
Viral Modid86bde22012-12-10 13:09:21 -08004780
4781 // send the scan response back with status failure and do not even call insert NOA
4782 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304783 vos_mem_free(pMsgNoA);
Viral Modid440e682013-03-06 02:25:31 -08004784 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004785 }
4786
Viral Modid440e682013-03-06 02:25:31 -08004787 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_INSERT_SINGLESHOT_NOA_TIMER));
4788
Viral Modid86bde22012-12-10 13:09:21 -08004789 msg.type = WDA_SET_P2P_GO_NOA_REQ;
4790 msg.reserved = 0;
4791 msg.bodyptr = pMsgNoA;
4792 msg.bodyval = 0;
4793
4794 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4795 {
4796 /* 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 -07004797 limLog(pMac, LOGP, FL("wdaPost Msg failed"));
Viral Modid440e682013-03-06 02:25:31 -08004798 /* Deactivate the NOA timer in failure case */
4799 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
4800 goto error;
Viral Modid86bde22012-12-10 13:09:21 -08004801 }
Viral Modid440e682013-03-06 02:25:31 -08004802 return FALSE;
Viral Modid86bde22012-12-10 13:09:21 -08004803
Viral Modid440e682013-03-06 02:25:31 -08004804error:
4805 /* In any of the failure cases, just go ahead with the processing of registered deferred SME request without
4806 * worrying about the NOA
4807 */
4808 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
4809 // msg buffer is consumed and freed in above function so return FALSE
Viral Modid86bde22012-12-10 13:09:21 -08004810 return FALSE;
4811
4812}
4813
Viral Modid440e682013-03-06 02:25:31 -08004814static void __limRegisterDeferredSmeReqForNOAStart(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4815{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004816 limLog(pMac, LOG1, FL("Reg msgType %d"), msgType) ;
Viral Modid440e682013-03-06 02:25:31 -08004817 pMac->lim.gDeferMsgTypeForNOA = msgType;
4818 pMac->lim.gpDefdSmeMsgForNOA = pMsgBuf;
4819}
4820
4821static void __limDeregisterDeferredSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4822{
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004823 limLog(pMac, LOG1, FL("Dereg msgType %d"), pMac->lim.gDeferMsgTypeForNOA) ;
Viral Modid440e682013-03-06 02:25:31 -08004824 pMac->lim.gDeferMsgTypeForNOA = 0;
4825 if (pMac->lim.gpDefdSmeMsgForNOA != NULL)
4826 {
4827 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05304828 vos_mem_free(pMac->lim.gpDefdSmeMsgForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004829 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4830 }
4831}
4832
4833static
4834tANI_U32 limCalculateNOADuration(tpAniSirGlobal pMac, tANI_U16 msgType, tANI_U32 *pMsgBuf)
4835{
4836 tANI_U32 noaDuration = 0;
4837
4838 switch (msgType)
4839 {
4840 case eWNI_SME_SCAN_REQ:
4841 {
4842 tANI_U32 val;
4843 tANI_U8 i;
4844 tpSirSmeScanReq pScanReq = (tpSirSmeScanReq) pMsgBuf;
4845 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
4846 {
4847 /*
4848 * Could not get max channel value
4849 * from CFG. Log error.
4850 */
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004851 limLog(pMac, LOGP, FL("could not retrieve passive max channel value"));
Viral Modid440e682013-03-06 02:25:31 -08004852
4853 /* use a default value of 110ms */
4854 val = DEFAULT_PASSIVE_MAX_CHANNEL_TIME;
4855 }
4856
4857 for (i = 0; i < pScanReq->channelList.numChannels; i++) {
4858 tANI_U8 channelNum = pScanReq->channelList.channelNumber[i];
4859
4860 if (limActiveScanAllowed(pMac, channelNum)) {
4861 /* Use min + max channel time to calculate the total duration of scan */
4862 noaDuration += pScanReq->minChannelTime + pScanReq->maxChannelTime;
4863 } else {
4864 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
4865 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
4866 */
4867 noaDuration += val;
4868 }
4869 }
4870
4871 /* Adding an overhead of 20ms to account for the scan messaging delays */
4872 noaDuration += SCAN_MESSAGING_OVERHEAD;
4873 noaDuration *= CONV_MS_TO_US;
4874
4875 break;
4876 }
4877
4878 case eWNI_SME_OEM_DATA_REQ:
4879 noaDuration = OEM_DATA_NOA_DURATION*CONV_MS_TO_US; // use 60 msec as default
4880 break;
4881
4882 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
4883 {
4884 tSirRemainOnChnReq *pRemainOnChnReq = (tSirRemainOnChnReq *) pMsgBuf;
4885 noaDuration = (pRemainOnChnReq->duration)*CONV_MS_TO_US;
4886 break;
4887 }
4888
4889 case eWNI_SME_JOIN_REQ:
4890 noaDuration = JOIN_NOA_DURATION*CONV_MS_TO_US;
4891 break;
4892
4893 default:
4894 noaDuration = 0;
4895 break;
4896
4897 }
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004898 limLog(pMac, LOGW, FL("msgType %d noa %d"), msgType, noaDuration);
Viral Modid440e682013-03-06 02:25:31 -08004899 return noaDuration;
4900}
4901
4902void limProcessRegdDefdSmeReqAfterNOAStart(tpAniSirGlobal pMac)
4903{
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05304904 tANI_BOOLEAN bufConsumed = TRUE;
Viral Modid440e682013-03-06 02:25:31 -08004905
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004906 limLog(pMac, LOG1, FL("Process defd sme req %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004907 if ( (pMac->lim.gDeferMsgTypeForNOA != 0) &&
4908 (pMac->lim.gpDefdSmeMsgForNOA != NULL) )
4909 {
4910 switch (pMac->lim.gDeferMsgTypeForNOA)
4911 {
4912 case eWNI_SME_SCAN_REQ:
4913 __limProcessSmeScanReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4914 break;
4915 case eWNI_SME_OEM_DATA_REQ:
4916 __limProcessSmeOemDataReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4917 break;
4918 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Gopichand Nakkala7c4c3b92013-03-25 18:08:31 +05304919 bufConsumed = limProcessRemainOnChnlReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4920 /* limProcessRemainOnChnlReq doesnt want us to free the buffer since
4921 * it is freed in limRemainOnChnRsp. this change is to avoid "double free"
4922 */
4923 if (FALSE == bufConsumed)
4924 {
4925 pMac->lim.gpDefdSmeMsgForNOA = NULL;
4926 }
Viral Modid440e682013-03-06 02:25:31 -08004927 break;
4928 case eWNI_SME_JOIN_REQ:
4929 __limProcessSmeJoinReq(pMac, pMac->lim.gpDefdSmeMsgForNOA);
4930 break;
4931 default:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004932 limLog(pMac, LOGE, FL("Unknown deferred msg type %d"), pMac->lim.gDeferMsgTypeForNOA);
Viral Modid440e682013-03-06 02:25:31 -08004933 break;
4934 }
4935 __limDeregisterDeferredSmeReqAfterNOAStart(pMac);
4936 }
4937 else
4938 {
4939 limLog( pMac, LOGW, FL("start received from FW when no sme deferred msg pending. Do nothing."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004940 "It might happen sometime when NOA start ind and timeout happen at the same time"));
Viral Modid440e682013-03-06 02:25:31 -08004941 }
4942}
Jeff Johnson295189b2012-06-20 16:38:30 -07004943
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004944#ifdef FEATURE_WLAN_TDLS_INTERNAL
4945/*
4946 * Process Discovery request recieved from SME and transmit to AP.
4947 */
4948static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
4949 tANI_U32 *pMsgBuf)
4950{
4951 /* get all discovery request parameters */
4952 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
4953 tpPESession psessionEntry;
4954 tANI_U8 sessionId;
4955
4956 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004957 ("Discovery Req Recieved")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004958
4959 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
4960 == NULL)
4961 {
4962 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004963 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004964 disReq->sessionId);
4965 goto lim_tdls_dis_start_error;
4966 }
4967
4968 /* check if we are in proper state to work as TDLS client */
4969 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
4970 {
4971 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004972 "dis req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004973 psessionEntry->limSystemRole);
4974 goto lim_tdls_dis_start_error;
4975 }
4976
4977 /*
4978 * if we are still good, go ahead and check if we are in proper state to
4979 * do TDLS discovery procedure.
4980 */
4981 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4982 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4983 {
4984
4985 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07004986 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004987 goto lim_tdls_dis_start_error;
4988 }
4989
4990 /*
4991 * if we are still good, go ahead and transmit TDLS discovery request,
4992 * and save Dis Req info for future reference.
4993 */
4994
4995#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
4996 /*
4997 * send message to HAL to set RXP filters to receieve frame on
4998 * direct link..
4999 */
5000 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
5001 // psessionEntry->bssId) ;
5002#endif
5003
5004 /* save dis request message for matching dialog token */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305005 vos_mem_copy((tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
5006 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005007
5008 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005009 "Transmit Discovery Request Frame") ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005010 /* format TDLS discovery request frame and transmit it */
5011 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
5012 psessionEntry) ;
5013
5014 /* prepare for response */
5015 pMac->lim.gLimTdlsDisStaCount = 0 ;
5016 pMac->lim.gLimTdlsDisResultList = NULL ;
5017
5018 /*
5019 * start TDLS discovery request timer to wait for discovery responses
5020 * from all TDLS enabled clients in BSS.
5021 */
5022
5023 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005024 ("Start Discovery request Timeout Timer")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005025 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
5026 eLIM_TDLS_DISCOVERY_RSP_WAIT));
5027
5028 /* assign appropriate sessionId to the timer object */
5029 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
5030 psessionEntry->peSessionId;
5031
5032 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
5033 != TX_SUCCESS)
5034 {
5035 limLog(pMac, LOGP, FL("TDLS discovery response timer \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005036 activation failed!"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005037 goto lim_tdls_dis_start_error;
5038 }
5039 /*
5040 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
5041 * back to SME
5042 */
5043 return (eSIR_SUCCESS) ;
5044lim_tdls_dis_start_error:
5045 /* in error case, PE has to sent the response SME immediately with error code */
5046 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
5047 eWNI_SME_TDLS_DISCOVERY_START_RSP);
5048 return eSIR_FAILURE;
5049}
5050/*
5051 * Process link start request recieved from SME and transmit to AP.
5052 */
5053eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5054{
5055 /* get all discovery request parameters */
5056 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
5057 tLimTdlsLinkSetupInfo *linkSetupInfo;
5058 //tLimTdlsLinkSetupPeer *setupPeer;
5059 tpPESession psessionEntry;
5060 tANI_U8 sessionId;
5061 eHalStatus status;
5062
5063 if((psessionEntry = peFindSessionByBssid(pMac,
5064 setupReq->bssid, &sessionId)) == NULL)
5065 {
5066 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005067 "PE Session does not exist for given sme sessionId %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005068 setupReq->sessionId);
5069 goto lim_tdls_link_start_error;
5070 }
5071
5072 /* check if we are in proper state to work as TDLS client */
5073 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5074 {
5075 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005076 "TDLS link setup req received in wrong system Role %d",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005077 psessionEntry->limSystemRole);
5078 goto lim_tdls_link_start_error;
5079 }
5080
5081 /*
5082 * if we are still good, go ahead and check if we are in proper state to
5083 * do TDLS setup procedure.
5084 */
5085 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5086 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5087 {
5088 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005089 state (%d)", pMac->lim.gLimSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005090 goto lim_tdls_link_start_error;
5091 }
5092
5093 /*
5094 * Now, go ahead and transmit TDLS discovery request, and save setup Req
5095 * info for future reference.
5096 */
5097 /* create node for Link setup */
5098 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
5099 //setupPeer = NULL ;
5100
5101 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
5102 setupReq->peerMac, psessionEntry) ;
5103 if(eHAL_STATUS_SUCCESS == status)
5104 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5105 TDLS setup cnf TX complete is successful. */
5106 return eSIR_SUCCESS;
5107#if 0
5108
5109 /*
5110 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005111 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005112 * free this memory if any timeout is happen in link setup procedure
5113 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305114 setupPeer = vos_mem_malloc(sizeof( tLimTdlsLinkSetupPeer ));
5115 if ( NULL == setupPeer )
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005116 {
5117 limLog( pMac, LOGP,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005118 FL( "Unable to allocate memory during ADD_STA" ));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005119 VOS_ASSERT(0) ;
5120 return eSIR_MEM_ALLOC_FAILED;
5121 }
5122 setupPeer->dialog = setupReq->dialog ;
5123 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
5124 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
5125 /* TDLS_sessionize: remember sessionId for future */
5126 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
5127 setupPeer->tdls_bIsResponder = 1;
5128
5129 /*
5130 * we only populate peer MAC, so it can assit us to find the
5131 * TDLS peer after response/or after response timeout
5132 */
Madan Mohan Koyyalamudi9e8ce1f2013-07-11 10:40:43 +05305133 vos_mem_copy(setupPeer->peerMac, setupReq->peerMac,
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005134 sizeof(tSirMacAddr)) ;
5135 /* format TDLS discovery request frame and transmit it */
5136 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
5137 setupReq->dialog, psessionEntry, NULL, 0) ;
5138
5139 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
5140 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
5141 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
5142 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
5143 /* update setup peer list */
5144 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
5145 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
5146 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5147 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
5148 return eSIR_SUCCESS ;
5149#endif
5150lim_tdls_link_start_error:
5151 /* in case of error, return immediately to SME */
5152 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
5153 eWNI_SME_TDLS_LINK_START_RSP);
5154 return eSIR_FAILURE ;
5155}
5156
5157/*
5158 * Process link teardown request recieved from SME and transmit to AP.
5159 */
5160eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5161{
5162 /* get all discovery request parameters */
5163 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
5164 tLimTdlsLinkSetupPeer *setupPeer;
5165 tpPESession psessionEntry;
5166 tANI_U8 sessionId;
5167
5168 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
5169 {
5170 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005171 "PE Session does not exist for given sme sessionId %d", teardownReq->sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005172 goto lim_tdls_teardown_req_error;
5173 }
5174
5175 /* check if we are in proper state to work as TDLS client */
5176 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5177 {
5178 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005179 "TDLS teardown req received in wrong system Role %d", psessionEntry->limSystemRole);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005180 goto lim_tdls_teardown_req_error;
5181 }
5182
5183 /*
5184 * if we are still good, go ahead and check if we are in proper state to
5185 * do TDLS setup procedure.
5186 */
5187 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5188 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5189 {
5190 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005191 state (%d)", psessionEntry->limSmeState);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005192 goto lim_tdls_teardown_req_error;
5193 }
5194
5195 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005196 "Teardown for peer = %02x,%02x,%02x,%02x,%02x,%02x",
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005197 teardownReq->peerMac[0],
5198 teardownReq->peerMac[1],
5199 teardownReq->peerMac[2],
5200 teardownReq->peerMac[3],
5201 teardownReq->peerMac[4],
5202 teardownReq->peerMac[5]) ;
5203 /*
5204 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5205 * info for future reference.
5206 */
5207 /* Verify if this link is setup */
5208 setupPeer = NULL ;
5209 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5210 if(NULL == setupPeer)
5211 {
5212 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005213 ("invalid Peer on teardown ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005214 goto lim_tdls_teardown_req_error;
5215 }
5216
5217
5218 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5219 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5220 /* TDLS_sessionize: check sessionId in case */
5221 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5222 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005223 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)", \
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005224 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5225 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5226 }
5227
5228 /* format TDLS teardown request frame and transmit it */
5229 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5230 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5231 {
5232 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005233 ("couldn't send teardown frame ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005234 goto lim_tdls_teardown_req_error;
5235 }
5236 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5237 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5238 return eSIR_SUCCESS;
5239lim_tdls_teardown_req_error:
5240 /* in case of error, return immediately to SME */
5241 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5242 eWNI_SME_TDLS_TEARDOWN_RSP);
5243 return eSIR_FAILURE;
5244}
5245
5246
5247#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005248
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305249static void
5250__limProcessSmeResetApCapsChange(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5251{
5252 tpSirResetAPCapsChange pResetCapsChange;
5253 tpPESession psessionEntry;
5254 tANI_U8 sessionId = 0;
5255 if (pMsgBuf == NULL)
5256 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005257 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305258 return;
5259 }
5260
5261 pResetCapsChange = (tpSirResetAPCapsChange)pMsgBuf;
5262 psessionEntry = peFindSessionByBssid(pMac, pResetCapsChange->bssId, &sessionId);
5263 if (psessionEntry == NULL)
5264 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005265 limLog(pMac, LOGE, FL("Session does not exist for given BSSID"));
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305266 return;
5267 }
5268
5269 psessionEntry->limSentCapsChangeNtf = false;
5270 return;
5271}
5272
Jeff Johnson295189b2012-06-20 16:38:30 -07005273/**
5274 * limProcessSmeReqMessages()
5275 *
5276 *FUNCTION:
5277 * This function is called by limProcessMessageQueue(). This
5278 * function processes SME request messages from HDD or upper layer
5279 * application.
5280 *
5281 *LOGIC:
5282 *
5283 *ASSUMPTIONS:
5284 *
5285 *NOTE:
5286 *
5287 * @param pMac Pointer to Global MAC structure
5288 * @param msgType Indicates the SME message type
5289 * @param *pMsgBuf A pointer to the SME message buffer
5290 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5291 * FALSE - if pMsgBuf is not to be freed.
5292 */
5293
5294tANI_BOOLEAN
5295limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5296{
5297 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5298 tANI_U32 *pMsgBuf = pMsg->bodyptr;
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005299 tpSirSmeScanReq pScanReq;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005300 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 -07005301 limMsgStr(pMsg->type), pMsg->type,
5302 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5303 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5304
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005305 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Viral Modid440e682013-03-06 02:25:31 -08005306 /* Special handling of some SME Req msgs where we have an existing GO session and
5307 * want to insert NOA before processing those msgs. These msgs will be processed later when
5308 * start event happens
5309 */
5310 switch (pMsg->type)
5311 {
5312 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005313 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Sudhir Sattayappa Kohalliabf751c2013-06-30 15:37:18 -07005314
5315 /* If scan is disabled return from here
5316 */
5317 if (pMac->lim.fScanDisabled)
5318 {
5319 PELOGE(limLog(pMac, LOGE, FL("Error: Scan Disabled"));)
5320 if (pMsg->type == eWNI_SME_SCAN_REQ)
5321 {
5322 limSendSmeScanRsp(pMac,
5323 offsetof(tSirSmeScanRsp,bssDescription[0]),
5324 eSIR_SME_INVALID_PARAMETERS,
5325 pScanReq->sessionId,
5326 pScanReq->transactionId);
5327
5328 bufConsumed = TRUE;
5329 }
5330 else if (pMsg->type == eWNI_SME_REMAIN_ON_CHANNEL_REQ)
5331 {
5332 pMac->lim.gpDefdSmeMsgForNOA = NULL;
5333 pMac->lim.gpLimRemainOnChanReq = (tpSirRemainOnChnReq )pMsgBuf;
5334 limRemainOnChnRsp(pMac,eHAL_STATUS_FAILURE, NULL);
5335
5336 /*
5337 * limRemainOnChnRsp will free the buffer this change is to
5338 * avoid "double free"
5339 */
5340 bufConsumed = FALSE;
5341 }
5342
5343 return bufConsumed;
5344 }
5345 /*
5346 * Do not add BREAK here
5347 */
5348 case eWNI_SME_OEM_DATA_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005349 case eWNI_SME_JOIN_REQ:
5350 /* If we have an existing P2P GO session we need to insert NOA before actually process this SME Req */
5351 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5352 {
5353 tANI_U32 noaDuration;
5354 __limRegisterDeferredSmeReqForNOAStart(pMac, pMsg->type, pMsgBuf);
5355 noaDuration = limCalculateNOADuration(pMac, pMsg->type, pMsgBuf);
5356 bufConsumed = __limInsertSingleShotNOAForScan(pMac, noaDuration);
5357 return bufConsumed;
5358 }
5359 }
5360 /* If no insert NOA required then execute the code below */
5361
Jeff Johnson295189b2012-06-20 16:38:30 -07005362 switch (pMsg->type)
5363 {
5364 case eWNI_SME_START_REQ:
5365 __limProcessSmeStartReq(pMac, pMsgBuf);
5366 break;
5367
5368 case eWNI_SME_SYS_READY_IND:
5369 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5370 break;
5371
Jeff Johnson295189b2012-06-20 16:38:30 -07005372 case eWNI_SME_START_BSS_REQ:
5373 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5374 break;
5375
5376 case eWNI_SME_SCAN_REQ:
Viral Modid440e682013-03-06 02:25:31 -08005377 __limProcessSmeScanReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005378 break;
5379
Jeff Johnsone7245742012-09-05 17:12:55 -07005380#ifdef FEATURE_OEM_DATA_SUPPORT
5381 case eWNI_SME_OEM_DATA_REQ:
5382 __limProcessSmeOemDataReq(pMac, pMsgBuf);
Jeff Johnsone7245742012-09-05 17:12:55 -07005383 break;
5384#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005385 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5386 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5387 break;
5388
5389 case eWNI_SME_UPDATE_NOA:
5390 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5391 break;
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05305392 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
5393 __limProcessClearDfsChannelList(pMac, pMsg);
5394 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005395 case eWNI_SME_JOIN_REQ:
5396 __limProcessSmeJoinReq(pMac, pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07005397 break;
5398
5399 case eWNI_SME_AUTH_REQ:
5400 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5401
5402 break;
5403
5404 case eWNI_SME_REASSOC_REQ:
5405 __limProcessSmeReassocReq(pMac, pMsgBuf);
5406
5407 break;
5408
5409 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5410 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5411
5412 break;
5413
5414 case eWNI_SME_DISASSOC_REQ:
5415 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5416
5417 break;
5418
5419 case eWNI_SME_DISASSOC_CNF:
5420 case eWNI_SME_DEAUTH_CNF:
5421 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5422
5423 break;
5424
5425 case eWNI_SME_DEAUTH_REQ:
5426 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5427
5428 break;
5429
Jeff Johnson295189b2012-06-20 16:38:30 -07005430
5431
5432 case eWNI_SME_SETCONTEXT_REQ:
5433 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5434
5435 break;
5436
5437 case eWNI_SME_REMOVEKEY_REQ:
5438 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5439
5440 break;
5441
5442 case eWNI_SME_STOP_BSS_REQ:
5443 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5444 break;
5445
5446 case eWNI_SME_ASSOC_CNF:
5447 case eWNI_SME_REASSOC_CNF:
5448 if (pMsg->type == eWNI_SME_ASSOC_CNF)
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005449 PELOG1(limLog(pMac, LOG1, FL("Received ASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005450 else
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005451 PELOG1(limLog(pMac, LOG1, FL("Received REASSOC_CNF message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005452 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5453 break;
5454
5455 case eWNI_SME_ADDTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005456 PELOG1(limLog(pMac, LOG1, FL("Received ADDTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005457 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5458 break;
5459
5460 case eWNI_SME_DELTS_REQ:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005461 PELOG1(limLog(pMac, LOG1, FL("Received DELTS_REQ message"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005462 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5463 break;
5464
5465 case SIR_LIM_ADDTS_RSP_TIMEOUT:
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07005466 PELOG1(limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message "));)
Jeff Johnson295189b2012-06-20 16:38:30 -07005467 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5468 break;
5469
5470 case eWNI_SME_STA_STAT_REQ:
5471 case eWNI_SME_AGGR_STAT_REQ:
5472 case eWNI_SME_GLOBAL_STAT_REQ:
5473 case eWNI_SME_STAT_SUMM_REQ:
5474 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5475 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5476 bufConsumed = FALSE;
5477 break;
5478 case eWNI_SME_GET_STATISTICS_REQ:
5479 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5480 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5481 bufConsumed = FALSE;
5482 break;
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08005483#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
5484 case eWNI_SME_GET_ROAM_RSSI_REQ:
5485 __limProcessSmeGetRoamRssiRequest( pMac, pMsgBuf);
5486 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5487 bufConsumed = FALSE;
5488 break;
5489#endif
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005490#if defined(FEATURE_WLAN_CCX) && defined(FEATURE_WLAN_CCX_UPLOAD)
5491 case eWNI_SME_GET_TSM_STATS_REQ:
5492 __limProcessSmeGetTsmStatsRequest( pMac, pMsgBuf);
5493 bufConsumed = FALSE;
5494 break;
5495#endif /* FEATURE_WLAN_CCX && FEATURE_WLAN_CCX_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07005496 case eWNI_SME_DEL_BA_PEER_IND:
5497 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5498 break;
5499 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5500 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5501 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005502 case eWNI_SME_GET_ASSOC_STAS_REQ:
5503 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5504 break;
5505 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5506 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5507 break;
5508
5509 case eWNI_SME_HIDE_SSID_REQ:
5510 __limProcessSmeHideSSID(pMac, pMsgBuf);
5511 break;
5512 case eWNI_SME_UPDATE_APWPSIE_REQ:
5513 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5514 break;
5515 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5516 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5517 break;
5518
5519 case eWNI_SME_SET_APWPARSNIEs_REQ:
5520 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5521 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005522
5523 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5524 //Update the beaconInterval
5525 __limProcessSmeChangeBI(pMac, pMsgBuf );
5526 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005527
5528#if defined WLAN_FEATURE_VOWIFI
5529 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5530 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5531 __limProcessReportMessage(pMac, pMsg);
5532 break;
5533#endif
5534
5535#if defined WLAN_FEATURE_VOWIFI_11R
5536 case eWNI_SME_FT_PRE_AUTH_REQ:
5537 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5538 break;
5539 case eWNI_SME_FT_UPDATE_KEY:
5540 limProcessFTUpdateKey(pMac, pMsgBuf);
5541 break;
5542
5543 case eWNI_SME_FT_AGGR_QOS_REQ:
5544 limProcessFTAggrQosReq(pMac, pMsgBuf);
5545 break;
5546#endif
5547
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07005548#if defined(FEATURE_WLAN_CCX) && !defined(FEATURE_WLAN_CCX_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07005549 case eWNI_SME_CCX_ADJACENT_AP_REPORT:
5550 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5551 break;
5552#endif
5553 case eWNI_SME_ADD_STA_SELF_REQ:
5554 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5555 break;
5556 case eWNI_SME_DEL_STA_SELF_REQ:
5557 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5558 break;
5559
Jeff Johnson295189b2012-06-20 16:38:30 -07005560 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5561 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5562 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005563#ifdef FEATURE_WLAN_TDLS
5564 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5565 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5566 break;
5567 case eWNI_SME_TDLS_ADD_STA_REQ:
5568 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5569 break;
5570 case eWNI_SME_TDLS_DEL_STA_REQ:
5571 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5572 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05305573 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
5574 limProcesSmeTdlsLinkEstablishReq(pMac, pMsgBuf);
5575 break;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005576#endif
5577#ifdef FEATURE_WLAN_TDLS_INTERNAL
5578 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
5579 limProcessSmeDisStartReq(pMac, pMsgBuf);
5580 break ;
5581 case eWNI_SME_TDLS_LINK_START_REQ:
5582 limProcessSmeLinkStartReq(pMac, pMsgBuf);
5583 break ;
5584 case eWNI_SME_TDLS_TEARDOWN_REQ:
5585 limProcessSmeTeardownReq(pMac, pMsgBuf);
5586 break ;
5587#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05305588 case eWNI_SME_RESET_AP_CAPS_CHANGED:
5589 __limProcessSmeResetApCapsChange(pMac, pMsgBuf);
5590 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005591
schang86c22c42013-03-13 18:41:24 -07005592 case eWNI_SME_SET_TX_POWER_REQ:
5593 limSendSetTxPowerReq(pMac, pMsgBuf);
5594 break ;
5595
Jeff Johnson295189b2012-06-20 16:38:30 -07005596 default:
5597 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5598 pMsg->bodyptr = NULL;
5599 break;
5600 } // switch (msgType)
5601
5602 return bufConsumed;
5603} /*** end limProcessSmeReqMessages() ***/