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