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