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