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