blob: 595aad12a418659f34c66c3bd7fe85226b2a736e [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"
56#ifdef ANI_PRODUCT_TYPE_AP
57#include "wniCfgAp.h"
58#else
59#include "wniCfgSta.h"
60#endif
61#include "cfgApi.h"
62#include "sirApi.h"
63#include "schApi.h"
64#include "utilsApi.h"
65#include "limTypes.h"
66#include "limUtils.h"
67#include "limAssocUtils.h"
68#include "limSecurityUtils.h"
69#include "limSerDesUtils.h"
70#include "limSmeReqUtils.h"
71#include "limIbssPeerMgmt.h"
72#include "limAdmitControl.h"
73#include "dphHashTable.h"
74#include "limSendMessages.h"
75#include "limApi.h"
76#include "wmmApsd.h"
77
78#ifdef WLAN_SOFTAP_FEATURE
79#include "sapApi.h"
80#endif
81
82#if defined WLAN_FEATURE_VOWIFI
83#include "rrmApi.h"
84#endif
85#if defined FEATURE_WLAN_CCX
86#include "ccxApi.h"
87#endif
88
89#if defined WLAN_FEATURE_VOWIFI_11R
90#include <limFT.h>
91#endif
92
93#ifdef FEATURE_WLAN_CCX
94/* These are the min/max tx power (non virtual rates) range
95 supported by prima hardware */
96#define MIN_TX_PWR_CAP 12
97#define MAX_TX_PWR_CAP 19
98
99#endif
100
Viral Modid86bde22012-12-10 13:09:21 -0800101/* This overhead is time for sending NOA start to host in case of GO/sending NULL data & receiving ACK
102 * in case of P2P Client and starting actual scanning with init scan req/rsp plus in case of concurrency,
103 * taking care of sending null data and receiving ACK to/from AP.
104 */
105#define SCAN_MESSAGING_OVERHEAD 5 // in msecs
Jeff Johnson295189b2012-06-20 16:38:30 -0700106
Gopichand Nakkala096a1052012-12-21 07:05:34 -0800107#define CONV_MS_TO_US 1024 //conversion factor from ms to us
108
Jeff Johnson295189b2012-06-20 16:38:30 -0700109// SME REQ processing function templates
110static void __limProcessSmeStartReq(tpAniSirGlobal, tANI_U32 *);
111static tANI_BOOLEAN __limProcessSmeSysReadyInd(tpAniSirGlobal, tANI_U32 *);
112static tANI_BOOLEAN __limProcessSmeStartBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
Viral Modid86bde22012-12-10 13:09:21 -0800113void __limProcessSmeScanReq(tpAniSirGlobal, tANI_U32 *);
Jeff Johnson295189b2012-06-20 16:38:30 -0700114static void __limProcessSmeJoinReq(tpAniSirGlobal, tANI_U32 *);
115static void __limProcessSmeReassocReq(tpAniSirGlobal, tANI_U32 *);
116static void __limProcessSmeDisassocReq(tpAniSirGlobal, tANI_U32 *);
117static void __limProcessSmeDisassocCnf(tpAniSirGlobal, tANI_U32 *);
118static void __limProcessSmeDeauthReq(tpAniSirGlobal, tANI_U32 *);
119static void __limProcessSmeSetContextReq(tpAniSirGlobal, tANI_U32 *);
120static tANI_BOOLEAN __limProcessSmeStopBssReq(tpAniSirGlobal, tpSirMsgQ pMsg);
121
122#if 0
123 static void __limProcessSmeAuthReq(tpAniSirGlobal, tANI_U32 *);
124 static void __limProcessSmePromiscuousReq(tpAniSirGlobal, tANI_U32 *);
125#endif
126
127#ifdef ANI_PRODUCT_TYPE_AP
128static void __limProcessSmeAssocCnf(tpAniSirGlobal, tANI_U32, tANI_U32 *);
129#endif
130void __limProcessSmeAssocCnfNew(tpAniSirGlobal, tANI_U32, tANI_U32 *);
131
132#ifdef VOSS_ENABLED
133extern void peRegisterTLHandle(tpAniSirGlobal pMac);
134#endif
135
136#ifdef WLAN_FEATURE_P2P
137extern int limProcessRemainOnChnlReq(tpAniSirGlobal pMac, tANI_U32 *pMsg);
138#endif
139
140#ifdef ANI_PRODUCT_TYPE_CLIENT
141#ifdef BACKGROUND_SCAN_ENABLED
142
143// start the background scan timers if it hasn't already started
144static void
145__limBackgroundScanInitiate(tpAniSirGlobal pMac)
146{
147 if (pMac->lim.gLimBackgroundScanStarted)
148 return;
149
150 //make sure timer is created first
151 if (TX_TIMER_VALID(pMac->lim.limTimers.gLimBackgroundScanTimer))
152 {
153 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
Jeff Johnsone7245742012-09-05 17:12:55 -0700154 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, NO_SESSION, eLIM_BACKGROUND_SCAN_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -0700155 if (tx_timer_activate(&pMac->lim.limTimers.gLimBackgroundScanTimer) != TX_SUCCESS)
156 limLog(pMac, LOGP, FL("could not activate background scan timer\n"));
157 pMac->lim.gLimBackgroundScanStarted = true;
158 pMac->lim.gLimBackgroundScanChannelId = 0;
159 }
160}
161
162#endif // BACKGROUND_SCAN_ENABLED
163#endif
164
165// determine if a fresh scan request must be issued or not
166/*
167* PE will do fresh scan, if all of the active sessions are in good state (Link Est or BSS Started)
168* If one of the sessions is not in one of the above states, then PE does not do fresh scan
169* If no session exists (scanning very first time), then PE will always do fresh scan if SME
170* asks it to do that.
171*/
172static tANI_U8
173__limFreshScanReqd(tpAniSirGlobal pMac, tANI_U8 returnFreshResults)
174{
175
176 tANI_U8 validState = TRUE;
177 int i;
178
179 if(pMac->lim.gLimSmeState != eLIM_SME_IDLE_STATE)
180 {
181 return FALSE;
182 }
183 for(i =0; i < pMac->lim.maxBssId; i++)
184 {
185
186 if(pMac->lim.gpSession[i].valid == TRUE)
187 {
188 if(!( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRASTRUCTURE_MODE) ||
189 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
190 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_LINK_EST_STATE) )||
191
192 ( ( (pMac->lim.gpSession[i].bssType == eSIR_IBSS_MODE)||
193 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_AP_ROLE)||
194 (pMac->lim.gpSession[i].limSystemRole == eLIM_BT_AMP_STA_ROLE) )&&
195 (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
196#ifdef WLAN_FEATURE_P2P
197 || ( ( ( (pMac->lim.gpSession[i].bssType == eSIR_INFRA_AP_MODE)
198 && ( pMac->lim.gpSession[i].pePersona == VOS_P2P_GO_MODE) )
199 || (pMac->lim.gpSession[i].limSystemRole == eLIM_AP_ROLE) )
200 && (pMac->lim.gpSession[i].limSmeState == eLIM_SME_NORMAL_STATE) )
201#endif
202 ))
203 {
204 validState = FALSE;
205 break;
206 }
207
208 }
209 }
210 PELOG1(limLog(pMac, LOG1, FL("FreshScanReqd: %d \n"), validState);)
211
212 if( (validState) && (returnFreshResults & SIR_BG_SCAN_RETURN_FRESH_RESULTS))
213 return TRUE;
214
215 return FALSE;
216}
217
218#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
219static tANI_BOOLEAN __limProcessSmeSwitchChlReq(tpAniSirGlobal, tpSirMsgQ pMsg);
220#endif
221
222
223/**
224 * __limIsSmeAssocCnfValid()
225 *
226 *FUNCTION:
227 * This function is called by limProcessLmmMessages() upon
228 * receiving SME_ASSOC_CNF.
229 *
230 *LOGIC:
231 * Message validity checks are performed in this function
232 *
233 *ASSUMPTIONS:
234 *
235 *NOTE:
236 *
237 * @param pMeasReq Pointer to Received ASSOC_CNF message
238 * @return true When received SME_ASSOC_CNF is formatted
239 * correctly
240 * false otherwise
241 */
242
243inline static tANI_U8
244__limIsSmeAssocCnfValid(tpSirSmeAssocCnf pAssocCnf)
245{
246 if (limIsGroupAddr(pAssocCnf->peerMacAddr))
247 return false;
248 else
249 return true;
250} /*** end __limIsSmeAssocCnfValid() ***/
251
252
253/**
254 * __limGetSmeJoinReqSizeForAlloc()
255 *
256 *FUNCTION:
257 * This function is called in various places to get IE length
258 * from tSirBssDescription structure
259 * number being scanned.
260 *
261 *PARAMS:
262 *
263 *LOGIC:
264 *
265 *ASSUMPTIONS:
266 * NA
267 *
268 *NOTE:
269 * NA
270 *
271 * @param pBssDescr
272 * @return Total IE length
273 */
274
275static tANI_U16
276__limGetSmeJoinReqSizeForAlloc(tANI_U8 *pBuf)
277{
278 tANI_U16 len = 0;
279
280 if (!pBuf)
281 return len;
282
283 pBuf += sizeof(tANI_U16);
284 len = limGetU16( pBuf );
285 return (len + sizeof( tANI_U16 ));
286} /*** end __limGetSmeJoinReqSizeForAlloc() ***/
287
288
289/**----------------------------------------------------------------
290\fn __limIsDeferedMsgForLearn
291
292\brief Has role only if 11h is enabled. Not used on STA side.
293 Defers the message if SME is in learn state and brings
294 the LIM back to normal mode.
295
296\param pMac
297\param pMsg - Pointer to message posted from SME to LIM.
298\return TRUE - If defered
299 FALSE - Otherwise
300------------------------------------------------------------------*/
301static tANI_BOOLEAN
302__limIsDeferedMsgForLearn(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
303{
304 if (limIsSystemInScanState(pMac))
305 {
306 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
307 {
308 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d\n"), pMsg->type);)
309 return eANI_BOOLEAN_FALSE;
310 }
311 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d\n"),
312 pMsg->type);)
313
314 /** Send finish scan req to HAL only if LIM is not waiting for any response
315 * from HAL like init scan rsp, start scan rsp etc.
316 */
317 if (GET_LIM_PROCESS_DEFD_MESGS(pMac))
318 {
319 //Set the resume channel to Any valid channel (invalid).
320 //This will instruct HAL to set it to any previous valid channel.
321 peSetResumeChannel(pMac, 0, 0);
322 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_LEARN_WAIT_STATE);
323 }
324
325 return eANI_BOOLEAN_TRUE;
326 }
327 return eANI_BOOLEAN_FALSE;
328}
329
330/**----------------------------------------------------------------
331\fn __limIsDeferedMsgForRadar
332
333\brief Has role only if 11h is enabled. Not used on STA side.
334 Defers the message if radar is detected.
335
336\param pMac
337\param pMsg - Pointer to message posted from SME to LIM.
338\return TRUE - If defered
339 FALSE - Otherwise
340------------------------------------------------------------------*/
341static tANI_BOOLEAN
342__limIsDeferedMsgForRadar(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
343{
344 /** fRadarDetCurOperChan will be set only if we detect radar in current
345 * operating channel and System Role == AP ROLE */
Jeff Johnsone7245742012-09-05 17:12:55 -0700346 //TODO: Need to take care radar detection.
347 //if (LIM_IS_RADAR_DETECTED(pMac))
348 if( 0 )
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 {
350 if (limDeferMsg(pMac, pMsg) != TX_SUCCESS)
351 {
352 PELOGE(limLog(pMac, LOGE, FL("Could not defer Msg = %d\n"), pMsg->type);)
353 return eANI_BOOLEAN_FALSE;
354 }
355 PELOG1(limLog(pMac, LOG1, FL("Defer the message, in learn mode type = %d\n"),
356 pMsg->type);)
357 return eANI_BOOLEAN_TRUE;
358 }
359 return eANI_BOOLEAN_FALSE;
360}
361
362
363/**
364 * __limProcessSmeStartReq()
365 *
366 *FUNCTION:
367 * This function is called to process SME_START_REQ message
368 * from HDD or upper layer application.
369 *
370 *LOGIC:
371 *
372 *ASSUMPTIONS:
373 *
374 *NOTE:
375 *
376 * @param pMac Pointer to Global MAC structure
377 * @param *pMsgBuf A pointer to the SME message buffer
378 * @return None
379 */
380
381static void
382__limProcessSmeStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
383{
384 tSirResultCodes retCode = eSIR_SME_SUCCESS;
385 tANI_U8 smesessionId;
386 tANI_U16 smetransactionId;
387
388
389 PELOG1(limLog(pMac, LOG1, FL("Received START_REQ\n"));)
390
391 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
392
393 if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
394 {
395 pMac->lim.gLimSmeState = eLIM_SME_IDLE_STATE;
396
Jeff Johnsone7245742012-09-05 17:12:55 -0700397 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -0700398
399 /// By default do not return after first scan match
400 pMac->lim.gLimReturnAfterFirstMatch = 0;
401
402 /// Initialize MLM state machine
403 limInitMlm(pMac);
404
405 /// By default return unique scan results
406 pMac->lim.gLimReturnUniqueResults = true;
407 pMac->lim.gLimSmeScanResultLength = 0;
408
409#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
410 if (((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
411 {
412 /*
413 * Need to indicate new BSSs found during background scanning to
414 * host. Update this parameter at CFG
415 */
416 if (cfgSetInt(pMac, WNI_CFG_NEW_BSS_FOUND_IND, ((tSirSmeStartReq *) pMsgBuf)->sendNewBssInd)
417 != eSIR_SUCCESS)
418 {
419 limLog(pMac, LOGP, FL("could not set NEIGHBOR_BSS_IND at CFG\n"));
420 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
421 }
422 }
423#endif
424 }
425 else
426 {
427 /**
428 * Should not have received eWNI_SME_START_REQ in states
429 * other than OFFLINE. Return response to host and
430 * log error
431 */
432 limLog(pMac, LOGE, FL("Invalid SME_START_REQ received in SME state %X\n"),pMac->lim.gLimSmeState );
433 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
434 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
435 }
436 limSendSmeRsp(pMac, eWNI_SME_START_RSP, retCode,smesessionId,smetransactionId);
437} /*** end __limProcessSmeStartReq() ***/
438
439
440/** -------------------------------------------------------------
441\fn __limProcessSmeSysReadyInd
442\brief handles the notification from HDD. PE just forwards this message to HAL.
443\param tpAniSirGlobal pMac
444\param tANI_U32* pMsgBuf
445\return TRUE-Posting to HAL failed, so PE will consume the buffer.
446\ FALSE-Posting to HAL successful, so HAL will consume the buffer.
447 -------------------------------------------------------------*/
448static tANI_BOOLEAN
449__limProcessSmeSysReadyInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
450{
451 tSirMsgQ msg;
452
453 msg.type = WDA_SYS_READY_IND;
454 msg.reserved = 0;
455 msg.bodyptr = pMsgBuf;
456 msg.bodyval = 0;
457
458#ifdef VOSS_ENABLED
459 if(pMac->gDriverType != eDRIVER_TYPE_MFG)
460 {
461 peRegisterTLHandle(pMac);
462 }
463#endif
464 PELOGW(limLog(pMac, LOGW, FL("sending WDA_SYS_READY_IND msg to HAL\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -0700465 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -0700466
467 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
468 {
469 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed\n"));
470 return eANI_BOOLEAN_TRUE;
471 }
472 return eANI_BOOLEAN_FALSE;
473}
474
Jeff Johnsone7245742012-09-05 17:12:55 -0700475#ifdef WLAN_FEATURE_11AC
Jeff Johnson295189b2012-06-20 16:38:30 -0700476
Jeff Johnsone7245742012-09-05 17:12:55 -0700477tANI_U32 limGetCenterChannel(tpAniSirGlobal pMac,tANI_U8 primarychanNum,ePhyChanBondState secondaryChanOffset, tANI_U8 chanWidth)
478{
479 if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
480 {
481 switch(secondaryChanOffset)
482 {
483 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
484 return primarychanNum;
485 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
486 return primarychanNum + 2;
487 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
488 return primarychanNum - 2;
489 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
490 return primarychanNum + 6;
491 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
492 return primarychanNum + 2;
493 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
494 return primarychanNum - 2;
495 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
496 return primarychanNum - 6;
497 default :
498 return eSIR_CFG_INVALID_ID;
499 }
500 }
501 else if (chanWidth == WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
502 {
503 switch(secondaryChanOffset)
504 {
505 case PHY_DOUBLE_CHANNEL_LOW_PRIMARY:
506 return primarychanNum + 2;
507 case PHY_DOUBLE_CHANNEL_HIGH_PRIMARY:
508 return primarychanNum - 2;
509 case PHY_QUADRUPLE_CHANNEL_20MHZ_CENTERED_40MHZ_CENTERED:
510 return primarychanNum;
511 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_CENTERED:
512 return primarychanNum + 2;
513 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_CENTERED:
514 return primarychanNum - 2;
515 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_LOW:
516 return primarychanNum + 2;
517 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_LOW:
518 return primarychanNum - 2;
519 case PHY_QUADRUPLE_CHANNEL_20MHZ_LOW_40MHZ_HIGH:
520 return primarychanNum + 2;
521 case PHY_QUADRUPLE_CHANNEL_20MHZ_HIGH_40MHZ_HIGH:
522 return primarychanNum - 2;
523 default :
524 return eSIR_CFG_INVALID_ID;
525 }
526 }
527 return primarychanNum;
528}
529
530#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700531/**
532 * __limHandleSmeStartBssRequest()
533 *
534 *FUNCTION:
535 * This function is called to process SME_START_BSS_REQ message
536 * from HDD or upper layer application.
537 *
538 *LOGIC:
539 *
540 *ASSUMPTIONS:
541 *
542 *NOTE:
543 *
544 * @param pMac Pointer to Global MAC structure
545 * @param *pMsgBuf A pointer to the SME message buffer
546 * @return None
547 */
548
549static void
550__limHandleSmeStartBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
551{
552 tANI_U16 size;
553 tANI_U32 val = 0;
554 tSirRetStatus retStatus;
555 tSirMacChanNum channelNumber;
556 tLimMlmStartReq *pMlmStartReq;
557 tpSirSmeStartBssReq pSmeStartBssReq; //Local variable for Start BSS Req.. Added For BT-AMP Support
558 tSirResultCodes retCode = eSIR_SME_SUCCESS;
559 tANI_U32 autoGenBssId = FALSE; //Flag Used in case of IBSS to Auto generate BSSID.
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 tANI_U8 sessionId;
561 tpPESession psessionEntry = NULL;
562 tANI_U8 smesessionId;
563 tANI_U16 smetransactionId;
564
565#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
566 //Since the session is not created yet, sending NULL. The response should have the correct state.
567 limDiagEventReport(pMac, WLAN_PE_DIAG_START_BSS_REQ_EVENT, NULL, 0, 0);
568#endif //FEATURE_WLAN_DIAG_SUPPORT
569
570 PELOG1(limLog(pMac, LOG1, FL("Received START_BSS_REQ\n"));)
571
572 /* Global Sme state and mlm states are not defined yet , for BT-AMP Suppoprt . TO BE DONE */
573 if ( (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE) ||
574 (pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE))
575 {
576 size = sizeof(tSirSmeStartBssReq) + SIR_MAC_MAX_IE_LENGTH;
577
578#ifdef ANI_PRODUCT_TYPE_AP
579 size + = ANI_WDS_INFO_MAX_LENGTH;
580#endif
581
582 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSmeStartBssReq, size))
583 {
584 PELOGE(limLog(pMac, LOGE, FL("palAllocateMemory failed for pMac->lim.gpLimStartBssReq\n"));)
585 /// Send failure response to host
586 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
587 goto end;
588 }
589
590 (void) palZeroMemory(pMac->hHdd, (void *)pSmeStartBssReq, size);
591
592 if ((limStartBssReqSerDes(pMac, pSmeStartBssReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
593 (!limIsSmeStartBssReqValid(pMac, pSmeStartBssReq)))
594 {
595 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ\n"));)
596 retCode = eSIR_SME_INVALID_PARAMETERS;
597 goto free;
598 }
599#if 0
600 PELOG3(limLog(pMac, LOG3,
601 FL("Parsed START_BSS_REQ fields are bssType=%d, channelId=%d\n"),
602 pMac->lim.gpLimStartBssReq->bssType, pMac->lim.gpLimStartBssReq->channelId);)
603#endif
604
605 /* This is the place where PE is going to create a session.
606 * If session is not existed , then create a new session */
607 if((psessionEntry = peFindSessionByBssid(pMac,pSmeStartBssReq->bssId,&sessionId)) != NULL)
608 {
609 limLog(pMac, LOGW, FL("Session Already exists for given BSSID\n"));
610 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
611 psessionEntry = NULL;
612 goto free;
613 }
614 else
615 {
616 if((psessionEntry = peCreateSession(pMac,pSmeStartBssReq->bssId,&sessionId, pMac->lim.maxStation)) == NULL)
617 {
618 limLog(pMac, LOGW, FL("Session Can not be created \n"));
619 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
620 goto free;
621 }
622
623 }
624
625 /* Store the session related parameters in newly created session */
626 psessionEntry->pLimStartBssReq = pSmeStartBssReq;
627
628 /* Store PE sessionId in session Table */
629 psessionEntry->peSessionId = sessionId;
630
631 /* Store SME session Id in sessionTable */
632 psessionEntry->smeSessionId = pSmeStartBssReq->sessionId;
633
634 psessionEntry->transactionId = pSmeStartBssReq->transactionId;
635
636 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeStartBssReq->selfMacAddr);
637
638 /* Copy SSID to session table */
639 palCopyMemory( pMac->hHdd, (tANI_U8 *)&psessionEntry->ssId,
640 (tANI_U8 *)&pSmeStartBssReq->ssId,
641 (pSmeStartBssReq->ssId.length + 1));
642
643
644
645 psessionEntry->bssType = pSmeStartBssReq->bssType;
646
647 psessionEntry->nwType = pSmeStartBssReq->nwType;
648
649 psessionEntry->beaconParams.beaconInterval = pSmeStartBssReq->beaconInterval;
650
651 /* Store the channel number in session Table */
652 psessionEntry->currentOperChannel = pSmeStartBssReq->channelId;
653
654 /*Store Persona */
655 psessionEntry->pePersona = pSmeStartBssReq->bssPersona;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700656 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,FL("PE PERSONA=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700657 psessionEntry->pePersona);
658
659 /*Update the phymode*/
660 psessionEntry->gLimPhyMode = pSmeStartBssReq->nwType;
661
662 psessionEntry->maxTxPower = cfgGetRegulatoryMaxTransmitPower( pMac,
663 psessionEntry->currentOperChannel );
664 /* Store the dot 11 mode in to the session Table*/
665
666 psessionEntry->dot11mode = pSmeStartBssReq->dot11mode;
Jeff Johnsone7245742012-09-05 17:12:55 -0700667 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
668#ifdef WLAN_FEATURE_11AC
669 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700670 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
671 FL("*****psessionEntry->vhtCapability = %d"),psessionEntry->vhtCapability);
Jeff Johnsone7245742012-09-05 17:12:55 -0700672#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700673 palCopyMemory(pMac->hHdd, (void*)&psessionEntry->rateSet,
674 (void*)&pSmeStartBssReq->operationalRateSet,
675 sizeof(tSirMacRateSet));
676 palCopyMemory(pMac->hHdd, (void*)&psessionEntry->extRateSet,
677 (void*)&pSmeStartBssReq->extendedRateSet,
678 sizeof(tSirMacRateSet));
679
680 switch(pSmeStartBssReq->bssType)
681 {
682#ifdef WLAN_SOFTAP_FEATURE
683 case eSIR_INFRA_AP_MODE:
684 psessionEntry->limSystemRole = eLIM_AP_ROLE;
685 psessionEntry->privacy = pSmeStartBssReq->privacy;
686 psessionEntry->fwdWPSPBCProbeReq = pSmeStartBssReq->fwdWPSPBCProbeReq;
687 psessionEntry->authType = pSmeStartBssReq->authType;
688 /* Store the DTIM period */
689 psessionEntry->dtimPeriod = (tANI_U8)pSmeStartBssReq->dtimPeriod;
690 /*Enable/disable UAPSD*/
691 psessionEntry->apUapsdEnable = pSmeStartBssReq->apUapsdEnable;
692 if (psessionEntry->pePersona == VOS_P2P_GO_MODE)
693 {
694 psessionEntry->proxyProbeRspEn = 0;
695 }
696 else
697 {
698 /* To detect PBC overlap in SAP WPS mode, Host handles
699 * Probe Requests.
700 */
701 if(SAP_WPS_DISABLED == pSmeStartBssReq->wps_state)
702 {
703 psessionEntry->proxyProbeRspEn = 1;
704 }
705 else
706 {
707 psessionEntry->proxyProbeRspEn = 0;
708 }
709 }
710 psessionEntry->ssidHidden = pSmeStartBssReq->ssidHidden;
711 psessionEntry->wps_state = pSmeStartBssReq->wps_state;
Madan Mohan Koyyalamudi6db7ad12012-10-29 16:14:41 -0700712 psessionEntry->shortSlotTimeSupported = limGetShortSlotFromPhyMode(pMac, psessionEntry, psessionEntry->gLimPhyMode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 break;
714#endif
715 case eSIR_IBSS_MODE:
716 psessionEntry->limSystemRole = eLIM_STA_IN_IBSS_ROLE;
717 break;
718
719 case eSIR_BTAMP_AP_MODE:
720 psessionEntry->limSystemRole = eLIM_BT_AMP_AP_ROLE;
721 break;
722
723 case eSIR_BTAMP_STA_MODE:
724 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
725 break;
726
727 /* There is one more mode called auto mode. which is used no where */
728
729 //FORBUILD -TEMPFIX.. HOW TO use AUTO MODE?????
730
731
732 default:
733 //not used anywhere...used in scan function
734 break;
735 }
736
737 // BT-AMP: Allocate memory for the array of parsed (Re)Assoc request structure
738 if ( (pSmeStartBssReq->bssType == eSIR_BTAMP_AP_MODE)
739#ifdef WLAN_SOFTAP_FEATURE
740 || (pSmeStartBssReq->bssType == eSIR_INFRA_AP_MODE)
741#endif
742 )
743 {
744 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&psessionEntry->parsedAssocReq,
745 (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)) ))
746 {
747 limLog(pMac, LOGW, FL("palAllocateMemory() failed\n"));
748 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
749 goto free;
750 }
751 palZeroMemory(pMac->hHdd, psessionEntry->parsedAssocReq, (psessionEntry->dph.dphHashTable.size * sizeof(tpSirAssocReq)) );
752 }
753
754 /* Channel Bonding is not addressd yet for BT-AMP Support.. sunit will address channel bonding */
755 if (pSmeStartBssReq->channelId)
756 {
757 channelNumber = pSmeStartBssReq->channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -0700758 psessionEntry->htSupportedChannelWidthSet = (pSmeStartBssReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
759 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
760 psessionEntry->htSecondaryChannelOffset = pSmeStartBssReq->cbMode;
Madan Mohan Koyyalamudi8bdd3112012-09-24 13:55:14 -0700761 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -0700762 FL("cbMode %u"), pSmeStartBssReq->cbMode);
763#ifdef WLAN_FEATURE_11AC
764 if(psessionEntry->vhtCapability)
765 {
766 tANI_U32 centerChan;
767 tANI_U32 chanWidth;
Jeff Johnson295189b2012-06-20 16:38:30 -0700768
Jeff Johnsone7245742012-09-05 17:12:55 -0700769 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
770 &chanWidth) != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700771 {
Jeff Johnsone7245742012-09-05 17:12:55 -0700772 limLog(pMac, LOGP,
773 FL("Unable to retrieve Channel Width from CFG\n"));
774 }
775
776 if(chanWidth == eHT_CHANNEL_WIDTH_20MHZ || chanWidth == eHT_CHANNEL_WIDTH_40MHZ)
777 {
778 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_20_40MHZ)
779 != eSIR_SUCCESS)
Jeff Johnson295189b2012-06-20 16:38:30 -0700780 {
781 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG\n"));
782 retCode = eSIR_LOGP_EXCEPTION;
Jeff Johnsone7245742012-09-05 17:12:55 -0700783 goto free;
Jeff Johnson295189b2012-06-20 16:38:30 -0700784 }
785 }
Jeff Johnsone7245742012-09-05 17:12:55 -0700786 if (chanWidth == eHT_CHANNEL_WIDTH_80MHZ)
787 {
788 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH, WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ)
789 != eSIR_SUCCESS)
790 {
791 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG\n"));
792 retCode = eSIR_LOGP_EXCEPTION;
793 goto free;
794 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700795
Jeff Johnsone7245742012-09-05 17:12:55 -0700796 centerChan = limGetCenterChannel(pMac,channelNumber,pSmeStartBssReq->cbMode,WNI_CFG_VHT_CHANNEL_WIDTH_80MHZ);
797 if(centerChan != eSIR_CFG_INVALID_ID)
798 {
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700799 limLog(pMac, LOGW, FL("***Center Channel for 80MHZ channel width = %ld\n"),centerChan);
800 psessionEntry->apCenterChan = centerChan;
Jeff Johnsone7245742012-09-05 17:12:55 -0700801 if (cfgSetInt(pMac, WNI_CFG_VHT_CHANNEL_CENTER_FREQ_SEGMENT1, centerChan)
802 != eSIR_SUCCESS)
803 {
804 limLog(pMac, LOGP, FL("could not set WNI_CFG_CHANNEL_BONDING_MODE at CFG\n"));
805 retCode = eSIR_LOGP_EXCEPTION;
806 goto free;
807 }
808 }
809 }
810
811 /* All the translation is done by now for gVhtChannelWidth from .ini file to
812 * the actual values as defined in spec. So, grabing the spec value which is
813 * updated in .dat file by the above logic */
814 if (wlan_cfgGetInt(pMac, WNI_CFG_VHT_CHANNEL_WIDTH,
815 &chanWidth) != eSIR_SUCCESS)
816 {
817 limLog(pMac, LOGP,
818 FL("Unable to retrieve Channel Width from CFG\n"));
819 }
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700820 /*For Sta+p2p-Go concurrency
821 vhtTxChannelWidthSet is used for storing p2p-GO channel width
822 apChanWidth is used for storing the AP channel width that the Sta is going to associate.
823 Initialize the apChanWidth same as p2p-GO channel width this gets over written once the station joins the AP
824 */
Jeff Johnsone7245742012-09-05 17:12:55 -0700825 psessionEntry->vhtTxChannelWidthSet = chanWidth;
Madan Mohan Koyyalamudi8b152b82012-10-18 20:56:27 -0700826 psessionEntry->apChanWidth = chanWidth;
Jeff Johnsone7245742012-09-05 17:12:55 -0700827 }
828 psessionEntry->htSecondaryChannelOffset = limGetHTCBState(pSmeStartBssReq->cbMode);
829#endif
830 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 else
832 {
833 PELOGW(limLog(pMac, LOGW, FL("Received invalid eWNI_SME_START_BSS_REQ\n"));)
834 retCode = eSIR_SME_INVALID_PARAMETERS;
835 goto free;
836 }
837
838 // Delete pre-auth list if any
839 limDeletePreAuthList(pMac);
840
841 // Delete IBSS peer BSSdescription list if any
842 //limIbssDelete(pMac); sep 26 review
843
844
845
846#ifdef FIXME_GEN6 //following code may not be required. limInitMlm is now being invoked during peStart
847 /// Initialize MLM state machine
Jeff Johnson295189b2012-06-20 16:38:30 -0700848 limInitMlm(pMac);
849#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700850
Jeff Johnsone7245742012-09-05 17:12:55 -0700851 psessionEntry->htCapability = IS_DOT11_MODE_HT(pSmeStartBssReq->dot11mode);
Jeff Johnson295189b2012-06-20 16:38:30 -0700852
853#ifdef WLAN_SOFTAP_FEATURE
854 /* keep the RSN/WPA IE information in PE Session Entry
855 * later will be using this to check when received (Re)Assoc req
856 * */
857 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac,&pSmeStartBssReq->rsnIE,psessionEntry);
858
859#endif
860
861#ifdef WLAN_SOFTAP_FEATURE
862 //Taken care for only softAP case rest need to be done
863 if (psessionEntry->limSystemRole == eLIM_AP_ROLE){
864 psessionEntry->gLimProtectionControl = pSmeStartBssReq->protEnabled;
865 /*each byte will have the following info
866 *bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
867 *reserved reserved RIFS Lsig n-GF ht20 11g 11b*/
868 palCopyMemory( pMac->hHdd, (void *) &psessionEntry->cfgProtection,
869 (void *) &pSmeStartBssReq->ht_capab,
870 sizeof( tCfgProtection ));
871 psessionEntry->pAPWPSPBCSession = NULL; // Initialize WPS PBC session link list
872 }
873#endif
874
875 // Prepare and Issue LIM_MLM_START_REQ to MLM
876 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmStartReq, sizeof(tLimMlmStartReq)))
877 {
878 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for mlmStartReq\n"));
879 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
880 goto free;
881 }
882
883 (void)palZeroMemory(pMac->hHdd, (void *) pMlmStartReq, sizeof(tLimMlmStartReq));
884
885 /* Copy SSID to the MLM start structure */
886 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmStartReq->ssId,
887 (tANI_U8 *) &pSmeStartBssReq->ssId,
888 pSmeStartBssReq->ssId.length + 1);
889#ifdef WLAN_SOFTAP_FEATURE
890 pMlmStartReq->ssidHidden = pSmeStartBssReq->ssidHidden;
891 pMlmStartReq->obssProtEnabled = pSmeStartBssReq->obssProtEnabled;
892#endif
893
894
895 pMlmStartReq->bssType = psessionEntry->bssType;
896
897 /* Fill PE session Id from the session Table */
898 pMlmStartReq->sessionId = psessionEntry->peSessionId;
899
900 if( (pMlmStartReq->bssType == eSIR_BTAMP_STA_MODE) || (pMlmStartReq->bssType == eSIR_BTAMP_AP_MODE )
901#ifdef WLAN_SOFTAP_FEATURE
902 || (pMlmStartReq->bssType == eSIR_INFRA_AP_MODE)
903#endif
904 )
905 {
906 //len = sizeof(tSirMacAddr);
907 //retStatus = wlan_cfgGetStr(pMac, WNI_CFG_STA_ID, (tANI_U8 *) pMlmStartReq->bssId, &len);
908 //if (retStatus != eSIR_SUCCESS)
909 //limLog(pMac, LOGP, FL("could not retrive BSSID, retStatus=%d\n"), retStatus);
910
911 /* Copy the BSSId from sessionTable to mlmStartReq struct */
912 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
913 }
914
915 else // ibss mode
916 {
917 pMac->lim.gLimIbssCoalescingHappened = false;
918
919 if((retStatus = wlan_cfgGetInt(pMac, WNI_CFG_IBSS_AUTO_BSSID, &autoGenBssId)) != eSIR_SUCCESS)
920 {
921 limLog(pMac, LOGP, FL("Could not retrieve Auto Gen BSSID, retStatus=%d\n"), retStatus);
922 retCode = eSIR_LOGP_EXCEPTION;
923 goto free;
924 }
925
926 if(!autoGenBssId)
927 {
928 // We're not auto generating BSSID. Instead, get it from session entry
929 sirCopyMacAddr(pMlmStartReq->bssId,psessionEntry->bssId);
930
931 if(pMlmStartReq->bssId[0] & 0x01)
932 {
933 PELOGE(limLog(pMac, LOGE, FL("Request to start IBSS with group BSSID\n Autogenerating the BSSID\n"));)
934 autoGenBssId = TRUE;
935 }
936 }
937
938 if( autoGenBssId )
939 { //if BSSID is not any uc id. then use locally generated BSSID.
940 //Autogenerate the BSSID
941 limGetRandomBssid( pMac, pMlmStartReq->bssId);
942 pMlmStartReq->bssId[0]= 0x02;
943
944 /* Copy randomly generated BSSID to the session Table */
945 sirCopyMacAddr(psessionEntry->bssId,pMlmStartReq->bssId);
946 }
947 }
948 /* store the channel num in mlmstart req structure */
949 pMlmStartReq->channelNumber = psessionEntry->currentOperChannel;
950 pMlmStartReq->cbMode = pSmeStartBssReq->cbMode;
951 pMlmStartReq->beaconPeriod = psessionEntry->beaconParams.beaconInterval;
952
953#ifdef WLAN_SOFTAP_FEATURE
954 if(psessionEntry->limSystemRole == eLIM_AP_ROLE ){
955 pMlmStartReq->dtimPeriod = psessionEntry->dtimPeriod;
956 pMlmStartReq->wps_state = psessionEntry->wps_state;
957
958 }else
959#endif
960 {
961 if (wlan_cfgGetInt(pMac, WNI_CFG_DTIM_PERIOD, &val) != eSIR_SUCCESS)
962 limLog(pMac, LOGP, FL("could not retrieve DTIM Period\n"));
963 pMlmStartReq->dtimPeriod = (tANI_U8)val;
964 }
965
966 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_PERIOD, &val) != eSIR_SUCCESS)
967 limLog(pMac, LOGP, FL("could not retrieve Beacon interval\n"));
968 pMlmStartReq->cfParamSet.cfpPeriod = (tANI_U8)val;
969
970 if (wlan_cfgGetInt(pMac, WNI_CFG_CFP_MAX_DURATION, &val) != eSIR_SUCCESS)
971 limLog(pMac, LOGP, FL("could not retrieve CFPMaxDuration\n"));
972 pMlmStartReq->cfParamSet.cfpMaxDuration = (tANI_U16) val;
973
974 //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
975 palCopyMemory(pMac->hHdd, (void*)&pMlmStartReq->rateSet, (void*)&psessionEntry->rateSet,
976 sizeof(tSirMacRateSet));
977
978
979 // Now populate the 11n related parameters
980 pMlmStartReq->nwType = psessionEntry->nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -0700981 pMlmStartReq->htCapable = psessionEntry->htCapability;
Jeff Johnson295189b2012-06-20 16:38:30 -0700982 //
983 // FIXME_GEN4 - Determine the appropriate defaults...
984 //
985 pMlmStartReq->htOperMode = pMac->lim.gHTOperMode;
986 pMlmStartReq->dualCTSProtection = pMac->lim.gHTDualCTSProtection; // Unused
Jeff Johnsone7245742012-09-05 17:12:55 -0700987 pMlmStartReq->txChannelWidthSet = psessionEntry->htRecommendedTxWidthSet;
Jeff Johnson295189b2012-06-20 16:38:30 -0700988
989 /* sep26 review */
990 psessionEntry->limRFBand = limGetRFBand(channelNumber);
991
992 // Initialize 11h Enable Flag
993 psessionEntry->lim11hEnable = 0;
994 if((pMlmStartReq->bssType != eSIR_IBSS_MODE) &&
995 (SIR_BAND_5_GHZ == psessionEntry->limRFBand) )
996 {
997 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
998 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED \n"));
999 psessionEntry->lim11hEnable = val;
1000 }
1001
1002 if (!psessionEntry->lim11hEnable)
1003 {
1004 if (cfgSetInt(pMac, WNI_CFG_LOCAL_POWER_CONSTRAINT, 0) != eSIR_SUCCESS)
1005 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED \n"));
1006 }
1007
Jeff Johnson295189b2012-06-20 16:38:30 -07001008 psessionEntry ->limPrevSmeState = psessionEntry->limSmeState;
1009 psessionEntry ->limSmeState = eLIM_SME_WT_START_BSS_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001010 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry ->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001011
1012 limPostMlmMessage(pMac, LIM_MLM_START_REQ, (tANI_U32 *) pMlmStartReq);
1013 return;
1014 }
1015 else
1016 {
1017
1018 limLog(pMac, LOGE, FL("Received unexpected START_BSS_REQ, in state %X\n"),pMac->lim.gLimSmeState);
1019 retCode = eSIR_SME_BSS_ALREADY_STARTED_OR_JOINED;
1020 goto end;
1021 } // if (pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
1022
1023free:
1024 palFreeMemory( pMac->hHdd, pSmeStartBssReq);
1025 pSmeStartBssReq = NULL;
1026
1027end:
1028
1029 /* This routine should return the sme sessionId and SME transaction Id */
1030 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1031
1032 if(NULL != psessionEntry)
1033 {
1034 peDeleteSession(pMac,psessionEntry);
1035 psessionEntry = NULL;
1036 }
1037 limSendSmeStartBssRsp(pMac, eWNI_SME_START_BSS_RSP, retCode,psessionEntry,smesessionId,smetransactionId);
1038} /*** end __limHandleSmeStartBssRequest() ***/
1039
1040
1041/**--------------------------------------------------------------
1042\fn __limProcessSmeStartBssReq
1043
1044\brief Wrapper for the function __limHandleSmeStartBssRequest
1045 This message will be defered until softmac come out of
1046 scan mode or if we have detected radar on the current
1047 operating channel.
1048\param pMac
1049\param pMsg
1050
1051\return TRUE - If we consumed the buffer
1052 FALSE - If have defered the message.
1053 ---------------------------------------------------------------*/
1054static tANI_BOOLEAN
1055__limProcessSmeStartBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
1056{
1057 if (__limIsDeferedMsgForLearn(pMac, pMsg) ||
1058 __limIsDeferedMsgForRadar(pMac, pMsg))
1059 {
1060 /**
1061 * If message defered, buffer is not consumed yet.
1062 * So return false
1063 */
1064 return eANI_BOOLEAN_FALSE;
1065 }
1066
1067 __limHandleSmeStartBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
1068 return eANI_BOOLEAN_TRUE;
1069}
1070
1071
1072/**
1073 * limGetRandomBssid()
1074 *
1075 * FUNCTION:This function is called to process generate the random number for bssid
1076 * This function is called to process SME_SCAN_REQ message
1077 * from HDD or upper layer application.
1078 *
1079 * LOGIC:
1080 *
1081 * ASSUMPTIONS:
1082 *
1083 * NOTE:
1084 * 1. geneartes the unique random number for bssid in ibss
1085 *
1086 * @param pMac Pointer to Global MAC structure
1087 * @param *data Pointer to bssid buffer
1088 * @return None
1089 */
1090void limGetRandomBssid(tpAniSirGlobal pMac, tANI_U8 *data)
1091{
1092 tANI_U32 random[2] ;
1093 random[0] = tx_time_get();
1094 random[0] |= (random[0] << 15) ;
1095 random[1] = random[0] >> 1;
1096 palCopyMemory(pMac->hHdd, data, (tANI_U8*)random, sizeof(tSirMacAddr));
1097}
1098
1099
1100/**
1101 * __limProcessSmeScanReq()
1102 *
1103 *FUNCTION:
1104 * This function is called to process SME_SCAN_REQ message
1105 * from HDD or upper layer application.
1106 *
1107 *LOGIC:
1108 *
1109 *ASSUMPTIONS:
1110 *
1111 *NOTE:
1112 * 1. Periodic scanning should be requesting to return unique
1113 * scan results.
1114 *
1115 * @param pMac Pointer to Global MAC structure
1116 * @param *pMsgBuf A pointer to the SME message buffer
1117 * @return None
1118 */
1119
Viral Modid86bde22012-12-10 13:09:21 -08001120void
Jeff Johnson295189b2012-06-20 16:38:30 -07001121__limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1122{
1123 tANI_U32 len;
1124 tLimMlmScanReq *pMlmScanReq;
1125 tpSirSmeScanReq pScanReq;
1126 tANI_U8 i = 0;
1127
1128#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1129 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_REQ_EVENT, NULL, 0, 0);
1130#endif //FEATURE_WLAN_DIAG_SUPPORT
1131
1132 pScanReq = (tpSirSmeScanReq) pMsgBuf;
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001133 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\n"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001134 pScanReq->channelList.numChannels,
1135 pScanReq->minChannelTime,
1136 pScanReq->maxChannelTime,
1137 pScanReq->uIEFieldLen,
1138 pScanReq->returnAfterFirstMatch,
1139 pScanReq->returnFreshResults,
1140 pScanReq->returnUniqueResults,
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001141 pScanReq->scanType,
1142 pScanReq->backgroundScanMode,
1143 pMac->lim.gLimRspReqd ? 1 : 0);)
Viral Modid86bde22012-12-10 13:09:21 -08001144
1145 /* Since scan req always requires a response, we will overwrite response required here.
1146 * This is added esp to take care of the condition where in p2p go case, we hold the scan req and
1147 * insert single NOA. We send the held scan request to FW later on getting start NOA ind from FW so
1148 * we lose state of the gLimRspReqd flag for the scan req if any other request comes by then.
1149 * e.g. While unit testing, we found when insert single NOA is done, we see a get stats request which turns the flag
1150 * gLimRspReqd to FALSE; now when we actually start the saved scan req for init scan after getting
1151 * NOA started, the gLimRspReqd being a global flag is showing FALSE instead of TRUE value for
1152 * this saved scan req. Since all scan reqs coming to lim require a response, there is no harm in setting
1153 * the global flag gLimRspReqd to TRUE here.
1154 */
1155 pMac->lim.gLimRspReqd = TRUE;
1156
Jeff Johnson295189b2012-06-20 16:38:30 -07001157 /*copy the Self MAC address from SmeReq to the globalplace , used for sending probe req.discussed on code review sep18*/
1158 sirCopyMacAddr(pMac->lim.gSelfMacAddr, pScanReq->selfMacAddr);
1159
1160 /* This routine should return the sme sessionId and SME transaction Id */
1161
1162 if (!limIsSmeScanReqValid(pMac, pScanReq))
1163 {
1164 PELOGW(limLog(pMac, LOGW, FL("Received SME_SCAN_REQ with invalid parameters\n"));)
1165
1166 if (pMac->lim.gLimRspReqd)
1167 {
1168 pMac->lim.gLimRspReqd = false;
1169
1170 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1171
1172 } // if (pMac->lim.gLimRspReqd)
1173
1174 return;
1175 }
1176
1177 //if scan is disabled then return as invalid scan request.
1178 //if scan in power save is disabled, and system is in power save mode, then ignore scan request.
1179 if( (pMac->lim.fScanDisabled) || (!pMac->lim.gScanInPowersave && !limIsSystemInActiveState(pMac)) )
1180 {
1181 limSendSmeScanRsp(pMac, 8, eSIR_SME_INVALID_PARAMETERS, pScanReq->sessionId, pScanReq->transactionId);
1182 return;
1183 }
1184
1185
1186 /**
1187 * If scan request is received in idle, joinFailed
1188 * states or in link established state (in STA role)
1189 * or in normal state (in STA-in-IBSS/AP role) with
1190 * 'return fresh scan results' request from HDD or
1191 * it is periodic background scanning request,
1192 * trigger fresh scan request to MLM
1193 */
1194 if (__limFreshScanReqd(pMac, pScanReq->returnFreshResults))
1195 {
1196 #if 0
1197 // Update global SME state
1198 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1199 if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) ||
1200 (pMac->lim.gLimSmeState == eLIM_SME_JOIN_FAILURE_STATE))
1201 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
1202 else if (pMac->lim.gLimSmeState == eLIM_SME_NORMAL_STATE)
1203 pMac->lim.gLimSmeState = eLIM_SME_NORMAL_CHANNEL_SCAN_STATE;
1204 else
1205
1206 #endif //TO SUPPORT BT-AMP
1207
1208 /*Change Global SME state */
1209
1210 /* Store the previous SME state */
1211
1212 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
1213
1214 pMac->lim.gLimSmeState = eLIM_SME_WT_SCAN_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07001215 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, NO_SESSION, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001216
1217 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1218 {
1219 // Discard previously cached scan results
1220 limReInitScanResults(pMac);
1221 }
1222
1223 pMac->lim.gLim24Band11dScanDone = 0;
1224 pMac->lim.gLim50Band11dScanDone = 0;
1225 pMac->lim.gLimReturnAfterFirstMatch =
1226 pScanReq->returnAfterFirstMatch;
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001227 pMac->lim.gLimBackgroundScanMode =
1228 pScanReq->backgroundScanMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001229
1230 pMac->lim.gLimReturnUniqueResults =
1231 ((pScanReq->returnUniqueResults) > 0 ? true : false);
1232 /* De-activate Heartbeat timers for connected sessions while
Madan Mohan Koyyalamudi70bb4cb2012-10-18 19:31:25 -07001233 * scan is in progress if the system is in Active mode *
1234 * AND it is not a ROAMING ("background") scan */
1235 if(((ePMM_STATE_BMPS_WAKEUP == pMac->pmm.gPmmState) ||
Yathish9f22e662012-12-10 14:21:35 -08001236 (ePMM_STATE_READY == pMac->pmm.gPmmState)) &&
1237 (pScanReq->backgroundScanMode != eSIR_ROAMING_SCAN ) &&
1238 (!IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE))
Jeff Johnson295189b2012-06-20 16:38:30 -07001239 {
1240 for(i=0;i<pMac->lim.maxBssId;i++)
1241 {
Jeff Johnson32d95a32012-09-10 13:15:23 -07001242 if((peFindSessionBySessionId(pMac,i) != NULL) &&
1243 (pMac->lim.gpSession[i].valid == TRUE) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001244 (eLIM_MLM_LINK_ESTABLISHED_STATE == pMac->lim.gpSession[i].limMlmState))
1245 {
1246 limHeartBeatDeactivateAndChangeTimer(pMac, peFindSessionBySessionId(pMac,i));
1247 }
1248 }
1249 }
1250
1251 if (pScanReq->channelList.numChannels == 0)
1252 {
1253 tANI_U32 cfg_len;
1254 // Scan all channels
1255 len = sizeof(tLimMlmScanReq) +
1256 (sizeof( pScanReq->channelList.channelNumber ) * (WNI_CFG_VALID_CHANNEL_LIST_LEN - 1)) +
1257 pScanReq->uIEFieldLen;
1258 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq, len) )
1259 {
1260 // Log error
1261 limLog(pMac, LOGP,
1262 FL("call to palAllocateMemory failed for mlmScanReq (%d)\n"), len);
1263
1264 return;
1265 }
1266
1267 // Initialize this buffer
1268 palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq, len );
1269
1270 cfg_len = WNI_CFG_VALID_CHANNEL_LIST_LEN;
1271 if (wlan_cfgGetStr(pMac, WNI_CFG_VALID_CHANNEL_LIST,
1272 pMlmScanReq->channelList.channelNumber,
1273 &cfg_len) != eSIR_SUCCESS)
1274 {
1275 /**
1276 * Could not get Valid channel list from CFG.
1277 * Log error.
1278 */
1279 limLog(pMac, LOGP,
1280 FL("could not retrieve Valid channel list\n"));
1281 }
1282 pMlmScanReq->channelList.numChannels = (tANI_U8) cfg_len;
1283 }
1284 else
1285 {
1286 len = sizeof( tLimMlmScanReq ) - sizeof( pScanReq->channelList.channelNumber ) +
1287 (sizeof( pScanReq->channelList.channelNumber ) * pScanReq->channelList.numChannels ) +
1288 pScanReq->uIEFieldLen;
1289
1290 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmScanReq, len) )
1291 {
1292 // Log error
1293 limLog(pMac, LOGP,
1294 FL("call to palAllocateMemory failed for mlmScanReq(%d)\n"), len);
1295
1296 return;
1297 }
1298
1299 // Initialize this buffer
1300 palZeroMemory( pMac->hHdd, (tANI_U8 *) pMlmScanReq, len);
1301 pMlmScanReq->channelList.numChannels =
1302 pScanReq->channelList.numChannels;
1303
1304 palCopyMemory( pMac->hHdd, pMlmScanReq->channelList.channelNumber,
1305 pScanReq->channelList.channelNumber,
1306 pScanReq->channelList.numChannels);
1307 }
1308
1309 pMlmScanReq->uIEFieldLen = pScanReq->uIEFieldLen;
1310 pMlmScanReq->uIEFieldOffset = len - pScanReq->uIEFieldLen;
1311
1312 if(pScanReq->uIEFieldLen)
1313 {
1314 palCopyMemory( pMac->hHdd, (tANI_U8 *)pMlmScanReq+ pMlmScanReq->uIEFieldOffset,
1315 (tANI_U8 *)pScanReq+(pScanReq->uIEFieldOffset),
1316 pScanReq->uIEFieldLen);
1317 }
1318
1319 pMlmScanReq->bssType = pScanReq->bssType;
1320 palCopyMemory( pMac->hHdd, pMlmScanReq->bssId,
1321 pScanReq->bssId,
1322 sizeof(tSirMacAddr));
1323 pMlmScanReq->numSsid = pScanReq->numSsid;
1324
1325 i = 0;
1326 while (i < pMlmScanReq->numSsid)
1327 {
1328 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmScanReq->ssId[i],
1329 (tANI_U8 *) &pScanReq->ssId[i],
1330 pScanReq->ssId[i].length + 1);
1331
1332 i++;
1333 }
1334
1335
1336 pMlmScanReq->scanType = pScanReq->scanType;
1337 pMlmScanReq->backgroundScanMode = pScanReq->backgroundScanMode;
1338 pMlmScanReq->minChannelTime = pScanReq->minChannelTime;
1339 pMlmScanReq->maxChannelTime = pScanReq->maxChannelTime;
1340 pMlmScanReq->dot11mode = pScanReq->dot11mode;
1341#ifdef WLAN_FEATURE_P2P
1342 pMlmScanReq->p2pSearch = pScanReq->p2pSearch;
1343#endif
1344
1345 //Store the smeSessionID and transaction ID for later use.
1346 pMac->lim.gSmeSessionId = pScanReq->sessionId;
1347 pMac->lim.gTransactionId = pScanReq->transactionId;
1348
1349 // Issue LIM_MLM_SCAN_REQ to MLM
1350 limPostMlmMessage(pMac, LIM_MLM_SCAN_REQ, (tANI_U32 *) pMlmScanReq);
1351
1352 } // if ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1353
1354 else
1355 {
1356 /// In all other cases return 'cached' scan results
1357 if ((pMac->lim.gLimRspReqd) || pMac->lim.gLimReportBackgroundScanResults)
1358 {
1359 tANI_U16 scanRspLen = sizeof(tSirSmeScanRsp);
1360
1361 pMac->lim.gLimRspReqd = false;
1362
1363 if (pMac->lim.gLimSmeScanResultLength == 0)
1364 {
1365 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pScanReq->sessionId, pScanReq->transactionId);
1366 }
1367 else
1368 {
1369 scanRspLen = sizeof(tSirSmeScanRsp) +
1370 pMac->lim.gLimSmeScanResultLength -
1371 sizeof(tSirBssDescription);
1372 limSendSmeScanRsp(pMac, scanRspLen, eSIR_SME_SUCCESS, pScanReq->sessionId, pScanReq->transactionId);
1373 }
1374
1375 if (pScanReq->returnFreshResults & SIR_BG_SCAN_PURGE_RESUTLS)
1376 {
1377 // Discard previously cached scan results
1378 limReInitScanResults(pMac);
1379 }
1380
1381 } // if (pMac->lim.gLimRspReqd)
1382 } // else ((pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE) || ...
1383
1384#if defined(ANI_PRODUCT_TYPE_CLIENT) || defined(ANI_AP_CLIENT_SDK)
1385#ifdef BACKGROUND_SCAN_ENABLED
1386 // start background scans if needed
1387 // There is a bug opened against softmac. Need to enable when the bug is fixed.
1388 __limBackgroundScanInitiate(pMac);
1389#endif
1390#endif
1391
1392} /*** end __limProcessSmeScanReq() ***/
1393
Jeff Johnsone7245742012-09-05 17:12:55 -07001394#ifdef FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001395
Jeff Johnsone7245742012-09-05 17:12:55 -07001396static void __limProcessSmeOemDataReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1397{
1398 tpSirOemDataReq pOemDataReq;
1399 tLimMlmOemDataReq* pMlmOemDataReq;
1400
1401 pOemDataReq = (tpSirOemDataReq) pMsgBuf;
1402
1403 //post the lim mlm message now
1404 if(eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd, (void**)&pMlmOemDataReq, (sizeof(tLimMlmOemDataReq))))
1405 {
1406 limLog(pMac, LOGP, FL("palAllocateMemory failed for mlmOemDataReq\n"));
1407 return;
1408 }
1409
1410 //Initialize this buffer
1411 palZeroMemory(pMac->hHdd, pMlmOemDataReq, (sizeof(tLimMlmOemDataReq)));
1412
1413 palCopyMemory(pMac->hHdd, pMlmOemDataReq->selfMacAddr, pOemDataReq->selfMacAddr, sizeof(tSirMacAddr));
1414 palCopyMemory(pMac->hHdd, pMlmOemDataReq->oemDataReq, pOemDataReq->oemDataReq, OEM_DATA_REQ_SIZE);
1415
1416 //Issue LIM_MLM_OEM_DATA_REQ to MLM
1417 limPostMlmMessage(pMac, LIM_MLM_OEM_DATA_REQ, (tANI_U32*)pMlmOemDataReq);
1418
1419 return;
1420
1421} /*** end __limProcessSmeOemDataReq() ***/
1422
1423#endif //FEATURE_OEM_DATA_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -07001424
1425
1426/**
1427 * __limProcessSmeJoinReq()
1428 *
1429 *FUNCTION:
1430 * This function is called to process SME_JOIN_REQ message
1431 * from HDD or upper layer application.
1432 *
1433 *LOGIC:
1434 *
1435 *ASSUMPTIONS:
1436 *
1437 *NOTE:
1438 *
1439 * @param pMac Pointer to Global MAC structure
1440 * @param *pMsgBuf A pointer to the SME message buffer
1441 * @return None
1442 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001443static void
1444__limProcessSmeJoinReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1445{
1446 // tANI_U8 *pBuf;
1447 //tANI_U32 len;
1448// tSirMacAddr currentBssId;
1449 tpSirSmeJoinReq pSmeJoinReq = NULL;
1450 tLimMlmJoinReq *pMlmJoinReq;
1451 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1452 tANI_U32 val = 0;
1453 tANI_U16 nSize;
1454 tANI_U8 sessionId;
1455 tpPESession psessionEntry = NULL;
1456 tANI_U8 smesessionId;
1457 tANI_U16 smetransactionId;
1458 tPowerdBm localPowerConstraint = 0, regMax = 0;
1459
1460#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1461 //Not sending any session, since it is not created yet. The response whould have correct state.
1462 limDiagEventReport(pMac, WLAN_PE_DIAG_JOIN_REQ_EVENT, NULL, 0, 0);
1463#endif //FEATURE_WLAN_DIAG_SUPPORT
1464
1465 PELOG1(limLog(pMac, LOG1, FL("Received SME_JOIN_REQ\n"));)
1466
1467#ifdef WLAN_FEATURE_VOWIFI
1468 /* Need to read the CFG here itself as this is used in limExtractAPCapability() below.
1469 * This CFG is actually read in rrmUpdateConfig() which is called later. Because this is not
1470 * read, RRM related path before calling rrmUpdateConfig() is not getting executed causing issues
1471 * like not honoring power constraint on 1st association after driver loading. */
1472 if (wlan_cfgGetInt(pMac, WNI_CFG_RRM_ENABLED, &val) != eSIR_SUCCESS)
1473 limLog(pMac, LOGP, FL("cfg get rrm enabled failed\n"));
1474 pMac->rrm.rrmPEContext.rrmEnable = (val) ? 1 : 0;
1475 val = 0;
1476#endif /* WLAN_FEATURE_VOWIFI */
1477
1478 /**
1479 * Expect Join request in idle state.
1480 * Reassociate request is expected in link established state.
1481 */
1482
1483 /* Global SME and LIM states are not defined yet for BT-AMP Support */
1484 if(pMac->lim.gLimSmeState == eLIM_SME_IDLE_STATE)
1485 {
1486 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8*) pMsgBuf);
1487 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSmeJoinReq, nSize))
1488 {
1489 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pSmeJoinReq\n"));
1490 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1491 goto end;
1492 }
1493 (void) palZeroMemory(pMac->hHdd, (void *) pSmeJoinReq, nSize);
1494
Jeff Johnson295189b2012-06-20 16:38:30 -07001495 if ((limJoinReqSerDes(pMac, pSmeJoinReq, (tANI_U8 *)pMsgBuf) == eSIR_FAILURE) ||
1496 (!limIsSmeJoinReqValid(pMac, pSmeJoinReq)))
1497 {
1498 /// Received invalid eWNI_SME_JOIN_REQ
1499 // Log the event
1500 limLog(pMac, LOGW, FL("received SME_JOIN_REQ with invalid data\n"));
1501 retCode = eSIR_SME_INVALID_PARAMETERS;
1502 goto end;
1503 }
1504
1505 //pMac->lim.gpLimJoinReq = pSmeJoinReq; TO SUPPORT BT-AMP ,review os sep 23
1506
1507 /* check for the existence of start BSS session */
1508#ifdef FIXME_GEN6
1509 if(pSmeJoinReq->bsstype == eSIR_BTAMP_AP_MODE)
1510 {
1511 if(peValidateBtJoinRequest(pMac)!= TRUE)
1512 {
1513 limLog(pMac, LOGW, FL("Start Bss session not present::SME_JOIN_REQ in unexpected state\n"));
1514 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1515 psessionEntry = NULL;
1516 goto end;
1517 }
1518 }
1519
1520#endif
1521
1522
1523 if((psessionEntry = peFindSessionByBssid(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId)) != NULL)
1524 {
1525 limLog(pMac, LOGE, FL("Session Already exists for given BSSID\n"));
1526
1527 if(psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)
1528 {
1529 // Received eWNI_SME_JOIN_REQ for same
1530 // BSS as currently associated.
1531 // Log the event and send success
1532 PELOGW(limLog(pMac, LOGW, FL("Received SME_JOIN_REQ for currently joined BSS\n"));)
1533 /// Send Join success response to host
1534 retCode = eSIR_SME_SUCCESS;
1535 goto end;
1536 }
1537 else
1538 {
1539 retCode = eSIR_SME_REFUSED;
1540 psessionEntry = NULL;
1541 goto end;
1542 }
1543 }
1544 else /* Session Entry does not exist for given BSSId */
1545 {
1546 /* Try to Create a new session */
1547 if((psessionEntry = peCreateSession(pMac,pSmeJoinReq->bssDescription.bssId,&sessionId, pMac->lim.maxStation)) == NULL)
1548 {
1549 limLog(pMac, LOGE, FL("Session Can not be created \n"));
1550 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1551 goto end;
1552 }
1553 }
Jeff Johnsone7245742012-09-05 17:12:55 -07001554 handleHTCapabilityandHTInfo(pMac, psessionEntry);
1555
Jeff Johnson295189b2012-06-20 16:38:30 -07001556 /* Store Session related parameters */
1557 /* Store PE session Id in session Table */
1558 psessionEntry->peSessionId = sessionId;
1559
1560 /* store the smejoin req handle in session table */
1561 psessionEntry->pLimJoinReq = pSmeJoinReq;
1562
1563 /* Store SME session Id in sessionTable */
1564 psessionEntry->smeSessionId = pSmeJoinReq->sessionId;
1565
1566 /* Store SME transaction Id in session Table */
1567 psessionEntry->transactionId = pSmeJoinReq->transactionId;
1568
1569 /* Store beaconInterval */
1570 psessionEntry->beaconParams.beaconInterval = pSmeJoinReq->bssDescription.beaconInterval;
1571
1572 /* Copying of bssId is already done, while creating session */
1573 //sirCopyMacAddr(psessionEntry->bssId,pSmeJoinReq->bssId);
1574 sirCopyMacAddr(psessionEntry->selfMacAddr,pSmeJoinReq->selfMacAddr);
1575 psessionEntry->bssType = pSmeJoinReq->bsstype;
1576
1577 psessionEntry->statypeForBss = STA_ENTRY_PEER;
1578
1579 /* Copy the dot 11 mode in to the session table */
1580
1581 psessionEntry->dot11mode = pSmeJoinReq->dot11mode;
1582 psessionEntry->nwType = pSmeJoinReq->bssDescription.nwType;
Jeff Johnsone7245742012-09-05 17:12:55 -07001583#ifdef WLAN_FEATURE_11AC
1584 psessionEntry->vhtCapability = IS_DOT11_MODE_VHT(psessionEntry->dot11mode);
Jeff Johnson32d95a32012-09-10 13:15:23 -07001585 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO_MED,
Jeff Johnsone7245742012-09-05 17:12:55 -07001586 "***__limProcessSmeJoinReq: vhtCapability=%d****\n",psessionEntry->vhtCapability);
1587#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001588
1589 /*Phy mode*/
1590 psessionEntry->gLimPhyMode = pSmeJoinReq->bssDescription.nwType;
1591
1592 /* Copy The channel Id to the session Table */
1593 psessionEntry->currentOperChannel = pSmeJoinReq->bssDescription.channelId;
Jeff Johnsone7245742012-09-05 17:12:55 -07001594 psessionEntry->htSupportedChannelWidthSet = (pSmeJoinReq->cbMode)?1:0; // This is already merged value of peer and self - done by csr in csrGetCBModeFromIes
1595 psessionEntry->htRecommendedTxWidthSet = psessionEntry->htSupportedChannelWidthSet;
1596 psessionEntry->htSecondaryChannelOffset = pSmeJoinReq->cbMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07001597
1598 /*Store Persona */
1599 psessionEntry->pePersona = pSmeJoinReq->staPersona;
1600 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Jeff Johnsone7245742012-09-05 17:12:55 -07001601 FL("PE PERSONA=%d cbMode %u"), psessionEntry->pePersona, pSmeJoinReq->cbMode);
Jeff Johnson295189b2012-06-20 16:38:30 -07001602
1603 /* Copy the SSID from smejoinreq to session entry */
1604 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
1605 palCopyMemory( pMac->hHdd,psessionEntry->ssId.ssId,pSmeJoinReq->ssId.ssId,psessionEntry->ssId.length);
1606
1607 /* Copy the SSID from smejoinreq to session entry */
1608 psessionEntry->ssId.length = pSmeJoinReq->ssId.length;
1609 palCopyMemory( pMac->hHdd,psessionEntry->ssId.ssId,pSmeJoinReq->ssId.ssId,psessionEntry->ssId.length);
1610
1611 // Determin 11r or CCX connection based on input from SME
1612 // which inturn is dependent on the profile the user wants to connect
1613 // to, So input is coming from supplicant
1614#ifdef WLAN_FEATURE_VOWIFI_11R
1615 psessionEntry->is11Rconnection = pSmeJoinReq->is11Rconnection;
1616#endif
1617#ifdef FEATURE_WLAN_CCX
1618 psessionEntry->isCCXconnection = pSmeJoinReq->isCCXconnection;
1619#endif
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001620#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001621 psessionEntry->isFastTransitionEnabled = pSmeJoinReq->isFastTransitionEnabled;
1622#endif
1623
Jeff Johnson43971f52012-07-17 12:26:56 -07001624#ifdef FEATURE_WLAN_LFR
1625 psessionEntry->isFastRoamIniFeatureEnabled = pSmeJoinReq->isFastRoamIniFeatureEnabled;
1626#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001627 if(psessionEntry->bssType == eSIR_INFRASTRUCTURE_MODE)
1628 {
1629 psessionEntry->limSystemRole = eLIM_STA_ROLE;
1630 }
1631 else if(psessionEntry->bssType == eSIR_BTAMP_AP_MODE)
1632 {
1633 psessionEntry->limSystemRole = eLIM_BT_AMP_STA_ROLE;
1634 }
1635 else
1636 {
1637 /* Throw an error and return and make sure to delete the session.*/
1638 limLog(pMac, LOGW, FL("received SME_JOIN_REQ with invalid bss type\n"));
1639 retCode = eSIR_SME_INVALID_PARAMETERS;
1640 goto end;
1641 }
1642
1643 if(pSmeJoinReq->addIEScan.length)
1644 {
1645 palCopyMemory(pMac->hHdd, &psessionEntry->pLimJoinReq->addIEScan,
1646 &pSmeJoinReq->addIEScan, sizeof(tSirAddie));
1647 }
1648
1649 if(pSmeJoinReq->addIEAssoc.length)
1650 {
1651 palCopyMemory(pMac->hHdd, &psessionEntry->pLimJoinReq->addIEAssoc,
1652 &pSmeJoinReq->addIEAssoc, sizeof(tSirAddie));
1653 }
1654
1655#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1656
1657 val = sizeof(tLimMlmJoinReq) + sizeof(tSirMacSSidIE) +
1658 sizeof(tSirMacRateSetIE) + sizeof(tSirMacDsParamSetIE);
1659#else
1660 val = sizeof(tLimMlmJoinReq) + psessionEntry->pLimJoinReq->bssDescription.length + 2;
1661#endif
1662 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmJoinReq, val))
1663 {
1664 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for mlmJoinReq\n"));
1665 return;
1666 }
1667 (void) palZeroMemory(pMac->hHdd, (void *) pMlmJoinReq, val);
1668
1669 /* PE SessionId is stored as a part of JoinReq*/
1670 pMlmJoinReq->sessionId = psessionEntry->peSessionId;
1671
1672 if (wlan_cfgGetInt(pMac, WNI_CFG_JOIN_FAILURE_TIMEOUT, (tANI_U32 *) &pMlmJoinReq->joinFailureTimeout)
1673 != eSIR_SUCCESS)
1674 limLog(pMac, LOGP, FL("could not retrieve JoinFailureTimer value\n"));
1675
1676 /* copy operational rate from psessionEntry*/
1677 palCopyMemory(pMac->hHdd, (void*)&psessionEntry->rateSet, (void*)&pSmeJoinReq->operationalRateSet,
1678 sizeof(tSirMacRateSet));
1679 palCopyMemory(pMac->hHdd, (void*)&psessionEntry->extRateSet, (void*)&pSmeJoinReq->extendedRateSet,
1680 sizeof(tSirMacRateSet));
1681 //this may not be needed anymore now, as rateSet is now included in the session entry and MLM has session context.
1682 palCopyMemory(pMac->hHdd, (void*)&pMlmJoinReq->operationalRateSet, (void*)&psessionEntry->rateSet,
1683 sizeof(tSirMacRateSet));
1684
1685 psessionEntry->encryptType = pSmeJoinReq->UCEncryptionType;
1686
1687#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
1688 palCopyMemory( pMac->hHdd, pMlmJoinReq->bssDescription.bssId,
1689 pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].bssId,
1690 sizeof(tSirMacAddr));
1691
1692 pMlmJoinReq->bssDescription.capabilityInfo = 1;
1693
1694 pMlmJoinReq->bssDescription.aniIndicator =
1695 (tANI_U8) pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].wniIndicator;
1696
1697 pMlmJoinReq->bssDescription.nwType =
1698 pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].nwType;
1699
1700 pMlmJoinReq->bssDescription.channelId =
1701 pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].channelId;
1702
1703 limCopyNeighborInfoToCfg(pMac,
1704 pMac->lim.gpLimJoinReq->neighborBssList.bssList[0], psessionEntry);
1705
1706 palCopyMemory( pMac->hHdd, pMac->lim.gLimCurrentBssId,
1707 pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].bssId,
1708 sizeof(tSirMacAddr));
1709
1710 pMac->lim.gLimCurrentChannelId =
1711 pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].channelId;
1712
1713 pMac->lim.gLimCurrentBssCaps =
1714 pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001715 palCopyMemory( pMac->hHdd,
1716 (tANI_U8 *) &pMac->lim.gLimCurrentSSID,
1717 (tANI_U8 *) &pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].ssId,
1718 pMac->lim.gpLimJoinReq->neighborBssList.bssList[0].ssId.length+1);
1719#else
1720 pMlmJoinReq->bssDescription.length = psessionEntry->pLimJoinReq->bssDescription.length;
1721
1722 palCopyMemory( pMac->hHdd,
1723 (tANI_U8 *) &pMlmJoinReq->bssDescription.bssId,
1724 (tANI_U8 *) &psessionEntry->pLimJoinReq->bssDescription.bssId,
1725 psessionEntry->pLimJoinReq->bssDescription.length + 2);
1726
Jeff Johnson295189b2012-06-20 16:38:30 -07001727 psessionEntry->limCurrentBssCaps =
Jeff Johnsone7245742012-09-05 17:12:55 -07001728 psessionEntry->pLimJoinReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001729
Jeff Johnsone7245742012-09-05 17:12:55 -07001730 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
1731 localPowerConstraint = regMax;
1732 limExtractApCapability( pMac,
1733 (tANI_U8 *) psessionEntry->pLimJoinReq->bssDescription.ieFields,
1734 limGetIElenFromBssDescription(&psessionEntry->pLimJoinReq->bssDescription),
1735 &psessionEntry->limCurrentBssQosCaps,
1736 &psessionEntry->limCurrentBssPropCap,
1737 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimCurrentBssUapsd this session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07001738 , &localPowerConstraint,
1739 psessionEntry
Jeff Johnsone7245742012-09-05 17:12:55 -07001740 );
Jeff Johnson295189b2012-06-20 16:38:30 -07001741#ifdef FEATURE_WLAN_CCX
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001742 psessionEntry->maxTxPower = limGetMaxTxPower(regMax, localPowerConstraint, pMac->roam.configParam.nTxPowerCap);
Jeff Johnson295189b2012-06-20 16:38:30 -07001743#else
1744 psessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
1745#endif
1746#if defined WLAN_VOWIFI_DEBUG
1747 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localPowerConstraint, psessionEntry->maxTxPower );
1748#endif
1749
1750 if (pMac->lim.gLimCurrentBssUapsd)
1751 {
1752 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimJoinReq->uapsdPerAcBitmask;
1753 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x\n"), pMac->lim.gUapsdPerAcBitmask);
1754
1755 // resetting the dynamic uapsd mask
1756 pMac->lim.gUapsdPerAcDeliveryEnableMask = 0;
1757 pMac->lim.gUapsdPerAcTriggerEnableMask = 0;
1758 }
1759#endif
1760
1761 psessionEntry->limRFBand = limGetRFBand(psessionEntry->currentOperChannel);
1762
1763 // Initialize 11h Enable Flag
1764 if(SIR_BAND_5_GHZ == psessionEntry->limRFBand)
1765 {
1766 if (wlan_cfgGetInt(pMac, WNI_CFG_11H_ENABLED, &val) != eSIR_SUCCESS)
1767 limLog(pMac, LOGP, FL("Fail to get WNI_CFG_11H_ENABLED \n"));
1768 psessionEntry->lim11hEnable = val;
1769 }
1770 else
1771 psessionEntry->lim11hEnable = 0;
1772
1773 //To care of the scenario when STA transitions from IBSS to Infrastructure mode.
1774 pMac->lim.gLimIbssCoalescingHappened = false;
1775
Jeff Johnsone7245742012-09-05 17:12:55 -07001776 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
1777 psessionEntry->limSmeState = eLIM_SME_WT_JOIN_STATE;
1778 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07001779
1780 PELOG1(limLog(pMac, LOG1, FL("SME JoinReq: SSID %d.%c%c%c%c%c%c\n"),
1781 psessionEntry->ssId.length,
1782 psessionEntry->ssId.ssId[0],
1783 psessionEntry->ssId.ssId[1],
1784 psessionEntry->ssId.ssId[2],
1785 psessionEntry->ssId.ssId[3],
1786 psessionEntry->ssId.ssId[4],
1787 psessionEntry->ssId.ssId[5]);
1788 limLog(pMac, LOG1, FL("Channel %d, BSSID %x:%x:%x:%x:%x:%x\n"),
1789 psessionEntry->currentOperChannel,
1790 psessionEntry->bssId[0],
1791 psessionEntry->bssId[1],
1792 psessionEntry->bssId[2],
1793 psessionEntry->bssId[3],
1794 psessionEntry->bssId[4],
1795 psessionEntry->bssId[5]);)
1796
1797 /* Indicate whether spectrum management is enabled*/
1798 psessionEntry->spectrumMgtEnabled =
1799 pSmeJoinReq->spectrumMgtIndicator;
1800 /* Issue LIM_MLM_JOIN_REQ to MLM */
1801 limPostMlmMessage(pMac, LIM_MLM_JOIN_REQ, (tANI_U32 *) pMlmJoinReq);
1802 return;
1803
1804 }
1805 else
1806 {
1807 /* Received eWNI_SME_JOIN_REQ un expected state */
1808 limLog(pMac, LOGE, FL("received unexpected SME_JOIN_REQ in state %X\n"), pMac->lim.gLimSmeState);
1809 limPrintSmeState(pMac, LOGE, pMac->lim.gLimSmeState);
1810 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1811 psessionEntry = NULL;
1812 goto end;
1813
1814 }
1815
1816end:
1817 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf,&smesessionId,&smetransactionId);
1818
1819 if(pSmeJoinReq)
1820 {
1821 palFreeMemory( pMac->hHdd, pSmeJoinReq);
1822 pSmeJoinReq = NULL;
1823 if (NULL != psessionEntry)
1824 {
1825 psessionEntry->pLimJoinReq = NULL;
1826 }
1827 }
1828
1829 if(retCode != eSIR_SME_SUCCESS)
1830 {
1831 if(NULL != psessionEntry)
1832 {
1833 peDeleteSession(pMac,psessionEntry);
1834 psessionEntry = NULL;
1835 }
1836 }
1837
1838 limSendSmeJoinReassocRsp(pMac, eWNI_SME_JOIN_RSP, retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,psessionEntry,smesessionId,smetransactionId);
1839} /*** end __limProcessSmeJoinReq() ***/
1840
1841
1842#ifdef FEATURE_WLAN_CCX
Madan Mohan Koyyalamudi3282c572012-11-09 17:01:41 -08001843tANI_U8 limGetMaxTxPower(tPowerdBm regMax, tPowerdBm apTxPower, tANI_U8 iniTxPower)
Jeff Johnson295189b2012-06-20 16:38:30 -07001844{
1845 tANI_U8 maxTxPower = 0;
1846 tANI_U8 txPower = VOS_MIN( regMax , (apTxPower) );
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001847 txPower = VOS_MIN(txPower, iniTxPower);
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 if((txPower >= MIN_TX_PWR_CAP) && (txPower <= MAX_TX_PWR_CAP))
1849 maxTxPower = txPower;
1850 else if (txPower < MIN_TX_PWR_CAP)
1851 maxTxPower = MIN_TX_PWR_CAP;
1852 else
1853 maxTxPower = MAX_TX_PWR_CAP;
1854
1855 return (maxTxPower);
1856}
1857#endif
1858
Jeff Johnson295189b2012-06-20 16:38:30 -07001859/**
1860 * __limProcessSmeReassocReq()
1861 *
1862 *FUNCTION:
1863 * This function is called to process SME_REASSOC_REQ message
1864 * from HDD or upper layer application.
1865 *
1866 *LOGIC:
1867 *
1868 *ASSUMPTIONS:
1869 *
1870 *NOTE:
1871 *
1872 * @param pMac Pointer to Global MAC structure
1873 * @param *pMsgBuf A pointer to the SME message buffer
1874 * @return None
1875 */
1876
1877static void
1878__limProcessSmeReassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
1879{
1880 tANI_U16 caps;
1881 tANI_U32 val;
1882 tpSirSmeReassocReq pReassocReq = NULL;
1883 tLimMlmReassocReq *pMlmReassocReq;
1884 tSirResultCodes retCode = eSIR_SME_SUCCESS;
1885 tpPESession psessionEntry = NULL;
1886 tANI_U8 sessionId;
1887 tANI_U8 smeSessionId;
1888 tANI_U16 transactionId;
1889 tPowerdBm localPowerConstraint = 0, regMax = 0;
1890 tANI_U32 teleBcnEn = 0;
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07001891 tANI_U16 nSize;
Jeff Johnson295189b2012-06-20 16:38:30 -07001892
1893
1894 PELOG3(limLog(pMac, LOG3, FL("Received REASSOC_REQ\n"));)
1895
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07001896 nSize = __limGetSmeJoinReqSizeForAlloc((tANI_U8 *) pMsgBuf);
1897 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pReassocReq, nSize ))
Jeff Johnson295189b2012-06-20 16:38:30 -07001898 {
1899 // Log error
1900 limLog(pMac, LOGP,
1901 FL("call to palAllocateMemory failed for pReassocReq\n"));
1902
1903 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
1904 goto end;
1905 }
Madan Mohan Koyyalamudi7df624d2012-10-31 16:32:50 -07001906 (void) palZeroMemory(pMac->hHdd, (void *) pReassocReq, nSize);
Jeff Johnson295189b2012-06-20 16:38:30 -07001907 if ((limJoinReqSerDes(pMac, (tpSirSmeJoinReq) pReassocReq,
1908 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
1909 (!limIsSmeJoinReqValid(pMac,
1910 (tpSirSmeJoinReq) pReassocReq)))
1911 {
1912 /// Received invalid eWNI_SME_REASSOC_REQ
1913 // Log the event
1914 limLog(pMac, LOGW,
1915 FL("received SME_REASSOC_REQ with invalid data\n"));
1916
1917 retCode = eSIR_SME_INVALID_PARAMETERS;
1918 goto end;
1919 }
1920
1921 if((psessionEntry = peFindSessionByBssid(pMac,pReassocReq->bssDescription.bssId,&sessionId))==NULL)
1922 {
1923 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
1924 limLog(pMac, LOGP, FL("Session does not exist for given bssId\n"));
1925 retCode = eSIR_SME_INVALID_PARAMETERS;
1926 goto end;
1927 }
1928
1929#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1930 limDiagEventReport(pMac, WLAN_PE_DIAG_REASSOC_REQ_EVENT, psessionEntry, 0, 0);
1931#endif //FEATURE_WLAN_DIAG_SUPPORT
1932 //pMac->lim.gpLimReassocReq = pReassocReq;//TO SUPPORT BT-AMP
1933
1934 /* Store the reassoc handle in the session Table.. 23rd sep review */
1935 psessionEntry->pLimReAssocReq = pReassocReq;
1936
1937 /**
1938 * Reassociate request is expected
1939 * in link established state only.
1940 */
1941
1942 if (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE)
1943 {
Jeff Johnson04dd8a82012-06-29 20:41:40 -07001944#if defined(WLAN_FEATURE_VOWIFI_11R) || defined(FEATURE_WLAN_CCX) || defined(FEATURE_WLAN_LFR)
Jeff Johnson295189b2012-06-20 16:38:30 -07001945 if (psessionEntry->limSmeState == eLIM_SME_WT_REASSOC_STATE)
1946 {
1947 // May be from 11r FT pre-auth. So lets check it before we bail out
1948 limLog(pMac, LOGE, FL("Session in reassoc state is %d\n"),
1949 psessionEntry->peSessionId);
1950
1951 // Make sure its our preauth bssid
1952 if (!palEqualMemory( pMac->hHdd, pReassocReq->bssDescription.bssId,
1953 pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, 6))
1954 {
1955 limPrintMacAddr(pMac, pReassocReq->bssDescription.bssId, LOGE);
1956 limPrintMacAddr(pMac, pMac->ft.ftPEContext.pFTPreAuthReq->preAuthbssId, LOGE);
1957 limLog(pMac, LOGP, FL("Unknown bssId in reassoc state\n"));
1958 retCode = eSIR_SME_INVALID_PARAMETERS;
1959 goto end;
1960 }
1961
1962 limProcessMlmFTReassocReq(pMac, pMsgBuf, psessionEntry);
1963 return;
1964 }
1965#endif
1966 /// Should not have received eWNI_SME_REASSOC_REQ
1967 // Log the event
1968 limLog(pMac, LOGE,
1969 FL("received unexpected SME_REASSOC_REQ in state %X\n"),
1970 psessionEntry->limSmeState);
1971 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
1972
1973 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
1974 goto end;
1975 }
1976
Jeff Johnson295189b2012-06-20 16:38:30 -07001977 palCopyMemory( pMac->hHdd,
1978 psessionEntry->limReAssocbssId,
1979 psessionEntry->pLimReAssocReq->bssDescription.bssId,
1980 sizeof(tSirMacAddr));
1981
1982 psessionEntry->limReassocChannelId =
1983 psessionEntry->pLimReAssocReq->bssDescription.channelId;
1984
Jeff Johnsone7245742012-09-05 17:12:55 -07001985 psessionEntry->reAssocHtSupportedChannelWidthSet =
1986 (psessionEntry->pLimReAssocReq->cbMode)?1:0;
1987 psessionEntry->reAssocHtRecommendedTxWidthSet =
1988 psessionEntry->reAssocHtSupportedChannelWidthSet;
1989 psessionEntry->reAssocHtSecondaryChannelOffset =
1990 psessionEntry->pLimReAssocReq->cbMode;
1991
Jeff Johnson295189b2012-06-20 16:38:30 -07001992 psessionEntry->limReassocBssCaps =
1993 psessionEntry->pLimReAssocReq->bssDescription.capabilityInfo;
Jeff Johnson295189b2012-06-20 16:38:30 -07001994 regMax = cfgGetRegulatoryMaxTransmitPower( pMac, psessionEntry->currentOperChannel );
1995 localPowerConstraint = regMax;
1996 limExtractApCapability( pMac,
1997 (tANI_U8 *) psessionEntry->pLimReAssocReq->bssDescription.ieFields,
1998 limGetIElenFromBssDescription(
1999 &psessionEntry->pLimReAssocReq->bssDescription),
2000 &psessionEntry->limReassocBssQosCaps,
2001 &psessionEntry->limReassocBssPropCap,
2002 &pMac->lim.gLimCurrentBssUapsd //TBD-RAJESH make gLimReassocBssUapsd session specific
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -07002003 , &localPowerConstraint,
2004 psessionEntry
Jeff Johnson295189b2012-06-20 16:38:30 -07002005 );
2006
2007 psessionEntry->maxTxPower = VOS_MIN( regMax , (localPowerConstraint) );
2008#if defined WLAN_VOWIFI_DEBUG
2009 limLog( pMac, LOGE, "Regulatory max = %d, local power constraint = %d, max tx = %d", regMax, localPowerConstraint, psessionEntry->maxTxPower );
2010#endif
2011 {
2012 #if 0
2013 if (wlan_cfgGetStr(pMac, WNI_CFG_SSID, pMac->lim.gLimReassocSSID.ssId,
2014 &cfgLen) != eSIR_SUCCESS)
2015 {
2016 /// Could not get SSID from CFG. Log error.
2017 limLog(pMac, LOGP, FL("could not retrive SSID\n"));
2018 }
2019 #endif//TO SUPPORT BT-AMP
2020
2021 /* Copy the SSID from sessio entry to local variable */
2022 #if 0
2023 palCopyMemory( pMac->hHdd, pMac->lim.gLimReassocSSID.ssId,
2024 psessionEntry->ssId.ssId,
2025 psessionEntry->ssId.length);
2026 #endif
2027 psessionEntry->limReassocSSID.length = pReassocReq->ssId.length;
2028 palCopyMemory( pMac->hHdd, psessionEntry->limReassocSSID.ssId,
2029 pReassocReq->ssId.ssId, psessionEntry->limReassocSSID.length);
2030
2031 }
2032
2033 if (pMac->lim.gLimCurrentBssUapsd)
2034 {
2035 pMac->lim.gUapsdPerAcBitmask = psessionEntry->pLimReAssocReq->uapsdPerAcBitmask;
2036 limLog( pMac, LOG1, FL("UAPSD flag for all AC - 0x%2x\n"), pMac->lim.gUapsdPerAcBitmask);
2037 }
2038
Jeff Johnson295189b2012-06-20 16:38:30 -07002039 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmReassocReq, sizeof(tLimMlmReassocReq)))
2040 {
2041 // Log error
2042 limLog(pMac, LOGP,
2043 FL("call to palAllocateMemory failed for mlmReassocReq\n"));
2044
2045 retCode = eSIR_SME_RESOURCES_UNAVAILABLE;
2046 goto end;
2047 }
2048
2049 palCopyMemory( pMac->hHdd, pMlmReassocReq->peerMacAddr,
2050 psessionEntry->limReAssocbssId,
2051 sizeof(tSirMacAddr));
2052
2053 if (wlan_cfgGetInt(pMac, WNI_CFG_REASSOCIATION_FAILURE_TIMEOUT,
2054 (tANI_U32 *) &pMlmReassocReq->reassocFailureTimeout)
2055 != eSIR_SUCCESS)
2056 {
2057 /**
2058 * Could not get ReassocFailureTimeout value
2059 * from CFG. Log error.
2060 */
2061 limLog(pMac, LOGP,
2062 FL("could not retrieve ReassocFailureTimeout value\n"));
2063 }
2064
2065 if (cfgGetCapabilityInfo(pMac, &caps,psessionEntry) != eSIR_SUCCESS)
2066 {
2067 /**
2068 * Could not get Capabilities value
2069 * from CFG. Log error.
2070 */
2071 limLog(pMac, LOGP,
2072 FL("could not retrieve Capabilities value\n"));
2073 }
2074 pMlmReassocReq->capabilityInfo = caps;
2075
2076 /* Update PE sessionId*/
2077 pMlmReassocReq->sessionId = sessionId;
2078
2079 /* If telescopic beaconing is enabled, set listen interval to
2080 WNI_CFG_TELE_BCN_MAX_LI */
2081 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_WAKEUP_EN, &teleBcnEn) !=
2082 eSIR_SUCCESS)
2083 limLog(pMac, LOGP, FL("Couldn't get WNI_CFG_TELE_BCN_WAKEUP_EN\n"));
2084
2085 val = WNI_CFG_LISTEN_INTERVAL_STADEF;
2086
2087 if(teleBcnEn)
2088 {
2089 if(wlan_cfgGetInt(pMac, WNI_CFG_TELE_BCN_MAX_LI, &val) !=
2090 eSIR_SUCCESS)
2091 {
2092 /**
2093 * Could not get ListenInterval value
2094 * from CFG. Log error.
2095 */
2096 limLog(pMac, LOGP, FL("could not retrieve ListenInterval\n"));
2097 }
2098 }
2099 else
2100 {
2101 if (wlan_cfgGetInt(pMac, WNI_CFG_LISTEN_INTERVAL, &val) != eSIR_SUCCESS)
2102 {
2103 /**
2104 * Could not get ListenInterval value
2105 * from CFG. Log error.
2106 */
2107 limLog(pMac, LOGP, FL("could not retrieve ListenInterval\n"));
2108 }
2109 }
2110
2111 /* Delete all BA sessions before Re-Assoc.
2112 * BA frames are class 3 frames and the session
2113 * is lost upon disassociation and reassociation.
2114 */
2115
2116 limDelAllBASessions(pMac);
2117
2118 pMlmReassocReq->listenInterval = (tANI_U16) val;
2119
2120 /* Indicate whether spectrum management is enabled*/
2121 psessionEntry->spectrumMgtEnabled = pReassocReq->spectrumMgtIndicator;
2122
2123 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2124 psessionEntry->limSmeState = eLIM_SME_WT_REASSOC_STATE;
2125
Jeff Johnsone7245742012-09-05 17:12:55 -07002126 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002127
2128 limPostMlmMessage(pMac,
2129 LIM_MLM_REASSOC_REQ,
2130 (tANI_U32 *) pMlmReassocReq);
2131 return;
2132
2133end:
2134 if (pReassocReq)
2135 palFreeMemory( pMac->hHdd, pReassocReq);
2136
2137 if (psessionEntry)
2138 {
2139 // error occurred after we determined the session so extract
2140 // session and transaction info from there
2141 smeSessionId = psessionEntry->smeSessionId;
2142 transactionId = psessionEntry->transactionId;
2143 }
2144 else
2145 {
2146 // error occurred before or during the time we determined the session
2147 // so extract the session and transaction info from the message
2148 limGetSessionInfo(pMac,(tANI_U8*)pMsgBuf, &smeSessionId, &transactionId);
2149 }
2150
2151 /// Send Reassoc failure response to host
2152 /// (note psessionEntry may be NULL, but that's OK)
2153 limSendSmeJoinReassocRsp(pMac, eWNI_SME_REASSOC_RSP,
2154 retCode, eSIR_MAC_UNSPEC_FAILURE_STATUS,
2155 psessionEntry, smeSessionId, transactionId);
2156
2157} /*** end __limProcessSmeReassocReq() ***/
2158
2159
2160tANI_BOOLEAN sendDisassocFrame = 1;
2161/**
2162 * __limProcessSmeDisassocReq()
2163 *
2164 *FUNCTION:
2165 * This function is called to process SME_DISASSOC_REQ message
2166 * from HDD or upper layer application.
2167 *
2168 *LOGIC:
2169 *
2170 *ASSUMPTIONS:
2171 *
2172 *NOTE:
2173 *
2174 * @param pMac Pointer to Global MAC structure
2175 * @param *pMsgBuf A pointer to the SME message buffer
2176 * @return None
2177 */
2178
2179static void
2180__limProcessSmeDisassocReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2181{
2182 tANI_U16 disassocTrigger, reasonCode;
2183 tLimMlmDisassocReq *pMlmDisassocReq;
2184 tSirResultCodes retCode = eSIR_SME_SUCCESS;
Jeff Johnson43971f52012-07-17 12:26:56 -07002185 tSirRetStatus status;
Jeff Johnson295189b2012-06-20 16:38:30 -07002186 tSirSmeDisassocReq smeDisassocReq;
2187 tpPESession psessionEntry = NULL;
2188 tANI_U8 sessionId;
2189 tANI_U8 smesessionId;
2190 tANI_U16 smetransactionId;
2191
2192 PELOG1(limLog(pMac, LOG1,FL("received DISASSOC_REQ message\n"));)
2193
Jeff Johnson43971f52012-07-17 12:26:56 -07002194 if (pMsgBuf == NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -07002195 {
Jeff Johnson43971f52012-07-17 12:26:56 -07002196 limLog(pMac, LOGE, FL("Buffer is Pointing to NULL\n"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002197 return;
2198 }
2199
Jeff Johnson43971f52012-07-17 12:26:56 -07002200 limGetSessionInfo(pMac, (tANI_U8 *)pMsgBuf,&smesessionId, &smetransactionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07002201
Jeff Johnson43971f52012-07-17 12:26:56 -07002202 status = limDisassocReqSerDes(pMac, &smeDisassocReq, (tANI_U8 *) pMsgBuf);
Jeff Johnson295189b2012-06-20 16:38:30 -07002203
Jeff Johnson43971f52012-07-17 12:26:56 -07002204 if ( (eSIR_FAILURE == status) ||
2205 (!limIsSmeDisassocReqValid(pMac, &smeDisassocReq, psessionEntry)) )
Jeff Johnson295189b2012-06-20 16:38:30 -07002206 {
2207 PELOGE(limLog(pMac, LOGE,
2208 FL("received invalid SME_DISASSOC_REQ message\n"));)
2209
2210 if (pMac->lim.gLimRspReqd)
2211 {
2212 pMac->lim.gLimRspReqd = false;
2213
2214 retCode = eSIR_SME_INVALID_PARAMETERS;
2215 disassocTrigger = eLIM_HOST_DISASSOC;
2216 goto sendDisassoc;
2217 }
2218
2219 return;
2220 }
2221
2222
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07002223 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_REQ message. Reason: %d global SmeState: %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002224 smeDisassocReq.reasonCode, pMac->lim.gLimSmeState);)
2225
2226
2227 if((psessionEntry = peFindSessionByBssid(pMac,smeDisassocReq.bssId,&sessionId))== NULL)
2228 {
2229 limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));
2230 retCode = eSIR_SME_INVALID_PARAMETERS;
2231 disassocTrigger = eLIM_HOST_DISASSOC;
2232 goto sendDisassoc;
2233
2234 }
2235
2236#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2237 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_REQ_EVENT, psessionEntry, 0, smeDisassocReq.reasonCode);
2238#endif //FEATURE_WLAN_DIAG_SUPPORT
2239
2240 /* Update SME session Id and SME transaction ID*/
2241
2242 psessionEntry->smeSessionId = smesessionId;
2243 psessionEntry->transactionId = smetransactionId;
2244
2245 switch (psessionEntry->limSystemRole)
2246 {
2247 case eLIM_STA_ROLE:
2248 case eLIM_BT_AMP_STA_ROLE:
2249 switch (psessionEntry->limSmeState)
2250 {
2251 case eLIM_SME_ASSOCIATED_STATE:
2252 case eLIM_SME_LINK_EST_STATE:
2253 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2254 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002255 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002256 break;
2257
2258 case eLIM_SME_WT_DEAUTH_STATE:
2259 /* PE shall still process the DISASSOC_REQ and proceed with
2260 * link tear down even if it had already sent a DEAUTH_IND to
2261 * to SME. pMac->lim.gLimPrevSmeState shall remain the same as
2262 * its been set when PE entered WT_DEAUTH_STATE.
2263 */
2264 psessionEntry->limSmeState= eLIM_SME_WT_DISASSOC_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002265 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002266 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DEAUTH_STATE. \n"));
2267 break;
2268
2269 case eLIM_SME_WT_DISASSOC_STATE:
2270 /* PE Recieved a Disassoc frame. Normally it gets DISASSOC_CNF but it
2271 * received DISASSOC_REQ. Which means host is also trying to disconnect.
2272 * PE can continue processing DISASSOC_REQ and send the response instead
2273 * of failing the request. SME will anyway ignore DEAUTH_IND that was sent
2274 * for disassoc frame.
2275 *
2276 * It will send a disassoc, which is ok. However, we can use the global flag
2277 * sendDisassoc to not send disassoc frame.
2278 */
2279 limLog(pMac, LOG1, FL("Rcvd SME_DISASSOC_REQ while in SME_WT_DISASSOC_STATE. \n"));
2280 break;
2281
2282 case eLIM_SME_JOIN_FAILURE_STATE: {
2283 /** Return Success as we are already in Disconnected State*/
2284 if (pMac->lim.gLimRspReqd) {
2285 retCode = eSIR_SME_SUCCESS;
2286 disassocTrigger = eLIM_HOST_DISASSOC;
2287 goto sendDisassoc;
2288 }
2289 }break;
2290 default:
2291 /**
2292 * STA is not currently associated.
2293 * Log error and send response to host
2294 */
2295 limLog(pMac, LOGE,
2296 FL("received unexpected SME_DISASSOC_REQ in state %X\n"),
2297 psessionEntry->limSmeState);
2298 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2299
2300 if (pMac->lim.gLimRspReqd)
2301 {
2302 if (psessionEntry->limSmeState !=
2303 eLIM_SME_WT_ASSOC_STATE)
2304 pMac->lim.gLimRspReqd = false;
2305
2306 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2307 disassocTrigger = eLIM_HOST_DISASSOC;
2308 goto sendDisassoc;
2309 }
2310
2311 return;
2312 }
2313
2314 break;
2315
2316 case eLIM_AP_ROLE:
2317 case eLIM_BT_AMP_AP_ROLE:
2318 // Fall through
2319 break;
2320
2321 case eLIM_STA_IN_IBSS_ROLE:
2322 default: // eLIM_UNKNOWN_ROLE
2323 limLog(pMac, LOGE,
2324 FL("received unexpected SME_DISASSOC_REQ for role %d\n"),
2325 psessionEntry->limSystemRole);
2326
2327 retCode = eSIR_SME_UNEXPECTED_REQ_RESULT_CODE;
2328 disassocTrigger = eLIM_HOST_DISASSOC;
2329 goto sendDisassoc;
2330 } // end switch (pMac->lim.gLimSystemRole)
2331
2332 if (smeDisassocReq.reasonCode == eLIM_LINK_MONITORING_DISASSOC)
2333 {
2334 /// Disassociation is triggered by Link Monitoring
2335 disassocTrigger = eLIM_LINK_MONITORING_DISASSOC;
2336 reasonCode = eSIR_MAC_DISASSOC_DUE_TO_INACTIVITY_REASON;
2337 }
2338 else
2339 {
2340 disassocTrigger = eLIM_HOST_DISASSOC;
2341 reasonCode = smeDisassocReq.reasonCode;
2342 }
2343
2344 if (smeDisassocReq.doNotSendOverTheAir)
2345 {
2346 sendDisassocFrame = 0;
2347 }
2348 // Trigger Disassociation frame to peer MAC entity
2349 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmDisassocReq, sizeof(tLimMlmDisassocReq)))
2350 {
2351 // Log error
2352 limLog(pMac, LOGP,
2353 FL("call to palAllocateMemory failed for mlmDisassocReq\n"));
2354
2355 return;
2356 }
2357
2358 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
2359 (tANI_U8 *) &smeDisassocReq.peerMacAddr,
2360 sizeof(tSirMacAddr));
2361
2362 pMlmDisassocReq->reasonCode = reasonCode;
2363 pMlmDisassocReq->disassocTrigger = disassocTrigger;
2364
2365 /* Update PE session ID*/
2366 pMlmDisassocReq->sessionId = sessionId;
2367#ifdef ANI_PRODUCT_TYPE_AP
2368 pMlmDisassocReq->aid = smeDisassocReq.aid;
2369#endif
2370
2371 limPostMlmMessage(pMac,
2372 LIM_MLM_DISASSOC_REQ,
2373 (tANI_U32 *) pMlmDisassocReq);
2374 return;
2375
2376sendDisassoc:
2377 if (psessionEntry)
2378 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2379 retCode,
2380 disassocTrigger,
2381#ifdef ANI_PRODUCT_TYPE_AP
2382 smeDisassocReq.aid);
2383#else
2384 1,smesessionId,smetransactionId,psessionEntry);
2385#endif
2386 else
2387 limSendSmeDisassocNtf(pMac, smeDisassocReq.peerMacAddr,
2388 retCode,
2389 disassocTrigger,
2390#ifdef ANI_PRODUCT_TYPE_AP
2391 smeDisassocReq.aid);
2392#else
2393 1, 0, 0, NULL);
2394#endif
2395
2396
2397} /*** end __limProcessSmeDisassocReq() ***/
2398
2399
2400/** -----------------------------------------------------------------
2401 \brief __limProcessSmeDisassocCnf() - Process SME_DISASSOC_CNF
2402
2403 This function is called to process SME_DISASSOC_CNF message
2404 from HDD or upper layer application.
2405
2406 \param pMac - global mac structure
2407 \param pStaDs - station dph hash node
2408 \return none
2409 \sa
2410 ----------------------------------------------------------------- */
2411static void
2412__limProcessSmeDisassocCnf(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2413{
2414 tSirSmeDisassocCnf smeDisassocCnf;
2415 tANI_U16 aid;
2416 tpDphHashNode pStaDs;
2417 tSirRetStatus status = eSIR_SUCCESS;
2418 tpPESession psessionEntry;
2419 tANI_U8 sessionId;
2420
2421
2422 PELOG1(limLog(pMac, LOG1, FL("received DISASSOC_CNF message\n"));)
2423
2424 status = limDisassocCnfSerDes(pMac, &smeDisassocCnf,(tANI_U8 *) pMsgBuf);
2425
2426 if (status == eSIR_FAILURE)
2427 {
2428 PELOGE(limLog(pMac, LOGE, FL("invalid SME_DISASSOC_CNF message\n"));)
2429 return;
2430 }
2431
2432 if((psessionEntry = peFindSessionByBssid(pMac, smeDisassocCnf.bssId, &sessionId))== NULL)
2433 {
2434 limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));
2435 return;
2436 }
2437
2438 if (!limIsSmeDisassocCnfValid(pMac, &smeDisassocCnf, psessionEntry))
2439 {
2440 limLog(pMac, LOGW, FL("received invalid SME_DISASSOC_CNF message\n"));
2441 return;
2442 }
2443
2444#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2445 if (smeDisassocCnf.messageType == eWNI_SME_DISASSOC_CNF)
2446 limDiagEventReport(pMac, WLAN_PE_DIAG_DISASSOC_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2447 else if (smeDisassocCnf.messageType == eWNI_SME_DEAUTH_CNF)
2448 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_CNF_EVENT, psessionEntry, (tANI_U16)smeDisassocCnf.statusCode, 0);
2449#endif //FEATURE_WLAN_DIAG_SUPPORT
2450
2451 switch (psessionEntry->limSystemRole)
2452 {
2453 case eLIM_STA_ROLE:
2454 case eLIM_BT_AMP_STA_ROLE: //To test reconn
2455 if ((psessionEntry->limSmeState != eLIM_SME_IDLE_STATE) &&
2456 (psessionEntry->limSmeState != eLIM_SME_WT_DISASSOC_STATE) &&
2457 (psessionEntry->limSmeState != eLIM_SME_WT_DEAUTH_STATE))
2458 {
2459 limLog(pMac, LOGE,
2460 FL("received unexp SME_DISASSOC_CNF in state %X\n"),
2461 psessionEntry->limSmeState);
2462 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2463 return;
2464 }
2465 break;
2466
2467 case eLIM_AP_ROLE:
2468 // Fall through
2469#ifdef WLAN_SOFTAP_FEATURE
2470 break;
2471#else
2472 return;
2473#endif
2474
2475 case eLIM_STA_IN_IBSS_ROLE:
2476 default: // eLIM_UNKNOWN_ROLE
2477 limLog(pMac, LOGE,
2478 FL("received unexpected SME_DISASSOC_CNF role %d\n"),
2479 psessionEntry->limSystemRole);
2480
2481 return;
2482 }
2483
2484
2485 if ( (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE) ||
2486 (psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE)
2487#ifdef WLAN_SOFTAP_FEATURE
2488 || (psessionEntry->limSystemRole == eLIM_AP_ROLE )
2489#endif
2490 )
2491 {
2492 pStaDs = dphLookupHashEntry(pMac, smeDisassocCnf.peerMacAddr, &aid, &psessionEntry->dph.dphHashTable);
2493 if (pStaDs == NULL)
2494 {
2495 PELOGW(limLog(pMac, LOGW, FL("received DISASSOC_CNF for a STA that does not have context, addr= "));
2496 limPrintMacAddr(pMac, smeDisassocCnf.peerMacAddr, LOGW);)
2497 return;
2498 }
Madan Mohan Koyyalamudi23001722012-10-31 16:48:56 -07002499 /* Delete FT session if there exists one */
2500 limFTCleanup(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002501 limCleanupRxPath(pMac, pStaDs, psessionEntry);
Madan Mohan Koyyalamudia67d4332012-11-29 11:35:23 -08002502
2503 limCleanUpDisassocDeauthReq(pMac, (char*)&smeDisassocCnf.peerMacAddr, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -07002504 }
2505
2506 return;
2507}
2508
2509
2510/**
2511 * __limProcessSmeDeauthReq()
2512 *
2513 *FUNCTION:
2514 * This function is called to process SME_DEAUTH_REQ message
2515 * from HDD or upper layer application.
2516 *
2517 *LOGIC:
2518 *
2519 *ASSUMPTIONS:
2520 *
2521 *NOTE:
2522 *
2523 * @param pMac Pointer to Global MAC structure
2524 * @param *pMsgBuf A pointer to the SME message buffer
2525 * @return None
2526 */
2527
2528static void
2529__limProcessSmeDeauthReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2530{
2531 tANI_U16 deauthTrigger, reasonCode;
2532 tLimMlmDeauthReq *pMlmDeauthReq;
2533 tSirSmeDeauthReq smeDeauthReq;
2534 tSirResultCodes retCode = eSIR_SME_SUCCESS;
2535 tSirRetStatus status = eSIR_SUCCESS;
2536 tpPESession psessionEntry;
2537 tANI_U8 sessionId; //PE sessionId
2538 tANI_U8 smesessionId;
2539 tANI_U16 smetransactionId;
2540
2541 PELOG1(limLog(pMac, LOG1,FL("received DEAUTH_REQ message\n"));)
2542
2543 status = limDeauthReqSerDes(pMac, &smeDeauthReq,(tANI_U8 *) pMsgBuf);
2544
2545 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2546
2547 //We need to get a session first but we don't even know if the message is correct.
2548 if((psessionEntry = peFindSessionByBssid(pMac, smeDeauthReq.bssId, &sessionId)) == NULL)
2549 {
2550 limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));
2551 retCode = eSIR_SME_INVALID_PARAMETERS;
2552 deauthTrigger = eLIM_HOST_DEAUTH;
2553 goto sendDeauth;
2554
2555 }
2556
2557 if ((status == eSIR_FAILURE) || (!limIsSmeDeauthReqValid(pMac, &smeDeauthReq, psessionEntry)))
2558 {
2559 PELOGE(limLog(pMac, LOGW,FL("received invalid SME_DEAUTH_REQ message\n"));)
2560 if (pMac->lim.gLimRspReqd)
2561 {
2562 pMac->lim.gLimRspReqd = false;
2563
2564 retCode = eSIR_SME_INVALID_PARAMETERS;
2565 deauthTrigger = eLIM_HOST_DEAUTH;
2566 goto sendDeauth;
2567 }
2568
2569 return;
2570 }
2571
2572#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2573 limDiagEventReport(pMac, WLAN_PE_DIAG_DEAUTH_REQ_EVENT, psessionEntry, 0, smeDeauthReq.reasonCode);
2574#endif //FEATURE_WLAN_DIAG_SUPPORT
2575
2576 /* Update SME session ID and Transaction ID */
2577 psessionEntry->smeSessionId = smesessionId;
2578 psessionEntry->transactionId = smetransactionId;
2579
2580
2581 switch (psessionEntry->limSystemRole)
2582 {
2583 case eLIM_STA_ROLE:
2584 case eLIM_BT_AMP_STA_ROLE:
2585
2586 switch (psessionEntry->limSmeState)
2587 {
2588 case eLIM_SME_ASSOCIATED_STATE:
2589 case eLIM_SME_LINK_EST_STATE:
2590 case eLIM_SME_WT_ASSOC_STATE:
2591 case eLIM_SME_JOIN_FAILURE_STATE:
2592 case eLIM_SME_IDLE_STATE:
2593 psessionEntry->limPrevSmeState = psessionEntry->limSmeState;
2594 psessionEntry->limSmeState = eLIM_SME_WT_DEAUTH_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07002595 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, pMac->lim.gLimSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07002596
2597 // Send Deauthentication request to MLM below
2598
2599 break;
2600
2601 default:
2602 /**
2603 * STA is not in a state to deauthenticate with
2604 * peer. Log error and send response to host.
2605 */
2606 limLog(pMac, LOGE,
2607 FL("received unexp SME_DEAUTH_REQ in state %X\n"),psessionEntry->limSmeState);
2608 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2609
2610 if (pMac->lim.gLimRspReqd)
2611 {
2612 pMac->lim.gLimRspReqd = false;
2613
2614 retCode = eSIR_SME_STA_NOT_AUTHENTICATED;
2615 deauthTrigger = eLIM_HOST_DEAUTH;
2616 goto sendDeauth;
2617 }
2618
2619 return;
2620 }
2621
2622 break;
2623
2624 case eLIM_STA_IN_IBSS_ROLE:
2625
2626 return;
2627
2628 case eLIM_AP_ROLE:
2629 // Fall through
2630
2631 break;
2632
2633 default:
2634 limLog(pMac, LOGE,
2635 FL("received unexpected SME_DEAUTH_REQ for role %X\n"),psessionEntry->limSystemRole);
2636
2637 return;
2638 } // end switch (pMac->lim.gLimSystemRole)
2639
2640 if (smeDeauthReq.reasonCode == eLIM_LINK_MONITORING_DEAUTH)
2641 {
2642 /// Deauthentication is triggered by Link Monitoring
2643 PELOG1(limLog(pMac, LOG1, FL("**** Lost link with AP ****\n"));)
2644 deauthTrigger = eLIM_LINK_MONITORING_DEAUTH;
2645 reasonCode = eSIR_MAC_UNSPEC_FAILURE_REASON;
2646 }
2647 else
2648 {
2649 deauthTrigger = eLIM_HOST_DEAUTH;
2650 reasonCode = smeDeauthReq.reasonCode;
2651 }
2652
2653 // Trigger Deauthentication frame to peer MAC entity
2654 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmDeauthReq, sizeof(tLimMlmDeauthReq)))
2655 {
2656 // Log error
2657 limLog(pMac, LOGP,
2658 FL("call to palAllocateMemory failed for mlmDeauthReq\n"));
2659
2660 return;
2661 }
2662
2663 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmDeauthReq->peerMacAddr,
2664 (tANI_U8 *) &smeDeauthReq.peerMacAddr,
2665 sizeof(tSirMacAddr));
2666
2667 pMlmDeauthReq->reasonCode = reasonCode;
2668 pMlmDeauthReq->deauthTrigger = deauthTrigger;
2669#ifdef ANI_PRODUCT_TYPE_AP
2670 pMlmDeauthReq->aid = smeDeauthReq.aid;
2671#endif
2672
2673 /* Update PE session Id*/
2674 pMlmDeauthReq->sessionId = sessionId;
2675
2676 limPostMlmMessage(pMac,
2677 LIM_MLM_DEAUTH_REQ,
2678 (tANI_U32 *) pMlmDeauthReq);
2679 return;
2680
2681sendDeauth:
2682 limSendSmeDeauthNtf(pMac, smeDeauthReq.peerMacAddr,
2683 retCode,
2684 deauthTrigger,
2685#ifdef ANI_PRODUCT_TYPE_AP
2686 smeDeauthReq.aid,
2687#else
2688 1,
2689#endif
2690 smesessionId, smetransactionId);
2691} /*** end __limProcessSmeDeauthReq() ***/
2692
2693
2694
2695/**
2696 * __limProcessSmeSetContextReq()
2697 *
2698 *FUNCTION:
2699 * This function is called to process SME_SETCONTEXT_REQ message
2700 * from HDD or upper layer application.
2701 *
2702 *LOGIC:
2703 *
2704 *ASSUMPTIONS:
2705 *
2706 *NOTE:
2707 *
2708 * @param pMac Pointer to Global MAC structure
2709 * @param *pMsgBuf A pointer to the SME message buffer
2710 * @return None
2711 */
2712
2713static void
2714__limProcessSmeSetContextReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2715{
2716 tpSirSmeSetContextReq pSetContextReq;
2717 tLimMlmSetKeysReq *pMlmSetKeysReq;
2718 tpPESession psessionEntry;
2719 tANI_U8 sessionId; //PE sessionID
2720 tANI_U8 smesessionId;
2721 tANI_U16 smetransactionId;
2722
2723
2724 PELOG1(limLog(pMac, LOG1,
2725 FL("received SETCONTEXT_REQ message\n")););
2726
2727
2728 if(pMsgBuf == NULL)
2729 {
2730 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
2731 return;
2732 }
2733
2734 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2735
2736 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSetContextReq,
2737 (sizeof(tSirKeys) * SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)))
2738 {
2739 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pSetContextReq\n"));
2740 return;
2741 }
2742
2743 if ((limSetContextReqSerDes(pMac, pSetContextReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
2744 (!limIsSmeSetContextReqValid(pMac, pSetContextReq)))
2745 {
2746 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message\n"));
2747 goto end;
2748 }
2749
2750 if(pSetContextReq->keyMaterial.numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2751 {
2752 PELOGE(limLog(pMac, LOGE, FL("numKeys:%d is more than SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS\n"), pSetContextReq->keyMaterial.numKeys);)
2753 limSendSmeSetContextRsp(pMac,
2754 pSetContextReq->peerMacAddr,
2755#ifdef ANI_PRODUCT_TYPE_AP
2756 pSetContextReq->aid,
2757#else
2758 1,
2759#endif
2760 eSIR_SME_INVALID_PARAMETERS,NULL,
2761 smesessionId,smetransactionId);
2762
2763 goto end;
2764 }
2765
2766
2767 if((psessionEntry = peFindSessionByBssid(pMac, pSetContextReq->bssId, &sessionId)) == NULL)
2768 {
2769 limLog(pMac, LOGW, FL("Session does not exist for given BSSID\n"));
2770 limSendSmeSetContextRsp(pMac,
2771 pSetContextReq->peerMacAddr,
2772#ifdef ANI_PRODUCT_TYPE_AP
2773 pSetContextReq->aid,
2774#else
2775 1,
2776#endif
2777 eSIR_SME_INVALID_PARAMETERS,NULL,
2778 smesessionId,smetransactionId);
2779
2780 goto end;
2781 }
2782
2783#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
2784 limDiagEventReport(pMac, WLAN_PE_DIAG_SETCONTEXT_REQ_EVENT, psessionEntry, 0, 0);
2785#endif //FEATURE_WLAN_DIAG_SUPPORT
2786
2787
2788 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE)) &&
2789 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
2790 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
2791 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
2792 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
2793 {
2794 // Trigger MLM_SETKEYS_REQ
2795 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmSetKeysReq, sizeof(tLimMlmSetKeysReq)))
2796 {
2797 // Log error
2798 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for mlmSetKeysReq\n"));
2799 goto end;
2800 }
2801
2802 pMlmSetKeysReq->edType = pSetContextReq->keyMaterial.edType;
2803 pMlmSetKeysReq->numKeys = pSetContextReq->keyMaterial.numKeys;
2804 if(pMlmSetKeysReq->numKeys > SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS)
2805 {
2806 limLog(pMac, LOGP, FL("Num of keys exceeded max num of default keys limit\n"));
2807 goto end;
2808 }
2809 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmSetKeysReq->peerMacAddr,
2810 (tANI_U8 *) &pSetContextReq->peerMacAddr,
2811 sizeof(tSirMacAddr));
2812
2813#ifdef ANI_PRODUCT_TYPE_AP
2814 pMlmSetKeysReq->aid = pSetContextReq->aid;
2815#endif
2816
2817 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmSetKeysReq->key,
2818 (tANI_U8 *) &pSetContextReq->keyMaterial.key,
2819 sizeof(tSirKeys) * (pMlmSetKeysReq->numKeys ? pMlmSetKeysReq->numKeys : 1));
2820
2821 pMlmSetKeysReq->sessionId = sessionId;
2822#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
2823 PELOG1(limLog(pMac, LOG1,
2824 FL("received SETCONTEXT_REQ message sessionId=%d\n"), pMlmSetKeysReq->sessionId););
2825#endif
2826
2827#ifdef WLAN_SOFTAP_FEATURE
2828 if(((pSetContextReq->keyMaterial.edType == eSIR_ED_WEP40) || (pSetContextReq->keyMaterial.edType == eSIR_ED_WEP104))
2829 && (psessionEntry->limSystemRole == eLIM_AP_ROLE))
2830 {
2831 if(pSetContextReq->keyMaterial.key[0].keyLength)
2832 {
2833 tANI_U8 keyId;
2834 keyId = pSetContextReq->keyMaterial.key[0].keyId;
2835 palCopyMemory(pMac, (tANI_U8 *)&psessionEntry->WEPKeyMaterial[keyId],
2836 (tANI_U8 *) &pSetContextReq->keyMaterial, sizeof(tSirKeyMaterial));
2837 }
2838 else {
2839 tANI_U32 i;
2840 for( i = 0; i < SIR_MAC_MAX_NUM_OF_DEFAULT_KEYS; i++)
2841 {
2842 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmSetKeysReq->key[i],
2843 (tANI_U8 *)psessionEntry->WEPKeyMaterial[i].key, sizeof(tSirKeys));
2844 }
2845 }
2846 }
2847#endif
2848
2849 limPostMlmMessage(pMac, LIM_MLM_SETKEYS_REQ, (tANI_U32 *) pMlmSetKeysReq);
2850
2851#ifdef ANI_AP_SDK
2852 /* For SDK acting as STA under Linux, need to consider the AP as *
2853 * as authenticatated. */
2854 if ( (psessionEntry->limSystemRole == eLIM_STA_ROLE) &&
2855 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE))
2856 {
2857 tpDphHashNode pSta;
2858 pSta = dphGetHashEntry(pMac, 0, &psessionEntry->dph.dphHashTable);
2859 if (pSta)
2860 pSta->staAuthenticated = 1;
2861 }
2862#endif
2863 }
2864 else
2865 {
2866 limLog(pMac, LOGE,
2867 FL("received unexpected SME_SETCONTEXT_REQ for role %d, state=%X\n"),
2868 psessionEntry->limSystemRole,
2869 psessionEntry->limSmeState);
2870 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
2871
2872 limSendSmeSetContextRsp(pMac, pSetContextReq->peerMacAddr,
2873#ifdef ANI_PRODUCT_TYPE_AP
2874 pSetContextReq->aid,
2875#else
2876 1,
2877#endif
2878 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
2879 smesessionId,
2880 smetransactionId);
2881 }
2882
2883end:
2884 palFreeMemory( pMac->hHdd, pSetContextReq);
2885 return;
2886} /*** end __limProcessSmeSetContextReq() ***/
2887
2888/**
2889 * __limProcessSmeRemoveKeyReq()
2890 *
2891 *FUNCTION:
2892 * This function is called to process SME_REMOVEKEY_REQ message
2893 * from HDD or upper layer application.
2894 *
2895 *LOGIC:
2896 *
2897 *ASSUMPTIONS:
2898 *
2899 *NOTE:
2900 *
2901 * @param pMac Pointer to Global MAC structure
2902 * @param *pMsgBuf A pointer to the SME message buffer
2903 * @return None
2904 */
2905
2906static void
2907__limProcessSmeRemoveKeyReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
2908{
2909 tpSirSmeRemoveKeyReq pRemoveKeyReq;
2910 tLimMlmRemoveKeyReq *pMlmRemoveKeyReq;
2911 tpPESession psessionEntry;
2912 tANI_U8 sessionId; //PE sessionID
2913 tANI_U8 smesessionId;
2914 tANI_U16 smetransactionId;
2915
2916 PELOG1(limLog(pMac, LOG1,
2917 FL("received REMOVEKEY_REQ message\n"));)
2918
2919 if(pMsgBuf == NULL)
2920 {
2921 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
2922 return;
2923 }
2924
2925
2926 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
2927
2928 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pRemoveKeyReq,
2929 (sizeof(*pRemoveKeyReq))))
2930 {
2931 //Log error
2932 limLog(pMac, LOGP,
2933 FL("call to palAllocateMemory failed for pRemoveKeyReq\n"));
2934
2935 return;
2936 }
2937
2938 if ((limRemoveKeyReqSerDes(pMac,
2939 pRemoveKeyReq,
2940 (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
2941 {
2942 limLog(pMac, LOGW,
2943 FL("received invalid SME_REMOVECONTEXT_REQ message\n"));
2944
2945 /* extra look up is needed since, session entry to be passed il limsendremovekey response */
2946
2947 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId,&sessionId))== NULL)
2948 {
2949 limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));
2950 //goto end;
2951 }
2952
2953 limSendSmeRemoveKeyRsp(pMac,
2954 pRemoveKeyReq->peerMacAddr,
2955 eSIR_SME_INVALID_PARAMETERS,psessionEntry,
2956 smesessionId,smetransactionId);
2957
2958 goto end;
2959 }
2960
2961 if((psessionEntry = peFindSessionByBssid(pMac,pRemoveKeyReq->bssId, &sessionId))== NULL)
2962 {
2963 limLog(pMac, LOGE,
2964 FL("session does not exist for given bssId\n"));
2965 limSendSmeRemoveKeyRsp(pMac,
2966 pRemoveKeyReq->peerMacAddr,
2967 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE, NULL,
2968 smesessionId, smetransactionId);
2969 goto end;
2970 }
2971
2972
2973 if ((((psessionEntry->limSystemRole == eLIM_STA_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE))&&
2974 (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE)) ||
2975 (((psessionEntry->limSystemRole == eLIM_STA_IN_IBSS_ROLE) ||
2976 (psessionEntry->limSystemRole == eLIM_AP_ROLE)|| (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)) &&
2977 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE)))
2978 {
2979 // Trigger MLM_REMOVEKEYS_REQ
2980 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmRemoveKeyReq, sizeof(tLimMlmRemoveKeyReq)))
2981 {
2982 // Log error
2983 limLog(pMac, LOGP,
2984 FL("call to palAllocateMemory failed for mlmRemoveKeysReq\n"));
2985
2986 goto end;
2987 }
2988
2989 pMlmRemoveKeyReq->edType = (tAniEdType)pRemoveKeyReq->edType;
2990 pMlmRemoveKeyReq->keyId = pRemoveKeyReq->keyId;
2991 pMlmRemoveKeyReq->wepType = pRemoveKeyReq->wepType;
2992 pMlmRemoveKeyReq->unicast = pRemoveKeyReq->unicast;
2993
2994 /* Update PE session Id */
2995 pMlmRemoveKeyReq->sessionId = sessionId;
2996
2997 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmRemoveKeyReq->peerMacAddr,
2998 (tANI_U8 *) &pRemoveKeyReq->peerMacAddr,
2999 sizeof(tSirMacAddr));
3000
3001
3002 limPostMlmMessage(pMac,
3003 LIM_MLM_REMOVEKEY_REQ,
3004 (tANI_U32 *) pMlmRemoveKeyReq);
3005 }
3006 else
3007 {
3008 limLog(pMac, LOGE,
3009 FL("received unexpected SME_REMOVEKEY_REQ for role %d, state=%X\n"),
3010 psessionEntry->limSystemRole,
3011 psessionEntry->limSmeState);
3012 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3013
3014 limSendSmeRemoveKeyRsp(pMac,
3015 pRemoveKeyReq->peerMacAddr,
3016 eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,psessionEntry,
3017 smesessionId,smetransactionId);
3018 }
3019
3020end:
3021 palFreeMemory( pMac->hHdd, pRemoveKeyReq);
3022} /*** end __limProcessSmeRemoveKeyReq() ***/
3023
Jeff Johnson295189b2012-06-20 16:38:30 -07003024void limProcessSmeGetScanChannelInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3025{
3026 tSirMsgQ mmhMsg;
3027 tpSmeGetScanChnRsp pSirSmeRsp;
3028 tANI_U16 len = 0;
3029
3030 if(pMac->lim.scanChnInfo.numChnInfo > SIR_MAX_SUPPORTED_CHANNEL_LIST)
3031 {
3032 limLog(pMac, LOGW, FL("numChn is out of bounds %d\n"),
3033 pMac->lim.scanChnInfo.numChnInfo);
3034 pMac->lim.scanChnInfo.numChnInfo = SIR_MAX_SUPPORTED_CHANNEL_LIST;
3035 }
3036
3037 PELOG2(limLog(pMac, LOG2,
3038 FL("Sending message %s with number of channels %d\n"),
3039 limMsgStr(eWNI_SME_GET_SCANNED_CHANNEL_RSP), pMac->lim.scanChnInfo.numChnInfo);)
3040
3041 len = sizeof(tSmeGetScanChnRsp) + (pMac->lim.scanChnInfo.numChnInfo - 1) * sizeof(tLimScanChn);
3042 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pSirSmeRsp, len ))
3043 {
3044 /// Buffer not available. Log error
3045 limLog(pMac, LOGP,
3046 FL("call to palAllocateMemory failed for JOIN/REASSOC_RSP\n"));
3047
3048 return;
3049 }
3050 palZeroMemory(pMac->hHdd, pSirSmeRsp, len);
3051
3052#if defined(ANI_PRODUCT_TYPE_AP) && defined(ANI_LITTLE_BYTE_ENDIAN)
3053 sirStoreU16N((tANI_U8*)&pSirSmeRsp->mesgType, eWNI_SME_GET_SCANNED_CHANNEL_RSP);
3054 sirStoreU16N((tANI_U8*)&pSirSmeRsp->mesgLen, len);
3055#else
3056 pSirSmeRsp->mesgType = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3057 pSirSmeRsp->mesgLen = len;
3058#endif
3059 pSirSmeRsp->sessionId = 0;
3060
3061 if(pMac->lim.scanChnInfo.numChnInfo)
3062 {
3063 pSirSmeRsp->numChn = pMac->lim.scanChnInfo.numChnInfo;
3064 palCopyMemory(pMac->hHdd, pSirSmeRsp->scanChn, pMac->lim.scanChnInfo.scanChn, sizeof(tLimScanChn) * pSirSmeRsp->numChn);
3065 }
3066 //Clear the list
3067 limRessetScanChannelInfo(pMac);
3068
3069 mmhMsg.type = eWNI_SME_GET_SCANNED_CHANNEL_RSP;
3070 mmhMsg.bodyptr = pSirSmeRsp;
3071 mmhMsg.bodyval = 0;
3072
3073 pMac->lim.gLimRspReqd = false;
Jeff Johnsone7245742012-09-05 17:12:55 -07003074 MTRACE(macTraceMsgTx(pMac, NO_SESSION, mmhMsg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07003075 limSysProcessMmhMsgApi(pMac, &mmhMsg, ePROT);
3076}
3077
3078
3079#ifdef WLAN_SOFTAP_FEATURE
3080void limProcessSmeGetAssocSTAsInfo(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3081{
3082 tSirSmeGetAssocSTAsReq getAssocSTAsReq;
3083 tpDphHashNode pStaDs = NULL;
3084 tpPESession psessionEntry = NULL;
3085 tSap_Event sapEvent;
3086 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3087 tpSap_AssocMacAddr pAssocStasTemp = NULL;// #include "sapApi.h"
3088 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3089 tANI_U8 assocId = 0;
3090 tANI_U8 staCount = 0;
3091
3092 if (!limIsSmeGetAssocSTAsReqValid(pMac, &getAssocSTAsReq, (tANI_U8 *) pMsgBuf))
3093 {
3094 limLog(pMac, LOGE,
3095 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message\n"));
3096 goto limAssocStaEnd;
3097 }
3098
3099 switch (getAssocSTAsReq.modId)
3100 {
3101/**
3102 case VOS_MODULE_ID_HAL:
3103 wdaPostCtrlMsg( pMac, &msgQ );
3104 return;
3105
3106 case VOS_MODULE_ID_TL:
3107 Post msg TL
3108 return;
3109*/
3110 case VOS_MODULE_ID_PE:
3111 default:
3112 break;
3113 }
3114
Jeff Johnson1250df42012-12-10 14:31:52 -08003115 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003116 // Find PE session Entry
3117 if ((psessionEntry = peFindSessionByBssid(pMac, getAssocSTAsReq.bssId, &sessionId)) == NULL)
3118 {
3119 limLog(pMac, LOGE,
3120 FL("session does not exist for given bssId\n"));
3121 goto limAssocStaEnd;
3122 }
3123
3124 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3125 {
3126 limLog(pMac, LOGE,
3127 FL("Received unexpected message in state %X, in role %X\n"),
3128 psessionEntry->limSmeState , psessionEntry->limSystemRole);
3129 goto limAssocStaEnd;
3130 }
3131
3132 // Retrieve values obtained in the request message
3133 pSapEventCallback = (tpWLAN_SAPEventCB)getAssocSTAsReq.pSapEventCallback;
3134 pAssocStasTemp = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3135
3136 for (assocId = 0; assocId < psessionEntry->dph.dphHashTable.size; assocId++)// Softap dphHashTable.size = 8
3137 {
3138 pStaDs = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
3139
3140 if (NULL == pStaDs)
3141 continue;
3142
3143 if (pStaDs->valid)
3144 {
3145 palCopyMemory(pMac->hHdd, (tANI_U8 *)&pAssocStasTemp->staMac,
3146 (tANI_U8 *)&pStaDs->staAddr,
3147 sizeof(v_MACADDR_t)); // Mac address
3148 pAssocStasTemp->assocId = (v_U8_t)pStaDs->assocId; // Association Id
3149 pAssocStasTemp->staId = (v_U8_t)pStaDs->staIndex; // Station Id
3150
3151 limLog(pMac, LOG1, FL("dph Station Number = %d"), staCount+1);
3152 limLog(pMac, LOG1, FL("MAC = %02x:%02x:%02x:%02x:%02x:%02x"),
3153 pStaDs->staAddr[0],
3154 pStaDs->staAddr[1],
3155 pStaDs->staAddr[2],
3156 pStaDs->staAddr[3],
3157 pStaDs->staAddr[4],
3158 pStaDs->staAddr[5]);
3159 limLog(pMac, LOG1, FL("Association Id = %d"),pStaDs->assocId);
3160 limLog(pMac, LOG1, FL("Station Index = %d"),pStaDs->staIndex);
3161
3162 pAssocStasTemp++;
3163 staCount++;
3164 }
3165 }
3166
3167limAssocStaEnd:
3168 // Call hdd callback with sap event to send the list of associated stations from PE
3169 if (pSapEventCallback != NULL)
3170 {
3171 sapEvent.sapHddEventCode = eSAP_ASSOC_STA_CALLBACK_EVENT;
3172 sapEvent.sapevt.sapAssocStaListEvent.module = VOS_MODULE_ID_PE;
3173 sapEvent.sapevt.sapAssocStaListEvent.noOfAssocSta = staCount;
3174 sapEvent.sapevt.sapAssocStaListEvent.pAssocStas = (tpSap_AssocMacAddr)getAssocSTAsReq.pAssocStasArray;
3175 pSapEventCallback(&sapEvent, getAssocSTAsReq.pUsrContext);
3176 }
3177}
3178
3179
3180/**
3181 * limProcessSmeGetWPSPBCSessions
3182 *
3183 *FUNCTION:
3184 * This function is called when query the WPS PBC overlap message is received
3185 *
3186 *LOGIC:
3187 * This function parses get WPS PBC overlap information message and call callback to pass
3188 * WPS PBC overlap information back to hdd.
3189 *ASSUMPTIONS:
3190 *
3191 *
3192 *NOTE:
3193 *
3194 * @param pMac Pointer to Global MAC structure
3195 * @param pMsgBuf A pointer to WPS PBC overlap query message
3196*
3197 * @return None
3198 */
3199void limProcessSmeGetWPSPBCSessions(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3200{
3201 tSirSmeGetWPSPBCSessionsReq GetWPSPBCSessionsReq;
3202 tpPESession psessionEntry = NULL;
3203 tSap_Event sapEvent;
3204 tpWLAN_SAPEventCB pSapEventCallback = NULL;
3205 tANI_U8 sessionId = CSR_SESSION_ID_INVALID;
3206 tSirMacAddr zeroMac = {0,0,0,0,0,0};
3207
3208 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_E_FAULT;
3209
3210 if (limIsSmeGetWPSPBCSessionsReqValid(pMac, &GetWPSPBCSessionsReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS)
3211 {
3212 limLog(pMac, LOGE,
3213 FL("received invalid eWNI_SME_GET_ASSOC_STAS_REQ message\n"));
3214 goto limGetWPSPBCSessionsEnd;
3215 }
3216
Jeff Johnson1250df42012-12-10 14:31:52 -08003217 // Get Associated stations from PE
Jeff Johnson295189b2012-06-20 16:38:30 -07003218 // Find PE session Entry
3219 if ((psessionEntry = peFindSessionByBssid(pMac, GetWPSPBCSessionsReq.bssId, &sessionId)) == NULL)
3220 {
3221 limLog(pMac, LOGE,
3222 FL("session does not exist for given bssId\n"));
3223 goto limGetWPSPBCSessionsEnd;
3224 }
3225
3226 if (psessionEntry->limSystemRole != eLIM_AP_ROLE)
3227 {
3228 limLog(pMac, LOGE,
3229 FL("Received unexpected message in role %X\n"),
3230 psessionEntry->limSystemRole);
3231 goto limGetWPSPBCSessionsEnd;
3232 }
3233
Jeff Johnson1250df42012-12-10 14:31:52 -08003234 // Call hdd callback with sap event to send the WPS PBC overlap information
Jeff Johnson295189b2012-06-20 16:38:30 -07003235 sapEvent.sapHddEventCode = eSAP_GET_WPSPBC_SESSION_EVENT;
3236 sapEvent.sapevt.sapGetWPSPBCSessionEvent.module = VOS_MODULE_ID_PE;
3237
3238 if (palEqualMemory(pMac->hHdd, zeroMac, GetWPSPBCSessionsReq.pRemoveMac, sizeof(tSirMacAddr)))
3239 { //This is GetWpsSession call
3240
3241 limGetWPSPBCSessions(pMac,
3242 sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, sapEvent.sapevt.sapGetWPSPBCSessionEvent.UUID_E,
3243 &sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap, psessionEntry);
3244 }
3245 else
3246 {
3247 limRemovePBCSessions(pMac, GetWPSPBCSessionsReq.pRemoveMac,psessionEntry);
3248 /* don't have to inform the HDD/Host */
3249 return;
3250 }
3251
3252 PELOG4(limLog(pMac, LOGE, FL("wpsPBCOverlap %d\n"), sapEvent.sapevt.sapGetWPSPBCSessionEvent.wpsPBCOverlap);)
3253 PELOG4(limPrintMacAddr(pMac, sapEvent.sapevt.sapGetWPSPBCSessionEvent.addr.bytes, LOG4);)
3254
3255 sapEvent.sapevt.sapGetWPSPBCSessionEvent.status = VOS_STATUS_SUCCESS;
3256
3257limGetWPSPBCSessionsEnd:
3258 pSapEventCallback = (tpWLAN_SAPEventCB)GetWPSPBCSessionsReq.pSapEventCallback;
3259 pSapEventCallback(&sapEvent, GetWPSPBCSessionsReq.pUsrContext);
3260}
3261
3262#endif
3263
3264
3265/**
3266 * __limCounterMeasures()
3267 *
3268 * FUNCTION:
3269 * This function is called to "implement" MIC counter measure
3270 * and is *temporary* only
3271 *
3272 * LOGIC: on AP, disassoc all STA associated thru TKIP,
3273 * we don't do the proper STA disassoc sequence since the
3274 * BSS will be stoped anyway
3275 *
3276 *ASSUMPTIONS:
3277 *
3278 *NOTE:
3279 *
3280 * @param pMac Pointer to Global MAC structure
3281 * @return None
3282 */
3283
3284static void
3285__limCounterMeasures(tpAniSirGlobal pMac, tpPESession psessionEntry)
3286{
3287 tSirMacAddr mac = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3288 if ( (psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
3289 || (psessionEntry->limSystemRole == eLIM_BT_AMP_STA_ROLE) )
3290
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003291 limSendDisassocMgmtFrame(pMac, eSIR_MAC_MIC_FAILURE_REASON, mac, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003292
3293 tx_thread_sleep(10);
3294};
3295
3296
3297#ifdef WLAN_SOFTAP_FEATURE
3298void
3299limProcessTkipCounterMeasures(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3300{
3301 tSirSmeTkipCntrMeasReq tkipCntrMeasReq;
3302 tpPESession psessionEntry;
3303 tANI_U8 sessionId; //PE sessionId
3304
3305 if ( limTkipCntrMeasReqSerDes( pMac, &tkipCntrMeasReq, (tANI_U8 *) pMsgBuf ) != eSIR_SUCCESS )
3306 {
3307 limLog(pMac, LOGE,
3308 FL("received invalid eWNI_SME_TKIP_CNTR_MEAS_REQ message\n"));
3309 return;
3310 }
3311
3312 if ( NULL == (psessionEntry = peFindSessionByBssid( pMac, tkipCntrMeasReq.bssId, &sessionId )) )
3313 {
3314 limLog(pMac, LOGE, FL("session does not exist for given BSSID \n"));
3315 return;
3316 }
3317
3318 if ( tkipCntrMeasReq.bEnable )
3319 {
3320 __limCounterMeasures( pMac, psessionEntry );
3321 }
3322
3323 psessionEntry->bTkipCntrMeasActive = tkipCntrMeasReq.bEnable;
3324}
3325#endif
3326
3327
3328static void
3329__limHandleSmeStopBssRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3330{
3331 tSirSmeStopBssReq stopBssReq;
3332 tSirRetStatus status;
3333 tLimSmeStates prevState;
3334 tANI_U8 sessionId; //PE sessionId
3335 tpPESession psessionEntry;
3336 tANI_U8 smesessionId;
3337 tANI_U16 smetransactionId;
3338
3339 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3340
3341
3342
3343 if ((limStopBssReqSerDes(pMac, &stopBssReq, (tANI_U8 *) pMsgBuf) != eSIR_SUCCESS) ||
3344 !limIsSmeStopBssReqValid(pMsgBuf))
3345 {
3346 PELOGW(limLog(pMac, LOGW, FL("received invalid SME_STOP_BSS_REQ message\n"));)
3347 /// Send Stop BSS response to host
3348 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3349 return;
3350 }
3351
3352
3353 if((psessionEntry = peFindSessionByBssid(pMac,stopBssReq.bssId,&sessionId)) == NULL)
3354 {
3355 limLog(pMac, LOGW, FL("session does not exist for given BSSID \n"));
3356 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_INVALID_PARAMETERS,smesessionId,smetransactionId);
3357 return;
3358 }
3359
3360#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3361 limDiagEventReport(pMac, WLAN_PE_DIAG_STOP_BSS_REQ_EVENT, psessionEntry, 0, 0);
3362#endif //FEATURE_WLAN_DIAG_SUPPORT
3363
3364
3365 if ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) || /* Added For BT -AMP Support */
3366 (psessionEntry->limSystemRole == eLIM_STA_ROLE ))
3367 {
3368 /**
3369 * Should not have received STOP_BSS_REQ in states
3370 * other than 'normal' state or on STA in Infrastructure
3371 * mode. Log error and return response to host.
3372 */
3373 limLog(pMac, LOGE,
3374 FL("received unexpected SME_STOP_BSS_REQ in state %X, for role %d\n"),
3375 psessionEntry->limSmeState, psessionEntry->limSystemRole);
3376 limPrintSmeState(pMac, LOGE, psessionEntry->limSmeState);
3377 /// Send Stop BSS response to host
3378 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_UNEXPECTED_REQ_RESULT_CODE,smesessionId,smetransactionId);
3379 return;
3380 }
3381
3382#ifdef WLAN_SOFTAP_FEATURE
3383 if (psessionEntry->limSystemRole == eLIM_AP_ROLE )
3384 {
3385 limWPSPBCClose(pMac, psessionEntry);
3386 }
3387#endif
3388 PELOGW(limLog(pMac, LOGW, FL("RECEIVED STOP_BSS_REQ with reason code=%d\n"), stopBssReq.reasonCode);)
3389
3390 prevState = psessionEntry->limSmeState;
3391
3392 psessionEntry->limSmeState = eLIM_SME_IDLE_STATE;
Jeff Johnsone7245742012-09-05 17:12:55 -07003393 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003394
3395 /* Update SME session Id and Transaction Id */
3396 psessionEntry->smeSessionId = smesessionId;
3397 psessionEntry->transactionId = smetransactionId;
3398
3399 /* BTAMP_STA and STA_IN_IBSS should NOT send Disassoc frame */
3400 if ( (eLIM_STA_IN_IBSS_ROLE != psessionEntry->limSystemRole) && (eLIM_BT_AMP_STA_ROLE != psessionEntry->limSystemRole) )
3401 {
3402 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3403 if ((stopBssReq.reasonCode == eSIR_SME_MIC_COUNTER_MEASURES))
3404 // Send disassoc all stations associated thru TKIP
3405 __limCounterMeasures(pMac,psessionEntry);
3406 else
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08003407 limSendDisassocMgmtFrame(pMac, eSIR_MAC_DISASSOC_LEAVING_BSS_REASON, bcAddr, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -07003408 }
3409
3410 //limDelBss is also called as part of coalescing, when we send DEL BSS followed by Add Bss msg.
3411 pMac->lim.gLimIbssCoalescingHappened = false;
3412
3413 /* send a delBss to HAL and wait for a response */
3414 status = limDelBss(pMac, NULL,psessionEntry->bssIdx,psessionEntry);
3415
3416 if (status != eSIR_SUCCESS)
3417 {
3418 PELOGE(limLog(pMac, LOGE, FL("delBss failed for bss %d\n"), psessionEntry->bssIdx);)
3419 psessionEntry->limSmeState= prevState;
3420
Jeff Johnsone7245742012-09-05 17:12:55 -07003421 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, psessionEntry->peSessionId, psessionEntry->limSmeState));
Jeff Johnson295189b2012-06-20 16:38:30 -07003422
3423 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_STOP_BSS_FAILURE,smesessionId,smetransactionId);
3424 }
3425}
3426
3427
3428/**--------------------------------------------------------------
3429\fn __limProcessSmeStopBssReq
3430
3431\brief Wrapper for the function __limHandleSmeStopBssRequest
3432 This message will be defered until softmac come out of
3433 scan mode. Message should be handled even if we have
3434 detected radar in the current operating channel.
3435\param pMac
3436\param pMsg
3437
3438\return TRUE - If we consumed the buffer
3439 FALSE - If have defered the message.
3440 ---------------------------------------------------------------*/
3441static tANI_BOOLEAN
3442__limProcessSmeStopBssReq(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
3443{
3444 if (__limIsDeferedMsgForLearn(pMac, pMsg))
3445 {
3446 /**
3447 * If message defered, buffer is not consumed yet.
3448 * So return false
3449 */
3450 return eANI_BOOLEAN_FALSE;
3451 }
3452 __limHandleSmeStopBssRequest(pMac, (tANI_U32 *) pMsg->bodyptr);
3453 return eANI_BOOLEAN_TRUE;
3454} /*** end __limProcessSmeStopBssReq() ***/
3455
3456
3457void limProcessSmeDelBssRsp(
3458 tpAniSirGlobal pMac,
3459 tANI_U32 body,tpPESession psessionEntry)
3460{
3461
3462 (void) body;
3463 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
3464 //TBD: get the sessionEntry
3465 dphHashTableClassInit(pMac, &psessionEntry->dph.dphHashTable);
3466 limDeletePreAuthList(pMac);
3467 limIbssDelete(pMac,psessionEntry);
3468 limSendSmeRsp(pMac, eWNI_SME_STOP_BSS_RSP, eSIR_SME_SUCCESS,psessionEntry->smeSessionId,psessionEntry->transactionId);
3469 return;
3470}
3471
3472
3473#if 0
3474/**
3475 * __limProcessSmePromiscuousReq()
3476 *
3477 *FUNCTION:
3478 * This function is called to process SME_PROMISCUOUS_REQ message
3479 * from HDD or upper layer application.
3480 *
3481 *LOGIC:
3482 *
3483 *ASSUMPTIONS:
3484 *
3485 *NOTE:
3486 *
3487 * @param pMac Pointer to Global MAC structure
3488 * @param *pMsgBuf A pointer to the SME message buffer
3489 * @return None
3490 */
3491
3492static void
3493__limProcessSmePromiscuousReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3494{
3495
3496 tANI_U32 cfg = sizeof(tSirMacAddr);
3497 tSirMacAddr currentBssId;
3498 tLimMlmDisassocReq *pMlmDisassocReq;
3499 tSirMacAddr bcAddr = {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF};
3500
3501
3502 if(pMsgBuf == NULL)
3503 {
3504 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
3505 return;
3506 }
3507
3508 PELOG1(limLog(pMac, LOG1,
3509 FL("received PROMISCUOUS_REQ message\n"));)
3510
3511 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, currentBssId, &cfg) !=
3512 eSIR_SUCCESS)
3513 {
3514 /// Could not get BSSID from CFG. Log error.
3515 limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
3516 }
3517
3518 if ((((pMac->lim.gLimSystemRole == eLIM_STA_ROLE) ||
3519 (pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)) &&
3520 ((pMac->lim.gLimSmeState == eLIM_SME_ASSOCIATED_STATE) ||
3521 (pMac->lim.gLimSmeState == eLIM_SME_LINK_EST_STATE))) ||
3522 ((pMac->lim.gLimSystemRole == eLIM_AP_ROLE) &&
3523 (pMac->lim.gLimSmeState == eLIM_SME_NORMAL_STATE)))
3524 {
3525 // Trigger Disassociation frame to peer MAC entity
3526 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMlmDisassocReq, sizeof(tLimMlmDisassocReq)))
3527 {
3528 // Log error
3529 limLog(pMac, LOGP,
3530 FL("call to palAllocateMemory failed for mlmDisassocReq\n"));
3531
3532 return;
3533 }
3534
3535 if (pMac->lim.gLimSystemRole == eLIM_AP_ROLE)
3536 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMlmDisassocReq->peerMacAddr,
3537 (tANI_U8 *) &bcAddr,
3538 sizeof(tSirMacAddr));
3539 else
3540 palCopyMemory( pMac->hHdd, pMlmDisassocReq->peerMacAddr,
3541 currentBssId,
3542 sizeof(tSirMacAddr));
3543
3544 pMlmDisassocReq->reasonCode =
3545 eSIR_MAC_DISASSOC_LEAVING_BSS_REASON;
3546 pMlmDisassocReq->disassocTrigger =
3547 eLIM_PROMISCUOUS_MODE_DISASSOC;
3548
3549 pMac->lim.gLimPrevSmeState = pMac->lim.gLimSmeState;
3550 pMac->lim.gLimSmeState = eLIM_SME_WT_DISASSOC_STATE;
3551 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
3552
3553 limPostMlmMessage(pMac,
3554 LIM_MLM_DISASSOC_REQ,
3555 (tANI_U32 *) pMlmDisassocReq);
3556 }
3557 else
3558 {
3559 // Send Promiscuous mode response to host
3560 limSendSmePromiscuousModeRsp(pMac);
3561
3562 pMac->lim.gLimSmeState = eLIM_SME_OFFLINE_STATE;
3563 MTRACE(macTrace(pMac, TRACE_CODE_SME_STATE, 0, pMac->lim.gLimSmeState));
3564 }
3565
3566} /*** end __limProcessSmePromiscuousReq() ***/
3567#endif
3568
3569
3570/**---------------------------------------------------------------
3571\fn __limProcessSmeAssocCnfNew
3572\brief This function handles SME_ASSOC_CNF/SME_REASSOC_CNF
3573\ in BTAMP AP.
3574\
3575\param pMac
3576\param msgType - message type
3577\param pMsgBuf - a pointer to the SME message buffer
3578\return None
3579------------------------------------------------------------------*/
3580
3581 void
3582__limProcessSmeAssocCnfNew(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3583{
3584 tSirSmeAssocCnf assocCnf;
3585 tpDphHashNode pStaDs = NULL;
3586 tpPESession psessionEntry= NULL;
3587 tANI_U8 sessionId;
3588
3589
3590 if(pMsgBuf == NULL)
3591 {
3592 limLog(pMac, LOGE, FL("pMsgBuf is NULL \n"));
3593 goto end;
3594 }
3595
3596 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE) ||
3597 !__limIsSmeAssocCnfValid(&assocCnf))
3598 {
3599 limLog(pMac, LOGE, FL("Received invalid SME_RE(ASSOC)_CNF message \n"));
3600 goto end;
3601 }
3602
3603 if((psessionEntry = peFindSessionByBssid(pMac, assocCnf.bssId, &sessionId))== NULL)
3604 {
3605 limLog(pMac, LOGE, FL("session does not exist for given bssId\n"));
3606 goto end;
3607 }
3608
3609 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3610 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3611 {
3612 limLog(pMac, LOGE, FL("Received unexpected message %X in state %X, in role %X\n"),
3613 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
3614 goto end;
3615 }
3616
3617 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3618
3619 if (pStaDs == NULL)
3620 {
3621 limLog(pMac, LOG1,
3622 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
3623 msgType, assocCnf.aid);
3624 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3625
3626 /*
3627 ** send a DISASSOC_IND message to WSM to make sure
3628 ** the state in WSM and LIM is the same
3629 **/
3630 limSendSmeDisassocNtf( pMac, assocCnf.peerMacAddr, eSIR_SME_STA_NOT_ASSOCIATED,
3631 eLIM_PEER_ENTITY_DISASSOC, assocCnf.aid,psessionEntry->smeSessionId,psessionEntry->transactionId,psessionEntry);
3632 goto end;
3633 }
3634 if ((pStaDs &&
3635 (( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pStaDs->staAddr,
3636 (tANI_U8 *) assocCnf.peerMacAddr,
3637 sizeof(tSirMacAddr)) ) ||
3638 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3639 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3640 (msgType != eWNI_SME_ASSOC_CNF)) ||
3641 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
3642#ifdef WLAN_SOFTAP_FEATURE
3643 (msgType != eWNI_SME_ASSOC_CNF))))) // since softap is passing this as ASSOC_CNF and subtype differs
3644#else
3645 (msgType != eWNI_SME_REASSOC_CNF)))))
3646#endif
3647 {
3648 limLog(pMac, LOG1,
3649 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
3650 msgType, assocCnf.aid);
3651 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);
3652 goto end;
3653 }
3654
3655 /*
3656 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3657 ** has been received
3658 **/
3659 limLog(pMac, LOG1, FL("Received SME_ASSOC_CNF. Delete Timer\n"));
3660 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER, pStaDs->assocId);
3661
3662 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3663 {
3664 /* In BTAMP-AP, PE already finished the WDA_ADD_STA sequence
3665 * when it had received Assoc Request frame. Now, PE just needs to send
3666 * Association Response frame to the requesting BTAMP-STA.
3667 */
3668 pStaDs->mlmStaContext.mlmState = eLIM_MLM_LINK_ESTABLISHED_STATE;
3669 limLog(pMac, LOG1, FL("sending Assoc Rsp frame to STA (assoc id=%d) \n"), pStaDs->assocId);
3670 limSendAssocRspMgmtFrame( pMac, eSIR_SUCCESS, pStaDs->assocId, pStaDs->staAddr,
3671 pStaDs->mlmStaContext.subType, pStaDs, psessionEntry);
3672 goto end;
3673 } // (assocCnf.statusCode == eSIR_SME_SUCCESS)
3674 else
3675 {
3676 // SME_ASSOC_CNF status is non-success, so STA is not allowed to be associated
3677 /*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*/
3678 if(!pStaDs->mlmStaContext.updateContext)
3679 pStaDs->mlmStaContext.updateContext = 1;
3680 limRejectAssociation(pMac, pStaDs->staAddr,
3681 pStaDs->mlmStaContext.subType,
3682 true, pStaDs->mlmStaContext.authType,
3683 pStaDs->assocId, true,
3684 eSIR_MAC_UNSPEC_FAILURE_STATUS, psessionEntry);
3685 return;
3686 }
3687
3688end:
3689 if((psessionEntry != NULL) && (pStaDs != NULL))
3690 {
3691 if ( psessionEntry->parsedAssocReq[pStaDs->assocId] != NULL )
3692 {
3693 if ( ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame)
3694 {
3695 palFreeMemory(pMac->hHdd,((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame);
3696 ((tpSirAssocReq)(psessionEntry->parsedAssocReq[pStaDs->assocId]))->assocReqFrame = NULL;
3697 }
3698
3699 palFreeMemory(pMac->hHdd, psessionEntry->parsedAssocReq[pStaDs->assocId]);
3700 psessionEntry->parsedAssocReq[pStaDs->assocId] = NULL;
3701 }
3702 }
3703
3704} /*** end __limProcessSmeAssocCnfNew() ***/
3705
3706
3707#ifdef ANI_PRODUCT_TYPE_AP
3708/**
3709 * __limProcessSmeAssocCnf()
3710 *
3711 *FUNCTION:
3712 * This function is called by limProcessSmeMessages() upon
3713 * receiving SME_ASSOC_CNF/SME_REASSOC_CNF from WSM.
3714 *
3715 *LOGIC:
3716 *
3717 *ASSUMPTIONS:
3718 *
3719 *NOTE:
3720 *
3721 * @param pMac Pointer to Global MAC structure
3722 * @param *pMsgBuf A pointer to the SME message buffer
3723 *
3724 * @return None
3725 */
3726
3727static void
3728__limProcessSmeAssocCnf(tpAniSirGlobal pMac, tANI_U32 msgType, tANI_U32 *pMsgBuf)
3729{
3730 tSirSmeAssocCnf assocCnf;
3731 tpDphHashNode pStaDs;
3732 tpPESession psessionEntry;
3733 tANI_U8 sessionId;
3734 tHalBitVal cbBitVal;
3735 tANI_U8 tspecIdx = 0; //index in the lim tspec table.
3736
3737 if(pMsgBuf == NULL)
3738 {
3739 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
3740 return;
3741 }
3742
3743 if ((limAssocCnfSerDes(pMac, &assocCnf, (tANI_U8 *) pMsgBuf) ==
3744 eSIR_FAILURE) ||
3745 !__limIsSmeAssocCnfValid(&assocCnf))
3746 {
3747 limLog(pMac, LOGW,
3748 FL("Received re/assocCnf message with invalid parameters\n"));
3749
3750 return;
3751 }
3752
3753 if((psessionEntry = peFindSessionByBssid(pMac,assocCnf->bssId,&sessionId))== NULL)
3754 {
3755
3756 limLog(pMac, LOGE,
3757 FL("session does not exist for given bssId\n"));
3758 return;
3759 }
3760
3761#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3762 limDiagEventReport(pMac, WLAN_PE_DIAG_ASSOC_CNF_EVENT, psessionEntry, 0, 0);
3763#endif //FEATURE_WLAN_DIAG_SUPPORT
3764
3765 if ( ((psessionEntry->limSystemRole != eLIM_AP_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_AP_ROLE)) ||
3766 ((psessionEntry->limSmeState != eLIM_SME_NORMAL_STATE) && (psessionEntry->limSmeState != eLIM_SME_NORMAL_CHANNEL_SCAN_STATE)))
3767 {
3768 limLog(pMac, LOGE,
3769 FL("Received unexpected message %X in state %X, in role %X\n"),
3770 msgType, psessionEntry->limSmeState , psessionEntry->limSystemRole);
3771
3772 return;
3773 }
3774
3775 pStaDs = dphGetHashEntry(pMac, assocCnf.aid, &psessionEntry->dph.dphHashTable);
3776
3777
3778 if (pStaDs == NULL)
3779 {
3780
3781 PELOG1(limLog(pMac, LOG1,
3782 FL("Received invalid message %X due to no STA context, for aid %d, peer "),
3783 msgType, assocCnf.aid);
3784 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);)
3785
3786 /*
3787 ** send a DISASSOC_IND message to WSM to make sure
3788 ** the state in WSM and LIM is the same
3789 **/
3790
3791 limSendSmeDisassocNtf(pMac,
3792 assocCnf.peerMacAddr,
3793 eSIR_SME_STA_NOT_ASSOCIATED,
3794 eLIM_PEER_ENTITY_DISASSOC,
3795 assocCnf.aid,psessionEntry);
3796
3797 return;
3798 }
3799 if ((pStaDs &&
3800 (( !palEqualMemory( pMac->hHdd,(tANI_U8 *) pStaDs->staAddr,
3801 (tANI_U8 *) assocCnf.peerMacAddr,
3802 sizeof(tSirMacAddr)) ) ||
3803 (pStaDs->mlmStaContext.mlmState !=
3804 eLIM_MLM_WT_ASSOC_CNF_STATE) ||
3805 ((pStaDs->mlmStaContext.subType == LIM_ASSOC) &&
3806 (msgType != eWNI_SME_ASSOC_CNF)) ||
3807 ((pStaDs->mlmStaContext.subType == LIM_REASSOC) &&
3808 (msgType != eWNI_SME_REASSOC_CNF)))))
3809 {
3810 PELOG1(limLog(pMac, LOG1,
3811 FL("Received invalid message %X due to peerMacAddr mismatched or not in eLIM_MLM_WT_ASSOC_CNF_STATE state, for aid %d, peer "),
3812 msgType, assocCnf.aid);
3813 limPrintMacAddr(pMac, assocCnf.peerMacAddr, LOG1);)
3814
3815 return;
3816 }
3817
3818 /*
3819 ** Deactivate/delet CNF_WAIT timer since ASSOC_CNF
3820 ** has been received
3821 **/
3822
3823 PELOG1(limLog(pMac, LOG1, FL("Received Cnf. Delete Timer\n"));)
3824 limDeactivateAndChangePerStaIdTimer(pMac, eLIM_CNF_WAIT_TIMER,
3825 pStaDs->assocId);
3826
3827 if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3828 {
3829 tSirMacScheduleIE schedule;
3830
3831 // If STA is a TITAN-compatible device, then setup
3832 // the TITAN proprietary capabilities appropriately
3833 // in the per STA DS, as per the local TITAN Prop
3834 // capabilities of this AP
3835
3836 // STA is allowed to be associated
3837 if (pStaDs->mlmStaContext.updateContext)
3838 {
3839
3840 tLimMlmStates mlmPrevState = pStaDs->mlmStaContext.mlmState;
3841 //we need to set the mlmState here in order differentiate in limDelSta.
3842 pStaDs->mlmStaContext.mlmState = eLIM_MLM_WT_ASSOC_DEL_STA_RSP_STATE;
3843 if(limDelSta(pMac, pStaDs, true,psessionEntry) != eSIR_SUCCESS)
3844 {
3845 limLog(pMac, LOGE,
3846 FL("could not DEL STA with assocId=%d staId %d\n"),
3847 pStaDs->assocId, pStaDs->staIndex);
3848
3849 limRejectAssociation(pMac,
3850 pStaDs->staAddr,
3851 pStaDs->mlmStaContext.subType,
3852 true, pStaDs->mlmStaContext.authType,
3853 pStaDs->assocId, true,
3854 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
3855 psessionEntry);
3856
3857 //Restoring the state back.
3858 pStaDs->mlmStaContext.mlmState = mlmPrevState;
3859 return;
3860 }
3861 return;
3862 }
3863 else
3864 {
3865 // Add STA context at HW
3866 if (limAddSta(pMac, pStaDs,psessionEntry) != eSIR_SUCCESS)
3867 {
3868 limLog(pMac, LOGE,
3869 FL("could not Add STA with assocId=%d\n"),
3870 pStaDs->assocId);
3871
3872 // delete the TS if it has already been added.
3873 // send the response with error status.
3874 if(pStaDs->qos.addtsPresent)
3875 {
3876 limAdmitControlDeleteTS(pMac, pStaDs->assocId, &pStaDs->qos.addts.tspec.tsinfo, NULL, &tspecIdx);
3877 }
3878
3879 limRejectAssociation(pMac,
3880 pStaDs->staAddr,
3881 pStaDs->mlmStaContext.subType,
3882 true, pStaDs->mlmStaContext.authType,
3883 pStaDs->assocId, true,
3884 (tSirResultCodes) eSIR_MAC_UNSPEC_FAILURE_STATUS,
3885 psessionEntry);
3886
3887 }
3888 return;
3889 }
3890
3891 } // if (assocCnf.statusCode == eSIR_SME_SUCCESS)
3892 else
3893 {
3894 // STA is not allowed to be associated
3895 limRejectAssociation(pMac, pStaDs->staAddr,
3896 pStaDs->mlmStaContext.subType,
3897 true, pStaDs->mlmStaContext.authType,
3898 pStaDs->assocId, true,
3899 assocCnf.statusCode, psessionEntry);
3900 }
3901} /*** end __limProcessSmeAssocCnf() ***/
3902#endif
3903
3904
3905static void
3906__limProcessSmeAddtsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
3907{
3908 tpDphHashNode pStaDs;
3909 tSirMacAddr peerMac;
3910 tpSirAddtsReq pSirAddts;
3911 tANI_U32 timeout;
3912 tpPESession psessionEntry;
3913 tANI_U8 sessionId; //PE sessionId
3914 tANI_U8 smesessionId;
3915 tANI_U16 smetransactionId;
3916
3917
3918 if(pMsgBuf == NULL)
3919 {
3920 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
3921 return;
3922 }
3923
3924 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
3925
3926 pSirAddts = (tpSirAddtsReq) pMsgBuf;
3927
3928 if((psessionEntry = peFindSessionByBssid(pMac, pSirAddts->bssId,&sessionId))== NULL)
3929 {
3930 limLog(pMac, LOGE, "Session Does not exist for given bssId\n");
3931 return;
3932 }
3933#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
3934 limDiagEventReport(pMac, WLAN_PE_DIAG_ADDTS_REQ_EVENT, psessionEntry, 0, 0);
3935#endif //FEATURE_WLAN_DIAG_SUPPORT
3936
3937
3938
3939 /* if sta
3940 * - verify assoc state
3941 * - send addts request to ap
3942 * - wait for addts response from ap
3943 * if ap, just ignore with error log
3944 */
3945 PELOG1(limLog(pMac, LOG1,
3946 FL("Received SME_ADDTS_REQ (TSid %d, UP %d)\n"),
3947 pSirAddts->req.tspec.tsinfo.traffic.tsid,
3948 pSirAddts->req.tspec.tsinfo.traffic.userPrio);)
3949
3950 if ((psessionEntry->limSystemRole != eLIM_STA_ROLE)&&(psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE))
3951 {
3952 PELOGE(limLog(pMac, LOGE, "AddTs received on AP - ignoring\n");)
3953 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3954 smesessionId,smetransactionId);
3955 return;
3956 }
3957
3958 //Ignore the request if STA is in 11B mode.
3959 if(psessionEntry->dot11mode == WNI_CFG_DOT11_MODE_11B)
3960 {
3961 PELOGE(limLog(pMac, LOGE, "AddTS received while Dot11Mode is 11B - ignoring\n");)
3962 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3963 smesessionId,smetransactionId);
3964 return;
3965 }
3966
3967
3968 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
3969
3970 if(pStaDs == NULL)
3971 {
3972 PELOGE(limLog(pMac, LOGE, "Cannot find AP context for addts req\n");)
3973 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3974 smesessionId,smetransactionId);
3975 return;
3976 }
3977
3978 if ((! pStaDs->valid) ||
3979 (pStaDs->mlmStaContext.mlmState != eLIM_MLM_LINK_ESTABLISHED_STATE))
3980 {
3981 PELOGE(limLog(pMac, LOGE, "AddTs received in invalid MLM state\n");)
3982 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
3983 smesessionId,smetransactionId);
3984 return;
3985 }
3986
3987 pSirAddts->req.wsmTspecPresent = 0;
3988 pSirAddts->req.wmeTspecPresent = 0;
3989 pSirAddts->req.lleTspecPresent = 0;
3990
3991 if ((pStaDs->wsmEnabled) &&
3992 (pSirAddts->req.tspec.tsinfo.traffic.accessPolicy != SIR_MAC_ACCESSPOLICY_EDCA))
3993 pSirAddts->req.wsmTspecPresent = 1;
3994 else if (pStaDs->wmeEnabled)
3995 pSirAddts->req.wmeTspecPresent = 1;
3996 else if (pStaDs->lleEnabled)
3997 pSirAddts->req.lleTspecPresent = 1;
3998 else
3999 {
4000 PELOGW(limLog(pMac, LOGW, FL("ADDTS_REQ ignore - qos is disabled\n"));)
4001 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4002 smesessionId,smetransactionId);
4003 return;
4004 }
4005
4006 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
4007 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
4008 {
4009 limLog(pMac, LOGE, "AddTs received in invalid LIMsme state (%d)\n",
4010 psessionEntry->limSmeState);
4011 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4012 smesessionId,smetransactionId);
4013 return;
4014 }
4015
4016 if (pMac->lim.gLimAddtsSent)
4017 {
4018 limLog(pMac, LOGE, "Addts (token %d, tsid %d, up %d) is still pending\n",
4019 pMac->lim.gLimAddtsReq.req.dialogToken,
4020 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.tsid,
4021 pMac->lim.gLimAddtsReq.req.tspec.tsinfo.traffic.userPrio);
4022 limSendSmeAddtsRsp(pMac, pSirAddts->rspReqd, eSIR_FAILURE, psessionEntry, pSirAddts->req.tspec,
4023 smesessionId,smetransactionId);
4024 return;
4025 }
4026
4027 #if 0
4028 val = sizeof(tSirMacAddr);
4029 if (wlan_cfgGetStr(pMac, WNI_CFG_BSSID, peerMac, &val) != eSIR_SUCCESS)
4030 {
4031 /// Could not get BSSID from CFG. Log error.
4032 limLog(pMac, LOGP, FL("could not retrieve BSSID\n"));
4033 return;
4034 }
4035 #endif
4036 sirCopyMacAddr(peerMac,psessionEntry->bssId);
4037
4038 // save the addts request
4039 pMac->lim.gLimAddtsSent = true;
4040 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMac->lim.gLimAddtsReq, (tANI_U8 *) pSirAddts, sizeof(tSirAddtsReq));
4041
4042 // ship out the message now
4043 limSendAddtsReqActionFrame(pMac, peerMac, &pSirAddts->req,
4044 psessionEntry);
4045 PELOG1(limLog(pMac, LOG1, "Sent ADDTS request\n");)
4046
4047 // start a timer to wait for the response
4048 if (pSirAddts->timeout)
4049 timeout = pSirAddts->timeout;
4050 else if (wlan_cfgGetInt(pMac, WNI_CFG_ADDTS_RSP_TIMEOUT, &timeout) != eSIR_SUCCESS)
4051 {
4052 limLog(pMac, LOGP, FL("Unable to get Cfg param %d (Addts Rsp Timeout)\n"),
4053 WNI_CFG_ADDTS_RSP_TIMEOUT);
4054 return;
4055 }
4056
4057 timeout = SYS_MS_TO_TICKS(timeout);
4058 if (tx_timer_change(&pMac->lim.limTimers.gLimAddtsRspTimer, timeout, 0) != TX_SUCCESS)
4059 {
4060 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!\n"));
4061 return;
4062 }
4063 pMac->lim.gLimAddtsRspTimerCount++;
4064 if (tx_timer_change_context(&pMac->lim.limTimers.gLimAddtsRspTimer,
4065 pMac->lim.gLimAddtsRspTimerCount) != TX_SUCCESS)
4066 {
4067 limLog(pMac, LOGP, FL("AddtsRsp timer change failed!\n"));
4068 return;
4069 }
Jeff Johnsone7245742012-09-05 17:12:55 -07004070 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, psessionEntry->peSessionId, eLIM_ADDTS_RSP_TIMER));
Jeff Johnson295189b2012-06-20 16:38:30 -07004071
4072 //add the sessionId to the timer object
4073 pMac->lim.limTimers.gLimAddtsRspTimer.sessionId = sessionId;
4074 if (tx_timer_activate(&pMac->lim.limTimers.gLimAddtsRspTimer) != TX_SUCCESS)
4075 {
4076 limLog(pMac, LOGP, FL("AddtsRsp timer activation failed!\n"));
4077 return;
4078 }
4079 return;
4080}
4081
4082
4083static void
4084__limProcessSmeDeltsReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4085{
4086 tSirMacAddr peerMacAddr;
4087 tANI_U8 ac;
4088 tSirMacTSInfo *pTsinfo;
4089 tpSirDeltsReq pDeltsReq = (tpSirDeltsReq) pMsgBuf;
4090 tpDphHashNode pStaDs = NULL;
4091 tpPESession psessionEntry;
4092 tANI_U8 sessionId;
4093 tANI_U32 status = eSIR_SUCCESS;
4094 tANI_U8 smesessionId;
4095 tANI_U16 smetransactionId;
4096
4097 limGetSessionInfo(pMac,(tANI_U8 *)pMsgBuf,&smesessionId,&smetransactionId);
4098
4099 if((psessionEntry = peFindSessionByBssid(pMac, pDeltsReq->bssId, &sessionId))== NULL)
4100 {
4101 limLog(pMac, LOGE, "Session Does not exist for given bssId\n");
4102 status = eSIR_FAILURE;
4103 goto end;
4104 }
4105#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
4106 limDiagEventReport(pMac, WLAN_PE_DIAG_DELTS_REQ_EVENT, psessionEntry, 0, 0);
4107#endif //FEATURE_WLAN_DIAG_SUPPORT
4108
4109
4110 if (eSIR_SUCCESS != limValidateDeltsReq(pMac, pDeltsReq, peerMacAddr,psessionEntry))
4111 {
4112 PELOGE(limLog(pMac, LOGE, FL("limValidateDeltsReq failed\n"));)
4113 status = eSIR_FAILURE;
4114 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_FAILURE,psessionEntry,smesessionId,smetransactionId);
4115 return;
4116 }
4117
4118 PELOG1(limLog(pMac, LOG1, FL("Sent DELTS request to station with assocId = %d MacAddr = %x:%x:%x:%x:%x:%x\n"),
4119 pDeltsReq->aid, peerMacAddr[0], peerMacAddr[1], peerMacAddr[2],
4120 peerMacAddr[3], peerMacAddr[4], peerMacAddr[5]);)
4121
4122 limSendDeltsReqActionFrame(pMac, peerMacAddr, pDeltsReq->req.wmeTspecPresent, &pDeltsReq->req.tsinfo, &pDeltsReq->req.tspec,
4123 psessionEntry);
4124
4125 pTsinfo = pDeltsReq->req.wmeTspecPresent ? &pDeltsReq->req.tspec.tsinfo : &pDeltsReq->req.tsinfo;
4126
4127 /* We've successfully send DELTS frame to AP. Update the
4128 * dynamic UAPSD mask. The AC for this TSPEC to be deleted
4129 * is no longer trigger enabled or delivery enabled
4130 */
4131 limSetTspecUapsdMask(pMac, pTsinfo, CLEAR_UAPSD_MASK);
4132
4133 /* We're deleting the TSPEC, so this particular AC is no longer
4134 * admitted. PE needs to downgrade the EDCA
4135 * parameters(for the AC for which TS is being deleted) to the
4136 * next best AC for which ACM is not enabled, and send the
4137 * updated values to HAL.
4138 */
4139 ac = upToAc(pTsinfo->traffic.userPrio);
4140
4141 if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_UPLINK)
4142 {
4143 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4144 }
4145 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_DNLINK)
4146 {
4147 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4148 }
4149 else if(pTsinfo->traffic.direction == SIR_MAC_DIRECTION_BIDIR)
4150 {
4151 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_UPLINK] &= ~(1 << ac);
4152 pMac->lim.gAcAdmitMask[SIR_MAC_DIRECTION_DNLINK] &= ~(1 << ac);
4153 }
4154
4155 limSetActiveEdcaParams(pMac, psessionEntry->gLimEdcaParams, psessionEntry);
4156
4157 pStaDs = dphGetHashEntry(pMac, DPH_STA_HASH_INDEX_PEER, &psessionEntry->dph.dphHashTable);
4158 if (pStaDs != NULL)
4159 {
4160 if (pStaDs->aniPeer == eANI_BOOLEAN_TRUE)
4161 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_TRUE);
4162 else
4163 limSendEdcaParams(pMac, psessionEntry->gLimEdcaParamsActive, pStaDs->bssId, eANI_BOOLEAN_FALSE);
4164 status = eSIR_SUCCESS;
4165 }
4166 else
4167 {
4168 limLog(pMac, LOGE, FL("Self entry missing in Hash Table \n"));
4169 status = eSIR_FAILURE;
4170 }
4171#ifdef FEATURE_WLAN_CCX
4172 limDeactivateAndChangeTimer(pMac,eLIM_TSM_TIMER);
4173#endif
4174
4175 // send an sme response back
4176 end:
4177 limSendSmeDeltsRsp(pMac, pDeltsReq, eSIR_SUCCESS,psessionEntry,smesessionId,smetransactionId);
4178}
4179
4180
4181void
4182limProcessSmeAddtsRspTimeout(tpAniSirGlobal pMac, tANI_U32 param)
4183{
4184 //fetch the sessionEntry based on the sessionId
4185 tpPESession psessionEntry;
4186 if((psessionEntry = peFindSessionBySessionId(pMac, pMac->lim.limTimers.gLimAddtsRspTimer.sessionId))== NULL)
4187 {
4188 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID\n"));
4189 return;
4190 }
4191
4192 if ( (psessionEntry->limSystemRole != eLIM_STA_ROLE) && (psessionEntry->limSystemRole != eLIM_BT_AMP_STA_ROLE) )
4193 {
4194 limLog(pMac, LOGW, "AddtsRspTimeout in non-Sta role (%d)\n", psessionEntry->limSystemRole);
4195 pMac->lim.gLimAddtsSent = false;
4196 return;
4197 }
4198
4199 if (! pMac->lim.gLimAddtsSent)
4200 {
4201 PELOGW(limLog(pMac, LOGW, "AddtsRspTimeout but no AddtsSent\n");)
4202 return;
4203 }
4204
4205 if (param != pMac->lim.gLimAddtsRspTimerCount)
4206 {
4207 limLog(pMac, LOGE, FL("Invalid AddtsRsp Timer count %d (exp %d)\n"),
4208 param, pMac->lim.gLimAddtsRspTimerCount);
4209 return;
4210 }
4211
4212 // this a real response timeout
4213 pMac->lim.gLimAddtsSent = false;
4214 pMac->lim.gLimAddtsRspTimerCount++;
4215
4216 limSendSmeAddtsRsp(pMac, true, eSIR_SME_ADDTS_RSP_TIMEOUT, psessionEntry, pMac->lim.gLimAddtsReq.req.tspec,
4217 psessionEntry->smeSessionId, psessionEntry->transactionId);
4218}
4219
4220
4221/**
4222 * __limProcessSmeStatsRequest()
4223 *
4224 *FUNCTION:
4225 *
4226 *
4227 *NOTE:
4228 *
4229 * @param pMac Pointer to Global MAC structure
4230 * @param *pMsgBuf A pointer to the SME message buffer
4231 * @return None
4232 */
4233static void
4234__limProcessSmeStatsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4235{
4236 tpAniGetStatsReq pStatsReq;
4237 tSirMsgQ msgQ;
4238 tpPESession psessionEntry;
4239 tANI_U8 sessionId;
4240
4241
4242 if(pMsgBuf == NULL)
4243 {
4244 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
4245 return;
4246 }
4247
4248 pStatsReq = (tpAniGetStatsReq) pMsgBuf;
4249
4250 if((psessionEntry = peFindSessionByBssid(pMac,pStatsReq->bssId,&sessionId))== NULL)
4251 {
4252 limLog(pMac, LOGE, FL("session does not exist for given bssId\n"));
Jeff Johnsone7245742012-09-05 17:12:55 -07004253 palFreeMemory( pMac, pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004254 return;
4255 }
4256
4257
4258
4259 switch(pStatsReq->msgType)
4260 {
4261 //Add Lim stats here. and send reqsponse.
4262
4263 //HAL maintained Stats.
4264 case eWNI_SME_STA_STAT_REQ:
4265 msgQ.type = WDA_STA_STAT_REQ;
4266 break;
4267 case eWNI_SME_AGGR_STAT_REQ:
4268 msgQ.type = WDA_AGGR_STAT_REQ;
4269 break;
4270 case eWNI_SME_GLOBAL_STAT_REQ:
4271 msgQ.type = WDA_GLOBAL_STAT_REQ;
4272 break;
4273 case eWNI_SME_STAT_SUMM_REQ:
4274 msgQ.type = WDA_STAT_SUMM_REQ;
4275 break;
4276 default: //Unknown request.
4277 PELOGE(limLog(pMac, LOGE, "Unknown Statistics request\n");)
4278 palFreeMemory( pMac, pMsgBuf );
4279 return;
4280 }
4281
4282 if ( !pMac->lim.gLimRspReqd )
4283 {
4284 palFreeMemory( pMac, pMsgBuf );
4285 return;
4286 }
4287 else
4288 {
4289 pMac->lim.gLimRspReqd = FALSE;
4290 }
4291
4292 msgQ.reserved = 0;
4293 msgQ.bodyptr = pMsgBuf;
4294 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004295 MTRACE(macTraceMsgTx(pMac, psessionEntry->peSessionId, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004296
4297 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4298 limLog(pMac, LOGP, "Unable to forward request\n");
Jeff Johnsone7245742012-09-05 17:12:55 -07004299 palFreeMemory( pMac, pMsgBuf );
Jeff Johnson295189b2012-06-20 16:38:30 -07004300 return;
4301 }
4302
4303 return;
4304}
4305
4306
4307/**
4308 * __limProcessSmeGetStatisticsRequest()
4309 *
4310 *FUNCTION:
4311 *
4312 *
4313 *NOTE:
4314 *
4315 * @param pMac Pointer to Global MAC structure
4316 * @param *pMsgBuf A pointer to the SME message buffer
4317 * @return None
4318 */
4319static void
4320__limProcessSmeGetStatisticsRequest(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4321{
4322 tpAniGetPEStatsReq pPEStatsReq;
4323 tSirMsgQ msgQ;
4324
4325 pPEStatsReq = (tpAniGetPEStatsReq) pMsgBuf;
4326
4327 //pPEStatsReq->msgType should be eWNI_SME_GET_STATISTICS_REQ
4328
4329 msgQ.type = WDA_GET_STATISTICS_REQ;
4330
4331 if ( !pMac->lim.gLimRspReqd )
4332 {
4333 palFreeMemory( pMac, pMsgBuf );
4334 return;
4335 }
4336 else
4337 {
4338 pMac->lim.gLimRspReqd = FALSE;
4339 }
4340
4341 msgQ.reserved = 0;
4342 msgQ.bodyptr = pMsgBuf;
4343 msgQ.bodyval = 0;
Jeff Johnsone7245742012-09-05 17:12:55 -07004344 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msgQ.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004345
4346 if( eSIR_SUCCESS != (wdaPostCtrlMsg( pMac, &msgQ ))){
4347 palFreeMemory( pMac, pMsgBuf );
4348 limLog(pMac, LOGP, "Unable to forward request\n");
4349 return;
4350 }
4351
4352 return;
4353}
4354
4355
4356#ifdef WLAN_SOFTAP_FEATURE
4357static void
4358__limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4359{
4360 tpSirUpdateAPWPSIEsReq pUpdateAPWPSIEsReq;
4361 tpPESession psessionEntry;
4362 tANI_U8 sessionId; //PE sessionID
4363
4364 PELOG1(limLog(pMac, LOG1,
4365 FL("received UPDATE_APWPSIEs_REQ message\n")););
4366
4367 if(pMsgBuf == NULL)
4368 {
4369 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
4370 return;
4371 }
4372
4373 if( palAllocateMemory( pMac->hHdd, (void **)&pUpdateAPWPSIEsReq, sizeof(tSirUpdateAPWPSIEsReq)))
4374 {
4375 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pUpdateAPWPSIEsReq\n"));
4376 return;
4377 }
4378
4379 if ((limUpdateAPWPSIEsReqSerDes(pMac, pUpdateAPWPSIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4380 {
4381 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message\n"));
4382 goto end;
4383 }
4384
4385 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPSIEsReq->bssId, &sessionId)) == NULL)
4386 {
4387 limLog(pMac, LOGW, FL("Session does not exist for given BSSID\n"));
4388 goto end;
4389 }
4390
4391 palCopyMemory(pMac->hHdd, &psessionEntry->APWPSIEs, &pUpdateAPWPSIEsReq->APWPSIEs, sizeof(tSirAPWPSIEs));
4392
4393 schSetFixedBeaconFields(pMac, psessionEntry);
4394 limSendBeaconInd(pMac, psessionEntry);
4395
4396end:
4397 palFreeMemory( pMac->hHdd, pUpdateAPWPSIEsReq);
4398 return;
4399} /*** end __limProcessSmeUpdateAPWPSIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4400
4401static void
4402__limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4403{
4404 tpSirUpdateParams pUpdateParams;
4405 tpPESession psessionEntry;
4406
4407 PELOG1(limLog(pMac, LOG1,
4408 FL("received HIDE_SSID message\n")););
4409
4410 if(pMsgBuf == NULL)
4411 {
4412 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
4413 return;
4414 }
4415
4416 pUpdateParams = (tpSirUpdateParams)pMsgBuf;
4417
4418 if((psessionEntry = peFindSessionBySessionId(pMac, pUpdateParams->sessionId)) == NULL)
4419 {
4420 limLog(pMac, LOGW, "Session does not exist for given sessionId %d\n",
4421 pUpdateParams->sessionId);
4422 return;
4423 }
4424
4425 /* Update the session entry */
4426 psessionEntry->ssidHidden = pUpdateParams->ssidHidden;
4427
4428 /* Update beacon */
4429 schSetFixedBeaconFields(pMac, psessionEntry);
4430 limSendBeaconInd(pMac, psessionEntry);
4431
4432 return;
4433} /*** end __limProcessSmeHideSSID(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4434
4435static void
4436__limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4437{
4438 tpSirUpdateAPWPARSNIEsReq pUpdateAPWPARSNIEsReq;
4439 tpPESession psessionEntry;
4440 tANI_U8 sessionId; //PE sessionID
4441
4442 if(pMsgBuf == NULL)
4443 {
4444 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
4445 return;
4446 }
4447
4448 if( palAllocateMemory( pMac->hHdd, (void **)&pUpdateAPWPARSNIEsReq, sizeof(tSirUpdateAPWPSIEsReq)))
4449 {
4450 limLog(pMac, LOGP, FL("call to palAllocateMemory failed for pUpdateAPWPARSNIEsReq\n"));
4451 return;
4452 }
4453
4454 if ((limUpdateAPWPARSNIEsReqSerDes(pMac, pUpdateAPWPARSNIEsReq, (tANI_U8 *) pMsgBuf) == eSIR_FAILURE))
4455 {
4456 limLog(pMac, LOGW, FL("received invalid SME_SETCONTEXT_REQ message\n"));
4457 goto end;
4458 }
4459
4460 if((psessionEntry = peFindSessionByBssid(pMac, pUpdateAPWPARSNIEsReq->bssId, &sessionId)) == NULL)
4461 {
4462 limLog(pMac, LOGW, FL("Session does not exist for given BSSID\n"));
4463 goto end;
4464 }
4465
4466 palCopyMemory(pMac->hHdd, &psessionEntry->pLimStartBssReq->rsnIE, &pUpdateAPWPARSNIEsReq->APWPARSNIEs, sizeof(tSirRSNie));
4467
4468 limSetRSNieWPAiefromSmeStartBSSReqMessage(pMac, &psessionEntry->pLimStartBssReq->rsnIE, psessionEntry);
4469
4470 psessionEntry->pLimStartBssReq->privacy = 1;
4471 psessionEntry->privacy = 1;
4472
4473 schSetFixedBeaconFields(pMac, psessionEntry);
4474 limSendBeaconInd(pMac, psessionEntry);
4475
4476end:
4477 palFreeMemory( pMac->hHdd, pUpdateAPWPARSNIEsReq);
4478 return;
4479} /*** end __limProcessSmeSetWPARSNIEs(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4480
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08004481/*
4482Update the beacon Interval dynamically if beaconInterval is different in MCC
4483*/
4484static void
4485__limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4486{
4487 tpSirChangeBIParams pChangeBIParams;
4488 tpPESession psessionEntry;
4489 tANI_U8 sessionId = 0;
4490 tUpdateBeaconParams beaconParams;
4491
4492 PELOG1(limLog(pMac, LOG1,
4493 FL("received Update Beacon Interval message\n")););
4494
4495 if(pMsgBuf == NULL)
4496 {
4497 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
4498 return;
4499 }
4500
4501 pChangeBIParams = (tpSirChangeBIParams)pMsgBuf;
4502
4503 if((psessionEntry = peFindSessionByBssid(pMac, pChangeBIParams->bssId, &sessionId)) == NULL)
4504 {
4505 limLog(pMac, LOGE, FL("Session does not exist for given BSSID\n"));
4506 return;
4507 }
4508
4509 /*Update sessionEntry Beacon Interval*/
4510 if(psessionEntry->beaconParams.beaconInterval !=
4511 pChangeBIParams->beaconInterval )
4512 {
4513 psessionEntry->beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4514 }
4515
4516 /*Update sch beaconInterval*/
4517 if(pMac->sch.schObject.gSchBeaconInterval !=
4518 pChangeBIParams->beaconInterval )
4519 {
4520 pMac->sch.schObject.gSchBeaconInterval = pChangeBIParams->beaconInterval;
4521
4522 PELOG1(limLog(pMac, LOG1,
4523 FL("LIM send update BeaconInterval Indication : %d"),pChangeBIParams->beaconInterval););
4524
4525 /* Update beacon */
4526 schSetFixedBeaconFields(pMac, psessionEntry);
4527
4528 //Set change in beacon Interval
4529 beaconParams.beaconInterval = pChangeBIParams->beaconInterval;
4530 beaconParams.paramChangeBitmap |= PARAM_BCN_INTERVAL_CHANGED;
4531 limSendBeaconParams(pMac, &beaconParams, psessionEntry);
4532 }
4533
4534 return;
4535} /*** end __limProcessSmeChangeBI(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf) ***/
4536
Jeff Johnson295189b2012-06-20 16:38:30 -07004537#endif
4538
4539
4540/** -------------------------------------------------------------
4541\fn limProcessSmeDelBaPeerInd
4542\brief handles indication message from HDD to send delete BA request
4543\param tpAniSirGlobal pMac
4544\param tANI_U32 pMsgBuf
4545\return None
4546-------------------------------------------------------------*/
4547void
4548limProcessSmeDelBaPeerInd(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4549{
4550 tANI_U16 assocId =0;
4551 tpSmeDelBAPeerInd pSmeDelBAPeerInd = (tpSmeDelBAPeerInd)pMsgBuf;
4552 tpDphHashNode pSta;
4553 tpPESession psessionEntry;
4554 tANI_U8 sessionId;
4555
4556
4557
4558 if(NULL == pSmeDelBAPeerInd)
4559 return;
4560
4561 if ((psessionEntry = peFindSessionByBssid(pMac,pSmeDelBAPeerInd->bssId,&sessionId))==NULL)
4562 {
4563 limLog(pMac, LOGE,FL("session does not exist for given bssId\n"));
4564 return;
4565 }
4566 limLog(pMac, LOGW, FL("called with staId = %d, tid = %d, baDirection = %d\n"),
4567 pSmeDelBAPeerInd->staIdx, pSmeDelBAPeerInd->baTID, pSmeDelBAPeerInd->baDirection);
4568
4569 pSta = dphLookupAssocId(pMac, pSmeDelBAPeerInd->staIdx, &assocId, &psessionEntry->dph.dphHashTable);
4570 if( eSIR_SUCCESS != limPostMlmDelBAReq( pMac,
4571 pSta,
4572 pSmeDelBAPeerInd->baDirection,
4573 pSmeDelBAPeerInd->baTID,
4574 eSIR_MAC_UNSPEC_FAILURE_REASON,psessionEntry))
4575 {
4576 limLog( pMac, LOGW,
4577 FL( "Failed to post LIM_MLM_DELBA_REQ to " ));
4578 if (pSta)
4579 limPrintMacAddr(pMac, pSta->staAddr, LOGW);
4580 }
4581}
4582
4583// --------------------------------------------------------------------
4584/**
4585 * __limProcessReportMessage
4586 *
4587 * FUNCTION: Processes the next received Radio Resource Management message
4588 *
4589 * LOGIC:
4590 *
4591 * ASSUMPTIONS:
4592 *
4593 * NOTE:
4594 *
4595 * @param None
4596 * @return None
4597 */
4598
4599void __limProcessReportMessage(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
4600{
4601#ifdef WLAN_FEATURE_VOWIFI
4602 switch (pMsg->type)
4603 {
4604 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
4605 rrmProcessNeighborReportReq( pMac, pMsg->bodyptr );
4606 break;
4607 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
4608 {
4609#if defined FEATURE_WLAN_CCX
4610 tpSirBeaconReportXmitInd pBcnReport=NULL;
4611 tpPESession psessionEntry=NULL;
4612 tANI_U8 sessionId;
4613
4614 if(pMsg->bodyptr == NULL)
4615 {
4616 limLog(pMac, LOGE,FL("Buffer is Pointing to NULL\n"));
4617 return;
4618 }
4619 pBcnReport = (tpSirBeaconReportXmitInd )pMsg->bodyptr;
4620 if((psessionEntry = peFindSessionByBssid(pMac, pBcnReport->bssId,&sessionId))== NULL)
4621 {
4622 limLog(pMac, LOGE, "Session Does not exist for given bssId\n");
4623 return;
4624 }
4625 if (psessionEntry->isCCXconnection)
4626 ccxProcessBeaconReportXmit( pMac, pMsg->bodyptr);
4627 else
4628#endif
4629 rrmProcessBeaconReportXmit( pMac, pMsg->bodyptr );
4630 }
4631 break;
4632 }
4633#endif
4634}
4635
4636#if defined(FEATURE_WLAN_CCX) || defined(WLAN_FEATURE_VOWIFI)
4637// --------------------------------------------------------------------
4638/**
4639 * limSendSetMaxTxPowerReq
4640 *
4641 * FUNCTION: Send SIR_HAL_SET_MAX_TX_POWER_REQ message to change the max tx power.
4642 *
4643 * LOGIC:
4644 *
4645 * ASSUMPTIONS:
4646 *
4647 * NOTE:
4648 *
4649 * @param txPower txPower to be set.
4650 * @param pSessionEntry session entry.
4651 * @return None
4652 */
4653tSirRetStatus
4654limSendSetMaxTxPowerReq ( tpAniSirGlobal pMac, tPowerdBm txPower, tpPESession pSessionEntry )
4655{
4656 tpMaxTxPowerParams pMaxTxParams = NULL;
4657 tSirRetStatus retCode = eSIR_SUCCESS;
4658 tSirMsgQ msgQ;
4659
4660 if( pSessionEntry == NULL )
4661 {
4662 PELOGE(limLog(pMac, LOGE, "%s:%d: Inavalid parameters\n", __func__, __LINE__ );)
4663 return eSIR_FAILURE;
4664 }
4665 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
4666 (void **) &pMaxTxParams, sizeof(tMaxTxPowerParams) ) )
4667 {
4668 limLog( pMac, LOGP, "%s:%d:Unable to allocate memory for pMaxTxParams \n", __func__, __LINE__);
4669 return eSIR_MEM_ALLOC_FAILED;
4670
4671 }
4672#if defined(WLAN_VOWIFI_DEBUG) || defined(FEATURE_WLAN_CCX)
4673 PELOG1(limLog( pMac, LOG1, "%s:%d: Allocated memory for pMaxTxParams...will be freed in other module\n", __func__, __LINE__ );)
4674#endif
4675 pMaxTxParams->power = txPower;
4676 palCopyMemory( pMac->hHdd, pMaxTxParams->bssId, pSessionEntry->bssId, sizeof(tSirMacAddr) );
4677 palCopyMemory( pMac->hHdd, pMaxTxParams->selfStaMacAddr, pSessionEntry->selfMacAddr, sizeof(tSirMacAddr) );
4678
4679 msgQ.type = WDA_SET_MAX_TX_POWER_REQ;
4680 msgQ.bodyptr = pMaxTxParams;
4681 msgQ.bodyval = 0;
4682 PELOGW(limLog(pMac, LOG1, FL("Posting WDA_SET_MAX_TX_POWER_REQ to WDA\n"));)
4683 if(eSIR_SUCCESS != (retCode = wdaPostCtrlMsg(pMac, &msgQ)))
4684 {
4685 PELOGW(limLog(pMac, LOGW, FL("wdaPostCtrlMsg() failed\n"));)
4686 if (NULL != pMaxTxParams)
4687 {
4688 palFreeMemory(pMac->hHdd, (tANI_U8*)pMaxTxParams);
4689 }
4690 return retCode;
4691 }
4692 return retCode;
4693}
4694#endif
4695
4696/**
4697 * __limProcessSmeAddStaSelfReq()
4698 *
4699 *FUNCTION:
4700 * This function is called to process SME_ADD_STA_SELF_REQ message
4701 * from SME. It sends a SIR_HAL_ADD_STA_SELF_REQ message to HAL.
4702 *
4703 *LOGIC:
4704 *
4705 *ASSUMPTIONS:
4706 *
4707 *NOTE:
4708 *
4709 * @param pMac Pointer to Global MAC structure
4710 * @param *pMsgBuf A pointer to the SME message buffer
4711 * @return None
4712 */
4713
4714static void
4715__limProcessSmeAddStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4716{
4717 tSirMsgQ msg;
4718 tpAddStaSelfParams pAddStaSelfParams;
4719 tpSirSmeAddStaSelfReq pSmeReq = (tpSirSmeAddStaSelfReq) pMsgBuf;
4720
4721 if ( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void**) &pAddStaSelfParams,
4722 sizeof( tAddStaSelfParams) ) )
4723 {
4724 limLog( pMac, LOGP, FL("Unable to allocate memory for tAddSelfStaParams") );
4725 return;
4726 }
4727
4728 palCopyMemory( pMac->hHdd, pAddStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
4729
4730 msg.type = SIR_HAL_ADD_STA_SELF_REQ;
4731 msg.reserved = 0;
4732 msg.bodyptr = pAddStaSelfParams;
4733 msg.bodyval = 0;
4734
4735 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004736 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004737
4738 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4739 {
4740 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed\n"));
4741 }
4742 return;
4743} /*** end __limProcessAddStaSelfReq() ***/
4744
4745
4746/**
4747 * __limProcessSmeDelStaSelfReq()
4748 *
4749 *FUNCTION:
4750 * This function is called to process SME_DEL_STA_SELF_REQ message
4751 * from SME. It sends a SIR_HAL_DEL_STA_SELF_REQ message to HAL.
4752 *
4753 *LOGIC:
4754 *
4755 *ASSUMPTIONS:
4756 *
4757 *NOTE:
4758 *
4759 * @param pMac Pointer to Global MAC structure
4760 * @param *pMsgBuf A pointer to the SME message buffer
4761 * @return None
4762 */
4763
4764static void
4765__limProcessSmeDelStaSelfReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4766{
4767 tSirMsgQ msg;
4768 tpDelStaSelfParams pDelStaSelfParams;
4769 tpSirSmeDelStaSelfReq pSmeReq = (tpSirSmeDelStaSelfReq) pMsgBuf;
4770
4771 if ( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void**) &pDelStaSelfParams,
4772 sizeof( tDelStaSelfParams) ) )
4773 {
4774 limLog( pMac, LOGP, FL("Unable to allocate memory for tDelStaSelfParams") );
4775 return;
4776 }
4777
4778 palCopyMemory( pMac->hHdd, pDelStaSelfParams->selfMacAddr, pSmeReq->selfMacAddr, sizeof(tSirMacAddr) );
4779
4780 msg.type = SIR_HAL_DEL_STA_SELF_REQ;
4781 msg.reserved = 0;
4782 msg.bodyptr = pDelStaSelfParams;
4783 msg.bodyval = 0;
4784
4785 PELOGW(limLog(pMac, LOG1, FL("sending SIR_HAL_ADD_STA_SELF_REQ msg to HAL\n"));)
Jeff Johnsone7245742012-09-05 17:12:55 -07004786 MTRACE(macTraceMsgTx(pMac, NO_SESSION, msg.type));
Jeff Johnson295189b2012-06-20 16:38:30 -07004787
4788 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4789 {
4790 limLog(pMac, LOGP, FL("wdaPostCtrlMsg failed\n"));
4791 }
4792 return;
4793} /*** end __limProcessSmeDelStaSelfReq() ***/
4794
4795
4796#ifdef WLAN_FEATURE_P2P
4797/**
4798 * __limProcessSmeRegisterMgmtFrameReq()
4799 *
4800 *FUNCTION:
4801 * This function is called to process eWNI_SME_REGISTER_MGMT_FRAME_REQ message
4802 * from SME. It Register this information within PE.
4803 *
4804 *LOGIC:
4805 *
4806 *ASSUMPTIONS:
4807 *
4808 *NOTE:
4809 *
4810 * @param pMac Pointer to Global MAC structure
4811 * @param *pMsgBuf A pointer to the SME message buffer
4812 * @return None
4813 */
4814static void
4815__limProcessSmeRegisterMgmtFrameReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4816{
4817 VOS_STATUS vosStatus;
4818 tpSirRegisterMgmtFrame pSmeReq = (tpSirRegisterMgmtFrame)pMsgBuf;
4819 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004820 tANI_BOOLEAN match = VOS_FALSE;
Jeff Johnson295189b2012-06-20 16:38:30 -07004821 PELOG1(limLog(pMac, LOG1,
Jeff Johnsone7245742012-09-05 17:12:55 -07004822 FL("registerFrame %d, frameType %d, matchLen %d\n"),
4823 pSmeReq->registerFrame, pSmeReq->frameType, pSmeReq->matchLen);)
Jeff Johnson295189b2012-06-20 16:38:30 -07004824
Jeff Johnsond13512a2012-07-17 11:42:19 -07004825 /* First check whether entry exists already*/
4826
4827 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4828 (vos_list_node_t**)&pLimMgmtRegistration);
4829
4830 while(pLimMgmtRegistration != NULL)
4831 {
4832 if (pLimMgmtRegistration->frameType == pSmeReq->frameType)
4833 {
4834 if(pSmeReq->matchLen)
4835 {
4836 if (pLimMgmtRegistration->matchLen == pSmeReq->matchLen)
4837 {
4838 if (palEqualMemory(pMac, pLimMgmtRegistration->matchData,
4839 pSmeReq->matchData, pLimMgmtRegistration->matchLen))
4840 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004841 /* found match! */
4842 match = VOS_TRUE;
4843 break;
Jeff Johnsond13512a2012-07-17 11:42:19 -07004844 }
4845 }
4846 }
4847 else
4848 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004849 /* found match! */
Jeff Johnsond13512a2012-07-17 11:42:19 -07004850 match = VOS_TRUE;
4851 break;
4852 }
4853 }
4854 vosStatus = vos_list_peek_next (
4855 &pMac->lim.gLimMgmtFrameRegistratinQueue,
4856 (vos_list_node_t*) pLimMgmtRegistration,
4857 (vos_list_node_t**) &pNext );
4858
4859 pLimMgmtRegistration = pNext;
4860 pNext = NULL;
4861
4862 }
4863
4864 if (match)
4865 {
4866 vos_list_remove_node(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4867 (vos_list_node_t*)pLimMgmtRegistration);
4868 palFreeMemory(pMac,pLimMgmtRegistration);
4869 }
4870
Jeff Johnson295189b2012-06-20 16:38:30 -07004871 if(pSmeReq->registerFrame)
4872 {
4873 palAllocateMemory(pMac, (void**)&pLimMgmtRegistration,
4874 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen);
4875 if(pLimMgmtRegistration != NULL)
4876 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004877 palZeroMemory(pMac, (void*)pLimMgmtRegistration,
Jeff Johnson295189b2012-06-20 16:38:30 -07004878 sizeof(tLimMgmtFrameRegistration) + pSmeReq->matchLen );
4879 pLimMgmtRegistration->frameType = pSmeReq->frameType;
4880 pLimMgmtRegistration->matchLen = pSmeReq->matchLen;
4881 pLimMgmtRegistration->sessionId = pSmeReq->sessionId;
4882 if(pSmeReq->matchLen)
4883 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -07004884 palCopyMemory(pMac,pLimMgmtRegistration->matchData,
Jeff Johnson295189b2012-06-20 16:38:30 -07004885 pSmeReq->matchData, pSmeReq->matchLen);
4886 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004887 vos_list_insert_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
4888 &pLimMgmtRegistration->node);
4889 }
4890 }
Jeff Johnson295189b2012-06-20 16:38:30 -07004891
4892 return;
4893} /*** end __limProcessSmeRegisterMgmtFrameReq() ***/
Viral Modid86bde22012-12-10 13:09:21 -08004894
4895static tANI_BOOLEAN
4896__limInsertSingleShotNOAForScan(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
4897{
4898 tpP2pPsParams pMsgNoA;
4899 tSirMsgQ msg;
4900 tpSirSmeScanReq pScanReq;
Vinay Malekal62757362012-12-17 12:15:51 -08004901 tANI_U32 val = 0;
4902 tANI_U8 i = 0;
4903
Viral Modid86bde22012-12-10 13:09:21 -08004904 pScanReq = (tpSirSmeScanReq) pMsgBuf;
4905 if( eHAL_STATUS_SUCCESS != palAllocateMemory(
4906 pMac->hHdd, (void **) &pMsgNoA, sizeof( tP2pPsConfig )))
4907 {
4908 limLog( pMac, LOGP,
4909 FL( "Unable to allocate memory during NoA Update\n" ));
4910 return TRUE;
4911 }
4912
4913 palZeroMemory( pMac->hHdd, (tANI_U8 *)pMsgNoA, sizeof(tP2pPsConfig));
4914 /* Below params used for opp PS/periodic NOA and are don't care in this case - so initialized to 0 */
4915 pMsgNoA->opp_ps = 0;
4916 pMsgNoA->ctWindow = 0;
4917 pMsgNoA->duration = 0;
4918 pMsgNoA->interval = 0;
4919 pMsgNoA->count = 0;
Vinay Malekal62757362012-12-17 12:15:51 -08004920
Viral Modid86bde22012-12-10 13:09:21 -08004921 pMac->lim.gpLimSmeScanReq = pScanReq;
4922
Vinay Malekal62757362012-12-17 12:15:51 -08004923 /* Below params used for Single Shot NOA - so assign proper values */
4924 pMsgNoA->psSelection = P2P_SINGLE_NOA;
4925
4926 /* Calculate the total duration of scan for all the channels
4927 * listed in the channel list */
4928 pMsgNoA->single_noa_duration = 0;
4929
4930 if (wlan_cfgGetInt(pMac, WNI_CFG_PASSIVE_MAXIMUM_CHANNEL_TIME, &val) != eSIR_SUCCESS)
4931 {
4932 /*
4933 * Could not get max channel value
4934 * from CFG. Log error.
4935 */
4936 limLog(pMac, LOGP, FL("could not retrieve passive max channel value\n"));
4937
4938 /* use a default value of 110ms */
4939 val = 110;
4940 }
4941
4942 for (i = 0; i < pMac->lim.gpLimSmeScanReq->channelList.numChannels; i++) {
4943 tANI_U8 channelNum = pMac->lim.gpLimSmeScanReq->channelList.channelNumber[i];
4944
4945 if (limActiveScanAllowed(pMac, channelNum)) {
4946 /* Use min + max channel time to calculate the total duration of scan */
4947 pMsgNoA->single_noa_duration += pMac->lim.gpLimSmeScanReq->minChannelTime + pMac->lim.gpLimSmeScanReq->maxChannelTime;
4948 } else {
4949 /* using the value from WNI_CFG_PASSIVE_MINIMUM_CHANNEL_TIME as is done in
4950 * void limContinuePostChannelScan(tpAniSirGlobal pMac)
4951 */
4952 pMsgNoA->single_noa_duration += val;
4953 }
4954 }
4955
4956 /* Adding an overhead of 5ms to account for the scan messaging delays */
4957 pMsgNoA->single_noa_duration += SCAN_MESSAGING_OVERHEAD;
4958
Gopichand Nakkala096a1052012-12-21 07:05:34 -08004959 /* Multiplying with 1024 since riva is expecting in micro Seconds */
4960 pMsgNoA->single_noa_duration *= CONV_MS_TO_US;
4961
Viral Modid86bde22012-12-10 13:09:21 -08004962 /* Start Insert NOA timer
4963 * If insert NOA req fails or NOA rsp fails or start NOA indication doesn't come from FW due to GO session deletion
4964 * or any other failure or reason, we still need to send probe response to SME with failure status. The insert NOA
4965 * timer of 500 ms will ensure a response back to SME/HDD for the scan req
4966 */
4967 if (tx_timer_activate(&pMac->lim.limTimers.gLimP2pSingleShotNoaInsertTimer)
4968 == TX_TIMER_ERROR)
4969 {
4970 /// Could not activate Insert NOA timer.
4971 // Log error
4972 limLog(pMac, LOGP, FL("could not activate Insert Single Shot NOA during scan timer\n"));
4973
4974 // send the scan response back with status failure and do not even call insert NOA
4975 limSendSmeScanRsp(pMac, sizeof(tSirSmeScanRsp), eSIR_SME_SCAN_FAILED, pMac->lim.gSmeSessionId, pMac->lim.gTransactionId);
4976 return TRUE;
4977 }
4978
4979 msg.type = WDA_SET_P2P_GO_NOA_REQ;
4980 msg.reserved = 0;
4981 msg.bodyptr = pMsgNoA;
4982 msg.bodyval = 0;
4983
4984 if(eSIR_SUCCESS != wdaPostCtrlMsg(pMac, &msg))
4985 {
4986 /* In this failure case, timer is already started, so its expiration will take care of sending scan response */
4987 limLog(pMac, LOGP, FL("wdaPost Msg failed\n"));
4988 return TRUE;
4989 }
4990
4991 return FALSE;
4992
4993}
4994
Jeff Johnson295189b2012-06-20 16:38:30 -07004995#endif
4996
Mohit Khanna698ba2a2012-12-04 15:08:18 -08004997#ifdef FEATURE_WLAN_TDLS_INTERNAL
4998/*
4999 * Process Discovery request recieved from SME and transmit to AP.
5000 */
5001static tSirRetStatus limProcessSmeDisStartReq(tpAniSirGlobal pMac,
5002 tANI_U32 *pMsgBuf)
5003{
5004 /* get all discovery request parameters */
5005 tSirTdlsDisReq *disReq = (tSirTdlsDisReq *) pMsgBuf ;
5006 tpPESession psessionEntry;
5007 tANI_U8 sessionId;
5008
5009 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
5010 ("Discovery Req Recieved\n")) ;
5011
5012 if((psessionEntry = peFindSessionByBssid(pMac, disReq->bssid, &sessionId))
5013 == NULL)
5014 {
5015 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
5016 "PE Session does not exist for given sme sessionId %d\n",
5017 disReq->sessionId);
5018 goto lim_tdls_dis_start_error;
5019 }
5020
5021 /* check if we are in proper state to work as TDLS client */
5022 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5023 {
5024 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
5025 "dis req received in wrong system Role %d\n",
5026 psessionEntry->limSystemRole);
5027 goto lim_tdls_dis_start_error;
5028 }
5029
5030 /*
5031 * if we are still good, go ahead and check if we are in proper state to
5032 * do TDLS discovery procedure.
5033 */
5034 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5035 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5036 {
5037
5038 limLog(pMac, LOGE, "dis req received in invalid LIMsme \
5039 state (%d)\n", psessionEntry->limSmeState);
5040 goto lim_tdls_dis_start_error;
5041 }
5042
5043 /*
5044 * if we are still good, go ahead and transmit TDLS discovery request,
5045 * and save Dis Req info for future reference.
5046 */
5047
5048#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
5049 /*
5050 * send message to HAL to set RXP filters to receieve frame on
5051 * direct link..
5052 */
5053 //limSetLinkState(pMac, eSIR_LINK_TDLS_DISCOVERY_STATE,
5054 // psessionEntry->bssId) ;
5055#endif
5056
5057 /* save dis request message for matching dialog token */
5058 palCopyMemory( pMac->hHdd, (tANI_U8 *) &pMac->lim.gLimTdlsDisReq,
5059 (tANI_U8 *) disReq, sizeof(tSirTdlsDisReq));
5060
5061 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
5062 "Transmit Discovery Request Frame\n") ;
5063 /* format TDLS discovery request frame and transmit it */
5064 limSendTdlsDisReqFrame(pMac, disReq->peerMac, disReq->dialog,
5065 psessionEntry) ;
5066
5067 /* prepare for response */
5068 pMac->lim.gLimTdlsDisStaCount = 0 ;
5069 pMac->lim.gLimTdlsDisResultList = NULL ;
5070
5071 /*
5072 * start TDLS discovery request timer to wait for discovery responses
5073 * from all TDLS enabled clients in BSS.
5074 */
5075
5076 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
5077 ("Start Discovery request Timeout Timer\n")) ;
5078 MTRACE(macTrace(pMac, TRACE_CODE_TIMER_ACTIVATE, 0,
5079 eLIM_TDLS_DISCOVERY_RSP_WAIT));
5080
5081 /* assign appropriate sessionId to the timer object */
5082 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId =
5083 psessionEntry->peSessionId;
5084
5085 if (tx_timer_activate(&pMac->lim.limTimers.gLimTdlsDisRspWaitTimer)
5086 != TX_SUCCESS)
5087 {
5088 limLog(pMac, LOGP, FL("TDLS discovery response timer \
5089 activation failed!\n"));
5090 goto lim_tdls_dis_start_error;
5091 }
5092 /*
5093 * when timer expired, eWNI_SME_TDLS_DISCOVERY_START_RSP is sent
5094 * back to SME
5095 */
5096 return (eSIR_SUCCESS) ;
5097lim_tdls_dis_start_error:
5098 /* in error case, PE has to sent the response SME immediately with error code */
5099 limSendSmeTdlsDisRsp(pMac, eSIR_FAILURE,
5100 eWNI_SME_TDLS_DISCOVERY_START_RSP);
5101 return eSIR_FAILURE;
5102}
5103/*
5104 * Process link start request recieved from SME and transmit to AP.
5105 */
5106eHalStatus limProcessSmeLinkStartReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5107{
5108 /* get all discovery request parameters */
5109 tSirTdlsSetupReq *setupReq = (tSirTdlsSetupReq *) pMsgBuf ;
5110 tLimTdlsLinkSetupInfo *linkSetupInfo;
5111 //tLimTdlsLinkSetupPeer *setupPeer;
5112 tpPESession psessionEntry;
5113 tANI_U8 sessionId;
5114 eHalStatus status;
5115
5116 if((psessionEntry = peFindSessionByBssid(pMac,
5117 setupReq->bssid, &sessionId)) == NULL)
5118 {
5119 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
5120 "PE Session does not exist for given sme sessionId %d\n",
5121 setupReq->sessionId);
5122 goto lim_tdls_link_start_error;
5123 }
5124
5125 /* check if we are in proper state to work as TDLS client */
5126 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5127 {
5128 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
5129 "TDLS link setup req received in wrong system Role %d\n",
5130 psessionEntry->limSystemRole);
5131 goto lim_tdls_link_start_error;
5132 }
5133
5134 /*
5135 * if we are still good, go ahead and check if we are in proper state to
5136 * do TDLS setup procedure.
5137 */
5138 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5139 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5140 {
5141 limLog(pMac, LOGE, "Setup request in invalid LIMsme \
5142 state (%d)\n", pMac->lim.gLimSmeState);
5143 goto lim_tdls_link_start_error;
5144 }
5145
5146 /*
5147 * Now, go ahead and transmit TDLS discovery request, and save setup Req
5148 * info for future reference.
5149 */
5150 /* create node for Link setup */
5151 linkSetupInfo = &pMac->lim.gLimTdlsLinkSetupInfo ;
5152 //setupPeer = NULL ;
5153
5154 status = limTdlsPrepareSetupReqFrame(pMac, linkSetupInfo, setupReq->dialog,
5155 setupReq->peerMac, psessionEntry) ;
5156 if(eHAL_STATUS_SUCCESS == status)
5157 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5158 TDLS setup cnf TX complete is successful. */
5159 return eSIR_SUCCESS;
5160#if 0
5161
5162 /*
5163 * we allocate the TDLS setup Peer Memory here, we will free'd this
Jeff Johnsonfeddb2d2012-12-10 14:41:22 -08005164 * memory after teardown, if the link is successfully setup or
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005165 * free this memory if any timeout is happen in link setup procedure
5166 */
5167 if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd,
5168 (void **) &setupPeer, sizeof( tLimTdlsLinkSetupPeer )))
5169 {
5170 limLog( pMac, LOGP,
5171 FL( "Unable to allocate memory during ADD_STA\n" ));
5172 VOS_ASSERT(0) ;
5173 return eSIR_MEM_ALLOC_FAILED;
5174 }
5175 setupPeer->dialog = setupReq->dialog ;
5176 setupPeer->tdls_prev_link_state = setupPeer->tdls_link_state ;
5177 setupPeer->tdls_link_state = TDLS_LINK_SETUP_START_STATE ;
5178 /* TDLS_sessionize: remember sessionId for future */
5179 setupPeer->tdls_sessionId = psessionEntry->peSessionId;
5180 setupPeer->tdls_bIsResponder = 1;
5181
5182 /*
5183 * we only populate peer MAC, so it can assit us to find the
5184 * TDLS peer after response/or after response timeout
5185 */
5186 palCopyMemory(pMac->hHdd, setupPeer->peerMac, setupReq->peerMac,
5187 sizeof(tSirMacAddr)) ;
5188 /* format TDLS discovery request frame and transmit it */
5189 limSendTdlsLinkSetupReqFrame(pMac, setupReq->peerMac,
5190 setupReq->dialog, psessionEntry, NULL, 0) ;
5191
5192 limStartTdlsTimer(pMac, psessionEntry->peSessionId,
5193 &setupPeer->gLimTdlsLinkSetupRspTimeoutTimer,
5194 (tANI_U32)setupPeer->peerMac, WNI_CFG_TDLS_LINK_SETUP_RSP_TIMEOUT,
5195 SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT) ;
5196 /* update setup peer list */
5197 setupPeer->next = linkSetupInfo->tdlsLinkSetupList ;
5198 linkSetupInfo->tdlsLinkSetupList = setupPeer ;
5199 /* in case of success, eWNI_SME_TDLS_LINK_START_RSP is sent back to SME later when
5200 TDLS setup cnf TX complete is successful. --> see limTdlsSetupCnfTxComplete() */
5201 return eSIR_SUCCESS ;
5202#endif
5203lim_tdls_link_start_error:
5204 /* in case of error, return immediately to SME */
5205 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, setupReq->peerMac,
5206 eWNI_SME_TDLS_LINK_START_RSP);
5207 return eSIR_FAILURE ;
5208}
5209
5210/*
5211 * Process link teardown request recieved from SME and transmit to AP.
5212 */
5213eHalStatus limProcessSmeTeardownReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf)
5214{
5215 /* get all discovery request parameters */
5216 tSirTdlsTeardownReq *teardownReq = (tSirTdlsTeardownReq *) pMsgBuf ;
5217 tLimTdlsLinkSetupPeer *setupPeer;
5218 tpPESession psessionEntry;
5219 tANI_U8 sessionId;
5220
5221 if((psessionEntry = peFindSessionByBssid(pMac, teardownReq->bssid, &sessionId)) == NULL)
5222 {
5223 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
5224 "PE Session does not exist for given sme sessionId %d\n", teardownReq->sessionId);
5225 goto lim_tdls_teardown_req_error;
5226 }
5227
5228 /* check if we are in proper state to work as TDLS client */
5229 if (psessionEntry->limSystemRole != eLIM_STA_ROLE)
5230 {
5231 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
5232 "TDLS teardown req received in wrong system Role %d\n", psessionEntry->limSystemRole);
5233 goto lim_tdls_teardown_req_error;
5234 }
5235
5236 /*
5237 * if we are still good, go ahead and check if we are in proper state to
5238 * do TDLS setup procedure.
5239 */
5240 if ((psessionEntry->limSmeState != eLIM_SME_ASSOCIATED_STATE) &&
5241 (psessionEntry->limSmeState != eLIM_SME_LINK_EST_STATE))
5242 {
5243 limLog(pMac, LOGE, "TDLS teardwon req received in invalid LIMsme \
5244 state (%d)\n", psessionEntry->limSmeState);
5245 goto lim_tdls_teardown_req_error;
5246 }
5247
5248 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
5249 "Teardown for peer = %02x,%02x,%02x,%02x,%02x,%02x\n",
5250 teardownReq->peerMac[0],
5251 teardownReq->peerMac[1],
5252 teardownReq->peerMac[2],
5253 teardownReq->peerMac[3],
5254 teardownReq->peerMac[4],
5255 teardownReq->peerMac[5]) ;
5256 /*
5257 * Now, go ahead and transmit TDLS teardown request, and save teardown info
5258 * info for future reference.
5259 */
5260 /* Verify if this link is setup */
5261 setupPeer = NULL ;
5262 limTdlsFindLinkPeer(pMac, teardownReq->peerMac, &setupPeer);
5263 if(NULL == setupPeer)
5264 {
5265 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
5266 ("invalid Peer on teardown \n")) ;
5267 goto lim_tdls_teardown_req_error;
5268 }
5269
5270
5271 (setupPeer)->tdls_prev_link_state = (setupPeer)->tdls_link_state ;
5272 (setupPeer)->tdls_link_state = TDLS_LINK_TEARDOWN_START_STATE ;
5273 /* TDLS_sessionize: check sessionId in case */
5274 if((setupPeer)->tdls_sessionId != psessionEntry->peSessionId)
5275 {
5276 limLog(pMac, LOGE, "TDLS teardown req; stored sessionId (%d) not matched from peSessionId (%d)\n", \
5277 (setupPeer)->tdls_sessionId, psessionEntry->limSmeState);
5278 (setupPeer)->tdls_sessionId = psessionEntry->peSessionId;
5279 }
5280
5281 /* format TDLS teardown request frame and transmit it */
5282 if(eSIR_SUCCESS != limSendTdlsTeardownFrame(pMac, teardownReq->peerMac,
5283 eSIR_MAC_TDLS_TEARDOWN_UNSPEC_REASON, psessionEntry, NULL, 0 ))
5284 {
5285 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
5286 ("couldn't send teardown frame \n")) ;
5287 goto lim_tdls_teardown_req_error;
5288 }
5289 /* in case of success, eWNI_SME_TDLS_TEARDOWN_RSP is sent back to SME later when
5290 TDLS teardown TX complete is successful. --> see limTdlsTeardownTxComplete() */
5291 return eSIR_SUCCESS;
5292lim_tdls_teardown_req_error:
5293 /* in case of error, return immediately to SME */
5294 limSendSmeTdlsTeardownRsp(pMac, eSIR_FAILURE, teardownReq->peerMac,
5295 eWNI_SME_TDLS_TEARDOWN_RSP);
5296 return eSIR_FAILURE;
5297}
5298
5299
5300#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005301
5302/**
5303 * limProcessSmeReqMessages()
5304 *
5305 *FUNCTION:
5306 * This function is called by limProcessMessageQueue(). This
5307 * function processes SME request messages from HDD or upper layer
5308 * application.
5309 *
5310 *LOGIC:
5311 *
5312 *ASSUMPTIONS:
5313 *
5314 *NOTE:
5315 *
5316 * @param pMac Pointer to Global MAC structure
5317 * @param msgType Indicates the SME message type
5318 * @param *pMsgBuf A pointer to the SME message buffer
5319 * @return Boolean - TRUE - if pMsgBuf is consumed and can be freed.
5320 * FALSE - if pMsgBuf is not to be freed.
5321 */
5322
5323tANI_BOOLEAN
5324limProcessSmeReqMessages(tpAniSirGlobal pMac, tpSirMsgQ pMsg)
5325{
5326 tANI_BOOLEAN bufConsumed = TRUE; //Set this flag to false within case block of any following message, that doesnt want pMsgBuf to be freed.
5327 tANI_U32 *pMsgBuf = pMsg->bodyptr;
5328
Jeff Johnsone7245742012-09-05 17:12:55 -07005329 PELOG1(limLog(pMac, LOG1, FL("LIM Received SME Message %s(%d) Global LimSmeState:%s(%d) Global LimMlmState: %s(%d)\n"),
Jeff Johnson295189b2012-06-20 16:38:30 -07005330 limMsgStr(pMsg->type), pMsg->type,
5331 limSmeStateStr(pMac->lim.gLimSmeState), pMac->lim.gLimSmeState,
5332 limMlmStateStr(pMac->lim.gLimMlmState), pMac->lim.gLimMlmState );)
5333
5334 switch (pMsg->type)
5335 {
5336 case eWNI_SME_START_REQ:
5337 __limProcessSmeStartReq(pMac, pMsgBuf);
5338 break;
5339
5340 case eWNI_SME_SYS_READY_IND:
5341 bufConsumed = __limProcessSmeSysReadyInd(pMac, pMsgBuf);
5342 break;
5343
5344
5345 case eWNI_SME_START_BSS_REQ:
5346 bufConsumed = __limProcessSmeStartBssReq(pMac, pMsg);
5347 break;
5348
5349 case eWNI_SME_SCAN_REQ:
Viral Modid86bde22012-12-10 13:09:21 -08005350#ifdef WLAN_FEATURE_P2P
5351 /* If we are in P2P GO mode we need to insert NOA before actually starting a scan */
5352 if ((limIsNOAInsertReqd(pMac) == TRUE) && IS_FEATURE_SUPPORTED_BY_FW(P2P_GO_NOA_DECOUPLE_INIT_SCAN))
5353 {
5354 bufConsumed = __limInsertSingleShotNOAForScan(pMac, pMsgBuf);
5355 }
5356 else
5357 {
5358#endif
5359 __limProcessSmeScanReq(pMac, pMsgBuf);
5360#ifdef WLAN_FEATURE_P2P
5361 }
5362#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005363 break;
5364
Jeff Johnsone7245742012-09-05 17:12:55 -07005365#ifdef FEATURE_OEM_DATA_SUPPORT
5366 case eWNI_SME_OEM_DATA_REQ:
5367 __limProcessSmeOemDataReq(pMac, pMsgBuf);
5368
5369 break;
5370#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005371#ifdef WLAN_FEATURE_P2P
5372 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
5373 bufConsumed = limProcessRemainOnChnlReq(pMac, pMsgBuf);
5374 break;
5375
5376 case eWNI_SME_UPDATE_NOA:
5377 __limProcessSmeNoAUpdate(pMac, pMsgBuf);
5378 break;
5379#endif
5380 case eWNI_SME_JOIN_REQ:
5381 __limProcessSmeJoinReq(pMac, pMsgBuf);
5382
5383 break;
5384
5385 case eWNI_SME_AUTH_REQ:
5386 // __limProcessSmeAuthReq(pMac, pMsgBuf);
5387
5388 break;
5389
5390 case eWNI_SME_REASSOC_REQ:
5391 __limProcessSmeReassocReq(pMac, pMsgBuf);
5392
5393 break;
5394
5395 case eWNI_SME_PROMISCUOUS_MODE_REQ:
5396 //__limProcessSmePromiscuousReq(pMac, pMsgBuf);
5397
5398 break;
5399
5400 case eWNI_SME_DISASSOC_REQ:
5401 __limProcessSmeDisassocReq(pMac, pMsgBuf);
5402
5403 break;
5404
5405 case eWNI_SME_DISASSOC_CNF:
5406 case eWNI_SME_DEAUTH_CNF:
5407 __limProcessSmeDisassocCnf(pMac, pMsgBuf);
5408
5409 break;
5410
5411 case eWNI_SME_DEAUTH_REQ:
5412 __limProcessSmeDeauthReq(pMac, pMsgBuf);
5413
5414 break;
5415
5416#if (WNI_POLARIS_FW_PACKAGE == ADVANCED) && defined(ANI_PRODUCT_TYPE_AP)
5417 case eWNI_SME_SWITCH_CHL_REQ:
5418 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
5419 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
5420 bufConsumed = __limProcessSmeSwitchChlReq(pMac, pMsg);
5421 break;
5422#endif
5423
5424
5425 case eWNI_SME_SETCONTEXT_REQ:
5426 __limProcessSmeSetContextReq(pMac, pMsgBuf);
5427
5428 break;
5429
5430 case eWNI_SME_REMOVEKEY_REQ:
5431 __limProcessSmeRemoveKeyReq(pMac, pMsgBuf);
5432
5433 break;
5434
5435 case eWNI_SME_STOP_BSS_REQ:
5436 bufConsumed = __limProcessSmeStopBssReq(pMac, pMsg);
5437 break;
5438
5439 case eWNI_SME_ASSOC_CNF:
5440 case eWNI_SME_REASSOC_CNF:
5441 if (pMsg->type == eWNI_SME_ASSOC_CNF)
5442 PELOG1(limLog(pMac, LOG1, FL("Received ASSOC_CNF message\n"));)
5443 else
5444 PELOG1(limLog(pMac, LOG1, FL("Received REASSOC_CNF message\n"));)
5445#ifdef ANI_PRODUCT_TYPE_AP
5446 __limProcessSmeAssocCnf(pMac, pMsg->type, pMsgBuf);
5447#endif
5448 __limProcessSmeAssocCnfNew(pMac, pMsg->type, pMsgBuf);
5449 break;
5450
5451 case eWNI_SME_ADDTS_REQ:
5452 PELOG1(limLog(pMac, LOG1, FL("Received ADDTS_REQ message\n"));)
5453 __limProcessSmeAddtsReq(pMac, pMsgBuf);
5454 break;
5455
5456 case eWNI_SME_DELTS_REQ:
5457 PELOG1(limLog(pMac, LOG1, FL("Received DELTS_REQ message\n"));)
5458 __limProcessSmeDeltsReq(pMac, pMsgBuf);
5459 break;
5460
5461 case SIR_LIM_ADDTS_RSP_TIMEOUT:
5462 PELOG1(limLog(pMac, LOG1, FL("Received SIR_LIM_ADDTS_RSP_TIMEOUT message \n"));)
5463 limProcessSmeAddtsRspTimeout(pMac, pMsg->bodyval);
5464 break;
5465
5466 case eWNI_SME_STA_STAT_REQ:
5467 case eWNI_SME_AGGR_STAT_REQ:
5468 case eWNI_SME_GLOBAL_STAT_REQ:
5469 case eWNI_SME_STAT_SUMM_REQ:
5470 __limProcessSmeStatsRequest( pMac, pMsgBuf);
5471 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5472 bufConsumed = FALSE;
5473 break;
5474 case eWNI_SME_GET_STATISTICS_REQ:
5475 __limProcessSmeGetStatisticsRequest( pMac, pMsgBuf);
5476 //HAL consumes pMsgBuf. It will be freed there. Set bufConsumed to false.
5477 bufConsumed = FALSE;
5478 break;
5479 case eWNI_SME_DEL_BA_PEER_IND:
5480 limProcessSmeDelBaPeerInd(pMac, pMsgBuf);
5481 break;
5482 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
5483 limProcessSmeGetScanChannelInfo(pMac, pMsgBuf);
5484 break;
5485#ifdef WLAN_SOFTAP_FEATURE
5486 case eWNI_SME_GET_ASSOC_STAS_REQ:
5487 limProcessSmeGetAssocSTAsInfo(pMac, pMsgBuf);
5488 break;
5489 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
5490 limProcessTkipCounterMeasures(pMac, pMsgBuf);
5491 break;
5492
5493 case eWNI_SME_HIDE_SSID_REQ:
5494 __limProcessSmeHideSSID(pMac, pMsgBuf);
5495 break;
5496 case eWNI_SME_UPDATE_APWPSIE_REQ:
5497 __limProcessSmeUpdateAPWPSIEs(pMac, pMsgBuf);
5498 break;
5499 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
5500 limProcessSmeGetWPSPBCSessions(pMac, pMsgBuf);
5501 break;
5502
5503 case eWNI_SME_SET_APWPARSNIEs_REQ:
5504 __limProcessSmeSetWPARSNIEs(pMac, pMsgBuf);
5505 break;
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08005506
5507 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
5508 //Update the beaconInterval
5509 __limProcessSmeChangeBI(pMac, pMsgBuf );
5510 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07005511#endif
5512
5513#if defined WLAN_FEATURE_VOWIFI
5514 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
5515 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
5516 __limProcessReportMessage(pMac, pMsg);
5517 break;
5518#endif
5519
5520#if defined WLAN_FEATURE_VOWIFI_11R
5521 case eWNI_SME_FT_PRE_AUTH_REQ:
5522 bufConsumed = (tANI_BOOLEAN)limProcessFTPreAuthReq(pMac, pMsg);
5523 break;
5524 case eWNI_SME_FT_UPDATE_KEY:
5525 limProcessFTUpdateKey(pMac, pMsgBuf);
5526 break;
5527
5528 case eWNI_SME_FT_AGGR_QOS_REQ:
5529 limProcessFTAggrQosReq(pMac, pMsgBuf);
5530 break;
5531#endif
5532
5533#if defined FEATURE_WLAN_CCX
5534 case eWNI_SME_CCX_ADJACENT_AP_REPORT:
5535 limProcessAdjacentAPRepMsg ( pMac, pMsgBuf );
5536 break;
5537#endif
5538 case eWNI_SME_ADD_STA_SELF_REQ:
5539 __limProcessSmeAddStaSelfReq( pMac, pMsgBuf );
5540 break;
5541 case eWNI_SME_DEL_STA_SELF_REQ:
5542 __limProcessSmeDelStaSelfReq( pMac, pMsgBuf );
5543 break;
5544
5545#ifdef WLAN_FEATURE_P2P
5546 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
5547 __limProcessSmeRegisterMgmtFrameReq( pMac, pMsgBuf );
5548 break;
5549#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08005550#ifdef FEATURE_WLAN_TDLS
5551 case eWNI_SME_TDLS_SEND_MGMT_REQ:
5552 limProcessSmeTdlsMgmtSendReq(pMac, pMsgBuf);
5553 break;
5554 case eWNI_SME_TDLS_ADD_STA_REQ:
5555 limProcessSmeTdlsAddStaReq(pMac, pMsgBuf);
5556 break;
5557 case eWNI_SME_TDLS_DEL_STA_REQ:
5558 limProcessSmeTdlsDelStaReq(pMac, pMsgBuf);
5559 break;
5560#endif
5561#ifdef FEATURE_WLAN_TDLS_INTERNAL
5562 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
5563 limProcessSmeDisStartReq(pMac, pMsgBuf);
5564 break ;
5565 case eWNI_SME_TDLS_LINK_START_REQ:
5566 limProcessSmeLinkStartReq(pMac, pMsgBuf);
5567 break ;
5568 case eWNI_SME_TDLS_TEARDOWN_REQ:
5569 limProcessSmeTeardownReq(pMac, pMsgBuf);
5570 break ;
5571#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07005572
5573 default:
5574 vos_mem_free((v_VOID_t*)pMsg->bodyptr);
5575 pMsg->bodyptr = NULL;
5576 break;
5577 } // switch (msgType)
5578
5579 return bufConsumed;
5580} /*** end limProcessSmeReqMessages() ***/