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