blob: edc9ae13c8c1df6cf33b019a7acf5e4e2756fe5a [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala9c070ad2013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
Jeff Johnson295189b2012-06-20 16:38:30 -070041/*
42 * Airgo Networks, Inc proprietary. All rights reserved.
43 * This file lim ProcessMessageQueue.cc contains the code
44 * for processing LIM message Queue.
45 * Author: Chandra Modumudi
46 * Date: 02/11/02
47 * History:-
48 * Date Modified by Modification Information
49 * --------------------------------------------------------------------
50 *
51 */
52#include "palTypes.h"
53#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070054#include "wlan_qct_wdi_ds.h"
55#include "wlan_qct_pal_packet.h"
56#include "wlan_qct_wda.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070057
Jeff Johnson295189b2012-06-20 16:38:30 -070058#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070059#include "cfgApi.h"
60#include "sirCommon.h"
61#include "utilsApi.h"
62#include "limTypes.h"
63#include "limUtils.h"
64#include "limAssocUtils.h"
65#include "limPropExtsUtils.h"
66
67#include "limAdmitControl.h"
68#include "pmmApi.h"
69#include "limIbssPeerMgmt.h"
70#include "schApi.h"
71#include "limSession.h"
Yathishd8713192012-12-10 14:21:35 -080072#include "limSendMessages.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070073
74#if defined WLAN_FEATURE_VOWIFI
75#include "rrmApi.h"
76#endif
77#if defined FEATURE_WLAN_CCX
78#include "ccxApi.h"
79#endif
80
81#if defined WLAN_FEATURE_VOWIFI_11R
82#include "limFT.h"
83#endif
84
85#ifdef WMM_APSD
86#include "wmmApsd.h"
87#endif
88
Jeff Johnson295189b2012-06-20 16:38:30 -070089#include "vos_types.h"
90#include "vos_packet.h"
91#include "vos_memory.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070092
Viral Modi9dc288a2012-12-10 13:09:21 -080093/* In P2P GO case, we want to call scan on NOA start indication from limProcessMessages */
94extern void __limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf);
Viral Modi9dc288a2012-12-10 13:09:21 -080095
Jeff Johnson295189b2012-06-20 16:38:30 -070096void limLogSessionStates(tpAniSirGlobal pMac);
97
98/** -------------------------------------------------------------
99\fn defMsgDecision
100\brief The function decides whether to defer a message or not in limProcessMessage function
101\param tpAniSirGlobal pMac
102\param tSirMsgQ limMsg
103\param tSirMacTspecIE *ppInfo
104\return none
105 -------------------------------------------------------------*/
106
107tANI_U8 static
108defMsgDecision(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
109{
110
111
112/* this function should not changed */
Jeff Johnsone7245742012-09-05 17:12:55 -0700113 if(pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700114 {
115 // Defer processsing this message
116 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
117 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700118 PELOGW(limLog(pMac, LOGW, FL("Unable to Defer message(0x%X) %s limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700119 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
120 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
121 limLogSessionStates(pMac);
122 limHandleDeferMsgError(pMac, limMsg);
123 }
124 return true;
125 }
126
127 //When defer is requested then defer all the messages except HAL responses.
128 if((!limIsSystemInScanState(pMac)) && (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) &&
129 !pMac->lim.gLimSystemInScanLearnMode)
130 {
131 if((limMsg->type != WDA_ADD_BSS_RSP) &&
132 (limMsg->type != WDA_DELETE_BSS_RSP) &&
133 (limMsg->type != WDA_ADD_STA_RSP) &&
134 (limMsg->type != WDA_ADD_STA_SELF_RSP) &&
135 (limMsg->type != WDA_DEL_STA_SELF_RSP) &&
136 (limMsg->type != WDA_DELETE_STA_RSP)&&
137 (limMsg->type != WDA_SET_BSSKEY_RSP)&&
138 (limMsg->type != WDA_SET_STAKEY_RSP)&&
139 (limMsg->type != WDA_SET_STA_BCASTKEY_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700140 (limMsg->type != eWNI_SME_START_REQ) &&
141 (limMsg->type != WDA_AGGR_QOS_RSP) &&
142 (limMsg->type != WDA_REMOVE_BSSKEY_RSP) &&
143 (limMsg->type != WDA_REMOVE_STAKEY_RSP) &&
144 (limMsg->type != WDA_SET_MIMOPS_RSP)&&
145 (limMsg->type != WDA_ADDBA_RSP) &&
146 (limMsg->type != WDA_ENTER_BMPS_RSP) &&
147 (limMsg->type != WDA_EXIT_BMPS_RSP) &&
148 (limMsg->type != WDA_ENTER_IMPS_RSP) &&
149 (limMsg->type != WDA_EXIT_IMPS_RSP) &&
150 (limMsg->type != WDA_ENTER_UAPSD_RSP) &&
151 (limMsg->type != WDA_EXIT_UAPSD_RSP) &&
152 (limMsg->type != WDA_WOWL_ENTER_RSP) &&
153 (limMsg->type != WDA_WOWL_EXIT_RSP) &&
154 (limMsg->type != WDA_SWITCH_CHANNEL_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700155 (limMsg->type != WDA_P2P_NOA_ATTR_IND) &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700156#ifdef FEATURE_OEM_DATA_SUPPORT
157 (limMsg->type != WDA_START_OEM_DATA_RSP) &&
158#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700159 (limMsg->type != WDA_ADD_TS_RSP))
160 {
161 PELOG1(limLog(pMac, LOG1, FL("Defer the current message %s , gLimProcessDefdMsgs is false and system is not in scan/learn mode\n"),
162 limMsgStr(limMsg->type));)
163
164 // Defer processsing this message
165 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
166 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700167 PELOGW(limLog(pMac, LOGW, FL("Unable to Defer message(0x%X) %s limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700168 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
169 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
170 limLogSessionStates(pMac);
171 limHandleDeferMsgError(pMac, limMsg);
172
173 }
174 return true;
175 }
176 }
177 return false;
178}
179
180/*
181* Beacon Handling Cases:
182* during scanning, when no session is active:
183* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
184* during scanning, when any session is active, but beacon/Pr does not belong to that session, psessionEntry will be null.
185* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
186* during scanning, when any session is active, and beacon/Pr belongs to one of the session, psessionEntry will not be null.
187* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
188* Not scanning, no session:
189* there should not be any beacon coming, if coming, should be dropped.
190* Not Scanning,
191*/
192static void
193__limHandleBeacon(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tpPESession psessionEntry)
194{
195 /* checking for global SME state...*/
196 tANI_U8 *pRxPacketInfo;
197 limGetBDfromRxPacket(pMac, pMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
198
199 //This function should not be called if beacon is received in scan state.
200 //So not doing any checks for the global state.
201
202 if(psessionEntry == NULL)
203 {
204 schBeaconProcess(pMac, pRxPacketInfo, NULL);
205 }
206 else if( (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
207 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE))
208 {
209 schBeaconProcess(pMac, pRxPacketInfo, psessionEntry);
210 }
211 else
212 limProcessBeaconFrame(pMac, pRxPacketInfo, psessionEntry);
213
214 return;
215}
216
217
218//Fucntion prototype
219void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd);
220
221/**
222 * limProcessMessageQueue
223 *
224 *FUNCTION:
225 * This function is called by LIM thread entry function. This
226 * function fetches messages posted to the message queue
227 * limMsgQ.
228 *
229 *LOGIC:
230 *
231 *ASSUMPTIONS:
232 * NA
233 *
234 *NOTE:
235 * NA
236 *
237 * @param pMac - Pointer to Global MAC structure
238 * @return None
239 */
240
241void
242limProcessMessageQueue(tpAniSirGlobal pMac)
243{
244 tSirMsgQ limMsg = { 0, 0, 0 };
245
246 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
247 {
248 return;
249 }
250
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 if (tx_queue_receive( &pMac->sys.gSirLimMsgQ, (void *) &limMsg, TX_WAIT_FOREVER)
252 == TX_SUCCESS)
253 {
254 PELOG3(limLog(pMac, LOG3, FL("LIM Received message %s\n"), limMsgStr(limMsg.type));)
255 limPrintMsgInfo(pMac, LOG3, &limMsg);
256 limMessageProcessor(pMac, &limMsg);
257 } // if (tx_queue_receive)
258
259} /*** end limProcessMessageQueue() ***/
260
261
262
263/**
264 * limDeferMsg()
265 *
266 *FUNCTION:
267 * This function is called to defer the messages received
268 * during Learn mode
269 *
270 *LOGIC:
271 * NA
272 *
273 *ASSUMPTIONS:
274 * NA
275 *
276 *NOTE:
277 * NA
278 *
279 * @param pMac - Pointer to Global MAC structure
280 * @param pMsg of type tSirMsgQ - Pointer to the message structure
281 * @return None
282 */
283
284tANI_U32
285limDeferMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
286{
287 tANI_U32 retCode = TX_SUCCESS;
Jeff Johnson8347b442013-03-07 08:15:44 -0800288
289 retCode = limWriteDeferredMsgQ(pMac, pMsg);
290
Jeff Johnson295189b2012-06-20 16:38:30 -0700291 if (retCode == TX_SUCCESS)
Jeff Johnson8347b442013-03-07 08:15:44 -0800292 {
293 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));)
294 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 else
Jeff Johnson8347b442013-03-07 08:15:44 -0800296 {
297 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));)
298 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700299
300 return retCode;
301} /*** end limDeferMsg() ***/
302
303
304
305/**
306 * limHandleFramesInScanState()
307 *
308 *FUNCTION:
309 * This function is called to process 802.11 frames
310 * received by LIM in scan state.
311 *
312 *LOGIC:
313 * NA
314 *
315 *ASSUMPTIONS:
316 * NA
317 *
318 *NOTE:
319 * NA
320 *
321 * @param pMac - Pointer to Global MAC structure
322 * @param limMsg - Received message
323 * @param pRxPacketInfo - Pointer to Rx packet info structure
324 * @param deferMsg - Indicates whether the frame shall be deferred
325 * @return None
326 */
327
328static void
329limHandleFramesInScanState(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pRxPacketInfo, tANI_U8 *deferMsg, tpPESession psessionEntry)
330{
331 tSirMacFrameCtl fc;
332 tpSirMacMgmtHdr pHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -0700333
334 *deferMsg = false;
335 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
336 fc = pHdr->fc;
337 limLog( pMac, LOG2, FL("ProtVersion %d, Type %d, Subtype %d\n"),
338 fc.protVer, fc.type, fc.subType );
339
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 // defer all message in scan state except for Beacons and Probe Response
341 if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_BEACON))
342 {
343 if (psessionEntry == NULL)
344 limProcessBeaconFrameNoSession(pMac, pRxPacketInfo);
345 else
346 limProcessBeaconFrame(pMac, pRxPacketInfo,psessionEntry);
347 }
348 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_RSP))
349 {
350 if (psessionEntry == NULL)
351 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
352 else
353 limProcessProbeRspFrame(pMac, pRxPacketInfo,psessionEntry);
354 }
355 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_REQ))
356 {
357 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo, psessionEntry);
358 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700359 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_ACTION))
360 {
361 limProcessActionFrameNoSession( pMac, pRxPacketInfo);
362 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700363 else
364 {
365 *deferMsg = true;
366 return;
367 }
368
Jeff Johnson295189b2012-06-20 16:38:30 -0700369 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
370 return;
371
372} /*** end limHandleFramesInScanState() ***/
373
374/** ------------------------------------------------------------
375\brief This function handles Unknown Unicast (A2 Index)
376\ packets.
377\param tpAniSirGlobal pMac Global Mac data structure
378\param void *pRxPacketInfo Pointer to Buffer Descriptor
379\return none
380\
381\ -------------------------------------------------------------- */
382static void limHandleUnknownA2IndexFrames(tpAniSirGlobal pMac, void *pRxPacketInfo,tpPESession psessionEntry)
383{
384#ifndef ANI_CHIPSET_VOLANS
385 tpSirMacDataHdr3a pMacHdr;
386
387 /** This prevents from disassoc/deauth being sent in a burst,
388 and gLimDisassocFrameCredit is reset for every 10 seconds.*/
389 if (pMac->lim.gLimDisassocFrameCredit > pMac->lim.gLimDisassocFrameThreshold)
390 return;
391
392 pMac->lim.gLimDisassocFrameCredit++;
393
394 pMacHdr = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
395
396 if (limIsGroupAddr(pMacHdr->addr2))
397 {
398 PELOG2(limLog(pMac, LOG2, FL("Ignoring A2 Invalid Packet received for MC/BC:\n"));
399 limPrintMacAddr(pMac, pMacHdr->addr2, LOG2);)
400
401 return;
402 }
403
404 if (((psessionEntry->limSystemRole == eLIM_AP_ROLE) || (psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE) )&&
405 (psessionEntry->limMlmState == eLIM_MLM_BSS_STARTED_STATE))
406 {
407 switch (pMacHdr->fc.type)
408 {
409 case SIR_MAC_MGMT_FRAME:
410 switch (pMacHdr->fc.subType)
411 {
412 case SIR_MAC_MGMT_ACTION:
413 // Send Disassociation frame to
414 // sender if role is AP
415 PELOG1(limLog(pMac, LOG1, FL("Send Disassoc Frame due to Invalid Addr2 packet"));
416 limPrintMacAddr(pMac, pMacHdr->addr2, LOG1);)
417 limSendDisassocMgmtFrame(pMac,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800418 eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMacHdr->addr2, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700419 break;
420
421 default:
422 break;
423
424 }
425 break;
426
427 case SIR_MAC_CTRL_FRAME:
428 switch (pMacHdr->fc.subType)
429 {
430 case SIR_MAC_CTRL_PS_POLL:
431 case SIR_MAC_CTRL_BAR:
432 // Send Disassociation frame to
433 // sender if role is AP
434 PELOG1(limLog(pMac, LOG1, FL("Send Disassoc Frame due to Invalid Addr2 packet"));
435 limPrintMacAddr(pMac, pMacHdr->addr2, LOG1);)
436 limSendDisassocMgmtFrame(pMac,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800437 eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMacHdr->addr2, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 break;
439
440 default:
441 break;
442 }
443 break;
444
445 case SIR_MAC_DATA_FRAME:
446 switch (pMacHdr->fc.subType)
447 {
448 case SIR_MAC_DATA_NULL:
449 case SIR_MAC_DATA_QOS_NULL:
450 // Send Disassociation frame to
451 // sender if role is AP
452 PELOG1(limLog(pMac, LOG1, FL("Send Disassoc Frame due to Invalid Addr2 packet"));
453 limPrintMacAddr(pMac, pMacHdr->addr2, LOG1);)
454 limSendDisassocMgmtFrame(pMac,
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -0800455 eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMacHdr->addr2, psessionEntry, FALSE);
Jeff Johnson295189b2012-06-20 16:38:30 -0700456 break;
457
458 default:
459 // Send Deauthentication frame to
460 // sender if role is AP
461 PELOG1(limLog(pMac, LOG1, FL("Sending Deauth frame due to Invalid Addr2 packet"));
462 limPrintMacAddr(pMac, pMacHdr->addr2, LOG1);)
463 limSendDeauthMgmtFrame(pMac,
464 eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON, pMacHdr->addr2,psessionEntry);
465 break;
466 }
467 break;
468 }
469 }
470#else
471 /* addr2 mismatch interrupt occurred this means previous
472 disassociation was not successful
473 In Volans pRxPacketInfo only contains pointer 48-bit address2 field */
474 /*Send disassociation message again*/
475 //Dinesh need one more arguement.
476 //limSendDisassocMgmtFrame(pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON,(tANI_U8 *) pRxPacketInfo);
Mohit Khannac0b992f2012-12-04 15:08:18 -0800477 //TODO: verify this
Jeff Johnson295189b2012-06-20 16:38:30 -0700478 //This could be a public action frame.
479 if( psessionEntry->limSystemRole == eLIM_P2P_DEVICE_ROLE )
480 limProcessActionFrameNoSession(pMac, (tANI_U8 *) pRxPacketInfo);
Mohit Khannac0b992f2012-12-04 15:08:18 -0800481
482#ifdef FEATURE_WLAN_TDLS
483 {
484 tpSirMacDataHdr3a pMacHdr;
485 pMacHdr = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
486
487 if (limIsGroupAddr(pMacHdr->addr2))
488 {
489 PELOG2(limLog(pMac, LOG2, FL("Ignoring A2 Invalid Packet received for MC/BC:\n"));
490 limPrintMacAddr(pMac, pMacHdr->addr2, LOG2);)
491
492 return;
493 }
494 /* TDLS_hklee: move down here to reject Addr2 == Group (first checking above)
495 and also checking if SystemRole == STA */
496 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
497 {
498 /* ADD handling of Public Action Frame */
499 LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \
500 ("limHandleUnknownA2IndexFrames: type=0x%x, subtype=0x%x\n"),pMacHdr->fc.type, pMacHdr->fc.subType));
501 switch (pMacHdr->fc.type)
502 {
503 case SIR_MAC_MGMT_FRAME:
504 {
505 switch (pMacHdr->fc.subType)
506 {
507 case SIR_MAC_MGMT_ACTION:
508 {
509 limProcessActionFrame(pMac, pRxPacketInfo, psessionEntry) ;
510 break ;
511 }
512 default:
513 {
514 break ;
515 }
516 }
517 }
518 default:
519 {
520 break ;
521 }
522 }
523 }
524 }
525#endif
526
Jeff Johnson295189b2012-06-20 16:38:30 -0700527#endif
528
529 return;
530}
531
Jeff Johnson295189b2012-06-20 16:38:30 -0700532/**
533 * limCheckMgmtRegisteredFrames()
534 *
535 *FUNCTION:
536 * This function is called to process to check if received frame match with
537 * any of the registered frame from HDD. If yes pass this frame to SME.
538 *
539 *LOGIC:
540 *
541 *ASSUMPTIONS:
542 *
543 *NOTE:
544 *
545 * @param pMac Pointer to Global MAC structure
546 * @param *pBd Pointer to the received Buffer Descriptor+payload
547 * @param *psessionEntry Pointer to session on which packet is received
548 * @return None
549 */
550static tANI_BOOLEAN
551limCheckMgmtRegisteredFrames(tpAniSirGlobal pMac, tANI_U8 *pBd,
552 tpPESession psessionEntry)
553{
554 tSirMacFrameCtl fc;
555 tpSirMacMgmtHdr pHdr;
556 tANI_U8 *pBody;
557 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
558 tANI_U16 frameType;
559 tANI_U16 framelen;
560 tANI_U8 type,subType;
561 tANI_BOOLEAN match = VOS_FALSE;
562 VOS_STATUS vosStatus;
563
564 pHdr = WDA_GET_RX_MAC_HEADER(pBd);
565 fc = pHdr->fc;
566 frameType = (fc.type << 2 ) | (fc.subType << 4);
567 pBody = WDA_GET_RX_MPDU_DATA(pBd);
568 framelen = WDA_GET_RX_PAYLOAD_LEN(pBd);
569
570 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
571 (vos_list_node_t**)&pLimMgmtRegistration);
572
573 while(pLimMgmtRegistration != NULL)
574 {
575 type = (pLimMgmtRegistration->frameType >> 2) & 0x03;
576 subType = (pLimMgmtRegistration->frameType >> 4) & 0x0f;
577 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
578 && (subType == SIR_MAC_MGMT_RESERVED15) )
579 {
580 limLog( pMac, LOG3,
581 FL("rcvd frame match with SIR_MAC_MGMT_RESERVED15\n"));
582 match = VOS_TRUE;
583 break;
584 }
585
586 if (pLimMgmtRegistration->frameType == frameType)
587 {
588 if (pLimMgmtRegistration->matchLen > 0)
589 {
590 if (pLimMgmtRegistration->matchLen <= framelen)
591 {
592 if (palEqualMemory(pMac, pLimMgmtRegistration->matchData,
593 pBody, pLimMgmtRegistration->matchLen))
594 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700595 /* found match! */
596 match = VOS_TRUE;
597 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 }
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700599 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700600 }
601 else
602 {
603 /* found match! */
604 match = VOS_TRUE;
605 break;
606 }
607 }
608
609 vosStatus =
610 vos_list_peek_next ( &pMac->lim.gLimMgmtFrameRegistratinQueue,
611 (vos_list_node_t*) pLimMgmtRegistration,
612 (vos_list_node_t**) &pNext );
613 pLimMgmtRegistration = pNext;
614 pNext = NULL;
615 }
616
617 if (match)
618 {
619 limLog( pMac, LOG1,
620 FL("rcvd frame match with registered frame params\n"));
621
622 /* Indicate this to SME */
623 limSendSmeMgmtFrameInd( pMac, pHdr->fc.subType, (tANI_U8*)pHdr,
624 WDA_GET_RX_PAYLOAD_LEN(pBd) + sizeof(tSirMacMgmtHdr),
625 pLimMgmtRegistration->sessionId,
Chilam NGde0b4112013-01-19 12:27:36 +0530626 WDA_GET_RX_CH(pBd), psessionEntry, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700627
628 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
629 && (subType == SIR_MAC_MGMT_RESERVED15) )
630 {
631 // These packets needs to be processed by PE/SME as well as HDD.
632 // If it returns TRUE here, the packet is forwarded to HDD only.
633 match = VOS_FALSE;
634 }
635 }
636
637 return match;
638} /*** end limCheckMgmtRegisteredFrames() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700639
640
641/**
642 * limHandle80211Frames()
643 *
644 *FUNCTION:
645 * This function is called to process 802.11 frames
646 * received by LIM.
647 *
648 *LOGIC:
649 * NA
650 *
651 *ASSUMPTIONS:
652 * NA
653 *
654 *NOTE:
655 * NA
656 *
657 * @param pMac - Pointer to Global MAC structure
658 * @param pMsg of type tSirMsgQ - Pointer to the message structure
659 * @return None
660 */
661
662static void
663limHandle80211Frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pDeferMsg)
664{
665 tANI_U8 *pRxPacketInfo = NULL;
666 tSirMacFrameCtl fc;
667 tpSirMacMgmtHdr pHdr=NULL;
668 tpPESession psessionEntry=NULL;
669 tANI_U8 sessionId;
670 tAniBool isFrmFt = FALSE;
671 tANI_U16 fcOffset = WLANHAL_RX_BD_HEADER_SIZE;
672
673 *pDeferMsg= false;
674 limGetBDfromRxPacket(pMac, limMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
675
676 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
677 isFrmFt = WDA_GET_RX_FT_DONE(pRxPacketInfo);
678 fcOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pRxPacketInfo);
679 fc = pHdr->fc;
680
Mohit Khanna23863762012-09-11 17:40:09 -0700681 limLog( pMac, LOG4, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d\n"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700682 fc.protVer, fc.type, fc.subType, WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
683
684
685#ifdef FEATURE_WLAN_CCX
686 if (fc.type == SIR_MAC_DATA_FRAME && isFrmFt)
687 {
688#if 0 // CCX TBD Need to PORT
689 tpSirMacDot3Hdr pDataFrmHdr;
690
691 pDataFrmHdr = (tpSirMacDot3Hdr)((tANI_U8 *)pBD+ WLANHAL_RX_BD_GET_MPDU_H_OFFSET(pBD));
692 if((psessionEntry = peFindSessionByBssid(pMac,pDataFrmHdr->sa,&sessionId))== NULL)
693 {
694 limLog( pMac, LOGE, FL("Session not found for Frm type %d, subtype %d, SA: "), fc.type, fc.subType);
695 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
696 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
697 return;
698 }
699
700 if (!psessionEntry->isCCXconnection)
701 {
702 limLog( pMac, LOGE, FL("LIM received Type %d, Subtype %d in Non CCX connection\n"),
703 fc.type, fc.subType);
704 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
705 return;
706 }
707 limLog( pMac, LOGE, FL("Processing IAPP Frm from SA:"));
708 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
709#else
710 printk("%s: Need to port handling of IAPP frames to PRIMA for CCX\n", __func__);
711#endif
712
713
714 } else
715#endif
716 /* Added For BT-AMP Support */
717 if((psessionEntry = peFindSessionByBssid(pMac,pHdr->bssId,&sessionId))== NULL)
718 {
719#ifdef WLAN_FEATURE_VOWIFI_11R
720 if (fc.subType == SIR_MAC_MGMT_AUTH)
721 {
722#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturu9163b672013-02-11 14:05:06 -0800723 limLog( pMac, LOG1, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 fc.protVer, fc.type, fc.subType, WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
Varun Reddy Yeturu9163b672013-02-11 14:05:06 -0800725 limPrintMacAddr(pMac, pHdr->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700726#endif
727 if (limProcessAuthFrameNoSession(pMac, pRxPacketInfo, limMsg->bodyptr) == eSIR_SUCCESS)
728 {
729 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
730 return;
731 }
732 }
733#endif
734 if((fc.subType != SIR_MAC_MGMT_PROBE_RSP )&&
735 (fc.subType != SIR_MAC_MGMT_BEACON)&&
736 (fc.subType != SIR_MAC_MGMT_PROBE_REQ)
Jeff Johnson295189b2012-06-20 16:38:30 -0700737 && (fc.subType != SIR_MAC_MGMT_ACTION ) //Public action frame can be received from non-associated stations.
Jeff Johnson295189b2012-06-20 16:38:30 -0700738 )
739 {
740
741 if((psessionEntry = peFindSessionByPeerSta(pMac,pHdr->sa,&sessionId))== NULL)
742 {
743 limLog(pMac, LOG1, FL("session does not exist for given bssId\n"));
744 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
745 return;
746 }
747 }
748 }
749
750
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 /* Check if frame is registered by HDD */
752 if(limCheckMgmtRegisteredFrames(pMac, pRxPacketInfo, psessionEntry))
753 {
754 limLog( pMac, LOG1, FL("Received frame is passed to SME\n"));
755 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
756 return;
757 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700758
759
Jeff Johnson295189b2012-06-20 16:38:30 -0700760
761 if (fc.protVer != SIR_MAC_PROTOCOL_VERSION)
762 { // Received Frame with non-zero Protocol Version
763 limLog(pMac, LOGE, FL("Unexpected frame with protVersion %d received\n"),
764 fc.protVer);
765 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
766#ifdef WLAN_DEBUG
767 pMac->lim.numProtErr++;
768#endif
769 return;
770 }
771
772
773 if (limIsSystemInScanState(pMac))
774 {
775 limHandleFramesInScanState(pMac, limMsg, pRxPacketInfo, pDeferMsg, psessionEntry);
776 return;
777 }
778
779/* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */
780
781#if 0
782 if (psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE) {
783 limLog( pMac, LOGW, FL( "gLimSystemRole is %d. Exiting...\n" ),psessionEntry->limSystemRole );
784 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
785
786#ifdef WLAN_DEBUG
787 pMac->lim.numProtErr++;
788#endif
789 return;
790 }
791 #endif //HACK to continue scanning
792
793
794#ifdef WLAN_DEBUG
795 pMac->lim.numMAC[fc.type][fc.subType]++;
796#endif
797
798 switch (fc.type)
799 {
800 case SIR_MAC_MGMT_FRAME:
801 {
802 #if 0 //TBD-RAJESH fix this
803 if (limIsReassocInProgress( pMac,psessionEntry) && (fc.subType != SIR_MAC_MGMT_DISASSOC) &&
804 (fc.subType != SIR_MAC_MGMT_DEAUTH) && (fc.subType != SIR_MAC_MGMT_REASSOC_RSP))
805 {
806 limLog(pMac, LOGE, FL("Frame with Type - %d, Subtype - %d received in ReAssoc Wait state, dropping...\n"),
807 fc.type, fc.subType);
808 return;
809 }
810 #endif //HACK to continue scanning
811 // Received Management frame
812 switch (fc.subType)
813 {
814 case SIR_MAC_MGMT_ASSOC_REQ:
815 // Make sure the role supports Association
816 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700818 )
819 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_ASSOC, psessionEntry);
820
821 else
822 {
823 // Unwanted messages - Log error
824 limLog(pMac, LOGE, FL("unexpected message received %X\n"),limMsg->type);
825 limPrintMsgName(pMac, LOGE, limMsg->type);
826 }
827 break;
828
829 case SIR_MAC_MGMT_ASSOC_RSP:
830 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_ASSOC,psessionEntry);
831 break;
832
833 case SIR_MAC_MGMT_REASSOC_REQ:
834 // Make sure the role supports Reassociation
835 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700836 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700837 ){
838 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_REASSOC, psessionEntry);
839 }
840 else
841 {
842 // Unwanted messages - Log error
843 limLog(pMac, LOGE, FL("unexpected message received %X\n"),limMsg->type);
844 limPrintMsgName(pMac, LOGE, limMsg->type);
845 }
846 break;
847
848 case SIR_MAC_MGMT_REASSOC_RSP:
849 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_REASSOC,psessionEntry);
850 break;
851
852 case SIR_MAC_MGMT_PROBE_REQ:
853 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo,psessionEntry);
854 break;
855
856 case SIR_MAC_MGMT_PROBE_RSP:
857 if(psessionEntry == NULL)
858 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
859 else
860 limProcessProbeRspFrame(pMac, pRxPacketInfo, psessionEntry);
861 break;
862
863 case SIR_MAC_MGMT_BEACON:
864 __limHandleBeacon(pMac, limMsg,psessionEntry);
865 break;
866
867 case SIR_MAC_MGMT_DISASSOC:
868 limProcessDisassocFrame(pMac, pRxPacketInfo,psessionEntry);
869 break;
870
871 case SIR_MAC_MGMT_AUTH:
872 limProcessAuthFrame(pMac, pRxPacketInfo,psessionEntry);
873 break;
874
875 case SIR_MAC_MGMT_DEAUTH:
876 limProcessDeauthFrame(pMac, pRxPacketInfo,psessionEntry);
877 break;
878
879 case SIR_MAC_MGMT_ACTION:
Jeff Johnson295189b2012-06-20 16:38:30 -0700880 if(psessionEntry == NULL)
881 limProcessActionFrameNoSession(pMac, pRxPacketInfo);
882 else
883 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700884 if (WDA_GET_RX_UNKNOWN_UCAST(pRxPacketInfo))
885 limHandleUnknownA2IndexFrames(pMac, pRxPacketInfo,psessionEntry);
886 else
887 limProcessActionFrame(pMac, pRxPacketInfo,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700888 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700889 break;
890 default:
891 // Received Management frame of 'reserved' subtype
892 break;
893 } // switch (fc.subType)
894
895 }
896 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 case SIR_MAC_DATA_FRAME:
898 {
Mohit Khannac0b992f2012-12-04 15:08:18 -0800899#ifdef FEATURE_WLAN_TDLS_INTERNAL
900 /*
901 * if we reach here, following cases are possible.
902 * Possible cases: a) if frame translation is disabled.
903 * b) Some frame with ADRR2 filter enabled may come
904 * here.
905 */
906 tANI_U8 *dataOffset = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
907 tANI_U8 *rfc1042Hdr = (tANI_U8 *)(dataOffset + RFC1042_HDR_LENGTH) ;
908 tANI_U16 ethType = GET_BE16(rfc1042Hdr) ;
909 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
910 ("TDLS frame with 80211 Header\n")) ;
911 if(ETH_TYPE_89_0d == ethType)
912 {
913 tANI_U8 payloadType = (rfc1042Hdr + ETH_TYPE_LEN)[0] ;
914 if(PAYLOAD_TYPE_TDLS == payloadType)
915 {
916 limProcessTdlsFrame(pMac, (tANI_U32*)pRxPacketInfo) ;
917 }
918 }
919#endif
920#ifdef FEATURE_WLAN_CCX
Jeff Johnson295189b2012-06-20 16:38:30 -0700921 /* We accept data frame (IAPP frame) only if Session is
922 * present and ccx connection is established on that
923 * session
924 */
925 if (psessionEntry && psessionEntry->isCCXconnection) {
926 limProcessIappFrame(pMac, pRxPacketInfo, psessionEntry);
927 }
Mohit Khannac0b992f2012-12-04 15:08:18 -0800928#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700929 }
930 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700931 default:
932 // Received frame of type 'reserved'
933 break;
934
935 } // switch (fc.type)
936
937 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr) ;
938 return;
939} /*** end limHandle80211Frames() ***/
940
941
942/**
943 * limProcessAbortScanInd()
944 *
945 *FUNCTION:
946 * This function is called from HDD to abort the scan which is presently being run
947 *
948 *
949 *NOTE:
950 *
951 * @param pMac Pointer to Global MAC structure
952 * @param *pMsgBuf A pointer to the SME message buffer
953 * @return None
954 */
955void
956limProcessAbortScanInd(tpAniSirGlobal pMac)
957{
958#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
959 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT, NULL, 0, 0);
960#endif //FEATURE_WLAN_DIAG_SUPPORT
961
962 /* Deactivate the gLimBackgroundScanTimer as part of the abort scan.
963 * SME should send WNI_CFG_BACKGROUND_SCAN_PERIOD indication
964 * to start the background scan again
965 */
Madan Mohan Koyyalamudi8b7f1e62012-10-05 14:56:51 -0700966 PELOG2(limLog(pMac, LOG2, FL("Processing AbortScan Ind"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700967
968 limAbortBackgroundScan(pMac);
969
970 /* Abort the scan if its running, else just return */
971 if(limIsSystemInScanState(pMac))
972 {
973 if( (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
974 (eLIM_HAL_START_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
975 (eLIM_HAL_END_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
976 (eLIM_HAL_FINISH_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
977 {
978 //Simply signal we need to abort
979 limLog( pMac, LOGW, FL(" waiting for HAL, simply signal abort gLimHalScanState = %d\n"), pMac->lim.gLimHalScanState );
980 pMac->lim.abortScan = 1;
981 }
982 else
983 {
984 //Force abort
985 limLog( pMac, LOGW, FL(" Force aborting scan\n") );
986 pMac->lim.abortScan = 0;
987 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
988 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
989 //Set the resume channel to Any valid channel (invalid).
990 //This will instruct HAL to set it to any previous valid channel.
991 peSetResumeChannel(pMac, 0, 0);
992 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
993 }
994 }
995 return;
996}
997
998/**
999 * limMessageProcessor
1000 *
1001 *FUNCTION:
1002 * Wrapper function for limProcessMessages when handling messages received by LIM.
1003 * Could either defer messages or process them.
1004 * @param pMac Pointer to Global MAC structure
1005 * @param limMsg Received LIM message
1006 * @return None
1007 */
1008
1009void limMessageProcessor(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1010{
1011 if (eLIM_MLM_OFFLINE_STATE == pMac->lim.gLimMlmState)
1012 {
1013 peFreeMsg(pMac, limMsg);
1014 return;
1015 }
1016
1017 if (!defMsgDecision(pMac, limMsg))
1018 {
1019 limProcessMessages(pMac, limMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001020 // process deferred message queue if allowed
1021 {
1022 if ( (! (pMac->lim.gLimAddtsSent))
1023 &&
1024 (! (limIsSystemInScanState(pMac)))
1025 )
1026 {
1027 if (true == GET_LIM_PROCESS_DEFD_MESGS(pMac))
1028 limProcessDeferredMessageQueue(pMac);
1029 }
1030 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001031 }
1032}
1033
Jeff Johnsone7245742012-09-05 17:12:55 -07001034#ifdef FEATURE_OEM_DATA_SUPPORT
1035
1036void limOemDataRspHandleResumeLinkRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* mlmOemDataRsp)
1037{
1038 if(status != eHAL_STATUS_SUCCESS)
1039 {
1040 limLog(pMac, LOGE, FL("OEM Data Rsp failed to get the response for resume link\n"));
1041 }
1042
1043 if(NULL != pMac->lim.gpLimMlmOemDataReq)
1044 {
1045 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmOemDataReq);
1046 pMac->lim.gpLimMlmOemDataReq = NULL;
1047 }
1048
1049 //"Failure" status doesn't mean that Oem Data Rsp did not happen
1050 //and hence we need to respond to upper layers. Only Resume link is failed, but
1051 //we got the oem data response already.
1052 //Post the meessage to MLM
1053 limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)(mlmOemDataRsp));
1054
1055 return;
1056}
1057
1058void limProcessOemDataRsp(tpAniSirGlobal pMac, tANI_U32* body)
1059{
1060 eHalStatus status = eHAL_STATUS_SUCCESS;
1061 tpLimMlmOemDataRsp mlmOemDataRsp = NULL;
1062 tpStartOemDataRsp oemDataRsp = NULL;
1063
1064 //Process all the messages for the lim queue
1065 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1066
1067 oemDataRsp = (tpStartOemDataRsp)(body);
1068
1069 status = palAllocateMemory(pMac->hHdd, (void**)(&mlmOemDataRsp), sizeof(tLimMlmOemDataRsp));
1070 if(status != eHAL_STATUS_SUCCESS)
1071 {
1072 limLog(pMac, LOGP, FL("could not allocate memory for mlmOemDataRsp\n"));
1073 return;
1074 }
1075
1076 //copy the memory into tLimMlmOemDataRsp and free the tStartOemDataRsp
1077 //the structures tStartOemDataRsp and tLimMlmOemDataRsp have the same structure
1078 palCopyMemory(pMac->hHdd, (void*)(mlmOemDataRsp), (void*)(oemDataRsp), sizeof(tLimMlmOemDataRsp));
1079
1080 //Now free the incoming memory
1081 palFreeMemory(pMac->hHdd, (void*)(oemDataRsp));
1082
1083 limResumeLink(pMac, limOemDataRspHandleResumeLinkRsp, (tANI_U32*)mlmOemDataRsp);
1084
1085 return;
1086}
1087
1088#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001089
1090
1091/**
1092 * limProcessMessages
1093 *
1094 *FUNCTION:
1095 * This function is called by limProcessMessageQueue function. This
1096 * function processes messages received by LIM.
1097 *
1098 *LOGIC:
1099 * Depending on the message type, corresponding function will be
1100 * called, for example limProcessSmeMessages() will be called to
1101 * process SME messages received from HDD/Upper layer software module.
1102 *
1103 *ASSUMPTIONS:
1104 * NA
1105 *
1106 *NOTE:
1107 * NA
1108 *
1109 * @param pMac Pointer to Global MAC structure
1110 * @param limMsg Received LIM message
1111 * @return None
1112 */
1113
1114void
1115limProcessMessages(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1116{
1117 tANI_U8 deferMsg = false;
1118 tLinkStateParams *linkStateParams;
1119#if defined WLAN_FEATURE_VOWIFI_11R
1120 tpPESession pSession;
1121#endif
1122#if defined(ANI_DVT_DEBUG)
1123 tSirMsgQ msgQ;
1124#endif
1125 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1126 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001127 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1128 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001129 return;
1130 }
1131#ifdef WLAN_DEBUG
1132 pMac->lim.numTot++;
1133#endif
1134
1135
1136 PELOG3(limLog(pMac, LOG3, FL("rcvd msgType = %s, sme state = %s, mlm state = %s\n"),
1137 limMsgStr(limMsg->type), limSmeStateStr(pMac->lim.gLimSmeState),
1138 limMlmStateStr(pMac->lim.gLimMlmState));)
1139
Jeff Johnsone7245742012-09-05 17:12:55 -07001140 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001141
1142 switch (limMsg->type)
1143 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001144
1145 case SIR_LIM_UPDATE_BEACON:
1146 limUpdateBeacon(pMac);
1147 break;
1148
Jeff Johnson295189b2012-06-20 16:38:30 -07001149 case SIR_CFG_PARAM_UPDATE_IND:
1150 /// CFG parameter updated
1151 if (limIsSystemInScanState(pMac))
1152 {
1153 // System is in DFS (Learn) mode
1154 // Defer processsing this message
1155 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1156 {
1157 PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
1158 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1159 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1160 limLogSessionStates(pMac);
1161 limPrintMsgName(pMac, LOGE, limMsg->type);
1162 }
1163 }
1164 else
1165 {
1166 limHandleCFGparamUpdate(pMac, limMsg->bodyval);
1167 }
1168
1169 break;
1170
1171 case WDA_INIT_SCAN_RSP:
1172 limProcessInitScanRsp(pMac, limMsg->bodyptr);
1173 break;
1174
1175 case WDA_START_SCAN_RSP:
1176 limProcessStartScanRsp(pMac, limMsg->bodyptr);
1177 break;
1178
1179 case WDA_END_SCAN_RSP:
1180 limProcessEndScanRsp(pMac, limMsg->bodyptr);
1181 break;
1182
1183 case WDA_FINISH_SCAN_RSP:
1184 limProcessFinishScanRsp(pMac, limMsg->bodyptr);
1185 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001186#ifdef FEATURE_OEM_DATA_SUPPORT
1187 case WDA_START_OEM_DATA_RSP:
1188 limProcessOemDataRsp(pMac, limMsg->bodyptr);
1189 break;
1190#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001191
1192 case WDA_SWITCH_CHANNEL_RSP:
1193 limProcessSwitchChannelRsp(pMac, limMsg->bodyptr);
1194 break;
1195
1196#ifdef ANI_SIR_IBSS_PEER_CACHING
1197 case WDA_IBSS_STA_ADD:
1198 limIbssStaAdd(pMac, limMsg->bodyptr);
1199 break;
1200#endif
1201 case SIR_BB_XPORT_MGMT_MSG:
1202 // These messages are from Peer MAC entity.
1203#ifdef WLAN_DEBUG
1204 pMac->lim.numBbt++;
1205#endif
1206
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 {
1208 v_U16_t pktLen = 0;
1209 vos_pkt_t *pVosPkt;
1210 VOS_STATUS vosStatus;
1211 tSirMsgQ limMsgNew;
Mohit Khannac0b992f2012-12-04 15:08:18 -08001212#ifdef FEATURE_WLAN_TDLS_INTERNAL
1213 tANI_U32 *pBD = NULL ;
1214#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001215
1216 /* The original limMsg which we were deferring have the
1217 * bodyPointer point to 'BD' instead of 'Vos pkt'. If we don't make a copy
1218 * of limMsg, then vos_pkt_peek_data will overwrite the limMsg->bodyPointer.
1219 * and next time when we try to process the msg, we will try to use 'BD' as
1220 * 'Vos Pkt' which will cause a crash
1221 */
1222 palCopyMemory(pMac, (tANI_U8*)&limMsgNew, (tANI_U8*)limMsg, sizeof(tSirMsgQ));
1223 pVosPkt = (vos_pkt_t *)limMsgNew.bodyptr;
1224 vos_pkt_get_packet_length(pVosPkt, &pktLen);
1225
1226 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&limMsgNew.bodyptr, VOS_FALSE );
1227
1228 if( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1229 {
1230 vos_pkt_return_packet(pVosPkt);
1231 break;
1232
1233 }
Mohit Khannac0b992f2012-12-04 15:08:18 -08001234#ifdef FEATURE_WLAN_TDLS_INTERNAL
1235 /*
1236 * TDLS frames comes as translated frames as well as
1237 * MAC 802.11 data frames..
1238 */
1239 limGetBDfromRxPacket(pMac, limMsgNew.bodyptr, &pBD);
1240 if(0 != WDA_GET_RX_FT_DONE(pBD))
1241 {
1242 /*
1243 * TODO: check for scanning state and set deferMesg flag
1244 * accordingly..
1245 */
1246 deferMsg = false ;
1247
1248 limProcessTdlsFrame(pMac, pBD) ;
1249 }
1250 else
1251#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001252 limHandle80211Frames(pMac, &limMsgNew, &deferMsg);
1253
1254 if ( deferMsg == true )
1255 {
1256 PELOG1(limLog(pMac, LOG1, FL("Defer message type=%X \n"), limMsg->type);)
1257 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1258 {
1259 PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
1260 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1261 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1262 limLogSessionStates(pMac);
1263 limPrintMsgName(pMac, LOGE, limMsg->type);
1264 vos_pkt_return_packet(pVosPkt);
1265 }
1266 }
1267 else
1268 {
1269 /* PE is not deferring this 802.11 frame so we need to call vos_pkt_return.
1270 * Asumption here is when Rx mgmt frame processing is done,
1271 * voss packet could be freed here.
1272 */
1273 vos_pkt_return_packet(pVosPkt);
1274 }
1275 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001276 break;
1277
1278 case eWNI_SME_SCAN_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001279 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001280 case eWNI_SME_DISASSOC_REQ:
1281 case eWNI_SME_DEAUTH_REQ:
1282 case eWNI_SME_STA_STAT_REQ:
1283 case eWNI_SME_AGGR_STAT_REQ:
1284 case eWNI_SME_GLOBAL_STAT_REQ:
1285 case eWNI_SME_STAT_SUMM_REQ:
1286 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
1287 case eWNI_SME_GET_STATISTICS_REQ:
Srinivas Girigowda2471d832013-01-25 13:33:11 -08001288#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
1289 case eWNI_SME_GET_ROAM_RSSI_REQ:
1290#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001291#ifdef FEATURE_OEM_DATA_SUPPORT
1292 case eWNI_SME_OEM_DATA_REQ:
1293#endif
Mohit Khannac0b992f2012-12-04 15:08:18 -08001294#ifdef FEATURE_WLAN_TDLS
1295 case eWNI_SME_TDLS_SEND_MGMT_REQ:
1296 case eWNI_SME_TDLS_ADD_STA_REQ:
1297 case eWNI_SME_TDLS_DEL_STA_REQ:
1298#endif
1299#ifdef FEATURE_WLAN_TDLS_INTERNAL
1300 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
1301 case eWNI_SME_TDLS_LINK_START_REQ:
1302 case eWNI_SME_TDLS_TEARDOWN_REQ:
1303#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001304 // These messages are from HDD
1305 limProcessNormalHddMsg(pMac, limMsg, true); //need to response to hdd
1306 break;
1307
1308 case eWNI_SME_SCAN_ABORT_IND:
1309 vos_mem_free((v_VOID_t *)limMsg->bodyptr);
1310 limMsg->bodyptr = NULL;
1311 limProcessAbortScanInd(pMac);
1312 break;
1313
1314 case eWNI_SME_START_REQ:
1315 case eWNI_SME_SYS_READY_IND:
1316#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1317 case eWNI_SME_JOIN_REQ:
1318#endif
1319 case eWNI_SME_AUTH_REQ:
1320 case eWNI_SME_REASSOC_REQ:
1321 case eWNI_SME_START_BSS_REQ:
1322 case eWNI_SME_STOP_BSS_REQ:
1323 case eWNI_SME_SWITCH_CHL_REQ:
1324 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
1325 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
1326 case eWNI_SME_SETCONTEXT_REQ:
1327 case eWNI_SME_REMOVEKEY_REQ:
1328#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1329 case eWNI_SME_PROMISCUOUS_MODE_REQ:
1330#endif
1331 case eWNI_SME_DISASSOC_CNF:
1332 case eWNI_SME_DEAUTH_CNF:
1333 case eWNI_SME_ASSOC_CNF:
1334 case eWNI_SME_REASSOC_CNF:
1335 case eWNI_SME_ADDTS_REQ:
1336 case eWNI_SME_DELTS_REQ:
1337 case eWNI_SME_DEL_BA_PEER_IND:
1338 case eWNI_SME_SET_TX_POWER_REQ:
1339 case eWNI_SME_GET_TX_POWER_REQ:
1340 case eWNI_SME_GET_NOISE_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001341 case eWNI_SME_GET_ASSOC_STAS_REQ:
1342 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
1343 case eWNI_SME_UPDATE_APWPSIE_REQ:
1344 case eWNI_SME_HIDE_SSID_REQ:
1345 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
1346 case eWNI_SME_SET_APWPARSNIEs_REQ:
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08001347 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
Jeff Johnson295189b2012-06-20 16:38:30 -07001348#if defined WLAN_FEATURE_VOWIFI
1349 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1350 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
1351#endif
1352#if defined FEATURE_WLAN_CCX
1353 case eWNI_SME_CCX_ADJACENT_AP_REPORT:
1354#endif
1355#ifdef WLAN_FEATURE_VOWIFI_11R
1356 case eWNI_SME_FT_UPDATE_KEY:
1357 case eWNI_SME_FT_PRE_AUTH_REQ:
1358 case eWNI_SME_FT_AGGR_QOS_REQ:
1359#endif
1360 case eWNI_SME_ADD_STA_SELF_REQ:
1361 case eWNI_SME_DEL_STA_SELF_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001362 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
1363 case eWNI_SME_UPDATE_NOA:
Jeff Johnson295189b2012-06-20 16:38:30 -07001364 // These messages are from HDD
1365 limProcessNormalHddMsg(pMac, limMsg, false); //no need to response to hdd
1366 break;
1367
1368 //Power Save Messages From HDD
1369 case eWNI_PMC_PWR_SAVE_CFG:
1370 case eWNI_PMC_ENTER_BMPS_REQ:
1371 case eWNI_PMC_EXIT_BMPS_REQ:
1372 case eWNI_PMC_ENTER_IMPS_REQ:
1373 case eWNI_PMC_EXIT_IMPS_REQ:
1374 case eWNI_PMC_ENTER_UAPSD_REQ:
1375 case eWNI_PMC_EXIT_UAPSD_REQ:
1376 case eWNI_PMC_ENTER_WOWL_REQ:
1377 case eWNI_PMC_EXIT_WOWL_REQ:
1378 case eWNI_PMC_WOWL_ADD_BCAST_PTRN:
1379 case eWNI_PMC_WOWL_DEL_BCAST_PTRN:
1380 pmmProcessMessage(pMac, limMsg);
1381 break;
1382
1383 case eWNI_PMC_SMPS_STATE_IND :
1384 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001385 if(limMsg->bodyptr){
1386 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1387 limMsg->bodyptr = NULL;
1388 }
1389 }
1390 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001391 case eWNI_SME_SEND_ACTION_FRAME_IND:
1392 limSendP2PActionFrame(pMac, limMsg);
1393 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1394 limMsg->bodyptr = NULL;
1395 break;
1396 case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
1397 limAbortRemainOnChan(pMac);
1398 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1399 limMsg->bodyptr = NULL;
1400 break;
1401
Viral Modi9dc288a2012-12-10 13:09:21 -08001402 case SIR_HAL_P2P_NOA_START_IND:
1403 {
1404 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1405 tANI_U8 i;
1406
1407 limLog(pMac, LOG1, "LIM received NOA start %x\n", limMsg->type);
1408 for(i=0; i < pMac->lim.maxBssId; i++)
1409 {
1410 psessionEntry = &pMac->lim.gpSession[i];
1411 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
1412 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1413 { //Save P2P NOA start attributes for P2P Go persona
1414 palCopyMemory(pMac->hHdd, &psessionEntry->p2pGoPsNoaStartInd, limMsg->bodyptr, sizeof(tSirP2PNoaStart));
1415
1416 if ((pMac->lim.gpLimSmeScanReq != NULL) && (psessionEntry->p2pGoPsNoaStartInd.status == eHAL_STATUS_SUCCESS))
1417 {
1418 /* We received the NOA start indication. Now we can send down the scan request */
1419 __limProcessSmeScanReq(pMac, (tANI_U32 *)pMac->lim.gpLimSmeScanReq);
1420 /* Since insert NOA is done and NOA start msg received, we should deactivate the Insert NOA timer */
1421 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
1422 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
1423 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimSmeScanReq);
1424 pMac->lim.gpLimSmeScanReq = NULL;
1425 }
1426 else
1427 limLog(pMac, LOGE, FL("GO NOA start failure reported by FW - don't do scan\n"));
1428 break;
1429 }
1430 }
1431 }
1432 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1433 limMsg->bodyptr = NULL;
1434 break;
1435
1436
Jeff Johnson295189b2012-06-20 16:38:30 -07001437 case SIR_HAL_P2P_NOA_ATTR_IND:
1438 {
1439 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1440 tANI_U8 i;
1441
Jeff Johnson295189b2012-06-20 16:38:30 -07001442 limLog(pMac, LOGW, FL("Received message Noa_ATTR %x\n"), limMsg->type);
1443 for(i=0; i < pMac->lim.maxBssId; i++)
1444 {
Viral Modi9dc288a2012-12-10 13:09:21 -08001445 psessionEntry = &pMac->lim.gpSession[i];
1446 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001447 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1448 { //Save P2P attributes for P2P Go persona
1449
1450 palCopyMemory(pMac->hHdd,&psessionEntry->p2pGoPsUpdate, limMsg->bodyptr,sizeof(tSirP2PNoaAttr));
1451
1452
Madan Mohan Koyyalamudief91c9e2012-10-05 14:37:13 -07001453 limLog(pMac, LOG2, FL(" &psessionEntry->bssId%02x:%02x:%02x:%02x:%02x:%02x ctWin=%d oppPsFlag=%d\n"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 psessionEntry->bssId[0],
1455 psessionEntry->bssId[1],
1456 psessionEntry->bssId[2],
1457 psessionEntry->bssId[3],
1458 psessionEntry->bssId[4],
1459 psessionEntry->bssId[5],
1460 psessionEntry->p2pGoPsUpdate.ctWin,
1461 psessionEntry->p2pGoPsUpdate.oppPsFlag);
1462
Madan Mohan Koyyalamudief91c9e2012-10-05 14:37:13 -07001463 limLog(pMac, LOG2, FL(" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d\n"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt,
1465 psessionEntry->p2pGoPsUpdate.uNoa1Duration,
1466 psessionEntry->p2pGoPsUpdate.uNoa1Interval,
1467 psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
1468
1469
1470 break;
1471 }
1472 }
1473
1474 }
1475 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1476 limMsg->bodyptr = NULL;
1477
1478 break;
1479
1480
Jeff Johnson295189b2012-06-20 16:38:30 -07001481 /* eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER Message comes after the
1482 * device comes out of full power for the full power request sent
1483 * because of channel switch with switch count as 0, so call the same
1484 * function used in timeout case(i.e SIR_LIM_CHANNEL_SWITCH_TIMEOUT)
1485 * for switching the channel*/
1486 case eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER:
Jeff Johnsone7245742012-09-05 17:12:55 -07001487 if ( !tx_timer_running(&pMac->lim.limTimers.gLimChannelSwitchTimer) )
1488 {
1489 limProcessChannelSwitchTimeout(pMac);
1490 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001491 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1492 limMsg->bodyptr = NULL;
1493 break;
1494
1495 //Power Save Related Messages From HAL
1496 case WDA_ENTER_BMPS_RSP:
1497 case WDA_EXIT_BMPS_RSP:
1498 case WDA_EXIT_BMPS_IND:
1499 case WDA_ENTER_IMPS_RSP:
1500 case WDA_EXIT_IMPS_RSP:
1501 case WDA_ENTER_UAPSD_RSP:
1502 case WDA_EXIT_UAPSD_RSP:
1503 case WDA_WOWL_ENTER_RSP:
1504 case WDA_WOWL_EXIT_RSP:
1505 pmmProcessMessage(pMac, limMsg);
1506 break;
1507
1508 case WDA_LOW_RSSI_IND:
1509 //limHandleLowRssiInd(pMac);
1510 break;
1511
1512 case WDA_BMPS_STATUS_IND:
1513 limHandleBmpsStatusInd(pMac);
1514 break;
1515
1516 case WDA_MISSED_BEACON_IND:
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001517 limHandleMissedBeaconInd(pMac, limMsg);
1518 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1519 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001520 break;
1521 case WDA_MIC_FAILURE_IND:
1522 limMicFailureInd(pMac, limMsg);
1523 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1524 limMsg->bodyptr = NULL;
1525 break;
1526
1527
Jeff Johnson295189b2012-06-20 16:38:30 -07001528
1529 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1530 limProcessSmeReqMessages(pMac,limMsg);
1531 break;
1532#ifdef FEATURE_WLAN_CCX
1533 case SIR_LIM_CCX_TSM_TIMEOUT:
1534 limProcessTsmTimeoutHandler(pMac,limMsg);
1535 break;
1536 case WDA_TSM_STATS_RSP:
1537 limProcessHalCcxTsmRsp(pMac, limMsg);
1538 break;
1539#endif
1540 case WDA_ADD_TS_RSP:
1541 limProcessHalAddTsRsp(pMac, limMsg);
1542 break;
1543
1544 case SIR_LIM_DEL_TS_IND:
1545 limProcessDelTsInd(pMac, limMsg);
Madan Mohan Koyyalamudif244d8f2012-11-29 11:21:05 -08001546 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001547 case SIR_LIM_ADD_BA_IND:
1548 limProcessAddBaInd(pMac, limMsg);
1549 break;
1550 case SIR_LIM_DEL_BA_ALL_IND:
1551 limDelAllBASessions(pMac); // refer notes and change
1552 break;
1553 case SIR_LIM_DEL_BA_IND:
1554 limProcessMlmHalBADeleteInd( pMac, limMsg );
1555 break;
1556
1557 case SIR_LIM_BEACON_GEN_IND: {
Jeff Johnson295189b2012-06-20 16:38:30 -07001558
Jeff Johnson295189b2012-06-20 16:38:30 -07001559 if( pMac->lim.gLimSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07001560 schProcessPreBeaconInd(pMac, limMsg);
1561
1562 }
1563 break;
1564
1565 case SIR_LIM_DELETE_STA_CONTEXT_IND:
1566 limDeleteStaContext(pMac, limMsg);
1567 break;
1568
1569 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1570 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1571 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1572 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001573 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001574 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1575 case SIR_LIM_AUTH_RSP_TIMEOUT:
1576 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1577 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1578#ifdef WLAN_FEATURE_VOWIFI_11R
1579 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
1580#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001581 case SIR_LIM_REMAIN_CHN_TIMEOUT:
Viral Modi9dc288a2012-12-10 13:09:21 -08001582 case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT:
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001583 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
1584 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001585 // These timeout messages are handled by MLM sub module
1586
1587 limProcessMlmReqMessages(pMac,
1588 limMsg);
1589
1590 break;
1591
1592 case SIR_LIM_HEART_BEAT_TIMEOUT:
1593 /** check if heart beat failed, even if one Beacon
1594 * is rcvd within the Heart Beat interval continue
1595 * normal processing
1596 */
1597
1598 #if 0
1599 PELOG1(limLog(pMac, LOG1, FL("Heartbeat timeout, SME %d, MLME %d, #bcn %d\n"),
1600 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1601 pMac->lim.gLimRxedBeaconCntDuringHB);)
1602
1603 if(pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)
1604 limIbssHeartBeatHandle(pMac); //HeartBeat for peers.
1605 else
1606 /**
1607 * Heartbeat failure occurred on STA
1608 * This is handled by LMM sub module.
1609 */
1610 limHandleHeartBeatFailure(pMac);
1611
1612 break;
1613 #endif //TO SUPPORT BT-AMP
Yathishd8713192012-12-10 14:21:35 -08001614 if (limIsSystemInScanState(pMac))
1615 {
1616 // System is in DFS (Learn) mode
1617 // Defer processsing this message
1618 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1619 {
1620 PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
1621 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1622 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1623 limLogSessionStates(pMac);
1624 }
1625 }
1626 else
1627 {
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001628 if (NULL == limMsg->bodyptr)
1629 {
1630 limHandleHeartBeatTimeout(pMac);
1631 }
1632 else
1633 {
1634 limHandleHeartBeatTimeoutForSession(pMac, (tpPESession)limMsg->bodyptr);
1635 }
Yathishd8713192012-12-10 14:21:35 -08001636 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001637 break;
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001638
Jeff Johnson295189b2012-06-20 16:38:30 -07001639 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1640 limHandleHeartBeatFailureTimeout(pMac);
1641 break;
1642
1643 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001644 /**
1645 * Background scan timeout occurred on STA.
1646 * This is handled by LMM sub module.
1647 */
1648 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
1649
1650 //We will do background scan even in bcnps mode
1651 //if (pMac->sys.gSysEnableScanMode)
1652 pMac->lim.gLimReportBackgroundScanResults = FALSE;
1653 limTriggerBackgroundScan(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001654 break;
1655
Jeff Johnson295189b2012-06-20 16:38:30 -07001656
1657 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1658
1659 /*
1660 ** clear the credit to the send disassociate frame bucket
1661 **/
1662
1663 pMac->lim.gLimDisassocFrameCredit = 0;
1664 break;
1665
1666 case SIR_LIM_CNF_WAIT_TIMEOUT:
1667
1668 /*
1669 ** Does not receive CNF or dummy packet
1670 **/
1671 limHandleCnfWaitTimeout(pMac, (tANI_U16) limMsg->bodyval);
1672
1673 break;
1674
1675 case SIR_LIM_KEEPALIVE_TIMEOUT:
1676 limSendKeepAliveToPeer(pMac);
1677
1678 break;
1679
1680 case SIR_LIM_RETRY_INTERRUPT_MSG:
1681 // Message from ISR upon TFP's max retry limit interrupt
1682
1683 break;
1684
1685 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
1686 // Message from ISR upon SP's Invalid session key interrupt
1687
1688 break;
1689
1690 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
1691 // Message from ISR upon SP's Invalid key ID interrupt
1692
1693 break;
1694
1695 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
1696 // Message from ISR upon SP's Replay threshold interrupt
1697
1698 break;
1699
1700 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
1701 limProcessChannelSwitchTimeout(pMac);
1702 break;
1703
1704 case SIR_LIM_QUIET_TIMEOUT:
1705 limProcessQuietTimeout(pMac);
1706 break;
1707
1708 case SIR_LIM_QUIET_BSS_TIMEOUT:
1709 limProcessQuietBssTimeout(pMac);
1710 break;
1711
Jeff Johnson295189b2012-06-20 16:38:30 -07001712 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
1713 limHandleUpdateOlbcCache(pMac);
1714 break;
1715#if 0
1716 case SIR_LIM_WPS_OVERLAP_TIMEOUT:
1717 limProcessWPSOverlapTimeout(pMac);
1718 break;
1719#endif
1720
Jeff Johnson295189b2012-06-20 16:38:30 -07001721
Mohit Khannac0b992f2012-12-04 15:08:18 -08001722#ifdef FEATURE_WLAN_TDLS_INTERNAL
1723 /*
1724 * Here discovery timer expires, now we can go ahead and collect all
1725 * the dicovery responses PE has process till now and send this
1726 * responses to SME..
1727 */
1728 case SIR_LIM_TDLS_DISCOVERY_RSP_WAIT:
1729 {
1730 //fetch the sessionEntry based on the sessionId
1731 tpPESession psessionEntry = peFindSessionBySessionId(pMac,
1732 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId) ;
1733 if(NULL == psessionEntry)
1734 {
1735 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID %d\n"), pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId);
1736 return;
1737 }
1738
1739 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1740 ("Discovery Rsp timer expires \n")) ;
1741#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
1742 /* restore RXP filters */
1743 limSetLinkState(pMac, eSIR_LINK_FINISH_TDLS_DISCOVERY_STATE,
1744 psessionEntry->bssId) ;
1745#endif
1746 limSendSmeTdlsDisRsp(pMac, eSIR_SUCCESS,
1747 eWNI_SME_TDLS_DISCOVERY_START_RSP) ;
1748 break ;
1749 }
1750
1751 /*
1752 * we initiated link setup and did not receive TDLS setup rsp
1753 * from TDLS peer STA, send failure RSP to SME.
1754 */
1755 case SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT:
1756 {
1757 tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
1758 tLimTdlsLinkSetupPeer *setupPeer = NULL ;
1759
1760 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1761 ("TDLS setup rsp timer expires \n")) ;
1762 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1763 ("TDLS setup rsp timer expires for peer:\n")) ;
1764 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1765 ("%02X, %02X, %02X,%02X, %02X, %02X\n"),
1766 peerMac[0],
1767 peerMac[1],
1768 peerMac[2],
1769 peerMac[3],
1770 peerMac[4],
1771 peerMac[5]);
1772
1773 limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
1774 if(NULL != setupPeer)
1775 {
1776 limTdlsDelLinkPeer( pMac, peerMac) ;
1777 }
1778
1779 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, peerMac,
1780 eWNI_SME_TDLS_LINK_START_RSP) ;
1781 break ;
1782 }
1783 case SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT:
1784 {
1785 tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
1786 tLimTdlsLinkSetupPeer *setupPeer = NULL ;
1787
1788 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1789 ("TDLS setup CNF timer expires \n")) ;
1790 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1791 ("TDLS setup CNF timer expires for peer:\n")) ;
1792 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1793 ("%02X, %02X, %02X,%02X, %02X, %02X\n"),
1794 peerMac[0],
1795 peerMac[1],
1796 peerMac[2],
1797 peerMac[3],
1798 peerMac[4],
1799 peerMac[5]);
1800 limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
1801 if(NULL != setupPeer)
1802 {
1803 limTdlsDelLinkPeer( pMac, peerMac) ;
1804 }
1805 break ;
1806 }
1807#endif /* FEATURE_WLAN_TDLS TIMER */
Jeff Johnson295189b2012-06-20 16:38:30 -07001808 case WDA_ADD_BSS_RSP:
1809 limProcessMlmAddBssRsp( pMac, limMsg );
1810 break;
1811
1812 case WDA_ADD_STA_RSP:
1813
1814 //call a wrapper by paasing bodyptr, their get sessionID and and call proper function from there.
1815 limProcessAddStaRsp(pMac,limMsg);
1816 break;
1817
1818 case WDA_DELETE_STA_RSP:
1819 limProcessMlmDelStaRsp(pMac, limMsg);
1820 break;
1821
1822 case WDA_ADD_STA_SELF_RSP:
1823 limProcessAddStaSelfRsp(pMac, limMsg);
1824 break;
1825 case WDA_DEL_STA_SELF_RSP:
1826 limProcessDelStaSelfRsp(pMac, limMsg);
1827 break;
1828
1829 case WDA_DELETE_BSS_RSP:
1830 limHandleDeleteBssRsp(pMac,limMsg); //wrapper routine to handle delete bss response
1831 break;
1832
1833 case WDA_SET_BSSKEY_RSP:
1834 case WDA_SET_STA_BCASTKEY_RSP:
1835 limProcessMlmSetBssKeyRsp( pMac, limMsg );
1836 break;
1837 case WDA_SET_STAKEY_RSP:
1838 limProcessMlmSetStaKeyRsp( pMac, limMsg );
1839 break;
1840 case WDA_REMOVE_BSSKEY_RSP:
1841 case WDA_REMOVE_STAKEY_RSP:
1842 limProcessMlmRemoveKeyRsp( pMac, limMsg );
1843 break;
1844 case WDA_ADDBA_RSP:
1845 limProcessMlmHalAddBARsp( pMac, limMsg );
1846 break;
1847
1848 case WDA_STA_STAT_RSP:
1849 case WDA_AGGR_STAT_RSP:
1850 case WDA_GLOBAL_STAT_RSP:
1851 case WDA_STAT_SUMM_RSP:
1852 limSendSmeStatsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1853 break;
1854
1855 case WDA_GET_STATISTICS_RSP:
1856 limSendSmePEStatisticsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1857 break;
Srinivas Girigowda2471d832013-01-25 13:33:11 -08001858#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
1859 case WDA_GET_ROAM_RSSI_RSP:
1860 limSendSmePEGetRoamRssiRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1861 break;
1862#endif
1863
Jeff Johnson295189b2012-06-20 16:38:30 -07001864
1865 case WDA_SET_MIMOPS_RSP: //limProcessSetMimoRsp(pMac, limMsg);
1866 case WDA_SET_TX_POWER_RSP: //limProcessSetTxPowerRsp(pMac, limMsg);
1867 case WDA_GET_TX_POWER_RSP: //limProcessGetTxPowerRsp(pMac, limMsg);
1868 case WDA_GET_NOISE_RSP:
1869 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
1870 limMsg->bodyptr = NULL;
1871 //limProcessGetNoiseRsp(pMac, limMsg);
1872 break;
1873
1874 case WDA_SET_MAX_TX_POWER_RSP:
1875#if defined WLAN_FEATURE_VOWIFI
1876 rrmSetMaxTxPowerRsp( pMac, limMsg );
1877#endif
1878 if(limMsg->bodyptr != NULL)
1879 {
1880 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
1881 limMsg->bodyptr = NULL;
1882 }
1883 break;
1884
1885#ifdef ANI_CHIPSET_VOLANS
1886 case SIR_LIM_ADDR2_MISS_IND:
1887 {
1888 limLog(pMac, LOGE,
1889 FL("Addr2 mismatch interrupt received %X\n"),
1890 limMsg->type);
1891 /*a message from HAL indicating addr2 mismatch interrupt occurred
1892 limMsg->bodyptr contains only pointer to 48-bit addr2 field*/
1893 //Dinesh fix this. the third parameter should be sessionentry.
1894 //limHandleUnknownA2IndexFrames(pMac, (void *)limMsg->bodyptr);
1895
1896 /*Free message body pointer*/
1897 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
1898 break;
1899 }
1900#endif
1901
1902#ifdef WLAN_FEATURE_VOWIFI_11R
1903 case WDA_AGGR_QOS_RSP:
1904 limProcessFTAggrQoSRsp( pMac, limMsg );
1905 break;
1906#endif
1907
1908 case WDA_SET_LINK_STATE_RSP:
1909 linkStateParams = (tLinkStateParams *)limMsg->bodyptr;
1910#if defined WLAN_FEATURE_VOWIFI_11R
1911 pSession = linkStateParams->session;
1912 if(linkStateParams->ft)
1913 {
1914 limSendReassocReqWithFTIEsMgmtFrame(pMac,
1915 pSession->pLimMlmReassocReq,
1916 pSession);
1917 }
1918#endif
1919 if( linkStateParams->callback )
1920 {
1921 linkStateParams->callback( pMac, linkStateParams->callbackArg );
1922 }
1923 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
1924 break;
1925
1926#ifdef WLAN_FEATURE_PACKET_FILTERING
1927 case WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
1928 pmmProcessMessage(pMac, limMsg);
1929 break;
1930#endif // WLAN_FEATURE_PACKET_FILTERING
1931
1932#ifdef WLAN_FEATURE_GTK_OFFLOAD
1933 case WDA_GTK_OFFLOAD_GETINFO_RSP:
1934 pmmProcessMessage(pMac, limMsg);
1935 break;
1936#endif // WLAN_FEATURE_GTK_OFFLOAD
Yathishd8713192012-12-10 14:21:35 -08001937 case eWNI_SME_SET_BCN_FILTER_REQ:
1938 {
1939#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1940 tpPESession psessionEntry;
1941 tANI_U8 sessionId = (tANI_U8)limMsg->bodyval ;
1942 psessionEntry = &pMac->lim.gpSession[sessionId];
1943 if(psessionEntry != NULL && IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1944 {
1945 // sending beacon filtering information down to HAL
1946 if (limSendBeaconFilterInfo(pMac, psessionEntry) != eSIR_SUCCESS)
1947 {
1948 limLog(pMac, LOGE, FL("Fail to send Beacon Filter Info \n"));
1949 }
1950 }
1951#endif
1952 }
1953 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001954 default:
1955 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
1956 limMsg->bodyptr = NULL;
1957 // Unwanted messages
1958 // Log error
1959 limLog(pMac, LOGE,
1960 FL("Discarding unexpected message received %X\n"),
1961 limMsg->type);
1962 limPrintMsgName(pMac, LOGE, limMsg->type);
1963 break;
1964
1965 } // switch (limMsg->type)
1966
1967 PELOG2(limLog(pMac, LOG2, FL("Done Processing msgType = %d, sme state = %s, mlm state = %s\n"),
1968 limMsg->type, limSmeStateStr(pMac->lim.gLimSmeState),
1969 limMlmStateStr(pMac->lim.gLimMlmState));)
1970
1971} /*** end limProcessMessages() ***/
1972
1973
1974
1975/**
1976 * limProcessDeferredMessageQueue
1977 *
1978 *FUNCTION:
1979 * This function is called by LIM while exiting from Learn
1980 * mode. This function fetches messages posted to the LIM
1981 * deferred message queue limDeferredMsgQ.
1982 *
1983 *LOGIC:
1984 *
1985 *ASSUMPTIONS:
1986 * NA
1987 *
1988 *NOTE:
1989 * NA
1990 *
1991 * @param pMac - Pointer to Global MAC structure
1992 * @return None
1993 */
1994
1995void
1996limProcessDeferredMessageQueue(tpAniSirGlobal pMac)
1997{
1998 tSirMsgQ limMsg = { 0, 0, 0 };
1999
Jeff Johnson295189b2012-06-20 16:38:30 -07002000 tSirMsgQ *readMsg;
2001 tANI_U16 size;
2002
2003 /*
2004 ** check any deferred messages need to be processed
2005 **/
2006 size = pMac->lim.gLimDeferredMsgQ.size;
2007 if (size > 0)
2008 {
2009 while ((readMsg = limReadDeferredMsgQ(pMac)) != NULL)
2010 {
2011 palCopyMemory( pMac->hHdd, (tANI_U8*) &limMsg,
2012 (tANI_U8*) readMsg, sizeof(tSirMsgQ));
2013 size--;
2014 limProcessMessages(pMac, &limMsg);
2015
2016 if((limIsSystemInScanState(pMac)) || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) ||
2017 (pMac->lim.gLimSystemInScanLearnMode))
2018 break;
2019 }
2020 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002021} /*** end limProcessDeferredMessageQueue() ***/
2022
2023
2024/*
2025 * limProcessNormalHddMsg
2026 * Function: this function checks the current lim state and decide whether the message passed shall be deffered.
2027 * @param pMac - Pointer to Global MAC structure
2028 * pLimMsg -- the message need to be processed
2029 * fRspReqd -- whether return result to hdd
2030 * @return None
2031 */
2032void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd)
2033{
2034 tANI_BOOLEAN fDeferMsg = eANI_BOOLEAN_TRUE;
2035
2036 /* Added For BT-AMP Support */
2037 if ((pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_AP_ROLE )
2038 ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_STA_ROLE)
2039 ||(pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE))
2040 {
2041 /** This check is required only for the AP and in 2 cases.
2042 * 1. If we are in learn mode and we receive any of these messages,
2043 * you have to come out of scan and process the message, hence dont
2044 * defer the message here. In handler, these message could be defered
2045 * till we actually come out of scan mode.
2046 * 2. If radar is detected, you might have to defer all of these
2047 * messages except Stop BSS request/ Switch channel request. This
2048 * decision is also made inside its handler.
2049 *
2050 * Please be careful while using the flag fDeferMsg. Possibly you
2051 * might end up in an infinite loop.
2052 **/
2053 if (((pLimMsg->type == eWNI_SME_START_BSS_REQ) ||
2054 (pLimMsg->type == eWNI_SME_STOP_BSS_REQ) ||
2055 (pLimMsg->type == eWNI_SME_SWITCH_CHL_REQ) ||
2056 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ) ||
2057 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ)))
2058 {
2059 fDeferMsg = eANI_BOOLEAN_FALSE;
2060 }
2061 }
2062
2063 /* limInsystemInscanState() refers the psessionEntry, how to get session Entry????*/
Jeff Johnsone7245742012-09-05 17:12:55 -07002064 if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) /*||
2065 (LIM_IS_RADAR_DETECTED(pMac))*/) && fDeferMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002066 {
2067 // System is in DFS (Learn) mode or awaiting addts response
2068 // or if radar is detected, Defer processsing this message
2069 if (limDeferMsg(pMac, pLimMsg) != TX_SUCCESS)
2070 {
2071#ifdef WLAN_DEBUG
2072 pMac->lim.numSme++;
2073#endif
2074 PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)\n"),
2075 pLimMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
2076 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
2077 limLogSessionStates(pMac);
2078 limPrintMsgName(pMac, LOGE, pLimMsg->type);
2079 // Release body
2080 palFreeMemory( pMac->hHdd, (tANI_U8 *) pLimMsg->bodyptr);
2081 }
2082 }
2083 else
2084 {
2085 if(fRspReqd)
2086 {
2087 // These messages are from HDD
2088 // Since these requests may also be generated
2089 // internally within LIM module, need to
2090 // distinquish and send response to host
2091 pMac->lim.gLimRspReqd = eANI_BOOLEAN_TRUE;
2092 }
2093#ifdef WLAN_DEBUG
2094 pMac->lim.numSme++;
2095#endif
2096 if(limProcessSmeReqMessages(pMac, pLimMsg))
2097 {
2098 // Release body
2099 // limProcessSmeReqMessage consumed the buffer. We can free it.
2100 palFreeMemory( pMac->hHdd, (tANI_U8 *) pLimMsg->bodyptr);
2101 }
2102 }
2103}
2104
2105void
Jeff Johnsone7245742012-09-05 17:12:55 -07002106handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002107{
2108 tSirMacHTCapabilityInfo macHTCapabilityInfo;
2109 tSirMacHTParametersInfo macHTParametersInfo;
2110 tSirMacHTInfoField1 macHTInfoField1;
2111 tSirMacHTInfoField2 macHTInfoField2;
2112 tSirMacHTInfoField3 macHTInfoField3;
2113 tANI_U32 cfgValue;
2114 tANI_U8 *ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002115
Jeff Johnson295189b2012-06-20 16:38:30 -07002116 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) != eSIR_SUCCESS)
2117 {
2118 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value\n"));
2119 return ;
2120 }
2121 ptr = (tANI_U8 *) &macHTCapabilityInfo;
2122 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2123 pMac->lim.gHTLsigTXOPProtection = (tANI_U8)macHTCapabilityInfo.lsigTXOPProtection;
2124 pMac->lim.gHTMIMOPSState = (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
2125 pMac->lim.gHTGreenfield = (tANI_U8)macHTCapabilityInfo.greenField;
2126 pMac->lim.gHTMaxAmsduLength = (tANI_U8)macHTCapabilityInfo.maximalAMSDUsize;
2127 pMac->lim.gHTShortGI20Mhz = (tANI_U8)macHTCapabilityInfo.shortGI20MHz;
2128 pMac->lim.gHTShortGI40Mhz = (tANI_U8)macHTCapabilityInfo.shortGI40MHz;
Jeff Johnson295189b2012-06-20 16:38:30 -07002129 pMac->lim.gHTPSMPSupport = (tANI_U8)macHTCapabilityInfo.psmp;
2130 pMac->lim.gHTDsssCckRate40MHzSupport = (tANI_U8)macHTCapabilityInfo.dsssCckMode40MHz;
2131
2132 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) != eSIR_SUCCESS)
2133 {
2134 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value\n"));
2135 return ;
2136 }
2137 ptr = (tANI_U8 *) &macHTParametersInfo;
2138 *ptr = (tANI_U8) (cfgValue & 0xff);
2139 pMac->lim.gHTAMpduDensity = (tANI_U8)macHTParametersInfo.mpduDensity;
2140 pMac->lim.gHTMaxRxAMpduFactor = (tANI_U8)macHTParametersInfo.maxRxAMPDUFactor;
2141
2142 // Get HT IE Info
2143 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) != eSIR_SUCCESS)
2144 {
2145 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value\n"));
2146 return ;
2147 }
2148 ptr = (tANI_U8 *) &macHTInfoField1;
2149 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
2150 pMac->lim.gHTServiceIntervalGranularity = (tANI_U8)macHTInfoField1.serviceIntervalGranularity;
2151 pMac->lim.gHTControlledAccessOnly = (tANI_U8)macHTInfoField1.controlledAccessOnly;
2152 pMac->lim.gHTRifsMode = (tANI_U8)macHTInfoField1.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002153
2154 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) != eSIR_SUCCESS)
2155 {
2156 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value\n"));
2157 return ;
2158 }
2159 ptr = (tANI_U8 *) &macHTInfoField2;
2160 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2161 pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
2162
2163 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) != eSIR_SUCCESS)
2164 {
2165 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value\n"));
2166 return ;
2167 }
2168 ptr = (tANI_U8 *) &macHTInfoField3;
2169 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2170 pMac->lim.gHTPCOActive = (tANI_U8)macHTInfoField3.pcoActive;
2171 pMac->lim.gHTPCOPhase = (tANI_U8)macHTInfoField3.pcoPhase;
Jeff Johnson295189b2012-06-20 16:38:30 -07002172 pMac->lim.gHTSecondaryBeacon = (tANI_U8)macHTInfoField3.secondaryBeacon;
2173 pMac->lim.gHTDualCTSProtection = (tANI_U8)macHTInfoField3.dualCTSProtection;
2174 pMac->lim.gHTSTBCBasicMCS = (tANI_U8)macHTInfoField3.basicSTBCMCS;
Jeff Johnsone7245742012-09-05 17:12:55 -07002175
2176 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2177 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
2178 * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
2179 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2180 */
2181 if (psessionEntry != NULL)
2182 {
2183 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
2184 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
2185 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002186}
2187
2188void limLogSessionStates(tpAniSirGlobal pMac)
2189{
2190#ifdef WLAN_DEBUG
2191 int i;
2192
2193 for(i = 0; i < pMac->lim.maxBssId; i++)
2194 {
2195 if(pMac->lim.gpSession[i].valid)
2196 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07002197 PELOG1(limLog(pMac, LOG1, FL("Session[%d] sysRole(%d) limSmeState %d (prev sme state %d) mlm state %d (prev mlm state %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 i, pMac->lim.gpSession[i].limSystemRole, pMac->lim.gpSession[i].limSmeState,
2199 pMac->lim.gpSession[i].limPrevSmeState, pMac->lim.gpSession[i].limMlmState,
2200 pMac->lim.gpSession[i].limPrevMlmState);)
2201 }
2202 }
2203#endif //ifdef WLAN_DEBUG
2204}