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