blob: ed05aa7aecaedac39ea2834353fc5c2192b41516 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05302 * 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*/
Jeff Johnson295189b2012-06-20 16:38:30 -070021/*
22 * Airgo Networks, Inc proprietary. All rights reserved.
23 * This file lim ProcessMessageQueue.cc contains the code
24 * for processing LIM message Queue.
25 * Author: Chandra Modumudi
26 * Date: 02/11/02
27 * History:-
28 * Date Modified by Modification Information
29 * --------------------------------------------------------------------
30 *
31 */
32#include "palTypes.h"
33#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070034#include "wlan_qct_wdi_ds.h"
35#include "wlan_qct_pal_packet.h"
36#include "wlan_qct_wda.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070037
Jeff Johnson295189b2012-06-20 16:38:30 -070038#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070039#include "cfgApi.h"
40#include "sirCommon.h"
41#include "utilsApi.h"
42#include "limTypes.h"
43#include "limUtils.h"
44#include "limAssocUtils.h"
45#include "limPropExtsUtils.h"
46
47#include "limAdmitControl.h"
48#include "pmmApi.h"
49#include "limIbssPeerMgmt.h"
50#include "schApi.h"
51#include "limSession.h"
Yathishd8713192012-12-10 14:21:35 -080052#include "limSendMessages.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070053
54#if defined WLAN_FEATURE_VOWIFI
55#include "rrmApi.h"
56#endif
57#if defined FEATURE_WLAN_CCX
58#include "ccxApi.h"
59#endif
60
61#if defined WLAN_FEATURE_VOWIFI_11R
62#include "limFT.h"
63#endif
64
65#ifdef WMM_APSD
66#include "wmmApsd.h"
67#endif
68
Jeff Johnson295189b2012-06-20 16:38:30 -070069#include "vos_types.h"
70#include "vos_packet.h"
71#include "vos_memory.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070072
73void limLogSessionStates(tpAniSirGlobal pMac);
74
75/** -------------------------------------------------------------
76\fn defMsgDecision
77\brief The function decides whether to defer a message or not in limProcessMessage function
78\param tpAniSirGlobal pMac
79\param tSirMsgQ limMsg
80\param tSirMacTspecIE *ppInfo
81\return none
82 -------------------------------------------------------------*/
83
84tANI_U8 static
85defMsgDecision(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
86{
87
88
89/* this function should not changed */
Jeff Johnsone7245742012-09-05 17:12:55 -070090 if(pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -070091 {
92 // Defer processsing this message
93 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
94 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -070095 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 -070096 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
97 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
98 limLogSessionStates(pMac);
99 limHandleDeferMsgError(pMac, limMsg);
100 }
101 return true;
102 }
103
104 //When defer is requested then defer all the messages except HAL responses.
105 if((!limIsSystemInScanState(pMac)) && (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) &&
106 !pMac->lim.gLimSystemInScanLearnMode)
107 {
108 if((limMsg->type != WDA_ADD_BSS_RSP) &&
109 (limMsg->type != WDA_DELETE_BSS_RSP) &&
110 (limMsg->type != WDA_ADD_STA_RSP) &&
111 (limMsg->type != WDA_ADD_STA_SELF_RSP) &&
112 (limMsg->type != WDA_DEL_STA_SELF_RSP) &&
113 (limMsg->type != WDA_DELETE_STA_RSP)&&
114 (limMsg->type != WDA_SET_BSSKEY_RSP)&&
115 (limMsg->type != WDA_SET_STAKEY_RSP)&&
116 (limMsg->type != WDA_SET_STA_BCASTKEY_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700117 (limMsg->type != eWNI_SME_START_REQ) &&
118 (limMsg->type != WDA_AGGR_QOS_RSP) &&
119 (limMsg->type != WDA_REMOVE_BSSKEY_RSP) &&
120 (limMsg->type != WDA_REMOVE_STAKEY_RSP) &&
121 (limMsg->type != WDA_SET_MIMOPS_RSP)&&
122 (limMsg->type != WDA_ADDBA_RSP) &&
123 (limMsg->type != WDA_ENTER_BMPS_RSP) &&
124 (limMsg->type != WDA_EXIT_BMPS_RSP) &&
125 (limMsg->type != WDA_ENTER_IMPS_RSP) &&
126 (limMsg->type != WDA_EXIT_IMPS_RSP) &&
127 (limMsg->type != WDA_ENTER_UAPSD_RSP) &&
128 (limMsg->type != WDA_EXIT_UAPSD_RSP) &&
129 (limMsg->type != WDA_WOWL_ENTER_RSP) &&
130 (limMsg->type != WDA_WOWL_EXIT_RSP) &&
131 (limMsg->type != WDA_SWITCH_CHANNEL_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700132 (limMsg->type != WDA_P2P_NOA_ATTR_IND) &&
Viral Modid871f222013-03-06 02:25:31 -0800133 (limMsg->type != WDA_P2P_NOA_START_IND) &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700134#ifdef FEATURE_OEM_DATA_SUPPORT
135 (limMsg->type != WDA_START_OEM_DATA_RSP) &&
136#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700137 (limMsg->type != WDA_ADD_TS_RSP))
138 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700139 PELOG1(limLog(pMac, LOG1, FL("Defer the current message %s , gLimProcessDefdMsgs is false and system is not in scan/learn mode"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700140 limMsgStr(limMsg->type));)
141
142 // Defer processsing this message
143 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
144 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700145 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 -0700146 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
147 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
148 limLogSessionStates(pMac);
149 limHandleDeferMsgError(pMac, limMsg);
150
151 }
152 return true;
153 }
154 }
155 return false;
156}
157
158/*
159* Beacon Handling Cases:
160* during scanning, when no session is active:
161* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
162* during scanning, when any session is active, but beacon/Pr does not belong to that session, psessionEntry will be null.
163* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
164* during scanning, when any session is active, and beacon/Pr belongs to one of the session, psessionEntry will not be null.
165* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
166* Not scanning, no session:
167* there should not be any beacon coming, if coming, should be dropped.
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530168* Not Scanning,
Jeff Johnson295189b2012-06-20 16:38:30 -0700169*/
170static void
171__limHandleBeacon(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tpPESession psessionEntry)
172{
173 /* checking for global SME state...*/
174 tANI_U8 *pRxPacketInfo;
175 limGetBDfromRxPacket(pMac, pMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
176
177 //This function should not be called if beacon is received in scan state.
178 //So not doing any checks for the global state.
179
180 if(psessionEntry == NULL)
181 {
182 schBeaconProcess(pMac, pRxPacketInfo, NULL);
183 }
184 else if( (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
185 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE))
186 {
187 schBeaconProcess(pMac, pRxPacketInfo, psessionEntry);
188 }
189 else
190 limProcessBeaconFrame(pMac, pRxPacketInfo, psessionEntry);
191
192 return;
193}
194
195
196//Fucntion prototype
197void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd);
198
199/**
Jeff Johnson295189b2012-06-20 16:38:30 -0700200 * limDeferMsg()
201 *
202 *FUNCTION:
203 * This function is called to defer the messages received
204 * during Learn mode
205 *
206 *LOGIC:
207 * NA
208 *
209 *ASSUMPTIONS:
210 * NA
211 *
212 *NOTE:
213 * NA
214 *
215 * @param pMac - Pointer to Global MAC structure
216 * @param pMsg of type tSirMsgQ - Pointer to the message structure
217 * @return None
218 */
219
220tANI_U32
221limDeferMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
222{
223 tANI_U32 retCode = TX_SUCCESS;
Jeff Johnson8347b442013-03-07 08:15:44 -0800224
225 retCode = limWriteDeferredMsgQ(pMac, pMsg);
226
Jeff Johnson295189b2012-06-20 16:38:30 -0700227 if (retCode == TX_SUCCESS)
Jeff Johnson8347b442013-03-07 08:15:44 -0800228 {
229 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));)
230 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700231 else
Jeff Johnson8347b442013-03-07 08:15:44 -0800232 {
233 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));)
234 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700235
236 return retCode;
237} /*** end limDeferMsg() ***/
238
239
240
241/**
242 * limHandleFramesInScanState()
243 *
244 *FUNCTION:
245 * This function is called to process 802.11 frames
246 * received by LIM in scan state.
247 *
248 *LOGIC:
249 * NA
250 *
251 *ASSUMPTIONS:
252 * NA
253 *
254 *NOTE:
255 * NA
256 *
257 * @param pMac - Pointer to Global MAC structure
258 * @param limMsg - Received message
259 * @param pRxPacketInfo - Pointer to Rx packet info structure
260 * @param deferMsg - Indicates whether the frame shall be deferred
261 * @return None
262 */
263
264static void
265limHandleFramesInScanState(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pRxPacketInfo, tANI_U8 *deferMsg, tpPESession psessionEntry)
266{
267 tSirMacFrameCtl fc;
268 tpSirMacMgmtHdr pHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -0700269
270 *deferMsg = false;
271 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
272 fc = pHdr->fc;
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700273 limLog( pMac, LOG2, FL("ProtVersion %d, Type %d, Subtype %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700274 fc.protVer, fc.type, fc.subType );
275
Jeff Johnson295189b2012-06-20 16:38:30 -0700276 // defer all message in scan state except for Beacons and Probe Response
277 if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_BEACON))
278 {
279 if (psessionEntry == NULL)
280 limProcessBeaconFrameNoSession(pMac, pRxPacketInfo);
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530281 else
Jeff Johnson295189b2012-06-20 16:38:30 -0700282 limProcessBeaconFrame(pMac, pRxPacketInfo,psessionEntry);
283 }
284 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_RSP))
285 {
286 if (psessionEntry == NULL)
287 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
288 else
289 limProcessProbeRspFrame(pMac, pRxPacketInfo,psessionEntry);
290 }
291 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_REQ))
292 {
293 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo, psessionEntry);
294 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700295 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_ACTION))
296 {
297 limProcessActionFrameNoSession( pMac, pRxPacketInfo);
298 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 else
300 {
301 *deferMsg = true;
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530302 return;
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 }
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530304
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
306 return;
307
308} /*** end limHandleFramesInScanState() ***/
309
310/** ------------------------------------------------------------
311\brief This function handles Unknown Unicast (A2 Index)
312\ packets.
313\param tpAniSirGlobal pMac Global Mac data structure
314\param void *pRxPacketInfo Pointer to Buffer Descriptor
315\return none
316\
317\ -------------------------------------------------------------- */
318static void limHandleUnknownA2IndexFrames(tpAniSirGlobal pMac, void *pRxPacketInfo,tpPESession psessionEntry)
319{
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530320 /* addr2 mismatch interrupt occurred this means previous
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 disassociation was not successful
322 In Volans pRxPacketInfo only contains pointer 48-bit address2 field */
323 /*Send disassociation message again*/
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530324 //Dinesh need one more arguement.
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 //limSendDisassocMgmtFrame(pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON,(tANI_U8 *) pRxPacketInfo);
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530326 //TODO: verify this
Jeff Johnson295189b2012-06-20 16:38:30 -0700327 //This could be a public action frame.
328 if( psessionEntry->limSystemRole == eLIM_P2P_DEVICE_ROLE )
329 limProcessActionFrameNoSession(pMac, (tANI_U8 *) pRxPacketInfo);
Mohit Khannac0b992f2012-12-04 15:08:18 -0800330
331#ifdef FEATURE_WLAN_TDLS
332 {
333 tpSirMacDataHdr3a pMacHdr;
334 pMacHdr = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
335
336 if (limIsGroupAddr(pMacHdr->addr2))
337 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700338 PELOG2(limLog(pMac, LOG2, FL("Ignoring A2 Invalid Packet received for MC/BC:"));
Mohit Khannac0b992f2012-12-04 15:08:18 -0800339 limPrintMacAddr(pMac, pMacHdr->addr2, LOG2);)
340
341 return;
342 }
343 /* TDLS_hklee: move down here to reject Addr2 == Group (first checking above)
344 and also checking if SystemRole == STA */
345 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
346 {
347 /* ADD handling of Public Action Frame */
348 LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700349 ("limHandleUnknownA2IndexFrames: type=0x%x, subtype=0x%x"),pMacHdr->fc.type, pMacHdr->fc.subType));
Mohit Khannac0b992f2012-12-04 15:08:18 -0800350 switch (pMacHdr->fc.type)
351 {
352 case SIR_MAC_MGMT_FRAME:
353 {
354 switch (pMacHdr->fc.subType)
355 {
356 case SIR_MAC_MGMT_ACTION:
357 {
358 limProcessActionFrame(pMac, pRxPacketInfo, psessionEntry) ;
359 break ;
360 }
361 default:
362 {
363 break ;
364 }
365 }
366 }
367 default:
368 {
369 break ;
370 }
371 }
372 }
373 }
374#endif
375
Jeff Johnson295189b2012-06-20 16:38:30 -0700376
377 return;
378}
379
Jeff Johnson295189b2012-06-20 16:38:30 -0700380/**
381 * limCheckMgmtRegisteredFrames()
382 *
383 *FUNCTION:
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530384 * This function is called to process to check if received frame match with
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 * any of the registered frame from HDD. If yes pass this frame to SME.
386 *
387 *LOGIC:
388 *
389 *ASSUMPTIONS:
390 *
391 *NOTE:
392 *
393 * @param pMac Pointer to Global MAC structure
394 * @param *pBd Pointer to the received Buffer Descriptor+payload
395 * @param *psessionEntry Pointer to session on which packet is received
396 * @return None
397 */
398static tANI_BOOLEAN
399limCheckMgmtRegisteredFrames(tpAniSirGlobal pMac, tANI_U8 *pBd,
400 tpPESession psessionEntry)
401{
402 tSirMacFrameCtl fc;
403 tpSirMacMgmtHdr pHdr;
404 tANI_U8 *pBody;
405 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
406 tANI_U16 frameType;
407 tANI_U16 framelen;
408 tANI_U8 type,subType;
409 tANI_BOOLEAN match = VOS_FALSE;
410 VOS_STATUS vosStatus;
411
412 pHdr = WDA_GET_RX_MAC_HEADER(pBd);
413 fc = pHdr->fc;
414 frameType = (fc.type << 2 ) | (fc.subType << 4);
415 pBody = WDA_GET_RX_MPDU_DATA(pBd);
416 framelen = WDA_GET_RX_PAYLOAD_LEN(pBd);
417
418 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
419 (vos_list_node_t**)&pLimMgmtRegistration);
420
421 while(pLimMgmtRegistration != NULL)
422 {
423 type = (pLimMgmtRegistration->frameType >> 2) & 0x03;
424 subType = (pLimMgmtRegistration->frameType >> 4) & 0x0f;
425 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
426 && (subType == SIR_MAC_MGMT_RESERVED15) )
427 {
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530428 limLog( pMac, LOG3,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700429 FL("rcvd frame match with SIR_MAC_MGMT_RESERVED15"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700430 match = VOS_TRUE;
431 break;
432 }
433
434 if (pLimMgmtRegistration->frameType == frameType)
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530435 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700436 if (pLimMgmtRegistration->matchLen > 0)
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530437 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700438 if (pLimMgmtRegistration->matchLen <= framelen)
439 {
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +0530440 if (vos_mem_compare(pLimMgmtRegistration->matchData,
Jeff Johnson295189b2012-06-20 16:38:30 -0700441 pBody, pLimMgmtRegistration->matchLen))
442 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700443 /* found match! */
444 match = VOS_TRUE;
445 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700446 }
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700447 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700448 }
449 else
450 {
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530451 /* found match! */
Jeff Johnson295189b2012-06-20 16:38:30 -0700452 match = VOS_TRUE;
453 break;
454 }
455 }
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530456
457 vosStatus =
458 vos_list_peek_next ( &pMac->lim.gLimMgmtFrameRegistratinQueue,
459 (vos_list_node_t*) pLimMgmtRegistration,
Jeff Johnson295189b2012-06-20 16:38:30 -0700460 (vos_list_node_t**) &pNext );
461 pLimMgmtRegistration = pNext;
462 pNext = NULL;
463 }
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530464
Jeff Johnson295189b2012-06-20 16:38:30 -0700465 if (match)
466 {
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530467 limLog( pMac, LOG1,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700468 FL("rcvd frame match with registered frame params"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700469
470 /* Indicate this to SME */
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530471 limSendSmeMgmtFrameInd( pMac, pHdr->fc.subType, (tANI_U8*)pHdr,
472 WDA_GET_RX_PAYLOAD_LEN(pBd) + sizeof(tSirMacMgmtHdr),
Jeff Johnson295189b2012-06-20 16:38:30 -0700473 pLimMgmtRegistration->sessionId,
Chilam NGde0b4112013-01-19 12:27:36 +0530474 WDA_GET_RX_CH(pBd), psessionEntry, 0);
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530475
Jeff Johnson295189b2012-06-20 16:38:30 -0700476 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
477 && (subType == SIR_MAC_MGMT_RESERVED15) )
478 {
479 // These packets needs to be processed by PE/SME as well as HDD.
480 // If it returns TRUE here, the packet is forwarded to HDD only.
481 match = VOS_FALSE;
482 }
483 }
484
485 return match;
486} /*** end limCheckMgmtRegisteredFrames() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700487
488
489/**
490 * limHandle80211Frames()
491 *
492 *FUNCTION:
493 * This function is called to process 802.11 frames
494 * received by LIM.
495 *
496 *LOGIC:
497 * NA
498 *
499 *ASSUMPTIONS:
500 * NA
501 *
502 *NOTE:
503 * NA
504 *
505 * @param pMac - Pointer to Global MAC structure
506 * @param pMsg of type tSirMsgQ - Pointer to the message structure
507 * @return None
508 */
509
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530510static void
Jeff Johnson295189b2012-06-20 16:38:30 -0700511limHandle80211Frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pDeferMsg)
512{
513 tANI_U8 *pRxPacketInfo = NULL;
514 tSirMacFrameCtl fc;
515 tpSirMacMgmtHdr pHdr=NULL;
516 tpPESession psessionEntry=NULL;
517 tANI_U8 sessionId;
518 tAniBool isFrmFt = FALSE;
519 tANI_U16 fcOffset = WLANHAL_RX_BD_HEADER_SIZE;
520
521 *pDeferMsg= false;
522 limGetBDfromRxPacket(pMac, limMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
523
524 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
525 isFrmFt = WDA_GET_RX_FT_DONE(pRxPacketInfo);
526 fcOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pRxPacketInfo);
527 fc = pHdr->fc;
528
Madan Mohan Koyyalamudif96ce952013-08-08 02:17:17 +0530529#ifdef WLAN_DUMP_MGMTFRAMES
530 limLog( pMac, LOGE, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
531 fc.protVer, fc.type, fc.subType,
532 WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
533 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, pHdr,
534 WDA_GET_RX_MPDU_HEADER_LEN(pRxPacketInfo));
535#endif
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530536
Varun Reddy Yeturu08614702013-04-15 21:58:13 -0700537#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
538 if ( WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
539 {
540 limLog( pMac, LOG2, FL("Notify SME with candidate ind"));
541 //send a session 0 for now - TBD
542 limSendSmeCandidateFoundInd(pMac, 0);
543 goto end;
544 }
545 if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo))
546 {
547 if (fc.subType == SIR_MAC_MGMT_BEACON)
548 {
549 limLog( pMac, LOG2, FL("Save this beacon in LFR cache"));
550 __limHandleBeacon(pMac, limMsg, NULL);
551 }
552 else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP)
553 {
554 limLog( pMac, LOG2, FL("Save this probe rsp in LFR cache"));
555 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
556 }
557 else
558 {
559 limLog( pMac, LOGE, FL("Wrong frame Type %d, Subtype %d for LFR"),
560 fc.type, fc.subType);
561 }
562 goto end;
563 }
564#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -0700565#ifdef FEATURE_WLAN_CCX
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530566 if (fc.type == SIR_MAC_DATA_FRAME && isFrmFt)
Jeff Johnson295189b2012-06-20 16:38:30 -0700567 {
568#if 0 // CCX TBD Need to PORT
569 tpSirMacDot3Hdr pDataFrmHdr;
570
571 pDataFrmHdr = (tpSirMacDot3Hdr)((tANI_U8 *)pBD+ WLANHAL_RX_BD_GET_MPDU_H_OFFSET(pBD));
572 if((psessionEntry = peFindSessionByBssid(pMac,pDataFrmHdr->sa,&sessionId))== NULL)
573 {
574 limLog( pMac, LOGE, FL("Session not found for Frm type %d, subtype %d, SA: "), fc.type, fc.subType);
575 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
576 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
577 return;
578 }
579
580 if (!psessionEntry->isCCXconnection)
581 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700582 limLog( pMac, LOGE, FL("LIM received Type %d, Subtype %d in Non CCX connection"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700583 fc.type, fc.subType);
584 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
585 return;
586 }
587 limLog( pMac, LOGE, FL("Processing IAPP Frm from SA:"));
588 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
589#else
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700590 printk("%s: Need to port handling of IAPP frames to PRIMA for CCX", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700591#endif
592
593
594 } else
595#endif
596 /* Added For BT-AMP Support */
597 if((psessionEntry = peFindSessionByBssid(pMac,pHdr->bssId,&sessionId))== NULL)
598 {
599#ifdef WLAN_FEATURE_VOWIFI_11R
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530600 if (fc.subType == SIR_MAC_MGMT_AUTH)
Jeff Johnson295189b2012-06-20 16:38:30 -0700601 {
602#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturu9163b672013-02-11 14:05:06 -0800603 limLog( pMac, LOG1, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700604 fc.protVer, fc.type, fc.subType, WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
Varun Reddy Yeturu9163b672013-02-11 14:05:06 -0800605 limPrintMacAddr(pMac, pHdr->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700606#endif
607 if (limProcessAuthFrameNoSession(pMac, pRxPacketInfo, limMsg->bodyptr) == eSIR_SUCCESS)
608 {
609 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
610 return;
611 }
612 }
613#endif
614 if((fc.subType != SIR_MAC_MGMT_PROBE_RSP )&&
615 (fc.subType != SIR_MAC_MGMT_BEACON)&&
616 (fc.subType != SIR_MAC_MGMT_PROBE_REQ)
Jeff Johnson295189b2012-06-20 16:38:30 -0700617 && (fc.subType != SIR_MAC_MGMT_ACTION ) //Public action frame can be received from non-associated stations.
Jeff Johnson295189b2012-06-20 16:38:30 -0700618 )
619 {
620
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530621 if((psessionEntry = peFindSessionByPeerSta(pMac,pHdr->sa,&sessionId))== NULL)
Jeff Johnson295189b2012-06-20 16:38:30 -0700622 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700623 limLog(pMac, LOG1, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700624 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
625 return;
626 }
Gopichand Nakkala035315f2013-03-20 23:32:50 +0530627 }
628 // For p2p resp frames search for valid session with DA as
629 // BSSID will be SA and session will be present with DA only
630 if(fc.subType == SIR_MAC_MGMT_ACTION )
631 {
632 psessionEntry = peFindSessionByBssid(pMac,pHdr->da,&sessionId);
633 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700634 }
635
636
Jeff Johnson295189b2012-06-20 16:38:30 -0700637 /* Check if frame is registered by HDD */
638 if(limCheckMgmtRegisteredFrames(pMac, pRxPacketInfo, psessionEntry))
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530639 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700640 limLog( pMac, LOG1, FL("Received frame is passed to SME"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700641 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
642 return;
643 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700644
645
Jeff Johnson295189b2012-06-20 16:38:30 -0700646
647 if (fc.protVer != SIR_MAC_PROTOCOL_VERSION)
648 { // Received Frame with non-zero Protocol Version
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700649 limLog(pMac, LOGE, FL("Unexpected frame with protVersion %d received"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700650 fc.protVer);
651 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530652#ifdef WLAN_DEBUG
Jeff Johnson295189b2012-06-20 16:38:30 -0700653 pMac->lim.numProtErr++;
654#endif
655 return;
656 }
657
Gopichand Nakkalae0078ce2013-06-11 17:49:16 +0530658 if (!pMac->fScanOffload)
Jeff Johnson295189b2012-06-20 16:38:30 -0700659 {
Gopichand Nakkalae0078ce2013-06-11 17:49:16 +0530660 if (limIsSystemInScanState(pMac))
661 {
662 limHandleFramesInScanState(pMac, limMsg, pRxPacketInfo, pDeferMsg, psessionEntry);
663 return;
664 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 }
666
667/* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */
668
669#if 0
670 if (psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE) {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700671 limLog( pMac, LOGW, FL( "gLimSystemRole is %d. Exiting..." ),psessionEntry->limSystemRole );
Jeff Johnson295189b2012-06-20 16:38:30 -0700672 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
673
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530674#ifdef WLAN_DEBUG
Jeff Johnson295189b2012-06-20 16:38:30 -0700675 pMac->lim.numProtErr++;
676#endif
677 return;
678 }
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530679 #endif //HACK to continue scanning
Jeff Johnson295189b2012-06-20 16:38:30 -0700680
681
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530682#ifdef WLAN_DEBUG
Jeff Johnson295189b2012-06-20 16:38:30 -0700683 pMac->lim.numMAC[fc.type][fc.subType]++;
684#endif
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530685
Jeff Johnson295189b2012-06-20 16:38:30 -0700686 switch (fc.type)
687 {
688 case SIR_MAC_MGMT_FRAME:
689 {
690 #if 0 //TBD-RAJESH fix this
691 if (limIsReassocInProgress( pMac,psessionEntry) && (fc.subType != SIR_MAC_MGMT_DISASSOC) &&
692 (fc.subType != SIR_MAC_MGMT_DEAUTH) && (fc.subType != SIR_MAC_MGMT_REASSOC_RSP))
693 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700694 limLog(pMac, LOGE, FL("Frame with Type - %d, Subtype - %d received in ReAssoc Wait state, dropping..."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700695 fc.type, fc.subType);
696 return;
697 }
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530698 #endif //HACK to continue scanning
Jeff Johnson295189b2012-06-20 16:38:30 -0700699 // Received Management frame
700 switch (fc.subType)
701 {
702 case SIR_MAC_MGMT_ASSOC_REQ:
703 // Make sure the role supports Association
704 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700705 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700706 )
707 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_ASSOC, psessionEntry);
708
709 else
710 {
711 // Unwanted messages - Log error
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700712 limLog(pMac, LOGE, FL("unexpected message received %X"),limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700713 limPrintMsgName(pMac, LOGE, limMsg->type);
714 }
715 break;
716
717 case SIR_MAC_MGMT_ASSOC_RSP:
718 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_ASSOC,psessionEntry);
719 break;
720
721 case SIR_MAC_MGMT_REASSOC_REQ:
722 // Make sure the role supports Reassociation
723 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700724 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700725 ){
726 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_REASSOC, psessionEntry);
727 }
728 else
729 {
730 // Unwanted messages - Log error
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700731 limLog(pMac, LOGE, FL("unexpected message received %X"),limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700732 limPrintMsgName(pMac, LOGE, limMsg->type);
733 }
734 break;
735
736 case SIR_MAC_MGMT_REASSOC_RSP:
737 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_REASSOC,psessionEntry);
738 break;
739
740 case SIR_MAC_MGMT_PROBE_REQ:
741 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo,psessionEntry);
742 break;
743
744 case SIR_MAC_MGMT_PROBE_RSP:
745 if(psessionEntry == NULL)
746 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
747 else
748 limProcessProbeRspFrame(pMac, pRxPacketInfo, psessionEntry);
749 break;
750
751 case SIR_MAC_MGMT_BEACON:
752 __limHandleBeacon(pMac, limMsg,psessionEntry);
753 break;
754
755 case SIR_MAC_MGMT_DISASSOC:
756 limProcessDisassocFrame(pMac, pRxPacketInfo,psessionEntry);
757 break;
758
759 case SIR_MAC_MGMT_AUTH:
760 limProcessAuthFrame(pMac, pRxPacketInfo,psessionEntry);
761 break;
762
763 case SIR_MAC_MGMT_DEAUTH:
764 limProcessDeauthFrame(pMac, pRxPacketInfo,psessionEntry);
765 break;
766
767 case SIR_MAC_MGMT_ACTION:
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 if(psessionEntry == NULL)
769 limProcessActionFrameNoSession(pMac, pRxPacketInfo);
770 else
771 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700772 if (WDA_GET_RX_UNKNOWN_UCAST(pRxPacketInfo))
773 limHandleUnknownA2IndexFrames(pMac, pRxPacketInfo,psessionEntry);
774 else
775 limProcessActionFrame(pMac, pRxPacketInfo,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700776 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700777 break;
778 default:
779 // Received Management frame of 'reserved' subtype
780 break;
781 } // switch (fc.subType)
782
783 }
784 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700785 case SIR_MAC_DATA_FRAME:
786 {
Mohit Khannac0b992f2012-12-04 15:08:18 -0800787#ifdef FEATURE_WLAN_TDLS_INTERNAL
788 /*
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530789 * if we reach here, following cases are possible.
Mohit Khannac0b992f2012-12-04 15:08:18 -0800790 * Possible cases: a) if frame translation is disabled.
791 * b) Some frame with ADRR2 filter enabled may come
792 * here.
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530793 */
Mohit Khannac0b992f2012-12-04 15:08:18 -0800794 tANI_U8 *dataOffset = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
795 tANI_U8 *rfc1042Hdr = (tANI_U8 *)(dataOffset + RFC1042_HDR_LENGTH) ;
796 tANI_U16 ethType = GET_BE16(rfc1042Hdr) ;
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530797 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700798 ("TDLS frame with 80211 Header")) ;
Mohit Khannac0b992f2012-12-04 15:08:18 -0800799 if(ETH_TYPE_89_0d == ethType)
800 {
801 tANI_U8 payloadType = (rfc1042Hdr + ETH_TYPE_LEN)[0] ;
802 if(PAYLOAD_TYPE_TDLS == payloadType)
803 {
804 limProcessTdlsFrame(pMac, (tANI_U32*)pRxPacketInfo) ;
805 }
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530806 }
Mohit Khannac0b992f2012-12-04 15:08:18 -0800807#endif
808#ifdef FEATURE_WLAN_CCX
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 /* We accept data frame (IAPP frame) only if Session is
810 * present and ccx connection is established on that
811 * session
812 */
813 if (psessionEntry && psessionEntry->isCCXconnection) {
814 limProcessIappFrame(pMac, pRxPacketInfo, psessionEntry);
815 }
Mohit Khannac0b992f2012-12-04 15:08:18 -0800816#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 }
818 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700819 default:
820 // Received frame of type 'reserved'
821 break;
822
823 } // switch (fc.type)
824
Varun Reddy Yeturu08614702013-04-15 21:58:13 -0700825#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
826end:
827#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700828 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr) ;
829 return;
830} /*** end limHandle80211Frames() ***/
831
Gopichand Nakkalafb348fe2013-06-13 14:47:55 +0530832/**
833 * limSendStopScanOffloadReq()
834 *
835 *FUNCTION:
836 * This function will be called to abort the ongoing offloaded scan
837 * request.
838 *
839 *
840 *NOTE:
841 *
842 * @param pMac Pointer to Global MAC structure
843 * @return eHAL_STATUS_SUCCESS or eHAL_STATUS_FAILURE
844 */
Madan Mohan Koyyalamudi78f17402013-06-13 14:47:55 +0530845eHalStatus limSendStopScanOffloadReq(tpAniSirGlobal pMac, tANI_U8 SessionId)
Gopichand Nakkalafb348fe2013-06-13 14:47:55 +0530846{
847 tSirMsgQ msg;
848 tSirRetStatus rc = eSIR_SUCCESS;
Madan Mohan Koyyalamudi78f17402013-06-13 14:47:55 +0530849 tAbortScanParams *pAbortScanParams;
Gopichand Nakkalafb348fe2013-06-13 14:47:55 +0530850
Madan Mohan Koyyalamudi78f17402013-06-13 14:47:55 +0530851 if (eHAL_STATUS_SUCCESS != palAllocateMemory(pMac->hHdd,
852 (void**) &pAbortScanParams,
853 sizeof(tAbortScanParams)))
854 {
855 limLog(pMac, LOGP, FL("Memory allocation failed for AbortScanParams"));
856 return eHAL_STATUS_FAILURE;
857 }
858
859 pAbortScanParams->SessionId = SessionId;
Gopichand Nakkalafb348fe2013-06-13 14:47:55 +0530860 msg.type = WDA_STOP_SCAN_OFFLOAD_REQ;
Madan Mohan Koyyalamudi78f17402013-06-13 14:47:55 +0530861 msg.bodyptr = pAbortScanParams;
Gopichand Nakkalafb348fe2013-06-13 14:47:55 +0530862 msg.bodyval = 0;
863
864 rc = wdaPostCtrlMsg(pMac, &msg);
865 if (rc != eSIR_SUCCESS)
866 {
867 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"),
868 pMac);
Madan Mohan Koyyalamudi78f17402013-06-13 14:47:55 +0530869 palFreeMemory(pMac->hHdd, (tANI_U8 *)pAbortScanParams);
Gopichand Nakkalafb348fe2013-06-13 14:47:55 +0530870 return eHAL_STATUS_FAILURE;
871 }
872
873 return eHAL_STATUS_SUCCESS;
874
875}
Jeff Johnson295189b2012-06-20 16:38:30 -0700876
877/**
878 * limProcessAbortScanInd()
879 *
880 *FUNCTION:
881 * This function is called from HDD to abort the scan which is presently being run
882 *
883 *
884 *NOTE:
885 *
886 * @param pMac Pointer to Global MAC structure
887 * @param *pMsgBuf A pointer to the SME message buffer
888 * @return None
889 */
890void
Madan Mohan Koyyalamudi78f17402013-06-13 14:47:55 +0530891limProcessAbortScanInd(tpAniSirGlobal pMac, tANI_U8 SessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -0700892{
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530893#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
Jeff Johnson295189b2012-06-20 16:38:30 -0700894 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT, NULL, 0, 0);
895#endif //FEATURE_WLAN_DIAG_SUPPORT
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530896
Jeff Johnson295189b2012-06-20 16:38:30 -0700897 /* Deactivate the gLimBackgroundScanTimer as part of the abort scan.
Gopichand Nakkala68d0c882013-06-27 19:38:43 +0530898 * SME should send WNI_CFG_BACKGROUND_SCAN_PERIOD indication
Jeff Johnson295189b2012-06-20 16:38:30 -0700899 * to start the background scan again
900 */
Madan Mohan Koyyalamudi8b7f1e62012-10-05 14:56:51 -0700901 PELOG2(limLog(pMac, LOG2, FL("Processing AbortScan Ind"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700902
903 limAbortBackgroundScan(pMac);
904
Gopichand Nakkalafb348fe2013-06-13 14:47:55 +0530905 if (pMac->fScanOffload)
Jeff Johnson295189b2012-06-20 16:38:30 -0700906 {
Gopichand Nakkalafb348fe2013-06-13 14:47:55 +0530907 /* send stop scan cmd to fw if scan offload is enabled. */
Madan Mohan Koyyalamudi78f17402013-06-13 14:47:55 +0530908 limSendStopScanOffloadReq(pMac, SessionId);
Gopichand Nakkalafb348fe2013-06-13 14:47:55 +0530909 }
910 else
911 {
912 /* Abort the scan if its running, else just return */
913 if(limIsSystemInScanState(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -0700914 {
Gopichand Nakkalafb348fe2013-06-13 14:47:55 +0530915 if( (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
916 (eLIM_HAL_START_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
917 (eLIM_HAL_END_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
918 (eLIM_HAL_FINISH_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
919 {
920 //Simply signal we need to abort
921 limLog( pMac, LOGW, FL(" waiting for HAL, simply signal abort gLimHalScanState = %d"), pMac->lim.gLimHalScanState );
922 pMac->lim.abortScan = 1;
923 }
924 else
925 {
926 //Force abort
927 limLog( pMac, LOGW, FL(" Force aborting scan") );
928 pMac->lim.abortScan = 0;
929 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
930 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
931 //Set the resume channel to Any valid channel (invalid).
932 //This will instruct HAL to set it to any previous valid channel.
933 peSetResumeChannel(pMac, 0, 0);
934 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
935 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700936 }
937 }
938 return;
939}
940
941/**
942 * limMessageProcessor
943 *
944 *FUNCTION:
945 * Wrapper function for limProcessMessages when handling messages received by LIM.
946 * Could either defer messages or process them.
947 * @param pMac Pointer to Global MAC structure
948 * @param limMsg Received LIM message
949 * @return None
950 */
951
952void limMessageProcessor(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
953{
954 if (eLIM_MLM_OFFLINE_STATE == pMac->lim.gLimMlmState)
955 {
956 peFreeMsg(pMac, limMsg);
957 return;
958 }
959
960 if (!defMsgDecision(pMac, limMsg))
961 {
962 limProcessMessages(pMac, limMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700963 // process deferred message queue if allowed
964 {
965 if ( (! (pMac->lim.gLimAddtsSent))
966 &&
967 (! (limIsSystemInScanState(pMac)))
968 )
969 {
970 if (true == GET_LIM_PROCESS_DEFD_MESGS(pMac))
971 limProcessDeferredMessageQueue(pMac);
972 }
973 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700974 }
975}
976
Jeff Johnsone7245742012-09-05 17:12:55 -0700977#ifdef FEATURE_OEM_DATA_SUPPORT
978
979void limOemDataRspHandleResumeLinkRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* mlmOemDataRsp)
980{
981 if(status != eHAL_STATUS_SUCCESS)
982 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700983 limLog(pMac, LOGE, FL("OEM Data Rsp failed to get the response for resume link"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700984 }
985
986 if(NULL != pMac->lim.gpLimMlmOemDataReq)
987 {
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +0530988 vos_mem_free(pMac->lim.gpLimMlmOemDataReq);
Jeff Johnsone7245742012-09-05 17:12:55 -0700989 pMac->lim.gpLimMlmOemDataReq = NULL;
990 }
991
992 //"Failure" status doesn't mean that Oem Data Rsp did not happen
993 //and hence we need to respond to upper layers. Only Resume link is failed, but
994 //we got the oem data response already.
995 //Post the meessage to MLM
996 limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)(mlmOemDataRsp));
997
998 return;
999}
1000
1001void limProcessOemDataRsp(tpAniSirGlobal pMac, tANI_U32* body)
1002{
Jeff Johnsone7245742012-09-05 17:12:55 -07001003 tpLimMlmOemDataRsp mlmOemDataRsp = NULL;
1004 tpStartOemDataRsp oemDataRsp = NULL;
1005
1006 //Process all the messages for the lim queue
1007 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1008
1009 oemDataRsp = (tpStartOemDataRsp)(body);
1010
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301011 mlmOemDataRsp = vos_mem_malloc(sizeof(tLimMlmOemDataRsp));
1012 if ( NULL == mlmOemDataRsp )
Jeff Johnsone7245742012-09-05 17:12:55 -07001013 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001014 limLog(pMac, LOGP, FL("could not allocate memory for mlmOemDataRsp"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001015 return;
1016 }
1017
1018 //copy the memory into tLimMlmOemDataRsp and free the tStartOemDataRsp
1019 //the structures tStartOemDataRsp and tLimMlmOemDataRsp have the same structure
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301020 vos_mem_copy((void*)(mlmOemDataRsp), (void*)(oemDataRsp),
1021 sizeof(tLimMlmOemDataRsp));
Jeff Johnsone7245742012-09-05 17:12:55 -07001022
1023 //Now free the incoming memory
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301024 vos_mem_free(oemDataRsp);
Jeff Johnsone7245742012-09-05 17:12:55 -07001025
1026 limResumeLink(pMac, limOemDataRspHandleResumeLinkRsp, (tANI_U32*)mlmOemDataRsp);
1027
1028 return;
1029}
1030
1031#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001032
1033
1034/**
1035 * limProcessMessages
1036 *
1037 *FUNCTION:
1038 * This function is called by limProcessMessageQueue function. This
1039 * function processes messages received by LIM.
1040 *
1041 *LOGIC:
1042 * Depending on the message type, corresponding function will be
1043 * called, for example limProcessSmeMessages() will be called to
1044 * process SME messages received from HDD/Upper layer software module.
1045 *
1046 *ASSUMPTIONS:
1047 * NA
1048 *
1049 *NOTE:
1050 * NA
1051 *
1052 * @param pMac Pointer to Global MAC structure
1053 * @param limMsg Received LIM message
1054 * @return None
1055 */
1056
1057void
1058limProcessMessages(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1059{
1060 tANI_U8 deferMsg = false;
1061 tLinkStateParams *linkStateParams;
1062#if defined WLAN_FEATURE_VOWIFI_11R
1063 tpPESession pSession;
1064#endif
1065#if defined(ANI_DVT_DEBUG)
1066 tSirMsgQ msgQ;
1067#endif
1068 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1069 {
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301070 vos_mem_free(limMsg->bodyptr);
Jeff Johnsone7245742012-09-05 17:12:55 -07001071 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001072 return;
1073 }
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301074#ifdef WLAN_DEBUG
Jeff Johnson295189b2012-06-20 16:38:30 -07001075 pMac->lim.numTot++;
1076#endif
1077
1078
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001079 PELOG3(limLog(pMac, LOG3, FL("rcvd msgType = %s, sme state = %s, mlm state = %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001080 limMsgStr(limMsg->type), limSmeStateStr(pMac->lim.gLimSmeState),
1081 limMlmStateStr(pMac->lim.gLimMlmState));)
1082
Jeff Johnsone7245742012-09-05 17:12:55 -07001083 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001084
1085 switch (limMsg->type)
1086 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001087
1088 case SIR_LIM_UPDATE_BEACON:
1089 limUpdateBeacon(pMac);
1090 break;
1091
Jeff Johnson295189b2012-06-20 16:38:30 -07001092 case SIR_CFG_PARAM_UPDATE_IND:
1093 /// CFG parameter updated
1094 if (limIsSystemInScanState(pMac))
1095 {
1096 // System is in DFS (Learn) mode
1097 // Defer processsing this message
1098 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1099 {
Leela Venkata Kiran Kumar Reddy Chirala240845a2013-03-22 19:21:10 -07001100 if(!(pMac->lim.deferredMsgCnt & 0xF))
1101 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001102 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)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001103 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1104 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
Leela Venkata Kiran Kumar Reddy Chirala240845a2013-03-22 19:21:10 -07001105 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001106 limLogSessionStates(pMac);
1107 limPrintMsgName(pMac, LOGE, limMsg->type);
1108 }
1109 }
1110 else
1111 {
1112 limHandleCFGparamUpdate(pMac, limMsg->bodyval);
1113 }
1114
1115 break;
1116
1117 case WDA_INIT_SCAN_RSP:
1118 limProcessInitScanRsp(pMac, limMsg->bodyptr);
1119 break;
1120
1121 case WDA_START_SCAN_RSP:
1122 limProcessStartScanRsp(pMac, limMsg->bodyptr);
1123 break;
1124
1125 case WDA_END_SCAN_RSP:
1126 limProcessEndScanRsp(pMac, limMsg->bodyptr);
1127 break;
1128
1129 case WDA_FINISH_SCAN_RSP:
1130 limProcessFinishScanRsp(pMac, limMsg->bodyptr);
1131 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001132#ifdef FEATURE_OEM_DATA_SUPPORT
1133 case WDA_START_OEM_DATA_RSP:
1134 limProcessOemDataRsp(pMac, limMsg->bodyptr);
1135 break;
1136#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001137
1138 case WDA_SWITCH_CHANNEL_RSP:
1139 limProcessSwitchChannelRsp(pMac, limMsg->bodyptr);
1140 break;
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301141
Jeff Johnson295189b2012-06-20 16:38:30 -07001142#ifdef ANI_SIR_IBSS_PEER_CACHING
1143 case WDA_IBSS_STA_ADD:
1144 limIbssStaAdd(pMac, limMsg->bodyptr);
1145 break;
1146#endif
1147 case SIR_BB_XPORT_MGMT_MSG:
1148 // These messages are from Peer MAC entity.
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301149#ifdef WLAN_DEBUG
Jeff Johnson295189b2012-06-20 16:38:30 -07001150 pMac->lim.numBbt++;
1151#endif
1152
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 {
1154 v_U16_t pktLen = 0;
1155 vos_pkt_t *pVosPkt;
1156 VOS_STATUS vosStatus;
1157 tSirMsgQ limMsgNew;
Mohit Khannac0b992f2012-12-04 15:08:18 -08001158#ifdef FEATURE_WLAN_TDLS_INTERNAL
1159 tANI_U32 *pBD = NULL ;
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301160#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001161
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301162 /* The original limMsg which we were deferring have the
Jeff Johnson295189b2012-06-20 16:38:30 -07001163 * bodyPointer point to 'BD' instead of 'Vos pkt'. If we don't make a copy
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301164 * of limMsg, then vos_pkt_peek_data will overwrite the limMsg->bodyPointer.
1165 * and next time when we try to process the msg, we will try to use 'BD' as
Jeff Johnson295189b2012-06-20 16:38:30 -07001166 * 'Vos Pkt' which will cause a crash
1167 */
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301168 vos_mem_copy((tANI_U8*)&limMsgNew, (tANI_U8*)limMsg,
1169 sizeof(tSirMsgQ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001170 pVosPkt = (vos_pkt_t *)limMsgNew.bodyptr;
1171 vos_pkt_get_packet_length(pVosPkt, &pktLen);
1172
1173 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&limMsgNew.bodyptr, VOS_FALSE );
1174
1175 if( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1176 {
1177 vos_pkt_return_packet(pVosPkt);
1178 break;
1179
1180 }
Mohit Khannac0b992f2012-12-04 15:08:18 -08001181#ifdef FEATURE_WLAN_TDLS_INTERNAL
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301182 /*
Mohit Khannac0b992f2012-12-04 15:08:18 -08001183 * TDLS frames comes as translated frames as well as
1184 * MAC 802.11 data frames..
1185 */
1186 limGetBDfromRxPacket(pMac, limMsgNew.bodyptr, &pBD);
1187 if(0 != WDA_GET_RX_FT_DONE(pBD))
1188 {
1189 /*
1190 * TODO: check for scanning state and set deferMesg flag
1191 * accordingly..
1192 */
1193 deferMsg = false ;
1194
1195 limProcessTdlsFrame(pMac, pBD) ;
1196 }
1197 else
1198#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001199 limHandle80211Frames(pMac, &limMsgNew, &deferMsg);
1200
1201 if ( deferMsg == true )
1202 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001203 PELOG1(limLog(pMac, LOG1, FL("Defer message type=%X "), limMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001204 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1205 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001206 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)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001207 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1208 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1209 limLogSessionStates(pMac);
1210 limPrintMsgName(pMac, LOGE, limMsg->type);
1211 vos_pkt_return_packet(pVosPkt);
1212 }
1213 }
1214 else
1215 {
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301216 /* PE is not deferring this 802.11 frame so we need to call vos_pkt_return.
Jeff Johnson295189b2012-06-20 16:38:30 -07001217 * Asumption here is when Rx mgmt frame processing is done,
1218 * voss packet could be freed here.
1219 */
1220 vos_pkt_return_packet(pVosPkt);
1221 }
1222 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001223 break;
1224
1225 case eWNI_SME_SCAN_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001226 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001227 case eWNI_SME_DISASSOC_REQ:
1228 case eWNI_SME_DEAUTH_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001229 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
Jeff Johnsone7245742012-09-05 17:12:55 -07001230#ifdef FEATURE_OEM_DATA_SUPPORT
1231 case eWNI_SME_OEM_DATA_REQ:
1232#endif
Mohit Khannac0b992f2012-12-04 15:08:18 -08001233#ifdef FEATURE_WLAN_TDLS
1234 case eWNI_SME_TDLS_SEND_MGMT_REQ:
1235 case eWNI_SME_TDLS_ADD_STA_REQ:
1236 case eWNI_SME_TDLS_DEL_STA_REQ:
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05301237 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
Mohit Khannac0b992f2012-12-04 15:08:18 -08001238#endif
1239#ifdef FEATURE_WLAN_TDLS_INTERNAL
1240 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
1241 case eWNI_SME_TDLS_LINK_START_REQ:
1242 case eWNI_SME_TDLS_TEARDOWN_REQ:
1243#endif
Gopichand Nakkala2b248b02013-03-07 17:05:07 +05301244 case eWNI_SME_RESET_AP_CAPS_CHANGED:
Jeff Johnson295189b2012-06-20 16:38:30 -07001245 // These messages are from HDD
1246 limProcessNormalHddMsg(pMac, limMsg, true); //need to response to hdd
1247 break;
1248
1249 case eWNI_SME_SCAN_ABORT_IND:
Madan Mohan Koyyalamudi78f17402013-06-13 14:47:55 +05301250 {
1251 tANI_U8 *pSessionId = (tANI_U8 *)limMsg->bodyptr;
1252 limProcessAbortScanInd(pMac, *pSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001253 vos_mem_free((v_VOID_t *)limMsg->bodyptr);
1254 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001255 break;
Madan Mohan Koyyalamudi78f17402013-06-13 14:47:55 +05301256 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001257 case eWNI_SME_START_REQ:
1258 case eWNI_SME_SYS_READY_IND:
1259#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1260 case eWNI_SME_JOIN_REQ:
1261#endif
1262 case eWNI_SME_AUTH_REQ:
1263 case eWNI_SME_REASSOC_REQ:
1264 case eWNI_SME_START_BSS_REQ:
1265 case eWNI_SME_STOP_BSS_REQ:
1266 case eWNI_SME_SWITCH_CHL_REQ:
1267 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
1268 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
1269 case eWNI_SME_SETCONTEXT_REQ:
1270 case eWNI_SME_REMOVEKEY_REQ:
1271#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1272 case eWNI_SME_PROMISCUOUS_MODE_REQ:
1273#endif
1274 case eWNI_SME_DISASSOC_CNF:
1275 case eWNI_SME_DEAUTH_CNF:
1276 case eWNI_SME_ASSOC_CNF:
1277 case eWNI_SME_REASSOC_CNF:
1278 case eWNI_SME_ADDTS_REQ:
1279 case eWNI_SME_DELTS_REQ:
1280 case eWNI_SME_DEL_BA_PEER_IND:
1281 case eWNI_SME_SET_TX_POWER_REQ:
1282 case eWNI_SME_GET_TX_POWER_REQ:
1283 case eWNI_SME_GET_NOISE_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001284 case eWNI_SME_GET_ASSOC_STAS_REQ:
1285 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
1286 case eWNI_SME_UPDATE_APWPSIE_REQ:
1287 case eWNI_SME_HIDE_SSID_REQ:
1288 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
1289 case eWNI_SME_SET_APWPARSNIEs_REQ:
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08001290 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
Jeff Johnson295189b2012-06-20 16:38:30 -07001291#if defined WLAN_FEATURE_VOWIFI
1292 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1293 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
1294#endif
1295#if defined FEATURE_WLAN_CCX
1296 case eWNI_SME_CCX_ADJACENT_AP_REPORT:
1297#endif
1298#ifdef WLAN_FEATURE_VOWIFI_11R
1299 case eWNI_SME_FT_UPDATE_KEY:
1300 case eWNI_SME_FT_PRE_AUTH_REQ:
1301 case eWNI_SME_FT_AGGR_QOS_REQ:
1302#endif
1303 case eWNI_SME_ADD_STA_SELF_REQ:
1304 case eWNI_SME_DEL_STA_SELF_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001305 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
1306 case eWNI_SME_UPDATE_NOA:
Gopichand Nakkala431db382013-05-30 19:53:39 +05301307 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
Madan Mohan Koyyalamudia51e4842013-07-05 21:13:10 +05301308 case eWNI_SME_STA_STAT_REQ:
1309 case eWNI_SME_AGGR_STAT_REQ:
1310 case eWNI_SME_GLOBAL_STAT_REQ:
1311 case eWNI_SME_STAT_SUMM_REQ:
1312 case eWNI_SME_GET_STATISTICS_REQ:
1313#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
1314 case eWNI_SME_GET_ROAM_RSSI_REQ:
1315#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001316 // These messages are from HDD
1317 limProcessNormalHddMsg(pMac, limMsg, false); //no need to response to hdd
1318 break;
1319
1320 //Power Save Messages From HDD
1321 case eWNI_PMC_PWR_SAVE_CFG:
1322 case eWNI_PMC_ENTER_BMPS_REQ:
1323 case eWNI_PMC_EXIT_BMPS_REQ:
1324 case eWNI_PMC_ENTER_IMPS_REQ:
1325 case eWNI_PMC_EXIT_IMPS_REQ:
1326 case eWNI_PMC_ENTER_UAPSD_REQ:
1327 case eWNI_PMC_EXIT_UAPSD_REQ:
1328 case eWNI_PMC_ENTER_WOWL_REQ:
1329 case eWNI_PMC_EXIT_WOWL_REQ:
1330 case eWNI_PMC_WOWL_ADD_BCAST_PTRN:
1331 case eWNI_PMC_WOWL_DEL_BCAST_PTRN:
1332 pmmProcessMessage(pMac, limMsg);
1333 break;
1334
1335 case eWNI_PMC_SMPS_STATE_IND :
1336 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001337 if(limMsg->bodyptr){
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301338 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001339 limMsg->bodyptr = NULL;
1340 }
1341 }
1342 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 case eWNI_SME_SEND_ACTION_FRAME_IND:
1344 limSendP2PActionFrame(pMac, limMsg);
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301345 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001346 limMsg->bodyptr = NULL;
1347 break;
1348 case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
1349 limAbortRemainOnChan(pMac);
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301350 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001351 limMsg->bodyptr = NULL;
1352 break;
1353
Viral Modi9dc288a2012-12-10 13:09:21 -08001354 case SIR_HAL_P2P_NOA_START_IND:
1355 {
1356 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1357 tANI_U8 i;
Viral Modid871f222013-03-06 02:25:31 -08001358 tANI_U8 p2pGOExists = 0;
Gopichand Nakkala271463a2013-05-13 16:39:49 +05301359
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001360 limLog(pMac, LOG1, "LIM received NOA start %x", limMsg->type);
Viral Modid871f222013-03-06 02:25:31 -08001361
1362 /* Since insert NOA is done and NOA start msg received, we should deactivate the Insert NOA timer */
1363 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
1364
Viral Modi9dc288a2012-12-10 13:09:21 -08001365 for(i=0; i < pMac->lim.maxBssId; i++)
1366 {
1367 psessionEntry = &pMac->lim.gpSession[i];
1368 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
1369 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1370 { //Save P2P NOA start attributes for P2P Go persona
Viral Modid871f222013-03-06 02:25:31 -08001371 p2pGOExists = 1;
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301372 vos_mem_copy(&psessionEntry->p2pGoPsNoaStartInd, limMsg->bodyptr,
1373 sizeof(tSirP2PNoaStart));
Viral Modid871f222013-03-06 02:25:31 -08001374 if (psessionEntry->p2pGoPsNoaStartInd.status != eHAL_STATUS_SUCCESS)
Viral Modi9dc288a2012-12-10 13:09:21 -08001375 {
Viral Modid871f222013-03-06 02:25:31 -08001376 limLog(pMac, LOGW, FL("GO NOA start failure status %d reported by FW."
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001377 " - still go ahead with deferred sme req. This is just info"),
Viral Modid871f222013-03-06 02:25:31 -08001378 psessionEntry->p2pGoPsNoaStartInd.status);
Viral Modi9dc288a2012-12-10 13:09:21 -08001379 }
Viral Modi9dc288a2012-12-10 13:09:21 -08001380 break;
1381 }
1382 }
Viral Modid871f222013-03-06 02:25:31 -08001383
1384 if (p2pGOExists == 0)
1385 {
1386 limLog(pMac, LOGW, FL("By the time, we received NOA start, GO is already removed."
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001387 " - still go ahead with deferred sme req. This is just info"));
Viral Modid871f222013-03-06 02:25:31 -08001388 }
1389
1390 /* We received the NOA start indication. Now we can send down the SME request which requires off-channel operation */
1391 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301392 vos_mem_free(limMsg->bodyptr);
Viral Modi9dc288a2012-12-10 13:09:21 -08001393 limMsg->bodyptr = NULL;
Viral Modid871f222013-03-06 02:25:31 -08001394 }
Viral Modi9dc288a2012-12-10 13:09:21 -08001395 break;
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05301396#ifdef FEATURE_WLAN_TDLS
1397 case SIR_HAL_TDLS_IND:
1398 {
1399 tSirTdlsInd *pTdlsInd = (tpSirTdlsInd)limMsg->bodyptr ;
1400 tpDphHashNode pStaDs = NULL ;
1401 tpPESession psessionEntry = NULL;
1402 tANI_U8 sessionId;
1403 if((psessionEntry = peFindSessionByStaId(pMac,pTdlsInd->staIdx,&sessionId))== NULL)
1404 {
1405 limLog(pMac, LOG1, FL("session does not exist for given bssId\n"));
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301406 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05301407 limMsg->bodyptr = NULL;
1408 return;
1409 }
1410 if ((pStaDs = dphGetHashEntry(pMac, pTdlsInd->assocId, &psessionEntry->dph.dphHashTable)) == NULL)
1411 {
1412 limLog(pMac, LOG1, FL("pStaDs Does not exist for given staId\n"));
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301413 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05301414 limMsg->bodyptr = NULL;
1415 return;
1416 }
Viral Modi9dc288a2012-12-10 13:09:21 -08001417
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05301418 if ((STA_ENTRY_TDLS_PEER == pStaDs->staType))
1419 {
1420 limLog(pMac, LOGE,
1421 FL("received TDLS Indication from the Firmware with Reason Code %d "),
1422 pTdlsInd->reasonCode);
1423 limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry,
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301424 pTdlsInd->reasonCode);
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05301425 }
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301426 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05301427 limMsg->bodyptr = NULL;
1428 }
1429 break;
1430#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001431 case SIR_HAL_P2P_NOA_ATTR_IND:
1432 {
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301433 tpPESession psessionEntry = &pMac->lim.gpSession[0];
Jeff Johnson295189b2012-06-20 16:38:30 -07001434 tANI_U8 i;
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301435
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001436 limLog(pMac, LOGW, FL("Received message Noa_ATTR %x"), limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001437 for(i=0; i < pMac->lim.maxBssId; i++)
1438 {
Viral Modi9dc288a2012-12-10 13:09:21 -08001439 psessionEntry = &pMac->lim.gpSession[i];
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301440 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001441 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1442 { //Save P2P attributes for P2P Go persona
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301443
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301444 vos_mem_copy(&psessionEntry->p2pGoPsUpdate, limMsg->bodyptr,
1445 sizeof(tSirP2PNoaAttr));
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301446
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001447 limLog(pMac, LOG2, FL(" &psessionEntry->bssId%02x:%02x:%02x:%02x:%02x:%02x ctWin=%d oppPsFlag=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001448 psessionEntry->bssId[0],
1449 psessionEntry->bssId[1],
1450 psessionEntry->bssId[2],
1451 psessionEntry->bssId[3],
1452 psessionEntry->bssId[4],
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301453 psessionEntry->bssId[5],
Jeff Johnson295189b2012-06-20 16:38:30 -07001454 psessionEntry->p2pGoPsUpdate.ctWin,
1455 psessionEntry->p2pGoPsUpdate.oppPsFlag);
1456
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001457 limLog(pMac, LOG2, FL(" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt,
1459 psessionEntry->p2pGoPsUpdate.uNoa1Duration,
1460 psessionEntry->p2pGoPsUpdate.uNoa1Interval,
1461 psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
1462
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301463
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 break;
1465 }
1466 }
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301467
Jeff Johnson295189b2012-06-20 16:38:30 -07001468 }
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301469 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001470 limMsg->bodyptr = NULL;
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301471
Jeff Johnson295189b2012-06-20 16:38:30 -07001472 break;
1473
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301474
Jeff Johnson295189b2012-06-20 16:38:30 -07001475 /* eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER Message comes after the
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301476 * device comes out of full power for the full power request sent
1477 * because of channel switch with switch count as 0, so call the same
1478 * function used in timeout case(i.e SIR_LIM_CHANNEL_SWITCH_TIMEOUT)
Jeff Johnson295189b2012-06-20 16:38:30 -07001479 * for switching the channel*/
1480 case eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER:
Jeff Johnsone7245742012-09-05 17:12:55 -07001481 if ( !tx_timer_running(&pMac->lim.limTimers.gLimChannelSwitchTimer) )
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301482 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001483 limProcessChannelSwitchTimeout(pMac);
1484 }
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301485 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001486 limMsg->bodyptr = NULL;
1487 break;
1488
1489 //Power Save Related Messages From HAL
1490 case WDA_ENTER_BMPS_RSP:
1491 case WDA_EXIT_BMPS_RSP:
1492 case WDA_EXIT_BMPS_IND:
1493 case WDA_ENTER_IMPS_RSP:
1494 case WDA_EXIT_IMPS_RSP:
1495 case WDA_ENTER_UAPSD_RSP:
1496 case WDA_EXIT_UAPSD_RSP:
1497 case WDA_WOWL_ENTER_RSP:
1498 case WDA_WOWL_EXIT_RSP:
1499 pmmProcessMessage(pMac, limMsg);
1500 break;
1501
1502 case WDA_LOW_RSSI_IND:
1503 //limHandleLowRssiInd(pMac);
1504 break;
1505
1506 case WDA_BMPS_STATUS_IND:
1507 limHandleBmpsStatusInd(pMac);
1508 break;
1509
1510 case WDA_MISSED_BEACON_IND:
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001511 limHandleMissedBeaconInd(pMac, limMsg);
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301512 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001513 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001514 break;
1515 case WDA_MIC_FAILURE_IND:
1516 limMicFailureInd(pMac, limMsg);
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301517 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001518 limMsg->bodyptr = NULL;
1519 break;
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301520
Jeff Johnson295189b2012-06-20 16:38:30 -07001521
Jeff Johnson295189b2012-06-20 16:38:30 -07001522
1523 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1524 limProcessSmeReqMessages(pMac,limMsg);
1525 break;
1526#ifdef FEATURE_WLAN_CCX
1527 case SIR_LIM_CCX_TSM_TIMEOUT:
1528 limProcessTsmTimeoutHandler(pMac,limMsg);
1529 break;
1530 case WDA_TSM_STATS_RSP:
1531 limProcessHalCcxTsmRsp(pMac, limMsg);
1532 break;
1533#endif
1534 case WDA_ADD_TS_RSP:
1535 limProcessHalAddTsRsp(pMac, limMsg);
1536 break;
1537
1538 case SIR_LIM_DEL_TS_IND:
1539 limProcessDelTsInd(pMac, limMsg);
Madan Mohan Koyyalamudif244d8f2012-11-29 11:21:05 -08001540 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001541 case SIR_LIM_ADD_BA_IND:
1542 limProcessAddBaInd(pMac, limMsg);
1543 break;
1544 case SIR_LIM_DEL_BA_ALL_IND:
Kiran Kumar Lokereb3c42b62013-05-29 14:29:43 -07001545 limDelAllBASessions(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001546 break;
1547 case SIR_LIM_DEL_BA_IND:
1548 limProcessMlmHalBADeleteInd( pMac, limMsg );
1549 break;
1550
1551 case SIR_LIM_BEACON_GEN_IND: {
Jeff Johnson295189b2012-06-20 16:38:30 -07001552
Jeff Johnson295189b2012-06-20 16:38:30 -07001553 if( pMac->lim.gLimSystemRole != eLIM_AP_ROLE )
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301554 schProcessPreBeaconInd(pMac, limMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001555
1556 }
1557 break;
1558
1559 case SIR_LIM_DELETE_STA_CONTEXT_IND:
1560 limDeleteStaContext(pMac, limMsg);
1561 break;
1562
1563 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1564 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1565 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1566 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001567 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001568 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1569 case SIR_LIM_AUTH_RSP_TIMEOUT:
1570 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1571 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1572#ifdef WLAN_FEATURE_VOWIFI_11R
1573 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
1574#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001575 case SIR_LIM_REMAIN_CHN_TIMEOUT:
Viral Modi9dc288a2012-12-10 13:09:21 -08001576 case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT:
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001577 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
1578 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
Gopichand Nakkala59a7b432013-05-10 02:50:47 +05301579 case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
Jeff Johnson295189b2012-06-20 16:38:30 -07001580 // These timeout messages are handled by MLM sub module
1581
1582 limProcessMlmReqMessages(pMac,
1583 limMsg);
1584
1585 break;
1586
1587 case SIR_LIM_HEART_BEAT_TIMEOUT:
1588 /** check if heart beat failed, even if one Beacon
1589 * is rcvd within the Heart Beat interval continue
1590 * normal processing
1591 */
1592
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301593 #if 0
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001594 PELOG1(limLog(pMac, LOG1, FL("Heartbeat timeout, SME %d, MLME %d, #bcn %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001595 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1596 pMac->lim.gLimRxedBeaconCntDuringHB);)
1597
1598 if(pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)
1599 limIbssHeartBeatHandle(pMac); //HeartBeat for peers.
1600 else
1601 /**
1602 * Heartbeat failure occurred on STA
1603 * This is handled by LMM sub module.
1604 */
1605 limHandleHeartBeatFailure(pMac);
1606
1607 break;
1608 #endif //TO SUPPORT BT-AMP
Yathishd8713192012-12-10 14:21:35 -08001609 if (limIsSystemInScanState(pMac))
1610 {
1611 // System is in DFS (Learn) mode
1612 // Defer processsing this message
1613 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1614 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001615 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)"),
Yathishd8713192012-12-10 14:21:35 -08001616 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1617 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1618 limLogSessionStates(pMac);
1619 }
1620 }
1621 else
1622 {
Gopichand Nakkala271463a2013-05-13 16:39:49 +05301623#if defined(FEATURE_WLAN_TDLS) && defined(FEATURE_WLAN_TDLS_OXYGEN_DISAPPEAR_AP)
1624 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1625 for (i=0; i < pMac->lim.maxBssId; i++)
1626 {
1627 psessionEntry = &pMac->lim.gpSession[i];
1628 if ((psessionEntry != NULL) && (psessionEntry->valid) &&
1629 ((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) ||
1630 (psessionEntry->pePersona == VOS_STA_MODE)))
1631 {
1632 if ((TRUE == pMac->lim.gLimTDLSOxygenSupport) &&
1633 (limGetTDLSPeerCount(pMac, psessionEntry) != 0)) {
1634 if (limMsg->bodyptr) {
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05301635 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala271463a2013-05-13 16:39:49 +05301636 limMsg->bodyptr = NULL;
1637 }
1638 return;
1639 }
1640 }
1641 }
1642#endif
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001643 if (NULL == limMsg->bodyptr)
1644 {
1645 limHandleHeartBeatTimeout(pMac);
1646 }
1647 else
1648 {
1649 limHandleHeartBeatTimeoutForSession(pMac, (tpPESession)limMsg->bodyptr);
1650 }
Gopichand Nakkala271463a2013-05-13 16:39:49 +05301651 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001652 break;
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001653
Jeff Johnson295189b2012-06-20 16:38:30 -07001654 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301655 limHandleHeartBeatFailureTimeout(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001656 break;
1657
1658 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001659 /**
1660 * Background scan timeout occurred on STA.
1661 * This is handled by LMM sub module.
1662 */
1663 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
1664
1665 //We will do background scan even in bcnps mode
1666 //if (pMac->sys.gSysEnableScanMode)
1667 pMac->lim.gLimReportBackgroundScanResults = FALSE;
1668 limTriggerBackgroundScan(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 break;
1670
Jeff Johnson295189b2012-06-20 16:38:30 -07001671
1672 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1673
1674 /*
1675 ** clear the credit to the send disassociate frame bucket
1676 **/
1677
1678 pMac->lim.gLimDisassocFrameCredit = 0;
1679 break;
1680
1681 case SIR_LIM_CNF_WAIT_TIMEOUT:
1682
1683 /*
1684 ** Does not receive CNF or dummy packet
1685 **/
1686 limHandleCnfWaitTimeout(pMac, (tANI_U16) limMsg->bodyval);
1687
1688 break;
1689
1690 case SIR_LIM_KEEPALIVE_TIMEOUT:
1691 limSendKeepAliveToPeer(pMac);
1692
1693 break;
1694
1695 case SIR_LIM_RETRY_INTERRUPT_MSG:
1696 // Message from ISR upon TFP's max retry limit interrupt
1697
1698 break;
1699
1700 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
1701 // Message from ISR upon SP's Invalid session key interrupt
1702
1703 break;
1704
1705 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
1706 // Message from ISR upon SP's Invalid key ID interrupt
1707
1708 break;
1709
1710 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
1711 // Message from ISR upon SP's Replay threshold interrupt
1712
1713 break;
1714
1715 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
1716 limProcessChannelSwitchTimeout(pMac);
1717 break;
1718
1719 case SIR_LIM_QUIET_TIMEOUT:
1720 limProcessQuietTimeout(pMac);
1721 break;
1722
1723 case SIR_LIM_QUIET_BSS_TIMEOUT:
1724 limProcessQuietBssTimeout(pMac);
1725 break;
1726
Jeff Johnson295189b2012-06-20 16:38:30 -07001727 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
1728 limHandleUpdateOlbcCache(pMac);
1729 break;
1730#if 0
1731 case SIR_LIM_WPS_OVERLAP_TIMEOUT:
1732 limProcessWPSOverlapTimeout(pMac);
1733 break;
1734#endif
1735
Jeff Johnson295189b2012-06-20 16:38:30 -07001736
Mohit Khannac0b992f2012-12-04 15:08:18 -08001737#ifdef FEATURE_WLAN_TDLS_INTERNAL
1738 /*
1739 * Here discovery timer expires, now we can go ahead and collect all
1740 * the dicovery responses PE has process till now and send this
1741 * responses to SME..
1742 */
1743 case SIR_LIM_TDLS_DISCOVERY_RSP_WAIT:
1744 {
1745 //fetch the sessionEntry based on the sessionId
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301746 tpPESession psessionEntry = peFindSessionBySessionId(pMac,
Mohit Khannac0b992f2012-12-04 15:08:18 -08001747 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId) ;
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301748 if(NULL == psessionEntry)
Mohit Khannac0b992f2012-12-04 15:08:18 -08001749 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001750 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID %d"), pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId);
Mohit Khannac0b992f2012-12-04 15:08:18 -08001751 return;
1752 }
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301753
1754 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001755 ("Discovery Rsp timer expires ")) ;
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301756#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
Mohit Khannac0b992f2012-12-04 15:08:18 -08001757 /* restore RXP filters */
1758 limSetLinkState(pMac, eSIR_LINK_FINISH_TDLS_DISCOVERY_STATE,
1759 psessionEntry->bssId) ;
1760#endif
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301761 limSendSmeTdlsDisRsp(pMac, eSIR_SUCCESS,
Mohit Khannac0b992f2012-12-04 15:08:18 -08001762 eWNI_SME_TDLS_DISCOVERY_START_RSP) ;
1763 break ;
1764 }
1765
1766 /*
1767 * we initiated link setup and did not receive TDLS setup rsp
1768 * from TDLS peer STA, send failure RSP to SME.
1769 */
1770 case SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT:
1771 {
1772 tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
1773 tLimTdlsLinkSetupPeer *setupPeer = NULL ;
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301774
Mohit Khannac0b992f2012-12-04 15:08:18 -08001775 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001776 ("TDLS setup rsp timer expires ")) ;
Mohit Khannac0b992f2012-12-04 15:08:18 -08001777 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001778 ("TDLS setup rsp timer expires for peer:")) ;
Mohit Khannac0b992f2012-12-04 15:08:18 -08001779 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001780 ("%02X, %02X, %02X,%02X, %02X, %02X"),
Mohit Khannac0b992f2012-12-04 15:08:18 -08001781 peerMac[0],
1782 peerMac[1],
1783 peerMac[2],
1784 peerMac[3],
1785 peerMac[4],
1786 peerMac[5]);
1787
1788 limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
1789 if(NULL != setupPeer)
1790 {
1791 limTdlsDelLinkPeer( pMac, peerMac) ;
1792 }
1793
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301794 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, peerMac,
Mohit Khannac0b992f2012-12-04 15:08:18 -08001795 eWNI_SME_TDLS_LINK_START_RSP) ;
1796 break ;
1797 }
1798 case SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT:
1799 {
1800 tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
1801 tLimTdlsLinkSetupPeer *setupPeer = NULL ;
1802
1803 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001804 ("TDLS setup CNF timer expires ")) ;
Mohit Khannac0b992f2012-12-04 15:08:18 -08001805 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001806 ("TDLS setup CNF timer expires for peer:")) ;
Mohit Khannac0b992f2012-12-04 15:08:18 -08001807 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001808 ("%02X, %02X, %02X,%02X, %02X, %02X"),
Mohit Khannac0b992f2012-12-04 15:08:18 -08001809 peerMac[0],
1810 peerMac[1],
1811 peerMac[2],
1812 peerMac[3],
1813 peerMac[4],
1814 peerMac[5]);
1815 limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
1816 if(NULL != setupPeer)
1817 {
1818 limTdlsDelLinkPeer( pMac, peerMac) ;
1819 }
1820 break ;
1821 }
1822#endif /* FEATURE_WLAN_TDLS TIMER */
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 case WDA_ADD_BSS_RSP:
1824 limProcessMlmAddBssRsp( pMac, limMsg );
1825 break;
1826
1827 case WDA_ADD_STA_RSP:
1828
1829 //call a wrapper by paasing bodyptr, their get sessionID and and call proper function from there.
1830 limProcessAddStaRsp(pMac,limMsg);
1831 break;
1832
1833 case WDA_DELETE_STA_RSP:
1834 limProcessMlmDelStaRsp(pMac, limMsg);
1835 break;
1836
1837 case WDA_ADD_STA_SELF_RSP:
1838 limProcessAddStaSelfRsp(pMac, limMsg);
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301839 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001840 case WDA_DEL_STA_SELF_RSP:
1841 limProcessDelStaSelfRsp(pMac, limMsg);
1842 break;
1843
1844 case WDA_DELETE_BSS_RSP:
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301845 limHandleDeleteBssRsp(pMac,limMsg); //wrapper routine to handle delete bss response
Jeff Johnson295189b2012-06-20 16:38:30 -07001846 break;
1847
1848 case WDA_SET_BSSKEY_RSP:
1849 case WDA_SET_STA_BCASTKEY_RSP:
1850 limProcessMlmSetBssKeyRsp( pMac, limMsg );
1851 break;
1852 case WDA_SET_STAKEY_RSP:
1853 limProcessMlmSetStaKeyRsp( pMac, limMsg );
1854 break;
1855 case WDA_REMOVE_BSSKEY_RSP:
1856 case WDA_REMOVE_STAKEY_RSP:
1857 limProcessMlmRemoveKeyRsp( pMac, limMsg );
1858 break;
1859 case WDA_ADDBA_RSP:
1860 limProcessMlmHalAddBARsp( pMac, limMsg );
1861 break;
1862
1863 case WDA_STA_STAT_RSP:
1864 case WDA_AGGR_STAT_RSP:
1865 case WDA_GLOBAL_STAT_RSP:
1866 case WDA_STAT_SUMM_RSP:
1867 limSendSmeStatsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1868 break;
1869
1870 case WDA_GET_STATISTICS_RSP:
1871 limSendSmePEStatisticsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1872 break;
Srinivas Girigowda2471d832013-01-25 13:33:11 -08001873#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
1874 case WDA_GET_ROAM_RSSI_RSP:
1875 limSendSmePEGetRoamRssiRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1876 break;
1877#endif
1878
Jeff Johnson295189b2012-06-20 16:38:30 -07001879
1880 case WDA_SET_MIMOPS_RSP: //limProcessSetMimoRsp(pMac, limMsg);
1881 case WDA_SET_TX_POWER_RSP: //limProcessSetTxPowerRsp(pMac, limMsg);
1882 case WDA_GET_TX_POWER_RSP: //limProcessGetTxPowerRsp(pMac, limMsg);
1883 case WDA_GET_NOISE_RSP:
1884 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
1885 limMsg->bodyptr = NULL;
1886 //limProcessGetNoiseRsp(pMac, limMsg);
1887 break;
1888
1889 case WDA_SET_MAX_TX_POWER_RSP:
1890#if defined WLAN_FEATURE_VOWIFI
1891 rrmSetMaxTxPowerRsp( pMac, limMsg );
1892#endif
1893 if(limMsg->bodyptr != NULL)
1894 {
1895 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
1896 limMsg->bodyptr = NULL;
1897 }
1898 break;
1899
Jeff Johnson295189b2012-06-20 16:38:30 -07001900 case SIR_LIM_ADDR2_MISS_IND:
1901 {
1902 limLog(pMac, LOGE,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001903 FL("Addr2 mismatch interrupt received %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001904 limMsg->type);
1905 /*a message from HAL indicating addr2 mismatch interrupt occurred
1906 limMsg->bodyptr contains only pointer to 48-bit addr2 field*/
1907 //Dinesh fix this. the third parameter should be sessionentry.
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301908 //limHandleUnknownA2IndexFrames(pMac, (void *)limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001909
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301910 /*Free message body pointer*/
Jeff Johnson295189b2012-06-20 16:38:30 -07001911 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
1912 break;
1913 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001914
1915#ifdef WLAN_FEATURE_VOWIFI_11R
1916 case WDA_AGGR_QOS_RSP:
1917 limProcessFTAggrQoSRsp( pMac, limMsg );
1918 break;
1919#endif
1920
1921 case WDA_SET_LINK_STATE_RSP:
1922 linkStateParams = (tLinkStateParams *)limMsg->bodyptr;
1923#if defined WLAN_FEATURE_VOWIFI_11R
1924 pSession = linkStateParams->session;
1925 if(linkStateParams->ft)
1926 {
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301927 limSendReassocReqWithFTIEsMgmtFrame(pMac,
Jeff Johnson295189b2012-06-20 16:38:30 -07001928 pSession->pLimMlmReassocReq,
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301929 pSession);
Jeff Johnson295189b2012-06-20 16:38:30 -07001930 }
1931#endif
1932 if( linkStateParams->callback )
1933 {
1934 linkStateParams->callback( pMac, linkStateParams->callbackArg );
1935 }
1936 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
1937 break;
1938
1939#ifdef WLAN_FEATURE_PACKET_FILTERING
1940 case WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
1941 pmmProcessMessage(pMac, limMsg);
1942 break;
1943#endif // WLAN_FEATURE_PACKET_FILTERING
1944
1945#ifdef WLAN_FEATURE_GTK_OFFLOAD
1946 case WDA_GTK_OFFLOAD_GETINFO_RSP:
1947 pmmProcessMessage(pMac, limMsg);
1948 break;
1949#endif // WLAN_FEATURE_GTK_OFFLOAD
Yathishd8713192012-12-10 14:21:35 -08001950 case eWNI_SME_SET_BCN_FILTER_REQ:
1951 {
1952#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1953 tpPESession psessionEntry;
1954 tANI_U8 sessionId = (tANI_U8)limMsg->bodyval ;
1955 psessionEntry = &pMac->lim.gpSession[sessionId];
1956 if(psessionEntry != NULL && IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1957 {
1958 // sending beacon filtering information down to HAL
1959 if (limSendBeaconFilterInfo(pMac, psessionEntry) != eSIR_SUCCESS)
1960 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001961 limLog(pMac, LOGE, FL("Fail to send Beacon Filter Info "));
Yathishd8713192012-12-10 14:21:35 -08001962 }
1963 }
Dhanashri Atre612af852013-03-29 11:19:05 -07001964 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
1965 limMsg->bodyptr = NULL;
Yathishd8713192012-12-10 14:21:35 -08001966#endif
1967 }
1968 break;
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05301969#ifdef FEATURE_WLAN_TDLS
1970 case WDA_SET_TDLS_LINK_ESTABLISH_REQ_RSP:
1971 {
Gopichand Nakkala7cbfc802013-07-02 16:47:12 +05301972 tpPESession psessionEntry;
1973 tANI_U8 sessionId;
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301974 tTdlsLinkEstablishParams *pTdlsLinkEstablishParams;
1975 pTdlsLinkEstablishParams = (tTdlsLinkEstablishParams*) limMsg->bodyptr;
Gopichand Nakkala7cbfc802013-07-02 16:47:12 +05301976
1977 if((psessionEntry = peFindSessionByStaId(pMac,
1978 pTdlsLinkEstablishParams->staIdx,
1979 &sessionId))== NULL)
1980 {
1981 limLog(pMac, LOGE, FL("session %u does not exist.\n"), sessionId);
1982 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP message to SME
1983 with session id as zero and status as FAILURE so, that message
1984 queued in SME queue can be freed to prevent the SME cmd buffer leak */
1985 limSendSmeTdlsLinkEstablishReqRsp(pMac,
1986 0,
1987 NULL,
1988 NULL,
1989 eSIR_FAILURE);
1990 }
1991 else
1992 {
1993 limSendSmeTdlsLinkEstablishReqRsp(pMac,
1994 psessionEntry->smeSessionId,
1995 NULL,
1996 NULL,
1997 pTdlsLinkEstablishParams->status) ;
1998 }
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05301999 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2000 limMsg->bodyptr = NULL;
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05302001 break;
2002 }
2003#endif
Gopichand Nakkalae0078ce2013-06-11 17:49:16 +05302004
2005 case WDA_RX_SCAN_EVENT:
2006 limProcessRxScanEvent(pMac, limMsg->bodyptr);
2007 break;
2008
Ravi Joshi96d77342013-07-23 08:37:49 -07002009 case WDA_IBSS_PEER_INACTIVITY_IND:
2010 {
2011 limProcessIbssPeerInactivity(pMac, limMsg->bodyptr);
2012 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2013 limMsg->bodyptr = NULL;
2014 break;
2015 }
2016
Jeff Johnson295189b2012-06-20 16:38:30 -07002017 default:
2018 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2019 limMsg->bodyptr = NULL;
2020 // Unwanted messages
2021 // Log error
2022 limLog(pMac, LOGE,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002023 FL("Discarding unexpected message received %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002024 limMsg->type);
2025 limPrintMsgName(pMac, LOGE, limMsg->type);
2026 break;
2027
2028 } // switch (limMsg->type)
2029
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002030 PELOG2(limLog(pMac, LOG2, FL("Done Processing msgType = %d, sme state = %s, mlm state = %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002031 limMsg->type, limSmeStateStr(pMac->lim.gLimSmeState),
2032 limMlmStateStr(pMac->lim.gLimMlmState));)
2033
2034} /*** end limProcessMessages() ***/
2035
2036
2037
2038/**
2039 * limProcessDeferredMessageQueue
2040 *
2041 *FUNCTION:
2042 * This function is called by LIM while exiting from Learn
2043 * mode. This function fetches messages posted to the LIM
2044 * deferred message queue limDeferredMsgQ.
2045 *
2046 *LOGIC:
2047 *
2048 *ASSUMPTIONS:
2049 * NA
2050 *
2051 *NOTE:
2052 * NA
2053 *
2054 * @param pMac - Pointer to Global MAC structure
2055 * @return None
2056 */
2057
2058void
2059limProcessDeferredMessageQueue(tpAniSirGlobal pMac)
2060{
2061 tSirMsgQ limMsg = { 0, 0, 0 };
2062
Jeff Johnson295189b2012-06-20 16:38:30 -07002063 tSirMsgQ *readMsg;
2064 tANI_U16 size;
2065
2066 /*
2067 ** check any deferred messages need to be processed
2068 **/
2069 size = pMac->lim.gLimDeferredMsgQ.size;
2070 if (size > 0)
2071 {
2072 while ((readMsg = limReadDeferredMsgQ(pMac)) != NULL)
2073 {
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05302074 vos_mem_copy((tANI_U8*) &limMsg,
Jeff Johnson295189b2012-06-20 16:38:30 -07002075 (tANI_U8*) readMsg, sizeof(tSirMsgQ));
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05302076 size--;
Jeff Johnson295189b2012-06-20 16:38:30 -07002077 limProcessMessages(pMac, &limMsg);
2078
2079 if((limIsSystemInScanState(pMac)) || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) ||
2080 (pMac->lim.gLimSystemInScanLearnMode))
2081 break;
2082 }
2083 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002084} /*** end limProcessDeferredMessageQueue() ***/
2085
2086
2087/*
2088 * limProcessNormalHddMsg
2089 * Function: this function checks the current lim state and decide whether the message passed shall be deffered.
2090 * @param pMac - Pointer to Global MAC structure
2091 * pLimMsg -- the message need to be processed
2092 * fRspReqd -- whether return result to hdd
2093 * @return None
2094 */
2095void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd)
2096{
2097 tANI_BOOLEAN fDeferMsg = eANI_BOOLEAN_TRUE;
2098
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05302099 /* Added For BT-AMP Support */
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 if ((pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_AP_ROLE )
2101 ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_STA_ROLE)
2102 ||(pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE))
2103 {
2104 /** This check is required only for the AP and in 2 cases.
2105 * 1. If we are in learn mode and we receive any of these messages,
2106 * you have to come out of scan and process the message, hence dont
2107 * defer the message here. In handler, these message could be defered
2108 * till we actually come out of scan mode.
2109 * 2. If radar is detected, you might have to defer all of these
2110 * messages except Stop BSS request/ Switch channel request. This
2111 * decision is also made inside its handler.
2112 *
2113 * Please be careful while using the flag fDeferMsg. Possibly you
2114 * might end up in an infinite loop.
2115 **/
2116 if (((pLimMsg->type == eWNI_SME_START_BSS_REQ) ||
2117 (pLimMsg->type == eWNI_SME_STOP_BSS_REQ) ||
2118 (pLimMsg->type == eWNI_SME_SWITCH_CHL_REQ) ||
2119 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ) ||
2120 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ)))
2121 {
2122 fDeferMsg = eANI_BOOLEAN_FALSE;
2123 }
2124 }
2125
2126 /* limInsystemInscanState() refers the psessionEntry, how to get session Entry????*/
Jeff Johnsone7245742012-09-05 17:12:55 -07002127 if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) /*||
2128 (LIM_IS_RADAR_DETECTED(pMac))*/) && fDeferMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002129 {
2130 // System is in DFS (Learn) mode or awaiting addts response
2131 // or if radar is detected, Defer processsing this message
2132 if (limDeferMsg(pMac, pLimMsg) != TX_SUCCESS)
2133 {
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05302134#ifdef WLAN_DEBUG
Jeff Johnson295189b2012-06-20 16:38:30 -07002135 pMac->lim.numSme++;
2136#endif
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002137 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)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002138 pLimMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
2139 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
2140 limLogSessionStates(pMac);
2141 limPrintMsgName(pMac, LOGE, pLimMsg->type);
2142 // Release body
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05302143 vos_mem_free(pLimMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 }
2145 }
2146 else
2147 {
2148 if(fRspReqd)
2149 {
2150 // These messages are from HDD
2151 // Since these requests may also be generated
2152 // internally within LIM module, need to
2153 // distinquish and send response to host
2154 pMac->lim.gLimRspReqd = eANI_BOOLEAN_TRUE;
2155 }
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05302156#ifdef WLAN_DEBUG
Jeff Johnson295189b2012-06-20 16:38:30 -07002157 pMac->lim.numSme++;
2158#endif
2159 if(limProcessSmeReqMessages(pMac, pLimMsg))
2160 {
2161 // Release body
2162 // limProcessSmeReqMessage consumed the buffer. We can free it.
Bansidhar Gopalachari45bc5d32013-07-11 10:24:30 +05302163 vos_mem_free(pLimMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002164 }
2165 }
2166}
2167
2168void
Jeff Johnsone7245742012-09-05 17:12:55 -07002169handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002170{
2171 tSirMacHTCapabilityInfo macHTCapabilityInfo;
2172 tSirMacHTParametersInfo macHTParametersInfo;
2173 tSirMacHTInfoField1 macHTInfoField1;
2174 tSirMacHTInfoField2 macHTInfoField2;
2175 tSirMacHTInfoField3 macHTInfoField3;
2176 tANI_U32 cfgValue;
2177 tANI_U8 *ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002178
Jeff Johnson295189b2012-06-20 16:38:30 -07002179 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) != eSIR_SUCCESS)
2180 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002181 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002182 return ;
2183 }
2184 ptr = (tANI_U8 *) &macHTCapabilityInfo;
2185 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2186 pMac->lim.gHTLsigTXOPProtection = (tANI_U8)macHTCapabilityInfo.lsigTXOPProtection;
2187 pMac->lim.gHTMIMOPSState = (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
2188 pMac->lim.gHTGreenfield = (tANI_U8)macHTCapabilityInfo.greenField;
2189 pMac->lim.gHTMaxAmsduLength = (tANI_U8)macHTCapabilityInfo.maximalAMSDUsize;
2190 pMac->lim.gHTShortGI20Mhz = (tANI_U8)macHTCapabilityInfo.shortGI20MHz;
2191 pMac->lim.gHTShortGI40Mhz = (tANI_U8)macHTCapabilityInfo.shortGI40MHz;
Jeff Johnson295189b2012-06-20 16:38:30 -07002192 pMac->lim.gHTPSMPSupport = (tANI_U8)macHTCapabilityInfo.psmp;
2193 pMac->lim.gHTDsssCckRate40MHzSupport = (tANI_U8)macHTCapabilityInfo.dsssCckMode40MHz;
2194
2195 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) != eSIR_SUCCESS)
2196 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002197 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002198 return ;
2199 }
2200 ptr = (tANI_U8 *) &macHTParametersInfo;
2201 *ptr = (tANI_U8) (cfgValue & 0xff);
2202 pMac->lim.gHTAMpduDensity = (tANI_U8)macHTParametersInfo.mpduDensity;
2203 pMac->lim.gHTMaxRxAMpduFactor = (tANI_U8)macHTParametersInfo.maxRxAMPDUFactor;
2204
2205 // Get HT IE Info
2206 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) != eSIR_SUCCESS)
2207 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002208 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002209 return ;
2210 }
2211 ptr = (tANI_U8 *) &macHTInfoField1;
2212 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
2213 pMac->lim.gHTServiceIntervalGranularity = (tANI_U8)macHTInfoField1.serviceIntervalGranularity;
2214 pMac->lim.gHTControlledAccessOnly = (tANI_U8)macHTInfoField1.controlledAccessOnly;
2215 pMac->lim.gHTRifsMode = (tANI_U8)macHTInfoField1.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002216
2217 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) != eSIR_SUCCESS)
2218 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002219 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 return ;
2221 }
2222 ptr = (tANI_U8 *) &macHTInfoField2;
2223 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2224 pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
2225
2226 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) != eSIR_SUCCESS)
2227 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002228 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002229 return ;
2230 }
2231 ptr = (tANI_U8 *) &macHTInfoField3;
2232 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2233 pMac->lim.gHTPCOActive = (tANI_U8)macHTInfoField3.pcoActive;
2234 pMac->lim.gHTPCOPhase = (tANI_U8)macHTInfoField3.pcoPhase;
Jeff Johnson295189b2012-06-20 16:38:30 -07002235 pMac->lim.gHTSecondaryBeacon = (tANI_U8)macHTInfoField3.secondaryBeacon;
2236 pMac->lim.gHTDualCTSProtection = (tANI_U8)macHTInfoField3.dualCTSProtection;
2237 pMac->lim.gHTSTBCBasicMCS = (tANI_U8)macHTInfoField3.basicSTBCMCS;
Jeff Johnsone7245742012-09-05 17:12:55 -07002238
2239 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2240 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
2241 * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
2242 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2243 */
2244 if (psessionEntry != NULL)
2245 {
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05302246 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
Jeff Johnsone7245742012-09-05 17:12:55 -07002247 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
2248 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002249}
2250
2251void limLogSessionStates(tpAniSirGlobal pMac)
2252{
2253#ifdef WLAN_DEBUG
2254 int i;
2255
2256 for(i = 0; i < pMac->lim.maxBssId; i++)
2257 {
2258 if(pMac->lim.gpSession[i].valid)
2259 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07002260 PELOG1(limLog(pMac, LOG1, FL("Session[%d] sysRole(%d) limSmeState %d (prev sme state %d) mlm state %d (prev mlm state %d)"),
Gopichand Nakkala68d0c882013-06-27 19:38:43 +05302261 i, pMac->lim.gpSession[i].limSystemRole, pMac->lim.gpSession[i].limSmeState,
2262 pMac->lim.gpSession[i].limPrevSmeState, pMac->lim.gpSession[i].limMlmState,
Jeff Johnson295189b2012-06-20 16:38:30 -07002263 pMac->lim.gpSession[i].limPrevMlmState);)
2264 }
2265 }
2266#endif //ifdef WLAN_DEBUG
2267}