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