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