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