blob: b79b3ff65b9929eb233f8f4a154c931007ec4d97 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala9c070ad2013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
Jeff Johnson295189b2012-06-20 16:38:30 -070041/*
42 * Airgo Networks, Inc proprietary. All rights reserved.
43 * This file lim ProcessMessageQueue.cc contains the code
44 * for processing LIM message Queue.
45 * Author: Chandra Modumudi
46 * Date: 02/11/02
47 * History:-
48 * Date Modified by Modification Information
49 * --------------------------------------------------------------------
50 *
51 */
52#include "palTypes.h"
53#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070054#include "wlan_qct_wdi_ds.h"
55#include "wlan_qct_pal_packet.h"
56#include "wlan_qct_wda.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070057
Jeff Johnson295189b2012-06-20 16:38:30 -070058#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070059#include "cfgApi.h"
60#include "sirCommon.h"
61#include "utilsApi.h"
62#include "limTypes.h"
63#include "limUtils.h"
64#include "limAssocUtils.h"
65#include "limPropExtsUtils.h"
66
67#include "limAdmitControl.h"
68#include "pmmApi.h"
69#include "limIbssPeerMgmt.h"
70#include "schApi.h"
71#include "limSession.h"
Yathishd8713192012-12-10 14:21:35 -080072#include "limSendMessages.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070073
74#if defined WLAN_FEATURE_VOWIFI
75#include "rrmApi.h"
76#endif
77#if defined FEATURE_WLAN_CCX
78#include "ccxApi.h"
79#endif
80
81#if defined WLAN_FEATURE_VOWIFI_11R
82#include "limFT.h"
83#endif
84
85#ifdef WMM_APSD
86#include "wmmApsd.h"
87#endif
88
Jeff Johnson295189b2012-06-20 16:38:30 -070089#include "vos_types.h"
90#include "vos_packet.h"
91#include "vos_memory.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070092
Viral Modi9dc288a2012-12-10 13:09:21 -080093/* In P2P GO case, we want to call scan on NOA start indication from limProcessMessages */
94extern void __limProcessSmeScanReq(tpAniSirGlobal pMac, tANI_U32 *pMsgBuf);
Viral Modi9dc288a2012-12-10 13:09:21 -080095
Jeff Johnson295189b2012-06-20 16:38:30 -070096void limLogSessionStates(tpAniSirGlobal pMac);
97
98/** -------------------------------------------------------------
99\fn defMsgDecision
100\brief The function decides whether to defer a message or not in limProcessMessage function
101\param tpAniSirGlobal pMac
102\param tSirMsgQ limMsg
103\param tSirMacTspecIE *ppInfo
104\return none
105 -------------------------------------------------------------*/
106
107tANI_U8 static
108defMsgDecision(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
109{
110
111
112/* this function should not changed */
Jeff Johnsone7245742012-09-05 17:12:55 -0700113 if(pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700114 {
115 // Defer processsing this message
116 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
117 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700118 PELOGW(limLog(pMac, LOGW, FL("Unable to Defer message(0x%X) %s limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700119 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
120 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
121 limLogSessionStates(pMac);
122 limHandleDeferMsgError(pMac, limMsg);
123 }
124 return true;
125 }
126
127 //When defer is requested then defer all the messages except HAL responses.
128 if((!limIsSystemInScanState(pMac)) && (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) &&
129 !pMac->lim.gLimSystemInScanLearnMode)
130 {
131 if((limMsg->type != WDA_ADD_BSS_RSP) &&
132 (limMsg->type != WDA_DELETE_BSS_RSP) &&
133 (limMsg->type != WDA_ADD_STA_RSP) &&
134 (limMsg->type != WDA_ADD_STA_SELF_RSP) &&
135 (limMsg->type != WDA_DEL_STA_SELF_RSP) &&
136 (limMsg->type != WDA_DELETE_STA_RSP)&&
137 (limMsg->type != WDA_SET_BSSKEY_RSP)&&
138 (limMsg->type != WDA_SET_STAKEY_RSP)&&
139 (limMsg->type != WDA_SET_STA_BCASTKEY_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700140 (limMsg->type != eWNI_SME_START_REQ) &&
141 (limMsg->type != WDA_AGGR_QOS_RSP) &&
142 (limMsg->type != WDA_REMOVE_BSSKEY_RSP) &&
143 (limMsg->type != WDA_REMOVE_STAKEY_RSP) &&
144 (limMsg->type != WDA_SET_MIMOPS_RSP)&&
145 (limMsg->type != WDA_ADDBA_RSP) &&
146 (limMsg->type != WDA_ENTER_BMPS_RSP) &&
147 (limMsg->type != WDA_EXIT_BMPS_RSP) &&
148 (limMsg->type != WDA_ENTER_IMPS_RSP) &&
149 (limMsg->type != WDA_EXIT_IMPS_RSP) &&
150 (limMsg->type != WDA_ENTER_UAPSD_RSP) &&
151 (limMsg->type != WDA_EXIT_UAPSD_RSP) &&
152 (limMsg->type != WDA_WOWL_ENTER_RSP) &&
153 (limMsg->type != WDA_WOWL_EXIT_RSP) &&
154 (limMsg->type != WDA_SWITCH_CHANNEL_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700155 (limMsg->type != WDA_P2P_NOA_ATTR_IND) &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700156#ifdef FEATURE_OEM_DATA_SUPPORT
157 (limMsg->type != WDA_START_OEM_DATA_RSP) &&
158#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700159 (limMsg->type != WDA_ADD_TS_RSP))
160 {
161 PELOG1(limLog(pMac, LOG1, FL("Defer the current message %s , gLimProcessDefdMsgs is false and system is not in scan/learn mode\n"),
162 limMsgStr(limMsg->type));)
163
164 // Defer processsing this message
165 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
166 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700167 PELOGW(limLog(pMac, LOGW, FL("Unable to Defer message(0x%X) %s limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700168 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
169 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
170 limLogSessionStates(pMac);
171 limHandleDeferMsgError(pMac, limMsg);
172
173 }
174 return true;
175 }
176 }
177 return false;
178}
179
180/*
181* Beacon Handling Cases:
182* during scanning, when no session is active:
183* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
184* during scanning, when any session is active, but beacon/Pr does not belong to that session, psessionEntry will be null.
185* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
186* during scanning, when any session is active, and beacon/Pr belongs to one of the session, psessionEntry will not be null.
187* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
188* Not scanning, no session:
189* there should not be any beacon coming, if coming, should be dropped.
190* Not Scanning,
191*/
192static void
193__limHandleBeacon(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tpPESession psessionEntry)
194{
195 /* checking for global SME state...*/
196 tANI_U8 *pRxPacketInfo;
197 limGetBDfromRxPacket(pMac, pMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
198
199 //This function should not be called if beacon is received in scan state.
200 //So not doing any checks for the global state.
201
202 if(psessionEntry == NULL)
203 {
204 schBeaconProcess(pMac, pRxPacketInfo, NULL);
205 }
206 else if( (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
207 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE))
208 {
209 schBeaconProcess(pMac, pRxPacketInfo, psessionEntry);
210 }
211 else
212 limProcessBeaconFrame(pMac, pRxPacketInfo, psessionEntry);
213
214 return;
215}
216
217
218//Fucntion prototype
219void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd);
220
221/**
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 Johnson8347b442013-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 Johnson8347b442013-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 Johnson8347b442013-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 Khannac0b992f2012-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 Khannac0b992f2012-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 NGde0b4112013-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 Yeturu9163b672013-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 Yeturu9163b672013-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 Khannac0b992f2012-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 Khannac0b992f2012-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 Khannac0b992f2012-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 Khannac0b992f2012-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 Girigowda2471d832013-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 Khannac0b992f2012-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
Gopichand Nakkala2b248b02013-03-07 17:05:07 +05301262 case eWNI_SME_RESET_AP_CAPS_CHANGED:
Jeff Johnson295189b2012-06-20 16:38:30 -07001263 // These messages are from HDD
1264 limProcessNormalHddMsg(pMac, limMsg, true); //need to response to hdd
1265 break;
1266
1267 case eWNI_SME_SCAN_ABORT_IND:
1268 vos_mem_free((v_VOID_t *)limMsg->bodyptr);
1269 limMsg->bodyptr = NULL;
1270 limProcessAbortScanInd(pMac);
1271 break;
1272
1273 case eWNI_SME_START_REQ:
1274 case eWNI_SME_SYS_READY_IND:
1275#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1276 case eWNI_SME_JOIN_REQ:
1277#endif
1278 case eWNI_SME_AUTH_REQ:
1279 case eWNI_SME_REASSOC_REQ:
1280 case eWNI_SME_START_BSS_REQ:
1281 case eWNI_SME_STOP_BSS_REQ:
1282 case eWNI_SME_SWITCH_CHL_REQ:
1283 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
1284 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
1285 case eWNI_SME_SETCONTEXT_REQ:
1286 case eWNI_SME_REMOVEKEY_REQ:
1287#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1288 case eWNI_SME_PROMISCUOUS_MODE_REQ:
1289#endif
1290 case eWNI_SME_DISASSOC_CNF:
1291 case eWNI_SME_DEAUTH_CNF:
1292 case eWNI_SME_ASSOC_CNF:
1293 case eWNI_SME_REASSOC_CNF:
1294 case eWNI_SME_ADDTS_REQ:
1295 case eWNI_SME_DELTS_REQ:
1296 case eWNI_SME_DEL_BA_PEER_IND:
1297 case eWNI_SME_SET_TX_POWER_REQ:
1298 case eWNI_SME_GET_TX_POWER_REQ:
1299 case eWNI_SME_GET_NOISE_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001300 case eWNI_SME_GET_ASSOC_STAS_REQ:
1301 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
1302 case eWNI_SME_UPDATE_APWPSIE_REQ:
1303 case eWNI_SME_HIDE_SSID_REQ:
1304 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
1305 case eWNI_SME_SET_APWPARSNIEs_REQ:
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08001306 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
Jeff Johnson295189b2012-06-20 16:38:30 -07001307#if defined WLAN_FEATURE_VOWIFI
1308 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1309 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
1310#endif
1311#if defined FEATURE_WLAN_CCX
1312 case eWNI_SME_CCX_ADJACENT_AP_REPORT:
1313#endif
1314#ifdef WLAN_FEATURE_VOWIFI_11R
1315 case eWNI_SME_FT_UPDATE_KEY:
1316 case eWNI_SME_FT_PRE_AUTH_REQ:
1317 case eWNI_SME_FT_AGGR_QOS_REQ:
1318#endif
1319 case eWNI_SME_ADD_STA_SELF_REQ:
1320 case eWNI_SME_DEL_STA_SELF_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001321 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
1322 case eWNI_SME_UPDATE_NOA:
Jeff Johnson295189b2012-06-20 16:38:30 -07001323 // These messages are from HDD
1324 limProcessNormalHddMsg(pMac, limMsg, false); //no need to response to hdd
1325 break;
1326
1327 //Power Save Messages From HDD
1328 case eWNI_PMC_PWR_SAVE_CFG:
1329 case eWNI_PMC_ENTER_BMPS_REQ:
1330 case eWNI_PMC_EXIT_BMPS_REQ:
1331 case eWNI_PMC_ENTER_IMPS_REQ:
1332 case eWNI_PMC_EXIT_IMPS_REQ:
1333 case eWNI_PMC_ENTER_UAPSD_REQ:
1334 case eWNI_PMC_EXIT_UAPSD_REQ:
1335 case eWNI_PMC_ENTER_WOWL_REQ:
1336 case eWNI_PMC_EXIT_WOWL_REQ:
1337 case eWNI_PMC_WOWL_ADD_BCAST_PTRN:
1338 case eWNI_PMC_WOWL_DEL_BCAST_PTRN:
1339 pmmProcessMessage(pMac, limMsg);
1340 break;
1341
1342 case eWNI_PMC_SMPS_STATE_IND :
1343 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001344 if(limMsg->bodyptr){
1345 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1346 limMsg->bodyptr = NULL;
1347 }
1348 }
1349 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001350 case eWNI_SME_SEND_ACTION_FRAME_IND:
1351 limSendP2PActionFrame(pMac, limMsg);
1352 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1353 limMsg->bodyptr = NULL;
1354 break;
1355 case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
1356 limAbortRemainOnChan(pMac);
1357 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1358 limMsg->bodyptr = NULL;
1359 break;
1360
Viral Modi9dc288a2012-12-10 13:09:21 -08001361 case SIR_HAL_P2P_NOA_START_IND:
1362 {
1363 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1364 tANI_U8 i;
1365
1366 limLog(pMac, LOG1, "LIM received NOA start %x\n", limMsg->type);
1367 for(i=0; i < pMac->lim.maxBssId; i++)
1368 {
1369 psessionEntry = &pMac->lim.gpSession[i];
1370 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
1371 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1372 { //Save P2P NOA start attributes for P2P Go persona
1373 palCopyMemory(pMac->hHdd, &psessionEntry->p2pGoPsNoaStartInd, limMsg->bodyptr, sizeof(tSirP2PNoaStart));
1374
1375 if ((pMac->lim.gpLimSmeScanReq != NULL) && (psessionEntry->p2pGoPsNoaStartInd.status == eHAL_STATUS_SUCCESS))
1376 {
1377 /* We received the NOA start indication. Now we can send down the scan request */
1378 __limProcessSmeScanReq(pMac, (tANI_U32 *)pMac->lim.gpLimSmeScanReq);
1379 /* Since insert NOA is done and NOA start msg received, we should deactivate the Insert NOA timer */
1380 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
1381 /* __limProcessSmeScanReq consumed the buffer. We can free it. */
1382 palFreeMemory( pMac->hHdd, (tANI_U8 *) pMac->lim.gpLimSmeScanReq);
1383 pMac->lim.gpLimSmeScanReq = NULL;
1384 }
1385 else
1386 limLog(pMac, LOGE, FL("GO NOA start failure reported by FW - don't do scan\n"));
1387 break;
1388 }
1389 }
1390 }
1391 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1392 limMsg->bodyptr = NULL;
1393 break;
1394
1395
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 case SIR_HAL_P2P_NOA_ATTR_IND:
1397 {
1398 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1399 tANI_U8 i;
1400
Jeff Johnson295189b2012-06-20 16:38:30 -07001401 limLog(pMac, LOGW, FL("Received message Noa_ATTR %x\n"), limMsg->type);
1402 for(i=0; i < pMac->lim.maxBssId; i++)
1403 {
Viral Modi9dc288a2012-12-10 13:09:21 -08001404 psessionEntry = &pMac->lim.gpSession[i];
1405 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001406 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1407 { //Save P2P attributes for P2P Go persona
1408
1409 palCopyMemory(pMac->hHdd,&psessionEntry->p2pGoPsUpdate, limMsg->bodyptr,sizeof(tSirP2PNoaAttr));
1410
1411
Madan Mohan Koyyalamudief91c9e2012-10-05 14:37:13 -07001412 limLog(pMac, LOG2, FL(" &psessionEntry->bssId%02x:%02x:%02x:%02x:%02x:%02x ctWin=%d oppPsFlag=%d\n"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001413 psessionEntry->bssId[0],
1414 psessionEntry->bssId[1],
1415 psessionEntry->bssId[2],
1416 psessionEntry->bssId[3],
1417 psessionEntry->bssId[4],
1418 psessionEntry->bssId[5],
1419 psessionEntry->p2pGoPsUpdate.ctWin,
1420 psessionEntry->p2pGoPsUpdate.oppPsFlag);
1421
Madan Mohan Koyyalamudief91c9e2012-10-05 14:37:13 -07001422 limLog(pMac, LOG2, FL(" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d\n"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001423 psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt,
1424 psessionEntry->p2pGoPsUpdate.uNoa1Duration,
1425 psessionEntry->p2pGoPsUpdate.uNoa1Interval,
1426 psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
1427
1428
1429 break;
1430 }
1431 }
1432
1433 }
1434 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1435 limMsg->bodyptr = NULL;
1436
1437 break;
1438
1439
Jeff Johnson295189b2012-06-20 16:38:30 -07001440 /* eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER Message comes after the
1441 * device comes out of full power for the full power request sent
1442 * because of channel switch with switch count as 0, so call the same
1443 * function used in timeout case(i.e SIR_LIM_CHANNEL_SWITCH_TIMEOUT)
1444 * for switching the channel*/
1445 case eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER:
Jeff Johnsone7245742012-09-05 17:12:55 -07001446 if ( !tx_timer_running(&pMac->lim.limTimers.gLimChannelSwitchTimer) )
1447 {
1448 limProcessChannelSwitchTimeout(pMac);
1449 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1451 limMsg->bodyptr = NULL;
1452 break;
1453
1454 //Power Save Related Messages From HAL
1455 case WDA_ENTER_BMPS_RSP:
1456 case WDA_EXIT_BMPS_RSP:
1457 case WDA_EXIT_BMPS_IND:
1458 case WDA_ENTER_IMPS_RSP:
1459 case WDA_EXIT_IMPS_RSP:
1460 case WDA_ENTER_UAPSD_RSP:
1461 case WDA_EXIT_UAPSD_RSP:
1462 case WDA_WOWL_ENTER_RSP:
1463 case WDA_WOWL_EXIT_RSP:
1464 pmmProcessMessage(pMac, limMsg);
1465 break;
1466
1467 case WDA_LOW_RSSI_IND:
1468 //limHandleLowRssiInd(pMac);
1469 break;
1470
1471 case WDA_BMPS_STATUS_IND:
1472 limHandleBmpsStatusInd(pMac);
1473 break;
1474
1475 case WDA_MISSED_BEACON_IND:
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001476 limHandleMissedBeaconInd(pMac, limMsg);
1477 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1478 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 break;
1480 case WDA_MIC_FAILURE_IND:
1481 limMicFailureInd(pMac, limMsg);
1482 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1483 limMsg->bodyptr = NULL;
1484 break;
1485
1486
Jeff Johnson295189b2012-06-20 16:38:30 -07001487
1488 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1489 limProcessSmeReqMessages(pMac,limMsg);
1490 break;
1491#ifdef FEATURE_WLAN_CCX
1492 case SIR_LIM_CCX_TSM_TIMEOUT:
1493 limProcessTsmTimeoutHandler(pMac,limMsg);
1494 break;
1495 case WDA_TSM_STATS_RSP:
1496 limProcessHalCcxTsmRsp(pMac, limMsg);
1497 break;
1498#endif
1499 case WDA_ADD_TS_RSP:
1500 limProcessHalAddTsRsp(pMac, limMsg);
1501 break;
1502
1503 case SIR_LIM_DEL_TS_IND:
1504 limProcessDelTsInd(pMac, limMsg);
Madan Mohan Koyyalamudif244d8f2012-11-29 11:21:05 -08001505 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001506 case SIR_LIM_ADD_BA_IND:
1507 limProcessAddBaInd(pMac, limMsg);
1508 break;
1509 case SIR_LIM_DEL_BA_ALL_IND:
1510 limDelAllBASessions(pMac); // refer notes and change
1511 break;
1512 case SIR_LIM_DEL_BA_IND:
1513 limProcessMlmHalBADeleteInd( pMac, limMsg );
1514 break;
1515
1516 case SIR_LIM_BEACON_GEN_IND: {
Jeff Johnson295189b2012-06-20 16:38:30 -07001517
Jeff Johnson295189b2012-06-20 16:38:30 -07001518 if( pMac->lim.gLimSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07001519 schProcessPreBeaconInd(pMac, limMsg);
1520
1521 }
1522 break;
1523
1524 case SIR_LIM_DELETE_STA_CONTEXT_IND:
1525 limDeleteStaContext(pMac, limMsg);
1526 break;
1527
1528 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1529 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1530 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1531 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001532 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001533 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1534 case SIR_LIM_AUTH_RSP_TIMEOUT:
1535 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1536 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1537#ifdef WLAN_FEATURE_VOWIFI_11R
1538 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
1539#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001540 case SIR_LIM_REMAIN_CHN_TIMEOUT:
Viral Modi9dc288a2012-12-10 13:09:21 -08001541 case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT:
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001542 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
1543 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001544 // These timeout messages are handled by MLM sub module
1545
1546 limProcessMlmReqMessages(pMac,
1547 limMsg);
1548
1549 break;
1550
1551 case SIR_LIM_HEART_BEAT_TIMEOUT:
1552 /** check if heart beat failed, even if one Beacon
1553 * is rcvd within the Heart Beat interval continue
1554 * normal processing
1555 */
1556
1557 #if 0
1558 PELOG1(limLog(pMac, LOG1, FL("Heartbeat timeout, SME %d, MLME %d, #bcn %d\n"),
1559 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1560 pMac->lim.gLimRxedBeaconCntDuringHB);)
1561
1562 if(pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)
1563 limIbssHeartBeatHandle(pMac); //HeartBeat for peers.
1564 else
1565 /**
1566 * Heartbeat failure occurred on STA
1567 * This is handled by LMM sub module.
1568 */
1569 limHandleHeartBeatFailure(pMac);
1570
1571 break;
1572 #endif //TO SUPPORT BT-AMP
Yathishd8713192012-12-10 14:21:35 -08001573 if (limIsSystemInScanState(pMac))
1574 {
1575 // System is in DFS (Learn) mode
1576 // Defer processsing this message
1577 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1578 {
1579 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"),
1580 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1581 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1582 limLogSessionStates(pMac);
1583 }
1584 }
1585 else
1586 {
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001587 if (NULL == limMsg->bodyptr)
1588 {
1589 limHandleHeartBeatTimeout(pMac);
1590 }
1591 else
1592 {
1593 limHandleHeartBeatTimeoutForSession(pMac, (tpPESession)limMsg->bodyptr);
1594 }
Yathishd8713192012-12-10 14:21:35 -08001595 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001596 break;
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001597
Jeff Johnson295189b2012-06-20 16:38:30 -07001598 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1599 limHandleHeartBeatFailureTimeout(pMac);
1600 break;
1601
1602 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001603 /**
1604 * Background scan timeout occurred on STA.
1605 * This is handled by LMM sub module.
1606 */
1607 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
1608
1609 //We will do background scan even in bcnps mode
1610 //if (pMac->sys.gSysEnableScanMode)
1611 pMac->lim.gLimReportBackgroundScanResults = FALSE;
1612 limTriggerBackgroundScan(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 break;
1614
Jeff Johnson295189b2012-06-20 16:38:30 -07001615
1616 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1617
1618 /*
1619 ** clear the credit to the send disassociate frame bucket
1620 **/
1621
1622 pMac->lim.gLimDisassocFrameCredit = 0;
1623 break;
1624
1625 case SIR_LIM_CNF_WAIT_TIMEOUT:
1626
1627 /*
1628 ** Does not receive CNF or dummy packet
1629 **/
1630 limHandleCnfWaitTimeout(pMac, (tANI_U16) limMsg->bodyval);
1631
1632 break;
1633
1634 case SIR_LIM_KEEPALIVE_TIMEOUT:
1635 limSendKeepAliveToPeer(pMac);
1636
1637 break;
1638
1639 case SIR_LIM_RETRY_INTERRUPT_MSG:
1640 // Message from ISR upon TFP's max retry limit interrupt
1641
1642 break;
1643
1644 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
1645 // Message from ISR upon SP's Invalid session key interrupt
1646
1647 break;
1648
1649 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
1650 // Message from ISR upon SP's Invalid key ID interrupt
1651
1652 break;
1653
1654 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
1655 // Message from ISR upon SP's Replay threshold interrupt
1656
1657 break;
1658
1659 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
1660 limProcessChannelSwitchTimeout(pMac);
1661 break;
1662
1663 case SIR_LIM_QUIET_TIMEOUT:
1664 limProcessQuietTimeout(pMac);
1665 break;
1666
1667 case SIR_LIM_QUIET_BSS_TIMEOUT:
1668 limProcessQuietBssTimeout(pMac);
1669 break;
1670
Jeff Johnson295189b2012-06-20 16:38:30 -07001671 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
1672 limHandleUpdateOlbcCache(pMac);
1673 break;
1674#if 0
1675 case SIR_LIM_WPS_OVERLAP_TIMEOUT:
1676 limProcessWPSOverlapTimeout(pMac);
1677 break;
1678#endif
1679
Jeff Johnson295189b2012-06-20 16:38:30 -07001680
Mohit Khannac0b992f2012-12-04 15:08:18 -08001681#ifdef FEATURE_WLAN_TDLS_INTERNAL
1682 /*
1683 * Here discovery timer expires, now we can go ahead and collect all
1684 * the dicovery responses PE has process till now and send this
1685 * responses to SME..
1686 */
1687 case SIR_LIM_TDLS_DISCOVERY_RSP_WAIT:
1688 {
1689 //fetch the sessionEntry based on the sessionId
1690 tpPESession psessionEntry = peFindSessionBySessionId(pMac,
1691 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId) ;
1692 if(NULL == psessionEntry)
1693 {
1694 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID %d\n"), pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId);
1695 return;
1696 }
1697
1698 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
1699 ("Discovery Rsp timer expires \n")) ;
1700#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
1701 /* restore RXP filters */
1702 limSetLinkState(pMac, eSIR_LINK_FINISH_TDLS_DISCOVERY_STATE,
1703 psessionEntry->bssId) ;
1704#endif
1705 limSendSmeTdlsDisRsp(pMac, eSIR_SUCCESS,
1706 eWNI_SME_TDLS_DISCOVERY_START_RSP) ;
1707 break ;
1708 }
1709
1710 /*
1711 * we initiated link setup and did not receive TDLS setup rsp
1712 * from TDLS peer STA, send failure RSP to SME.
1713 */
1714 case SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT:
1715 {
1716 tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
1717 tLimTdlsLinkSetupPeer *setupPeer = NULL ;
1718
1719 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1720 ("TDLS setup rsp timer expires \n")) ;
1721 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1722 ("TDLS setup rsp timer expires for peer:\n")) ;
1723 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1724 ("%02X, %02X, %02X,%02X, %02X, %02X\n"),
1725 peerMac[0],
1726 peerMac[1],
1727 peerMac[2],
1728 peerMac[3],
1729 peerMac[4],
1730 peerMac[5]);
1731
1732 limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
1733 if(NULL != setupPeer)
1734 {
1735 limTdlsDelLinkPeer( pMac, peerMac) ;
1736 }
1737
1738 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, peerMac,
1739 eWNI_SME_TDLS_LINK_START_RSP) ;
1740 break ;
1741 }
1742 case SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT:
1743 {
1744 tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
1745 tLimTdlsLinkSetupPeer *setupPeer = NULL ;
1746
1747 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
1748 ("TDLS setup CNF timer expires \n")) ;
1749 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1750 ("TDLS setup CNF timer expires for peer:\n")) ;
1751 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
1752 ("%02X, %02X, %02X,%02X, %02X, %02X\n"),
1753 peerMac[0],
1754 peerMac[1],
1755 peerMac[2],
1756 peerMac[3],
1757 peerMac[4],
1758 peerMac[5]);
1759 limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
1760 if(NULL != setupPeer)
1761 {
1762 limTdlsDelLinkPeer( pMac, peerMac) ;
1763 }
1764 break ;
1765 }
1766#endif /* FEATURE_WLAN_TDLS TIMER */
Jeff Johnson295189b2012-06-20 16:38:30 -07001767 case WDA_ADD_BSS_RSP:
1768 limProcessMlmAddBssRsp( pMac, limMsg );
1769 break;
1770
1771 case WDA_ADD_STA_RSP:
1772
1773 //call a wrapper by paasing bodyptr, their get sessionID and and call proper function from there.
1774 limProcessAddStaRsp(pMac,limMsg);
1775 break;
1776
1777 case WDA_DELETE_STA_RSP:
1778 limProcessMlmDelStaRsp(pMac, limMsg);
1779 break;
1780
1781 case WDA_ADD_STA_SELF_RSP:
1782 limProcessAddStaSelfRsp(pMac, limMsg);
1783 break;
1784 case WDA_DEL_STA_SELF_RSP:
1785 limProcessDelStaSelfRsp(pMac, limMsg);
1786 break;
1787
1788 case WDA_DELETE_BSS_RSP:
1789 limHandleDeleteBssRsp(pMac,limMsg); //wrapper routine to handle delete bss response
1790 break;
1791
1792 case WDA_SET_BSSKEY_RSP:
1793 case WDA_SET_STA_BCASTKEY_RSP:
1794 limProcessMlmSetBssKeyRsp( pMac, limMsg );
1795 break;
1796 case WDA_SET_STAKEY_RSP:
1797 limProcessMlmSetStaKeyRsp( pMac, limMsg );
1798 break;
1799 case WDA_REMOVE_BSSKEY_RSP:
1800 case WDA_REMOVE_STAKEY_RSP:
1801 limProcessMlmRemoveKeyRsp( pMac, limMsg );
1802 break;
1803 case WDA_ADDBA_RSP:
1804 limProcessMlmHalAddBARsp( pMac, limMsg );
1805 break;
1806
1807 case WDA_STA_STAT_RSP:
1808 case WDA_AGGR_STAT_RSP:
1809 case WDA_GLOBAL_STAT_RSP:
1810 case WDA_STAT_SUMM_RSP:
1811 limSendSmeStatsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1812 break;
1813
1814 case WDA_GET_STATISTICS_RSP:
1815 limSendSmePEStatisticsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1816 break;
Srinivas Girigowda2471d832013-01-25 13:33:11 -08001817#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
1818 case WDA_GET_ROAM_RSSI_RSP:
1819 limSendSmePEGetRoamRssiRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1820 break;
1821#endif
1822
Jeff Johnson295189b2012-06-20 16:38:30 -07001823
1824 case WDA_SET_MIMOPS_RSP: //limProcessSetMimoRsp(pMac, limMsg);
1825 case WDA_SET_TX_POWER_RSP: //limProcessSetTxPowerRsp(pMac, limMsg);
1826 case WDA_GET_TX_POWER_RSP: //limProcessGetTxPowerRsp(pMac, limMsg);
1827 case WDA_GET_NOISE_RSP:
1828 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
1829 limMsg->bodyptr = NULL;
1830 //limProcessGetNoiseRsp(pMac, limMsg);
1831 break;
1832
1833 case WDA_SET_MAX_TX_POWER_RSP:
1834#if defined WLAN_FEATURE_VOWIFI
1835 rrmSetMaxTxPowerRsp( pMac, limMsg );
1836#endif
1837 if(limMsg->bodyptr != NULL)
1838 {
1839 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
1840 limMsg->bodyptr = NULL;
1841 }
1842 break;
1843
1844#ifdef ANI_CHIPSET_VOLANS
1845 case SIR_LIM_ADDR2_MISS_IND:
1846 {
1847 limLog(pMac, LOGE,
1848 FL("Addr2 mismatch interrupt received %X\n"),
1849 limMsg->type);
1850 /*a message from HAL indicating addr2 mismatch interrupt occurred
1851 limMsg->bodyptr contains only pointer to 48-bit addr2 field*/
1852 //Dinesh fix this. the third parameter should be sessionentry.
1853 //limHandleUnknownA2IndexFrames(pMac, (void *)limMsg->bodyptr);
1854
1855 /*Free message body pointer*/
1856 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
1857 break;
1858 }
1859#endif
1860
1861#ifdef WLAN_FEATURE_VOWIFI_11R
1862 case WDA_AGGR_QOS_RSP:
1863 limProcessFTAggrQoSRsp( pMac, limMsg );
1864 break;
1865#endif
1866
1867 case WDA_SET_LINK_STATE_RSP:
1868 linkStateParams = (tLinkStateParams *)limMsg->bodyptr;
1869#if defined WLAN_FEATURE_VOWIFI_11R
1870 pSession = linkStateParams->session;
1871 if(linkStateParams->ft)
1872 {
1873 limSendReassocReqWithFTIEsMgmtFrame(pMac,
1874 pSession->pLimMlmReassocReq,
1875 pSession);
1876 }
1877#endif
1878 if( linkStateParams->callback )
1879 {
1880 linkStateParams->callback( pMac, linkStateParams->callbackArg );
1881 }
1882 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
1883 break;
1884
1885#ifdef WLAN_FEATURE_PACKET_FILTERING
1886 case WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
1887 pmmProcessMessage(pMac, limMsg);
1888 break;
1889#endif // WLAN_FEATURE_PACKET_FILTERING
1890
1891#ifdef WLAN_FEATURE_GTK_OFFLOAD
1892 case WDA_GTK_OFFLOAD_GETINFO_RSP:
1893 pmmProcessMessage(pMac, limMsg);
1894 break;
1895#endif // WLAN_FEATURE_GTK_OFFLOAD
Yathishd8713192012-12-10 14:21:35 -08001896 case eWNI_SME_SET_BCN_FILTER_REQ:
1897 {
1898#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1899 tpPESession psessionEntry;
1900 tANI_U8 sessionId = (tANI_U8)limMsg->bodyval ;
1901 psessionEntry = &pMac->lim.gpSession[sessionId];
1902 if(psessionEntry != NULL && IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1903 {
1904 // sending beacon filtering information down to HAL
1905 if (limSendBeaconFilterInfo(pMac, psessionEntry) != eSIR_SUCCESS)
1906 {
1907 limLog(pMac, LOGE, FL("Fail to send Beacon Filter Info \n"));
1908 }
1909 }
1910#endif
1911 }
1912 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001913 default:
1914 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
1915 limMsg->bodyptr = NULL;
1916 // Unwanted messages
1917 // Log error
1918 limLog(pMac, LOGE,
1919 FL("Discarding unexpected message received %X\n"),
1920 limMsg->type);
1921 limPrintMsgName(pMac, LOGE, limMsg->type);
1922 break;
1923
1924 } // switch (limMsg->type)
1925
1926 PELOG2(limLog(pMac, LOG2, FL("Done Processing msgType = %d, sme state = %s, mlm state = %s\n"),
1927 limMsg->type, limSmeStateStr(pMac->lim.gLimSmeState),
1928 limMlmStateStr(pMac->lim.gLimMlmState));)
1929
1930} /*** end limProcessMessages() ***/
1931
1932
1933
1934/**
1935 * limProcessDeferredMessageQueue
1936 *
1937 *FUNCTION:
1938 * This function is called by LIM while exiting from Learn
1939 * mode. This function fetches messages posted to the LIM
1940 * deferred message queue limDeferredMsgQ.
1941 *
1942 *LOGIC:
1943 *
1944 *ASSUMPTIONS:
1945 * NA
1946 *
1947 *NOTE:
1948 * NA
1949 *
1950 * @param pMac - Pointer to Global MAC structure
1951 * @return None
1952 */
1953
1954void
1955limProcessDeferredMessageQueue(tpAniSirGlobal pMac)
1956{
1957 tSirMsgQ limMsg = { 0, 0, 0 };
1958
Jeff Johnson295189b2012-06-20 16:38:30 -07001959 tSirMsgQ *readMsg;
1960 tANI_U16 size;
1961
1962 /*
1963 ** check any deferred messages need to be processed
1964 **/
1965 size = pMac->lim.gLimDeferredMsgQ.size;
1966 if (size > 0)
1967 {
1968 while ((readMsg = limReadDeferredMsgQ(pMac)) != NULL)
1969 {
1970 palCopyMemory( pMac->hHdd, (tANI_U8*) &limMsg,
1971 (tANI_U8*) readMsg, sizeof(tSirMsgQ));
1972 size--;
1973 limProcessMessages(pMac, &limMsg);
1974
1975 if((limIsSystemInScanState(pMac)) || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) ||
1976 (pMac->lim.gLimSystemInScanLearnMode))
1977 break;
1978 }
1979 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001980} /*** end limProcessDeferredMessageQueue() ***/
1981
1982
1983/*
1984 * limProcessNormalHddMsg
1985 * Function: this function checks the current lim state and decide whether the message passed shall be deffered.
1986 * @param pMac - Pointer to Global MAC structure
1987 * pLimMsg -- the message need to be processed
1988 * fRspReqd -- whether return result to hdd
1989 * @return None
1990 */
1991void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd)
1992{
1993 tANI_BOOLEAN fDeferMsg = eANI_BOOLEAN_TRUE;
1994
1995 /* Added For BT-AMP Support */
1996 if ((pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_AP_ROLE )
1997 ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_STA_ROLE)
1998 ||(pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE))
1999 {
2000 /** This check is required only for the AP and in 2 cases.
2001 * 1. If we are in learn mode and we receive any of these messages,
2002 * you have to come out of scan and process the message, hence dont
2003 * defer the message here. In handler, these message could be defered
2004 * till we actually come out of scan mode.
2005 * 2. If radar is detected, you might have to defer all of these
2006 * messages except Stop BSS request/ Switch channel request. This
2007 * decision is also made inside its handler.
2008 *
2009 * Please be careful while using the flag fDeferMsg. Possibly you
2010 * might end up in an infinite loop.
2011 **/
2012 if (((pLimMsg->type == eWNI_SME_START_BSS_REQ) ||
2013 (pLimMsg->type == eWNI_SME_STOP_BSS_REQ) ||
2014 (pLimMsg->type == eWNI_SME_SWITCH_CHL_REQ) ||
2015 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ) ||
2016 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ)))
2017 {
2018 fDeferMsg = eANI_BOOLEAN_FALSE;
2019 }
2020 }
2021
2022 /* limInsystemInscanState() refers the psessionEntry, how to get session Entry????*/
Jeff Johnsone7245742012-09-05 17:12:55 -07002023 if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) /*||
2024 (LIM_IS_RADAR_DETECTED(pMac))*/) && fDeferMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002025 {
2026 // System is in DFS (Learn) mode or awaiting addts response
2027 // or if radar is detected, Defer processsing this message
2028 if (limDeferMsg(pMac, pLimMsg) != TX_SUCCESS)
2029 {
2030#ifdef WLAN_DEBUG
2031 pMac->lim.numSme++;
2032#endif
2033 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"),
2034 pLimMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
2035 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
2036 limLogSessionStates(pMac);
2037 limPrintMsgName(pMac, LOGE, pLimMsg->type);
2038 // Release body
2039 palFreeMemory( pMac->hHdd, (tANI_U8 *) pLimMsg->bodyptr);
2040 }
2041 }
2042 else
2043 {
2044 if(fRspReqd)
2045 {
2046 // These messages are from HDD
2047 // Since these requests may also be generated
2048 // internally within LIM module, need to
2049 // distinquish and send response to host
2050 pMac->lim.gLimRspReqd = eANI_BOOLEAN_TRUE;
2051 }
2052#ifdef WLAN_DEBUG
2053 pMac->lim.numSme++;
2054#endif
2055 if(limProcessSmeReqMessages(pMac, pLimMsg))
2056 {
2057 // Release body
2058 // limProcessSmeReqMessage consumed the buffer. We can free it.
2059 palFreeMemory( pMac->hHdd, (tANI_U8 *) pLimMsg->bodyptr);
2060 }
2061 }
2062}
2063
2064void
Jeff Johnsone7245742012-09-05 17:12:55 -07002065handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002066{
2067 tSirMacHTCapabilityInfo macHTCapabilityInfo;
2068 tSirMacHTParametersInfo macHTParametersInfo;
2069 tSirMacHTInfoField1 macHTInfoField1;
2070 tSirMacHTInfoField2 macHTInfoField2;
2071 tSirMacHTInfoField3 macHTInfoField3;
2072 tANI_U32 cfgValue;
2073 tANI_U8 *ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002074
Jeff Johnson295189b2012-06-20 16:38:30 -07002075 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) != eSIR_SUCCESS)
2076 {
2077 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value\n"));
2078 return ;
2079 }
2080 ptr = (tANI_U8 *) &macHTCapabilityInfo;
2081 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2082 pMac->lim.gHTLsigTXOPProtection = (tANI_U8)macHTCapabilityInfo.lsigTXOPProtection;
2083 pMac->lim.gHTMIMOPSState = (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
2084 pMac->lim.gHTGreenfield = (tANI_U8)macHTCapabilityInfo.greenField;
2085 pMac->lim.gHTMaxAmsduLength = (tANI_U8)macHTCapabilityInfo.maximalAMSDUsize;
2086 pMac->lim.gHTShortGI20Mhz = (tANI_U8)macHTCapabilityInfo.shortGI20MHz;
2087 pMac->lim.gHTShortGI40Mhz = (tANI_U8)macHTCapabilityInfo.shortGI40MHz;
Jeff Johnson295189b2012-06-20 16:38:30 -07002088 pMac->lim.gHTPSMPSupport = (tANI_U8)macHTCapabilityInfo.psmp;
2089 pMac->lim.gHTDsssCckRate40MHzSupport = (tANI_U8)macHTCapabilityInfo.dsssCckMode40MHz;
2090
2091 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) != eSIR_SUCCESS)
2092 {
2093 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value\n"));
2094 return ;
2095 }
2096 ptr = (tANI_U8 *) &macHTParametersInfo;
2097 *ptr = (tANI_U8) (cfgValue & 0xff);
2098 pMac->lim.gHTAMpduDensity = (tANI_U8)macHTParametersInfo.mpduDensity;
2099 pMac->lim.gHTMaxRxAMpduFactor = (tANI_U8)macHTParametersInfo.maxRxAMPDUFactor;
2100
2101 // Get HT IE Info
2102 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) != eSIR_SUCCESS)
2103 {
2104 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value\n"));
2105 return ;
2106 }
2107 ptr = (tANI_U8 *) &macHTInfoField1;
2108 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
2109 pMac->lim.gHTServiceIntervalGranularity = (tANI_U8)macHTInfoField1.serviceIntervalGranularity;
2110 pMac->lim.gHTControlledAccessOnly = (tANI_U8)macHTInfoField1.controlledAccessOnly;
2111 pMac->lim.gHTRifsMode = (tANI_U8)macHTInfoField1.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002112
2113 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) != eSIR_SUCCESS)
2114 {
2115 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value\n"));
2116 return ;
2117 }
2118 ptr = (tANI_U8 *) &macHTInfoField2;
2119 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2120 pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
2121
2122 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) != eSIR_SUCCESS)
2123 {
2124 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value\n"));
2125 return ;
2126 }
2127 ptr = (tANI_U8 *) &macHTInfoField3;
2128 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2129 pMac->lim.gHTPCOActive = (tANI_U8)macHTInfoField3.pcoActive;
2130 pMac->lim.gHTPCOPhase = (tANI_U8)macHTInfoField3.pcoPhase;
Jeff Johnson295189b2012-06-20 16:38:30 -07002131 pMac->lim.gHTSecondaryBeacon = (tANI_U8)macHTInfoField3.secondaryBeacon;
2132 pMac->lim.gHTDualCTSProtection = (tANI_U8)macHTInfoField3.dualCTSProtection;
2133 pMac->lim.gHTSTBCBasicMCS = (tANI_U8)macHTInfoField3.basicSTBCMCS;
Jeff Johnsone7245742012-09-05 17:12:55 -07002134
2135 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2136 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
2137 * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
2138 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2139 */
2140 if (psessionEntry != NULL)
2141 {
2142 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
2143 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
2144 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002145}
2146
2147void limLogSessionStates(tpAniSirGlobal pMac)
2148{
2149#ifdef WLAN_DEBUG
2150 int i;
2151
2152 for(i = 0; i < pMac->lim.maxBssId; i++)
2153 {
2154 if(pMac->lim.gpSession[i].valid)
2155 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07002156 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 -07002157 i, pMac->lim.gpSession[i].limSystemRole, pMac->lim.gpSession[i].limSmeState,
2158 pMac->lim.gpSession[i].limPrevSmeState, pMac->lim.gpSession[i].limMlmState,
2159 pMac->lim.gpSession[i].limPrevMlmState);)
2160 }
2161 }
2162#endif //ifdef WLAN_DEBUG
2163}