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