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