blob: 0a8082fa929373366e9bf974d34fe54c03cc2b5f [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kiet Lam842dad02014-02-18 18:44:02 -08002 * Copyright (c) 2012-2013 The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21
22/*
Kiet Lama7f454d2014-07-24 12:04:06 -070023 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
Kiet Lamaa8e15a2014-02-11 23:30:06 -080026 */
Kiet Lam842dad02014-02-18 18:44:02 -080027
28
Kiet Lama7f454d2014-07-24 12:04:06 -070029
30
Jeff Johnson295189b2012-06-20 16:38:30 -070031/*
Jeff Johnson295189b2012-06-20 16:38:30 -070032 * This file lim ProcessMessageQueue.cc contains the code
33 * for processing LIM message Queue.
34 * Author: Chandra Modumudi
35 * Date: 02/11/02
36 * History:-
37 * Date Modified by Modification Information
38 * --------------------------------------------------------------------
39 *
40 */
41#include "palTypes.h"
42#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070043#include "wlan_qct_wdi_ds.h"
44#include "wlan_qct_pal_packet.h"
45#include "wlan_qct_wda.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070046
Jeff Johnson295189b2012-06-20 16:38:30 -070047#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070048#include "cfgApi.h"
49#include "sirCommon.h"
50#include "utilsApi.h"
51#include "limTypes.h"
52#include "limUtils.h"
53#include "limAssocUtils.h"
54#include "limPropExtsUtils.h"
55
56#include "limAdmitControl.h"
57#include "pmmApi.h"
58#include "limIbssPeerMgmt.h"
59#include "schApi.h"
60#include "limSession.h"
Yathish9f22e662012-12-10 14:21:35 -080061#include "limSendMessages.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070062
63#if defined WLAN_FEATURE_VOWIFI
64#include "rrmApi.h"
65#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -080066#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
67#include "eseApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070068#endif
69
70#if defined WLAN_FEATURE_VOWIFI_11R
71#include "limFT.h"
72#endif
73
74#ifdef WMM_APSD
75#include "wmmApsd.h"
76#endif
77
Jeff Johnson295189b2012-06-20 16:38:30 -070078#include "vos_types.h"
79#include "vos_packet.h"
80#include "vos_memory.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070081
Katya Nigam3802f202013-12-16 19:27:14 +053082/* This value corresponds to 500 ms */
83#define MAX_PROBEREQ_TIME 5000
84
Dino Mycle7a76e662014-06-10 11:36:34 +053085#ifdef WLAN_FEATURE_EXTSCAN
86#define SIZE_OF_FIXED_PARAM 12
87#endif
88
Jeff Johnson295189b2012-06-20 16:38:30 -070089void limLogSessionStates(tpAniSirGlobal pMac);
90
91/** -------------------------------------------------------------
92\fn defMsgDecision
93\brief The function decides whether to defer a message or not in limProcessMessage function
94\param tpAniSirGlobal pMac
95\param tSirMsgQ limMsg
96\param tSirMacTspecIE *ppInfo
97\return none
98 -------------------------------------------------------------*/
99
100tANI_U8 static
101defMsgDecision(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
102{
103
104
105/* this function should not changed */
Jeff Johnsone7245742012-09-05 17:12:55 -0700106 if(pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700107 {
108 // Defer processsing this message
109 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
110 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700111 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 -0700112 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
113 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
114 limLogSessionStates(pMac);
115 limHandleDeferMsgError(pMac, limMsg);
116 }
117 return true;
118 }
119
120 //When defer is requested then defer all the messages except HAL responses.
121 if((!limIsSystemInScanState(pMac)) && (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) &&
122 !pMac->lim.gLimSystemInScanLearnMode)
123 {
124 if((limMsg->type != WDA_ADD_BSS_RSP) &&
125 (limMsg->type != WDA_DELETE_BSS_RSP) &&
126 (limMsg->type != WDA_ADD_STA_RSP) &&
127 (limMsg->type != WDA_ADD_STA_SELF_RSP) &&
128 (limMsg->type != WDA_DEL_STA_SELF_RSP) &&
129 (limMsg->type != WDA_DELETE_STA_RSP)&&
130 (limMsg->type != WDA_SET_BSSKEY_RSP)&&
131 (limMsg->type != WDA_SET_STAKEY_RSP)&&
132 (limMsg->type != WDA_SET_STA_BCASTKEY_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700133 (limMsg->type != eWNI_SME_START_REQ) &&
134 (limMsg->type != WDA_AGGR_QOS_RSP) &&
135 (limMsg->type != WDA_REMOVE_BSSKEY_RSP) &&
136 (limMsg->type != WDA_REMOVE_STAKEY_RSP) &&
137 (limMsg->type != WDA_SET_MIMOPS_RSP)&&
138 (limMsg->type != WDA_ADDBA_RSP) &&
139 (limMsg->type != WDA_ENTER_BMPS_RSP) &&
140 (limMsg->type != WDA_EXIT_BMPS_RSP) &&
141 (limMsg->type != WDA_ENTER_IMPS_RSP) &&
142 (limMsg->type != WDA_EXIT_IMPS_RSP) &&
143 (limMsg->type != WDA_ENTER_UAPSD_RSP) &&
144 (limMsg->type != WDA_EXIT_UAPSD_RSP) &&
145 (limMsg->type != WDA_WOWL_ENTER_RSP) &&
146 (limMsg->type != WDA_WOWL_EXIT_RSP) &&
147 (limMsg->type != WDA_SWITCH_CHANNEL_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700148 (limMsg->type != WDA_P2P_NOA_ATTR_IND) &&
Viral Modid440e682013-03-06 02:25:31 -0800149 (limMsg->type != WDA_P2P_NOA_START_IND) &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700150#ifdef FEATURE_OEM_DATA_SUPPORT
151 (limMsg->type != WDA_START_OEM_DATA_RSP) &&
152#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700153 (limMsg->type != WDA_ADD_TS_RSP))
154 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700155 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 -0700156 limMsgStr(limMsg->type));)
157
158 // Defer processsing this message
159 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
160 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700161 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 -0700162 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
163 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
164 limLogSessionStates(pMac);
165 limHandleDeferMsgError(pMac, limMsg);
166
167 }
168 return true;
169 }
170 }
171 return false;
172}
173
174/*
175* Beacon Handling Cases:
176* during scanning, when no session is active:
177* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
178* during scanning, when any session is active, but beacon/Pr does not belong to that session, psessionEntry will be null.
179* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
180* during scanning, when any session is active, and beacon/Pr belongs to one of the session, psessionEntry will not be null.
181* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
182* Not scanning, no session:
183* there should not be any beacon coming, if coming, should be dropped.
184* Not Scanning,
185*/
186static void
187__limHandleBeacon(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tpPESession psessionEntry)
188{
189 /* checking for global SME state...*/
190 tANI_U8 *pRxPacketInfo;
191 limGetBDfromRxPacket(pMac, pMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
192
193 //This function should not be called if beacon is received in scan state.
194 //So not doing any checks for the global state.
195
196 if(psessionEntry == NULL)
197 {
198 schBeaconProcess(pMac, pRxPacketInfo, NULL);
199 }
200 else if( (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
201 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE))
202 {
203 schBeaconProcess(pMac, pRxPacketInfo, psessionEntry);
204 }
205 else
206 limProcessBeaconFrame(pMac, pRxPacketInfo, psessionEntry);
207
208 return;
209}
210
211
212//Fucntion prototype
213void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd);
214
215/**
Jeff Johnson295189b2012-06-20 16:38:30 -0700216 * limDeferMsg()
217 *
218 *FUNCTION:
219 * This function is called to defer the messages received
220 * during Learn mode
221 *
222 *LOGIC:
223 * NA
224 *
225 *ASSUMPTIONS:
226 * NA
227 *
228 *NOTE:
229 * NA
230 *
231 * @param pMac - Pointer to Global MAC structure
232 * @param pMsg of type tSirMsgQ - Pointer to the message structure
233 * @return None
234 */
235
236tANI_U32
237limDeferMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
238{
239 tANI_U32 retCode = TX_SUCCESS;
Jeff Johnson77165482013-03-07 08:15:44 -0800240
241 retCode = limWriteDeferredMsgQ(pMac, pMsg);
242
Jeff Johnson295189b2012-06-20 16:38:30 -0700243 if (retCode == TX_SUCCESS)
Jeff Johnson77165482013-03-07 08:15:44 -0800244 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530245 limLog(pMac, LOG1,
246 FL("Deferred message(0x%X) limSmeState %d (prev sme state %d)"
247 " sysRole %d mlm state %d (prev mlm state %d)"),
248 pMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
249 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState,
250 pMac->lim.gLimPrevMlmState);
Jeff Johnson77165482013-03-07 08:15:44 -0800251 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));)
252 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700253 else
Jeff Johnson77165482013-03-07 08:15:44 -0800254 {
Agarwal Ashishe865f332014-04-08 13:20:06 +0530255 limLog(pMac, LOG1, FL("Dropped lim message (0x%X)"), pMsg->type);
Jeff Johnson77165482013-03-07 08:15:44 -0800256 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));)
257 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700258
259 return retCode;
260} /*** end limDeferMsg() ***/
261
262
263
264/**
265 * limHandleFramesInScanState()
266 *
267 *FUNCTION:
268 * This function is called to process 802.11 frames
269 * received by LIM in scan state.
270 *
271 *LOGIC:
272 * NA
273 *
274 *ASSUMPTIONS:
275 * NA
276 *
277 *NOTE:
278 * NA
279 *
280 * @param pMac - Pointer to Global MAC structure
281 * @param limMsg - Received message
282 * @param pRxPacketInfo - Pointer to Rx packet info structure
283 * @param deferMsg - Indicates whether the frame shall be deferred
284 * @return None
285 */
286
287static void
288limHandleFramesInScanState(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pRxPacketInfo, tANI_U8 *deferMsg, tpPESession psessionEntry)
289{
290 tSirMacFrameCtl fc;
291 tpSirMacMgmtHdr pHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -0700292
293 *deferMsg = false;
294 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
295 fc = pHdr->fc;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700296 limLog( pMac, LOG2, FL("ProtVersion %d, Type %d, Subtype %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700297 fc.protVer, fc.type, fc.subType );
298
Jeff Johnson295189b2012-06-20 16:38:30 -0700299 // defer all message in scan state except for Beacons and Probe Response
300 if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_BEACON))
301 {
302 if (psessionEntry == NULL)
303 limProcessBeaconFrameNoSession(pMac, pRxPacketInfo);
304 else
305 limProcessBeaconFrame(pMac, pRxPacketInfo,psessionEntry);
306 }
307 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_RSP))
308 {
309 if (psessionEntry == NULL)
310 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
311 else
312 limProcessProbeRspFrame(pMac, pRxPacketInfo,psessionEntry);
313 }
314 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_REQ))
315 {
316 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo, psessionEntry);
317 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700318 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_ACTION))
319 {
320 limProcessActionFrameNoSession( pMac, pRxPacketInfo);
321 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700322 else
323 {
324 *deferMsg = true;
325 return;
326 }
327
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
329 return;
330
331} /*** end limHandleFramesInScanState() ***/
332
333/** ------------------------------------------------------------
334\brief This function handles Unknown Unicast (A2 Index)
335\ packets.
336\param tpAniSirGlobal pMac Global Mac data structure
337\param void *pRxPacketInfo Pointer to Buffer Descriptor
338\return none
339\
340\ -------------------------------------------------------------- */
341static void limHandleUnknownA2IndexFrames(tpAniSirGlobal pMac, void *pRxPacketInfo,tpPESession psessionEntry)
342{
Jeff Johnson295189b2012-06-20 16:38:30 -0700343 /* addr2 mismatch interrupt occurred this means previous
344 disassociation was not successful
345 In Volans pRxPacketInfo only contains pointer 48-bit address2 field */
346 /*Send disassociation message again*/
347 //Dinesh need one more arguement.
348 //limSendDisassocMgmtFrame(pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON,(tANI_U8 *) pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800349 //TODO: verify this
Jeff Johnson295189b2012-06-20 16:38:30 -0700350 //This could be a public action frame.
351 if( psessionEntry->limSystemRole == eLIM_P2P_DEVICE_ROLE )
352 limProcessActionFrameNoSession(pMac, (tANI_U8 *) pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800353
354#ifdef FEATURE_WLAN_TDLS
355 {
356 tpSirMacDataHdr3a pMacHdr;
357 pMacHdr = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
358
359 if (limIsGroupAddr(pMacHdr->addr2))
360 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700361 PELOG2(limLog(pMac, LOG2, FL("Ignoring A2 Invalid Packet received for MC/BC:"));
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800362 limPrintMacAddr(pMac, pMacHdr->addr2, LOG2);)
363
364 return;
365 }
366 /* TDLS_hklee: move down here to reject Addr2 == Group (first checking above)
367 and also checking if SystemRole == STA */
368 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
369 {
370 /* ADD handling of Public Action Frame */
371 LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700372 ("limHandleUnknownA2IndexFrames: type=0x%x, subtype=0x%x"),pMacHdr->fc.type, pMacHdr->fc.subType));
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800373 switch (pMacHdr->fc.type)
374 {
375 case SIR_MAC_MGMT_FRAME:
376 {
377 switch (pMacHdr->fc.subType)
378 {
379 case SIR_MAC_MGMT_ACTION:
380 {
381 limProcessActionFrame(pMac, pRxPacketInfo, psessionEntry) ;
382 break ;
383 }
384 default:
385 {
386 break ;
387 }
388 }
389 }
390 default:
391 {
392 break ;
393 }
394 }
395 }
396 }
397#endif
398
Jeff Johnson295189b2012-06-20 16:38:30 -0700399
400 return;
401}
402
Jeff Johnson295189b2012-06-20 16:38:30 -0700403/**
404 * limCheckMgmtRegisteredFrames()
405 *
406 *FUNCTION:
407 * This function is called to process to check if received frame match with
408 * any of the registered frame from HDD. If yes pass this frame to SME.
409 *
410 *LOGIC:
411 *
412 *ASSUMPTIONS:
413 *
414 *NOTE:
415 *
416 * @param pMac Pointer to Global MAC structure
417 * @param *pBd Pointer to the received Buffer Descriptor+payload
418 * @param *psessionEntry Pointer to session on which packet is received
419 * @return None
420 */
421static tANI_BOOLEAN
422limCheckMgmtRegisteredFrames(tpAniSirGlobal pMac, tANI_U8 *pBd,
423 tpPESession psessionEntry)
424{
425 tSirMacFrameCtl fc;
426 tpSirMacMgmtHdr pHdr;
427 tANI_U8 *pBody;
428 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
429 tANI_U16 frameType;
430 tANI_U16 framelen;
431 tANI_U8 type,subType;
432 tANI_BOOLEAN match = VOS_FALSE;
433 VOS_STATUS vosStatus;
434
435 pHdr = WDA_GET_RX_MAC_HEADER(pBd);
436 fc = pHdr->fc;
437 frameType = (fc.type << 2 ) | (fc.subType << 4);
438 pBody = WDA_GET_RX_MPDU_DATA(pBd);
439 framelen = WDA_GET_RX_PAYLOAD_LEN(pBd);
440
441 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
442 (vos_list_node_t**)&pLimMgmtRegistration);
443
444 while(pLimMgmtRegistration != NULL)
445 {
446 type = (pLimMgmtRegistration->frameType >> 2) & 0x03;
447 subType = (pLimMgmtRegistration->frameType >> 4) & 0x0f;
448 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
449 && (subType == SIR_MAC_MGMT_RESERVED15) )
450 {
451 limLog( pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700452 FL("rcvd frame match with SIR_MAC_MGMT_RESERVED15"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700453 match = VOS_TRUE;
454 break;
455 }
456
457 if (pLimMgmtRegistration->frameType == frameType)
458 {
459 if (pLimMgmtRegistration->matchLen > 0)
460 {
461 if (pLimMgmtRegistration->matchLen <= framelen)
462 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530463 if (vos_mem_compare(pLimMgmtRegistration->matchData,
Jeff Johnson295189b2012-06-20 16:38:30 -0700464 pBody, pLimMgmtRegistration->matchLen))
465 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700466 /* found match! */
467 match = VOS_TRUE;
468 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700469 }
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700470 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700471 }
472 else
473 {
474 /* found match! */
475 match = VOS_TRUE;
476 break;
477 }
478 }
479
480 vosStatus =
481 vos_list_peek_next ( &pMac->lim.gLimMgmtFrameRegistratinQueue,
482 (vos_list_node_t*) pLimMgmtRegistration,
483 (vos_list_node_t**) &pNext );
484 pLimMgmtRegistration = pNext;
485 pNext = NULL;
486 }
487
488 if (match)
489 {
490 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700491 FL("rcvd frame match with registered frame params"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700492
493 /* Indicate this to SME */
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +0530494 limSendSmeMgmtFrameInd( pMac, pLimMgmtRegistration->sessionId,
495 pBd, psessionEntry, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700496
497 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
498 && (subType == SIR_MAC_MGMT_RESERVED15) )
499 {
500 // These packets needs to be processed by PE/SME as well as HDD.
501 // If it returns TRUE here, the packet is forwarded to HDD only.
502 match = VOS_FALSE;
503 }
504 }
505
506 return match;
507} /*** end limCheckMgmtRegisteredFrames() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700508
Dino Mycle7a76e662014-06-10 11:36:34 +0530509#ifdef WLAN_FEATURE_EXTSCAN
510
511void
512limProcessEXTScanRealTimeData(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
513{
514 tpSirMacMgmtHdr pHdr = NULL;
515 eHalStatus status;
516 void *pCallbackContext;
517 tANI_U8 rfBand = 0;
518 tANI_U8 rxChannelInBD = 0;
519 tSirMacFrameCtl fc;
520 tDot11fBeacon *pBeacon = NULL;
521 tDot11fProbeResponse *pProbeResponse = NULL;
522 tSirWifiFullScanResultEvent tEXTScanFullScanResult;
523
524 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
525 fc = pHdr->fc;
526
527 limLog(pMac, LOG2,
528 FL("Received EXTScan Real Time data with length=%d from "),
529 WDA_GET_RX_MPDU_LEN(pRxPacketInfo));
530
531 limPrintMacAddr(pMac, pHdr->sa, LOG2);
532
533 vos_mem_set((tANI_U8 *) &tEXTScanFullScanResult,
534 sizeof(tSirWifiFullScanResultEvent), 0);
535
Dino Mycle3f783bc2014-08-08 17:40:22 +0530536 tEXTScanFullScanResult.ap.ts = vos_get_monotonic_boottime();
Dino Mycle7a76e662014-06-10 11:36:34 +0530537
538 vos_mem_copy(&tEXTScanFullScanResult.ap.bssid,
539 pHdr->bssId, sizeof(tSirMacAddr));
540
Dino Myclee8843b32014-07-04 14:21:45 +0530541 limPrintMacAddr(pMac, pHdr->bssId, LOG2);
Dino Mycle7a76e662014-06-10 11:36:34 +0530542
543
544 rfBand = WDA_GET_RX_RFBAND(pRxPacketInfo);
545 rxChannelInBD = WDA_GET_RX_CH(pRxPacketInfo);
546
547 if ((!rfBand) || IS_5G_BAND(rfBand))
548 {
549 rxChannelInBD = limUnmapChannel(rxChannelInBD);
550 }
551
552 tEXTScanFullScanResult.ap.channel = rxChannelInBD;
553 tEXTScanFullScanResult.ap.rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
554
555 if (fc.subType == SIR_MAC_MGMT_BEACON)
556 {
557 limLog( pMac, LOG2, FL("Beacon "));
558
559 pBeacon = vos_mem_malloc(sizeof(tDot11fBeacon));
560 if ( NULL == pBeacon ){
561 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
562 return;
563 }
564
565 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
566 // delegate to the framesc-generated code,
567 status = dot11fUnpackBeacon( pMac,
568 (tANI_U8 *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo),
569 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo), pBeacon );
570
571 if ( DOT11F_FAILED( status ) )
572 {
573 limLog(pMac, LOGE, FL("Failed to parse a Beacons"
574 "(%d):\n"), status);
575 vos_mem_free(pBeacon);
576 return;
577 }
578 if ( pBeacon->SSID.present )
579 {
580 vos_mem_copy(tEXTScanFullScanResult.ap.ssid,
581 pBeacon->SSID.ssid,
582 pBeacon->SSID.num_ssid);
583 }
584 //NULL Terminate the string.
585 tEXTScanFullScanResult.ap.ssid[pBeacon->SSID.num_ssid] = 0;
586 tEXTScanFullScanResult.ap.beaconPeriod =
587 pBeacon->BeaconInterval.interval;
588 tEXTScanFullScanResult.ap.capability =
589 *((tANI_U16 *)&pBeacon->Capabilities);
590 vos_mem_free(pBeacon);
591 }
592 else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP)
593 {
594 limLog( pMac, LOG2, FL("Probe rsp "));
595
596 pProbeResponse = vos_mem_malloc(sizeof(tDot11fProbeResponse));
597 if ( NULL == pProbeResponse ){
598 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
599 return;
600 }
601
602 vos_mem_set( ( tANI_U8* )pProbeResponse,
603 sizeof(tDot11fProbeResponse), 0);
604 //delegate to the framesc-generated code,
605 status = dot11fUnpackProbeResponse( pMac,
606 (tANI_U8 *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo),
607 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo), pProbeResponse );
608
609 if ( DOT11F_FAILED( status ) )
610 {
611 limLog(pMac, LOGE, FL("Failed to parse a Probe"
612 "Response (%d:\n"), status);
613 vos_mem_free(pProbeResponse);
614 return;
615 }
616 if ( pProbeResponse->SSID.present )
617 {
618 vos_mem_copy(tEXTScanFullScanResult.ap.ssid,
619 pProbeResponse->SSID.ssid,
620 pProbeResponse->SSID.num_ssid);
621 }
622 //NULL Terminate the string.
623 tEXTScanFullScanResult.ap.ssid[pProbeResponse->SSID.num_ssid] = 0;
624 tEXTScanFullScanResult.ap.beaconPeriod =
625 pProbeResponse->BeaconInterval.interval;
626 tEXTScanFullScanResult.ap.capability =
627 *(((tANI_U16 *)&pProbeResponse->Capabilities));
628
629 vos_mem_free(pBeacon);
630 }
631 else
632 {
633 limLog( pMac, LOGE, FL("Wrong frame Type %d, Subtype %d for LFR"),
634 fc.type, fc.subType);
635 VOS_ASSERT(0);
636 return;
637 }
638
639 tEXTScanFullScanResult.requestId = pMac->sme.extScanStartReqId;
640 tEXTScanFullScanResult.ieLength =
641 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) - SIZE_OF_FIXED_PARAM;
642 tEXTScanFullScanResult.ie =(tSirInformationElement *)
643 ((tANI_U8 *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo) + SIZE_OF_FIXED_PARAM);
644
645 pCallbackContext = pMac->sme.pEXTScanCallbackContext;
646 if(pMac->sme.pEXTScanIndCb)
647 {
648 pMac->sme.pEXTScanIndCb(pCallbackContext,
649 SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND,
650 (tANI_U8 *)&tEXTScanFullScanResult);
651 }
652
653 return;
654} /*** end limProcessEXTScanRealTimeData() ***/
655#endif /* WLAN_FEATURE_EXTSCAN */
Jeff Johnson295189b2012-06-20 16:38:30 -0700656
657/**
658 * limHandle80211Frames()
659 *
660 *FUNCTION:
661 * This function is called to process 802.11 frames
662 * received by LIM.
663 *
664 *LOGIC:
665 * NA
666 *
667 *ASSUMPTIONS:
668 * NA
669 *
670 *NOTE:
671 * NA
672 *
673 * @param pMac - Pointer to Global MAC structure
674 * @param pMsg of type tSirMsgQ - Pointer to the message structure
675 * @return None
676 */
677
678static void
679limHandle80211Frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pDeferMsg)
680{
681 tANI_U8 *pRxPacketInfo = NULL;
682 tSirMacFrameCtl fc;
683 tpSirMacMgmtHdr pHdr=NULL;
684 tpPESession psessionEntry=NULL;
685 tANI_U8 sessionId;
686 tAniBool isFrmFt = FALSE;
687 tANI_U16 fcOffset = WLANHAL_RX_BD_HEADER_SIZE;
688
689 *pDeferMsg= false;
690 limGetBDfromRxPacket(pMac, limMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
691
Dino Mycle7a76e662014-06-10 11:36:34 +0530692#ifdef WLAN_FEATURE_EXTSCAN
693
694 if ( WDA_GET_EXTSCANFULLSCANRESIND(pRxPacketInfo))
695 {
696 limLog( pMac, LOG2, FL("Notify EXTSCAN scan results to the HDD"));
697 limProcessEXTScanRealTimeData(pMac, pRxPacketInfo);
698 goto end;
699 }
700#endif //WLAN_FEATURE_EXTSCAN
701
Jeff Johnson295189b2012-06-20 16:38:30 -0700702 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
703 isFrmFt = WDA_GET_RX_FT_DONE(pRxPacketInfo);
704 fcOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pRxPacketInfo);
705 fc = pHdr->fc;
706
Madan Mohan Koyyalamudi99af06e2013-08-08 02:17:17 +0530707#ifdef WLAN_DUMP_MGMTFRAMES
708 limLog( pMac, LOGE, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
709 fc.protVer, fc.type, fc.subType,
710 WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
711 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, pHdr,
712 WDA_GET_RX_MPDU_HEADER_LEN(pRxPacketInfo));
713#endif
714
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -0800715 if ((fc.type == SIR_MAC_MGMT_FRAME) &&
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -0800716 (fc.subType != SIR_MAC_MGMT_BEACON))
717 {
Sushant Kaushik60273d02014-06-13 15:31:37 +0530718 limLog(pMac, LOG1, FL("RX MGMT - Type %hu, SubType %hu, Seq.no %d"),
719 fc.type, fc.subType,
720 ((pHdr->seqControl.seqNumHi << 4) | (pHdr->seqControl.seqNumLo)));
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -0800721 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700722#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
723 if ( WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
724 {
725 limLog( pMac, LOG2, FL("Notify SME with candidate ind"));
726 //send a session 0 for now - TBD
727 limSendSmeCandidateFoundInd(pMac, 0);
728 goto end;
729 }
730 if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo))
731 {
732 if (fc.subType == SIR_MAC_MGMT_BEACON)
733 {
734 limLog( pMac, LOG2, FL("Save this beacon in LFR cache"));
735 __limHandleBeacon(pMac, limMsg, NULL);
736 }
737 else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP)
738 {
739 limLog( pMac, LOG2, FL("Save this probe rsp in LFR cache"));
740 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
741 }
742 else
743 {
744 limLog( pMac, LOGE, FL("Wrong frame Type %d, Subtype %d for LFR"),
745 fc.type, fc.subType);
746 }
747 goto end;
748 }
749#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800750#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700751 if (fc.type == SIR_MAC_DATA_FRAME && isFrmFt)
752 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800753#if 0 // Ese TBD Need to PORT
Jeff Johnson295189b2012-06-20 16:38:30 -0700754 tpSirMacDot3Hdr pDataFrmHdr;
755
756 pDataFrmHdr = (tpSirMacDot3Hdr)((tANI_U8 *)pBD+ WLANHAL_RX_BD_GET_MPDU_H_OFFSET(pBD));
757 if((psessionEntry = peFindSessionByBssid(pMac,pDataFrmHdr->sa,&sessionId))== NULL)
758 {
759 limLog( pMac, LOGE, FL("Session not found for Frm type %d, subtype %d, SA: "), fc.type, fc.subType);
760 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
761 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
762 return;
763 }
764
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800765 if (!psessionEntry->isESEconnection)
Jeff Johnson295189b2012-06-20 16:38:30 -0700766 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800767 limLog( pMac, LOGE, FL("LIM received Type %d, Subtype %d in Non ESE connection"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700768 fc.type, fc.subType);
769 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
770 return;
771 }
772 limLog( pMac, LOGE, FL("Processing IAPP Frm from SA:"));
773 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
774#else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800775 printk("%s: Need to port handling of IAPP frames to PRIMA for ESE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700776#endif
777
778
779 } else
780#endif
781 /* Added For BT-AMP Support */
782 if((psessionEntry = peFindSessionByBssid(pMac,pHdr->bssId,&sessionId))== NULL)
783 {
784#ifdef WLAN_FEATURE_VOWIFI_11R
785 if (fc.subType == SIR_MAC_MGMT_AUTH)
786 {
787#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800788 limLog( pMac, LOG1, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700789 fc.protVer, fc.type, fc.subType, WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800790 limPrintMacAddr(pMac, pHdr->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700791#endif
792 if (limProcessAuthFrameNoSession(pMac, pRxPacketInfo, limMsg->bodyptr) == eSIR_SUCCESS)
793 {
794 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
795 return;
796 }
797 }
798#endif
799 if((fc.subType != SIR_MAC_MGMT_PROBE_RSP )&&
800 (fc.subType != SIR_MAC_MGMT_BEACON)&&
801 (fc.subType != SIR_MAC_MGMT_PROBE_REQ)
Jeff Johnson295189b2012-06-20 16:38:30 -0700802 && (fc.subType != SIR_MAC_MGMT_ACTION ) //Public action frame can be received from non-associated stations.
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 )
804 {
805
806 if((psessionEntry = peFindSessionByPeerSta(pMac,pHdr->sa,&sessionId))== NULL)
807 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700808 limLog(pMac, LOG1, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700809 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
810 return;
811 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530812 else
813 limLog(pMac,LOG1,"SessionId:%d Session Exist for given Bssid",
814 psessionEntry->peSessionId);
Gopichand Nakkala6265d6f2013-03-20 23:32:50 +0530815 }
816 // For p2p resp frames search for valid session with DA as
817 // BSSID will be SA and session will be present with DA only
818 if(fc.subType == SIR_MAC_MGMT_ACTION )
819 {
820 psessionEntry = peFindSessionByBssid(pMac,pHdr->da,&sessionId);
821 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700822 }
823
824
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 /* Check if frame is registered by HDD */
826 if(limCheckMgmtRegisteredFrames(pMac, pRxPacketInfo, psessionEntry))
827 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700828 limLog( pMac, LOG1, FL("Received frame is passed to SME"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700829 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
830 return;
831 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700832
833
Jeff Johnson295189b2012-06-20 16:38:30 -0700834
835 if (fc.protVer != SIR_MAC_PROTOCOL_VERSION)
836 { // Received Frame with non-zero Protocol Version
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700837 limLog(pMac, LOGE, FL("Unexpected frame with protVersion %d received"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700838 fc.protVer);
839 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
840#ifdef WLAN_DEBUG
841 pMac->lim.numProtErr++;
842#endif
843 return;
844 }
845
Gopichand Nakkala2c231c82013-06-11 17:49:16 +0530846 if (!pMac->fScanOffload)
Jeff Johnson295189b2012-06-20 16:38:30 -0700847 {
Gopichand Nakkala2c231c82013-06-11 17:49:16 +0530848 if (limIsSystemInScanState(pMac))
849 {
850 limHandleFramesInScanState(pMac, limMsg, pRxPacketInfo, pDeferMsg, psessionEntry);
851 return;
852 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700853 }
854
855/* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */
856
857#if 0
858 if (psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700859 limLog( pMac, LOGW, FL( "gLimSystemRole is %d. Exiting..." ),psessionEntry->limSystemRole );
Jeff Johnson295189b2012-06-20 16:38:30 -0700860 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
861
862#ifdef WLAN_DEBUG
863 pMac->lim.numProtErr++;
864#endif
865 return;
866 }
867 #endif //HACK to continue scanning
868
869
870#ifdef WLAN_DEBUG
871 pMac->lim.numMAC[fc.type][fc.subType]++;
872#endif
873
874 switch (fc.type)
875 {
876 case SIR_MAC_MGMT_FRAME:
877 {
878 #if 0 //TBD-RAJESH fix this
879 if (limIsReassocInProgress( pMac,psessionEntry) && (fc.subType != SIR_MAC_MGMT_DISASSOC) &&
880 (fc.subType != SIR_MAC_MGMT_DEAUTH) && (fc.subType != SIR_MAC_MGMT_REASSOC_RSP))
881 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700882 limLog(pMac, LOGE, FL("Frame with Type - %d, Subtype - %d received in ReAssoc Wait state, dropping..."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700883 fc.type, fc.subType);
884 return;
885 }
886 #endif //HACK to continue scanning
887 // Received Management frame
888 switch (fc.subType)
889 {
890 case SIR_MAC_MGMT_ASSOC_REQ:
891 // Make sure the role supports Association
892 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700893 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700894 )
895 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_ASSOC, psessionEntry);
896
897 else
898 {
899 // Unwanted messages - Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700900 limLog(pMac, LOGE, FL("unexpected message received %X"),limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700901 limPrintMsgName(pMac, LOGE, limMsg->type);
902 }
903 break;
904
905 case SIR_MAC_MGMT_ASSOC_RSP:
906 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_ASSOC,psessionEntry);
907 break;
908
909 case SIR_MAC_MGMT_REASSOC_REQ:
910 // Make sure the role supports Reassociation
911 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700912 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700913 ){
914 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_REASSOC, psessionEntry);
915 }
916 else
917 {
918 // Unwanted messages - Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700919 limLog(pMac, LOGE, FL("unexpected message received %X"),limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700920 limPrintMsgName(pMac, LOGE, limMsg->type);
921 }
922 break;
923
924 case SIR_MAC_MGMT_REASSOC_RSP:
925 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_REASSOC,psessionEntry);
926 break;
927
928 case SIR_MAC_MGMT_PROBE_REQ:
929 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo,psessionEntry);
930 break;
931
932 case SIR_MAC_MGMT_PROBE_RSP:
933 if(psessionEntry == NULL)
934 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
935 else
936 limProcessProbeRspFrame(pMac, pRxPacketInfo, psessionEntry);
937 break;
938
939 case SIR_MAC_MGMT_BEACON:
940 __limHandleBeacon(pMac, limMsg,psessionEntry);
941 break;
942
943 case SIR_MAC_MGMT_DISASSOC:
944 limProcessDisassocFrame(pMac, pRxPacketInfo,psessionEntry);
945 break;
946
947 case SIR_MAC_MGMT_AUTH:
948 limProcessAuthFrame(pMac, pRxPacketInfo,psessionEntry);
949 break;
950
951 case SIR_MAC_MGMT_DEAUTH:
952 limProcessDeauthFrame(pMac, pRxPacketInfo,psessionEntry);
953 break;
954
955 case SIR_MAC_MGMT_ACTION:
Jeff Johnson295189b2012-06-20 16:38:30 -0700956 if(psessionEntry == NULL)
957 limProcessActionFrameNoSession(pMac, pRxPacketInfo);
958 else
959 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700960 if (WDA_GET_RX_UNKNOWN_UCAST(pRxPacketInfo))
961 limHandleUnknownA2IndexFrames(pMac, pRxPacketInfo,psessionEntry);
962 else
963 limProcessActionFrame(pMac, pRxPacketInfo,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700964 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700965 break;
966 default:
967 // Received Management frame of 'reserved' subtype
968 break;
969 } // switch (fc.subType)
970
971 }
972 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700973 case SIR_MAC_DATA_FRAME:
974 {
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800975#ifdef FEATURE_WLAN_TDLS_INTERNAL
976 /*
977 * if we reach here, following cases are possible.
978 * Possible cases: a) if frame translation is disabled.
979 * b) Some frame with ADRR2 filter enabled may come
980 * here.
981 */
982 tANI_U8 *dataOffset = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
983 tANI_U8 *rfc1042Hdr = (tANI_U8 *)(dataOffset + RFC1042_HDR_LENGTH) ;
984 tANI_U16 ethType = GET_BE16(rfc1042Hdr) ;
985 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700986 ("TDLS frame with 80211 Header")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800987 if(ETH_TYPE_89_0d == ethType)
988 {
989 tANI_U8 payloadType = (rfc1042Hdr + ETH_TYPE_LEN)[0] ;
990 if(PAYLOAD_TYPE_TDLS == payloadType)
991 {
992 limProcessTdlsFrame(pMac, (tANI_U32*)pRxPacketInfo) ;
993 }
994 }
995#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800996#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -0700997 /* We accept data frame (IAPP frame) only if Session is
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800998 * present and ese connection is established on that
Jeff Johnson295189b2012-06-20 16:38:30 -0700999 * session
1000 */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001001 if (psessionEntry && psessionEntry->isESEconnection) {
Jeff Johnson295189b2012-06-20 16:38:30 -07001002 limProcessIappFrame(pMac, pRxPacketInfo, psessionEntry);
1003 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001004#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001005 }
1006 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001007 default:
1008 // Received frame of type 'reserved'
1009 break;
1010
1011 } // switch (fc.type)
1012
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001013#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1014end:
1015#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001016 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr) ;
1017 return;
1018} /*** end limHandle80211Frames() ***/
1019
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301020/**
1021 * limSendStopScanOffloadReq()
1022 *
1023 *FUNCTION:
1024 * This function will be called to abort the ongoing offloaded scan
1025 * request.
1026 *
1027 *
1028 *NOTE:
1029 *
1030 * @param pMac Pointer to Global MAC structure
1031 * @return eHAL_STATUS_SUCCESS or eHAL_STATUS_FAILURE
1032 */
1033eHalStatus limSendStopScanOffloadReq(tpAniSirGlobal pMac, tANI_U8 SessionId)
1034{
1035 tSirMsgQ msg;
1036 tSirRetStatus rc = eSIR_SUCCESS;
1037 tAbortScanParams *pAbortScanParams;
1038
Kiet Lamb1233192013-11-28 13:38:20 +05301039 pAbortScanParams = vos_mem_malloc(sizeof(tAbortScanParams));
1040 if (NULL == pAbortScanParams)
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301041 {
1042 limLog(pMac, LOGP, FL("Memory allocation failed for AbortScanParams"));
1043 return eHAL_STATUS_FAILURE;
1044 }
1045
1046 pAbortScanParams->SessionId = SessionId;
1047 msg.type = WDA_STOP_SCAN_OFFLOAD_REQ;
1048 msg.bodyptr = pAbortScanParams;
1049 msg.bodyval = 0;
1050
1051 rc = wdaPostCtrlMsg(pMac, &msg);
1052 if (rc != eSIR_SUCCESS)
1053 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001054 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Kiet Lamb1233192013-11-28 13:38:20 +05301055 vos_mem_free(pAbortScanParams);
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301056 return eHAL_STATUS_FAILURE;
1057 }
1058
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301059 limLog(pMac, LOG1, FL("Abort ongoing offload scan."));
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301060 return eHAL_STATUS_SUCCESS;
1061
1062}
Jeff Johnson295189b2012-06-20 16:38:30 -07001063
1064/**
1065 * limProcessAbortScanInd()
1066 *
1067 *FUNCTION:
1068 * This function is called from HDD to abort the scan which is presently being run
1069 *
1070 *
1071 *NOTE:
1072 *
1073 * @param pMac Pointer to Global MAC structure
1074 * @param *pMsgBuf A pointer to the SME message buffer
1075 * @return None
1076 */
1077void
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301078limProcessAbortScanInd(tpAniSirGlobal pMac, tANI_U8 SessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07001079{
1080#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1081 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT, NULL, 0, 0);
1082#endif //FEATURE_WLAN_DIAG_SUPPORT
1083
1084 /* Deactivate the gLimBackgroundScanTimer as part of the abort scan.
1085 * SME should send WNI_CFG_BACKGROUND_SCAN_PERIOD indication
1086 * to start the background scan again
1087 */
Madan Mohan Koyyalamudi8b7f1e62012-10-05 14:56:51 -07001088 PELOG2(limLog(pMac, LOG2, FL("Processing AbortScan Ind"));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001089
1090 limAbortBackgroundScan(pMac);
1091
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301092 if (pMac->fScanOffload)
Jeff Johnson295189b2012-06-20 16:38:30 -07001093 {
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301094 /* send stop scan cmd to fw if scan offload is enabled. */
1095 limSendStopScanOffloadReq(pMac, SessionId);
1096 }
1097 else
1098 {
1099 /* Abort the scan if its running, else just return */
1100 if(limIsSystemInScanState(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07001101 {
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301102 if( (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
1103 (eLIM_HAL_START_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
1104 (eLIM_HAL_END_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
1105 (eLIM_HAL_FINISH_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
1106 {
1107 //Simply signal we need to abort
1108 limLog( pMac, LOGW, FL(" waiting for HAL, simply signal abort gLimHalScanState = %d"), pMac->lim.gLimHalScanState );
1109 pMac->lim.abortScan = 1;
1110 }
1111 else
1112 {
1113 //Force abort
1114 limLog( pMac, LOGW, FL(" Force aborting scan") );
1115 pMac->lim.abortScan = 0;
1116 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
1117 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
1118 //Set the resume channel to Any valid channel (invalid).
1119 //This will instruct HAL to set it to any previous valid channel.
1120 peSetResumeChannel(pMac, 0, 0);
1121 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
1122 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001123 }
1124 }
1125 return;
1126}
1127
1128/**
1129 * limMessageProcessor
1130 *
1131 *FUNCTION:
1132 * Wrapper function for limProcessMessages when handling messages received by LIM.
1133 * Could either defer messages or process them.
1134 * @param pMac Pointer to Global MAC structure
1135 * @param limMsg Received LIM message
1136 * @return None
1137 */
1138
1139void limMessageProcessor(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1140{
1141 if (eLIM_MLM_OFFLINE_STATE == pMac->lim.gLimMlmState)
1142 {
1143 peFreeMsg(pMac, limMsg);
1144 return;
1145 }
1146
1147 if (!defMsgDecision(pMac, limMsg))
1148 {
1149 limProcessMessages(pMac, limMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001150 // process deferred message queue if allowed
1151 {
1152 if ( (! (pMac->lim.gLimAddtsSent))
1153 &&
1154 (! (limIsSystemInScanState(pMac)))
1155 )
1156 {
1157 if (true == GET_LIM_PROCESS_DEFD_MESGS(pMac))
1158 limProcessDeferredMessageQueue(pMac);
1159 }
1160 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001161 }
1162}
1163
Jeff Johnsone7245742012-09-05 17:12:55 -07001164#ifdef FEATURE_OEM_DATA_SUPPORT
1165
1166void limOemDataRspHandleResumeLinkRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* mlmOemDataRsp)
1167{
1168 if(status != eHAL_STATUS_SUCCESS)
1169 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001170 limLog(pMac, LOGE, FL("OEM Data Rsp failed to get the response for resume link"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001171 }
1172
1173 if(NULL != pMac->lim.gpLimMlmOemDataReq)
1174 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301175 vos_mem_free(pMac->lim.gpLimMlmOemDataReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001176 pMac->lim.gpLimMlmOemDataReq = NULL;
1177 }
1178
1179 //"Failure" status doesn't mean that Oem Data Rsp did not happen
1180 //and hence we need to respond to upper layers. Only Resume link is failed, but
1181 //we got the oem data response already.
1182 //Post the meessage to MLM
1183 limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)(mlmOemDataRsp));
1184
1185 return;
1186}
1187
1188void limProcessOemDataRsp(tpAniSirGlobal pMac, tANI_U32* body)
1189{
Jeff Johnsone7245742012-09-05 17:12:55 -07001190 tpLimMlmOemDataRsp mlmOemDataRsp = NULL;
1191 tpStartOemDataRsp oemDataRsp = NULL;
1192
1193 //Process all the messages for the lim queue
1194 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1195
1196 oemDataRsp = (tpStartOemDataRsp)(body);
1197
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301198 mlmOemDataRsp = vos_mem_malloc(sizeof(tLimMlmOemDataRsp));
1199 if ( NULL == mlmOemDataRsp )
Jeff Johnsone7245742012-09-05 17:12:55 -07001200 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001201 limLog(pMac, LOGP, FL("could not allocate memory for mlmOemDataRsp"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001202 return;
1203 }
1204
1205 //copy the memory into tLimMlmOemDataRsp and free the tStartOemDataRsp
1206 //the structures tStartOemDataRsp and tLimMlmOemDataRsp have the same structure
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301207 vos_mem_copy((void*)(mlmOemDataRsp), (void*)(oemDataRsp),
1208 sizeof(tLimMlmOemDataRsp));
Jeff Johnsone7245742012-09-05 17:12:55 -07001209
1210 //Now free the incoming memory
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301211 vos_mem_free(oemDataRsp);
Jeff Johnsone7245742012-09-05 17:12:55 -07001212
1213 limResumeLink(pMac, limOemDataRspHandleResumeLinkRsp, (tANI_U32*)mlmOemDataRsp);
1214
1215 return;
1216}
1217
1218#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001219
Katya Nigam3802f202013-12-16 19:27:14 +05301220static tANI_BOOLEAN limAgeOutProbeReq( tpAniSirGlobal pMac, tpSirMsgQ limMsg,
1221 vos_pkt_t *pVosPkt )
1222{
1223 tANI_U8 *pRxPacketInfo = NULL;
1224 tSirMacFrameCtl fc;
1225 tpSirMacMgmtHdr pHdr=NULL;
1226 tANI_BOOLEAN match = VOS_FALSE;
1227
1228 limGetBDfromRxPacket(pMac, limMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
1229 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1230 fc = pHdr->fc;
1231 if ( fc.subType == SIR_MAC_MGMT_PROBE_REQ )
1232 {
1233 if( vos_timer_get_system_ticks() - pVosPkt->timestamp >= MAX_PROBEREQ_TIME )
1234 {
1235 // drop packet
1236 limLog(pMac, LOGE,
1237 FL("Dropping Aged Out probe requests. Peer MAC is "MAC_ADDRESS_STR),
1238 MAC_ADDR_ARRAY(pHdr->sa));
1239
1240 vos_pkt_return_packet(pVosPkt);
1241 match = VOS_TRUE;
1242 }
1243 }
1244 return match;
1245}
1246
Jeff Johnson295189b2012-06-20 16:38:30 -07001247
1248/**
1249 * limProcessMessages
1250 *
1251 *FUNCTION:
1252 * This function is called by limProcessMessageQueue function. This
1253 * function processes messages received by LIM.
1254 *
1255 *LOGIC:
1256 * Depending on the message type, corresponding function will be
1257 * called, for example limProcessSmeMessages() will be called to
1258 * process SME messages received from HDD/Upper layer software module.
1259 *
1260 *ASSUMPTIONS:
1261 * NA
1262 *
1263 *NOTE:
1264 * NA
1265 *
1266 * @param pMac Pointer to Global MAC structure
1267 * @param limMsg Received LIM message
1268 * @return None
1269 */
1270
1271void
1272limProcessMessages(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1273{
1274 tANI_U8 deferMsg = false;
1275 tLinkStateParams *linkStateParams;
1276#if defined WLAN_FEATURE_VOWIFI_11R
1277 tpPESession pSession;
1278#endif
1279#if defined(ANI_DVT_DEBUG)
1280 tSirMsgQ msgQ;
1281#endif
1282 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1283 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301284 vos_mem_free(limMsg->bodyptr);
Jeff Johnsone7245742012-09-05 17:12:55 -07001285 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001286 return;
1287 }
1288#ifdef WLAN_DEBUG
1289 pMac->lim.numTot++;
1290#endif
1291
1292
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001293 PELOG3(limLog(pMac, LOG3, FL("rcvd msgType = %s, sme state = %s, mlm state = %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001294 limMsgStr(limMsg->type), limSmeStateStr(pMac->lim.gLimSmeState),
1295 limMlmStateStr(pMac->lim.gLimMlmState));)
1296
Jeff Johnsone7245742012-09-05 17:12:55 -07001297 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001298
1299 switch (limMsg->type)
1300 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001301
1302 case SIR_LIM_UPDATE_BEACON:
1303 limUpdateBeacon(pMac);
1304 break;
1305
Jeff Johnson295189b2012-06-20 16:38:30 -07001306 case SIR_CFG_PARAM_UPDATE_IND:
1307 /// CFG parameter updated
1308 if (limIsSystemInScanState(pMac))
1309 {
1310 // System is in DFS (Learn) mode
1311 // Defer processsing this message
1312 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1313 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001314 if(!(pMac->lim.deferredMsgCnt & 0xF))
1315 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001316 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 -07001317 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1318 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001319 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001320 limLogSessionStates(pMac);
1321 limPrintMsgName(pMac, LOGE, limMsg->type);
1322 }
1323 }
1324 else
1325 {
1326 limHandleCFGparamUpdate(pMac, limMsg->bodyval);
1327 }
1328
1329 break;
1330
1331 case WDA_INIT_SCAN_RSP:
1332 limProcessInitScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001333 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001334 break;
1335
1336 case WDA_START_SCAN_RSP:
1337 limProcessStartScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001338 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001339 break;
1340
1341 case WDA_END_SCAN_RSP:
1342 limProcessEndScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001343 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001344 break;
1345
1346 case WDA_FINISH_SCAN_RSP:
1347 limProcessFinishScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001348 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001349 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001350#ifdef FEATURE_OEM_DATA_SUPPORT
1351 case WDA_START_OEM_DATA_RSP:
1352 limProcessOemDataRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001353 limMsg->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001354 break;
1355#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001356
1357 case WDA_SWITCH_CHANNEL_RSP:
1358 limProcessSwitchChannelRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001359 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001360 break;
1361
1362#ifdef ANI_SIR_IBSS_PEER_CACHING
1363 case WDA_IBSS_STA_ADD:
1364 limIbssStaAdd(pMac, limMsg->bodyptr);
1365 break;
1366#endif
1367 case SIR_BB_XPORT_MGMT_MSG:
1368 // These messages are from Peer MAC entity.
1369#ifdef WLAN_DEBUG
1370 pMac->lim.numBbt++;
1371#endif
1372
Jeff Johnson295189b2012-06-20 16:38:30 -07001373 {
1374 v_U16_t pktLen = 0;
1375 vos_pkt_t *pVosPkt;
1376 VOS_STATUS vosStatus;
1377 tSirMsgQ limMsgNew;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001378#ifdef FEATURE_WLAN_TDLS_INTERNAL
1379 tANI_U32 *pBD = NULL ;
1380#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001381
1382 /* The original limMsg which we were deferring have the
1383 * bodyPointer point to 'BD' instead of 'Vos pkt'. If we don't make a copy
1384 * of limMsg, then vos_pkt_peek_data will overwrite the limMsg->bodyPointer.
1385 * and next time when we try to process the msg, we will try to use 'BD' as
1386 * 'Vos Pkt' which will cause a crash
1387 */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301388 vos_mem_copy((tANI_U8*)&limMsgNew, (tANI_U8*)limMsg,
1389 sizeof(tSirMsgQ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001390 pVosPkt = (vos_pkt_t *)limMsgNew.bodyptr;
1391 vos_pkt_get_packet_length(pVosPkt, &pktLen);
1392
1393 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&limMsgNew.bodyptr, VOS_FALSE );
1394
1395 if( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1396 {
1397 vos_pkt_return_packet(pVosPkt);
1398 break;
1399
1400 }
Katya Nigam3802f202013-12-16 19:27:14 +05301401
1402 /*
1403 * putting a check for age out probe request frames
1404 * such that any probe req more than 0.5 sec old can directly
1405 * be dropped. With this, there won't be blocking of MC thread.
1406 */
1407
1408 if( limAgeOutProbeReq ( pMac, &limMsgNew, pVosPkt ))
1409 {
1410 break;
1411 }
1412
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001413#ifdef FEATURE_WLAN_TDLS_INTERNAL
1414 /*
1415 * TDLS frames comes as translated frames as well as
1416 * MAC 802.11 data frames..
1417 */
1418 limGetBDfromRxPacket(pMac, limMsgNew.bodyptr, &pBD);
1419 if(0 != WDA_GET_RX_FT_DONE(pBD))
1420 {
1421 /*
1422 * TODO: check for scanning state and set deferMesg flag
1423 * accordingly..
1424 */
1425 deferMsg = false ;
1426
1427 limProcessTdlsFrame(pMac, pBD) ;
1428 }
1429 else
1430#endif
Katya Nigam3802f202013-12-16 19:27:14 +05301431
Jeff Johnson295189b2012-06-20 16:38:30 -07001432 limHandle80211Frames(pMac, &limMsgNew, &deferMsg);
1433
1434 if ( deferMsg == true )
1435 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001436 PELOG1(limLog(pMac, LOG1, FL("Defer message type=%X "), limMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001437 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1438 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001439 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 -07001440 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1441 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1442 limLogSessionStates(pMac);
1443 limPrintMsgName(pMac, LOGE, limMsg->type);
1444 vos_pkt_return_packet(pVosPkt);
1445 }
1446 }
1447 else
1448 {
1449 /* PE is not deferring this 802.11 frame so we need to call vos_pkt_return.
1450 * Asumption here is when Rx mgmt frame processing is done,
1451 * voss packet could be freed here.
1452 */
1453 vos_pkt_return_packet(pVosPkt);
1454 }
1455 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001456 break;
1457
1458 case eWNI_SME_SCAN_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001459 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 case eWNI_SME_DISASSOC_REQ:
1461 case eWNI_SME_DEAUTH_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001462 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
Jeff Johnsone7245742012-09-05 17:12:55 -07001463#ifdef FEATURE_OEM_DATA_SUPPORT
1464 case eWNI_SME_OEM_DATA_REQ:
1465#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001466#ifdef FEATURE_WLAN_TDLS
1467 case eWNI_SME_TDLS_SEND_MGMT_REQ:
1468 case eWNI_SME_TDLS_ADD_STA_REQ:
1469 case eWNI_SME_TDLS_DEL_STA_REQ:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301470 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301471// tdlsoffchan
1472 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001473#endif
1474#ifdef FEATURE_WLAN_TDLS_INTERNAL
1475 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
1476 case eWNI_SME_TDLS_LINK_START_REQ:
1477 case eWNI_SME_TDLS_TEARDOWN_REQ:
1478#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05301479 case eWNI_SME_RESET_AP_CAPS_CHANGED:
Jeff Johnson295189b2012-06-20 16:38:30 -07001480 // These messages are from HDD
1481 limProcessNormalHddMsg(pMac, limMsg, true); //need to response to hdd
1482 break;
1483
1484 case eWNI_SME_SCAN_ABORT_IND:
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301485 {
1486 tANI_U8 *pSessionId = (tANI_U8 *)limMsg->bodyptr;
1487 limProcessAbortScanInd(pMac, *pSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001488 vos_mem_free((v_VOID_t *)limMsg->bodyptr);
1489 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001490 break;
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301491 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001492 case eWNI_SME_START_REQ:
1493 case eWNI_SME_SYS_READY_IND:
1494#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1495 case eWNI_SME_JOIN_REQ:
1496#endif
1497 case eWNI_SME_AUTH_REQ:
1498 case eWNI_SME_REASSOC_REQ:
1499 case eWNI_SME_START_BSS_REQ:
1500 case eWNI_SME_STOP_BSS_REQ:
1501 case eWNI_SME_SWITCH_CHL_REQ:
1502 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
1503 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
1504 case eWNI_SME_SETCONTEXT_REQ:
1505 case eWNI_SME_REMOVEKEY_REQ:
1506#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1507 case eWNI_SME_PROMISCUOUS_MODE_REQ:
1508#endif
1509 case eWNI_SME_DISASSOC_CNF:
1510 case eWNI_SME_DEAUTH_CNF:
1511 case eWNI_SME_ASSOC_CNF:
1512 case eWNI_SME_REASSOC_CNF:
1513 case eWNI_SME_ADDTS_REQ:
1514 case eWNI_SME_DELTS_REQ:
1515 case eWNI_SME_DEL_BA_PEER_IND:
1516 case eWNI_SME_SET_TX_POWER_REQ:
1517 case eWNI_SME_GET_TX_POWER_REQ:
1518 case eWNI_SME_GET_NOISE_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001519 case eWNI_SME_GET_ASSOC_STAS_REQ:
1520 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
1521 case eWNI_SME_UPDATE_APWPSIE_REQ:
1522 case eWNI_SME_HIDE_SSID_REQ:
1523 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
1524 case eWNI_SME_SET_APWPARSNIEs_REQ:
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08001525 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
Jeff Johnson295189b2012-06-20 16:38:30 -07001526#if defined WLAN_FEATURE_VOWIFI
1527 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1528 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
1529#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001530#if defined FEATURE_WLAN_ESE
1531 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001532#endif
1533#ifdef WLAN_FEATURE_VOWIFI_11R
1534 case eWNI_SME_FT_UPDATE_KEY:
1535 case eWNI_SME_FT_PRE_AUTH_REQ:
1536 case eWNI_SME_FT_AGGR_QOS_REQ:
1537#endif
1538 case eWNI_SME_ADD_STA_SELF_REQ:
1539 case eWNI_SME_DEL_STA_SELF_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001540 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
1541 case eWNI_SME_UPDATE_NOA:
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301542 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
Madan Mohan Koyyalamudi44bbc152013-07-05 21:13:10 +05301543 case eWNI_SME_STA_STAT_REQ:
1544 case eWNI_SME_AGGR_STAT_REQ:
1545 case eWNI_SME_GLOBAL_STAT_REQ:
1546 case eWNI_SME_STAT_SUMM_REQ:
1547 case eWNI_SME_GET_STATISTICS_REQ:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001548#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi44bbc152013-07-05 21:13:10 +05301549 case eWNI_SME_GET_ROAM_RSSI_REQ:
1550#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001551#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001552 case eWNI_SME_GET_TSM_STATS_REQ:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001553#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 // These messages are from HDD
1555 limProcessNormalHddMsg(pMac, limMsg, false); //no need to response to hdd
1556 break;
1557
1558 //Power Save Messages From HDD
1559 case eWNI_PMC_PWR_SAVE_CFG:
1560 case eWNI_PMC_ENTER_BMPS_REQ:
1561 case eWNI_PMC_EXIT_BMPS_REQ:
1562 case eWNI_PMC_ENTER_IMPS_REQ:
1563 case eWNI_PMC_EXIT_IMPS_REQ:
1564 case eWNI_PMC_ENTER_UAPSD_REQ:
1565 case eWNI_PMC_EXIT_UAPSD_REQ:
1566 case eWNI_PMC_ENTER_WOWL_REQ:
1567 case eWNI_PMC_EXIT_WOWL_REQ:
1568 case eWNI_PMC_WOWL_ADD_BCAST_PTRN:
1569 case eWNI_PMC_WOWL_DEL_BCAST_PTRN:
1570 pmmProcessMessage(pMac, limMsg);
1571 break;
1572
1573 case eWNI_PMC_SMPS_STATE_IND :
1574 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001575 if(limMsg->bodyptr){
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301576 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 limMsg->bodyptr = NULL;
1578 }
1579 }
1580 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001581 case eWNI_SME_SEND_ACTION_FRAME_IND:
1582 limSendP2PActionFrame(pMac, limMsg);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301583 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001584 limMsg->bodyptr = NULL;
1585 break;
1586 case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
1587 limAbortRemainOnChan(pMac);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301588 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001589 limMsg->bodyptr = NULL;
1590 break;
1591
Viral Modid86bde22012-12-10 13:09:21 -08001592 case SIR_HAL_P2P_NOA_START_IND:
1593 {
1594 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1595 tANI_U8 i;
Viral Modid440e682013-03-06 02:25:31 -08001596 tANI_U8 p2pGOExists = 0;
Gopichand Nakkala78a6c812013-05-13 16:39:49 +05301597
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001598 limLog(pMac, LOG1, "LIM received NOA start %x", limMsg->type);
Viral Modid440e682013-03-06 02:25:31 -08001599
1600 /* Since insert NOA is done and NOA start msg received, we should deactivate the Insert NOA timer */
1601 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
1602
Viral Modid86bde22012-12-10 13:09:21 -08001603 for(i=0; i < pMac->lim.maxBssId; i++)
1604 {
1605 psessionEntry = &pMac->lim.gpSession[i];
1606 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
1607 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1608 { //Save P2P NOA start attributes for P2P Go persona
Viral Modid440e682013-03-06 02:25:31 -08001609 p2pGOExists = 1;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301610 vos_mem_copy(&psessionEntry->p2pGoPsNoaStartInd, limMsg->bodyptr,
1611 sizeof(tSirP2PNoaStart));
Viral Modid440e682013-03-06 02:25:31 -08001612 if (psessionEntry->p2pGoPsNoaStartInd.status != eHAL_STATUS_SUCCESS)
Viral Modid86bde22012-12-10 13:09:21 -08001613 {
Viral Modid440e682013-03-06 02:25:31 -08001614 limLog(pMac, LOGW, FL("GO NOA start failure status %d reported by FW."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001615 " - still go ahead with deferred sme req. This is just info"),
Viral Modid440e682013-03-06 02:25:31 -08001616 psessionEntry->p2pGoPsNoaStartInd.status);
Viral Modid86bde22012-12-10 13:09:21 -08001617 }
Viral Modid86bde22012-12-10 13:09:21 -08001618 break;
1619 }
1620 }
Viral Modid440e682013-03-06 02:25:31 -08001621
1622 if (p2pGOExists == 0)
1623 {
1624 limLog(pMac, LOGW, FL("By the time, we received NOA start, GO is already removed."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001625 " - still go ahead with deferred sme req. This is just info"));
Viral Modid440e682013-03-06 02:25:31 -08001626 }
1627
1628 /* We received the NOA start indication. Now we can send down the SME request which requires off-channel operation */
1629 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301630 vos_mem_free(limMsg->bodyptr);
Viral Modid86bde22012-12-10 13:09:21 -08001631 limMsg->bodyptr = NULL;
Viral Modid440e682013-03-06 02:25:31 -08001632 }
Viral Modid86bde22012-12-10 13:09:21 -08001633 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301634#ifdef FEATURE_WLAN_TDLS
1635 case SIR_HAL_TDLS_IND:
1636 {
1637 tSirTdlsInd *pTdlsInd = (tpSirTdlsInd)limMsg->bodyptr ;
1638 tpDphHashNode pStaDs = NULL ;
1639 tpPESession psessionEntry = NULL;
1640 tANI_U8 sessionId;
1641 if((psessionEntry = peFindSessionByStaId(pMac,pTdlsInd->staIdx,&sessionId))== NULL)
1642 {
1643 limLog(pMac, LOG1, FL("session does not exist for given bssId\n"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301644 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301645 limMsg->bodyptr = NULL;
1646 return;
1647 }
1648 if ((pStaDs = dphGetHashEntry(pMac, pTdlsInd->assocId, &psessionEntry->dph.dphHashTable)) == NULL)
1649 {
1650 limLog(pMac, LOG1, FL("pStaDs Does not exist for given staId\n"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301651 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301652 limMsg->bodyptr = NULL;
1653 return;
1654 }
Viral Modid86bde22012-12-10 13:09:21 -08001655
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301656 if ((STA_ENTRY_TDLS_PEER == pStaDs->staType))
1657 {
1658 limLog(pMac, LOGE,
1659 FL("received TDLS Indication from the Firmware with Reason Code %d "),
1660 pTdlsInd->reasonCode);
1661 limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry,
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05301662 pTdlsInd->reasonCode);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301663 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301664 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301665 limMsg->bodyptr = NULL;
1666 }
1667 break;
1668#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001669 case SIR_HAL_P2P_NOA_ATTR_IND:
1670 {
1671 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1672 tANI_U8 i;
1673
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001674 limLog(pMac, LOGW, FL("Received message Noa_ATTR %x"), limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001675 for(i=0; i < pMac->lim.maxBssId; i++)
1676 {
Viral Modid86bde22012-12-10 13:09:21 -08001677 psessionEntry = &pMac->lim.gpSession[i];
1678 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001679 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1680 { //Save P2P attributes for P2P Go persona
1681
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301682 vos_mem_copy(&psessionEntry->p2pGoPsUpdate, limMsg->bodyptr,
1683 sizeof(tSirP2PNoaAttr));
1684
Arif Hussain24bafea2013-11-15 15:10:03 -08001685 limLog(pMac, LOG2, FL(" &psessionEntry->bssId "
1686 MAC_ADDRESS_STR " ctWin=%d oppPsFlag=%d"),
1687 MAC_ADDR_ARRAY(psessionEntry->bssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001688 psessionEntry->p2pGoPsUpdate.ctWin,
1689 psessionEntry->p2pGoPsUpdate.oppPsFlag);
1690
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001691 limLog(pMac, LOG2, FL(" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001692 psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt,
1693 psessionEntry->p2pGoPsUpdate.uNoa1Duration,
1694 psessionEntry->p2pGoPsUpdate.uNoa1Interval,
1695 psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
1696
1697
1698 break;
1699 }
1700 }
1701
1702 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301703 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001704 limMsg->bodyptr = NULL;
1705
1706 break;
1707
1708
Jeff Johnson295189b2012-06-20 16:38:30 -07001709 /* eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER Message comes after the
1710 * device comes out of full power for the full power request sent
1711 * because of channel switch with switch count as 0, so call the same
1712 * function used in timeout case(i.e SIR_LIM_CHANNEL_SWITCH_TIMEOUT)
1713 * for switching the channel*/
1714 case eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER:
Jeff Johnsone7245742012-09-05 17:12:55 -07001715 if ( !tx_timer_running(&pMac->lim.limTimers.gLimChannelSwitchTimer) )
1716 {
1717 limProcessChannelSwitchTimeout(pMac);
1718 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301719 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001720 limMsg->bodyptr = NULL;
1721 break;
1722
1723 //Power Save Related Messages From HAL
1724 case WDA_ENTER_BMPS_RSP:
1725 case WDA_EXIT_BMPS_RSP:
1726 case WDA_EXIT_BMPS_IND:
1727 case WDA_ENTER_IMPS_RSP:
1728 case WDA_EXIT_IMPS_RSP:
1729 case WDA_ENTER_UAPSD_RSP:
1730 case WDA_EXIT_UAPSD_RSP:
1731 case WDA_WOWL_ENTER_RSP:
1732 case WDA_WOWL_EXIT_RSP:
1733 pmmProcessMessage(pMac, limMsg);
1734 break;
1735
1736 case WDA_LOW_RSSI_IND:
1737 //limHandleLowRssiInd(pMac);
1738 break;
1739
1740 case WDA_BMPS_STATUS_IND:
1741 limHandleBmpsStatusInd(pMac);
1742 break;
1743
1744 case WDA_MISSED_BEACON_IND:
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001745 limHandleMissedBeaconInd(pMac, limMsg);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301746 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001747 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001748 break;
1749 case WDA_MIC_FAILURE_IND:
1750 limMicFailureInd(pMac, limMsg);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301751 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001752 limMsg->bodyptr = NULL;
1753 break;
1754
1755
Jeff Johnson295189b2012-06-20 16:38:30 -07001756
1757 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1758 limProcessSmeReqMessages(pMac,limMsg);
1759 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001760#ifdef FEATURE_WLAN_ESE
1761 case SIR_LIM_ESE_TSM_TIMEOUT:
1762#ifndef FEATURE_WLAN_ESE_UPLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001763 limProcessTsmTimeoutHandler(pMac,limMsg);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001764#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001765 break;
1766 case WDA_TSM_STATS_RSP:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001767#ifdef FEATURE_WLAN_ESE_UPLOAD
1768 limSendSmePEEseTsmRsp(pMac, (tAniGetTsmStatsRsp *)limMsg->bodyptr);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001769#else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001770 limProcessHalEseTsmRsp(pMac, limMsg);
1771#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001772 break;
1773#endif
1774 case WDA_ADD_TS_RSP:
1775 limProcessHalAddTsRsp(pMac, limMsg);
1776 break;
1777
1778 case SIR_LIM_DEL_TS_IND:
1779 limProcessDelTsInd(pMac, limMsg);
Madan Mohan Koyyalamudif244d8f2012-11-29 11:21:05 -08001780 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001781 case SIR_LIM_ADD_BA_IND:
1782 limProcessAddBaInd(pMac, limMsg);
1783 break;
1784 case SIR_LIM_DEL_BA_ALL_IND:
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001785 limDelAllBASessions(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001786 break;
1787 case SIR_LIM_DEL_BA_IND:
1788 limProcessMlmHalBADeleteInd( pMac, limMsg );
1789 break;
1790
1791 case SIR_LIM_BEACON_GEN_IND: {
Jeff Johnson295189b2012-06-20 16:38:30 -07001792
Jeff Johnson295189b2012-06-20 16:38:30 -07001793 if( pMac->lim.gLimSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07001794 schProcessPreBeaconInd(pMac, limMsg);
1795
1796 }
1797 break;
1798
1799 case SIR_LIM_DELETE_STA_CONTEXT_IND:
1800 limDeleteStaContext(pMac, limMsg);
1801 break;
1802
1803 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1804 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1805 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1806 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001807 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001808 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1809 case SIR_LIM_AUTH_RSP_TIMEOUT:
1810 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1811 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1812#ifdef WLAN_FEATURE_VOWIFI_11R
1813 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
1814#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001815 case SIR_LIM_REMAIN_CHN_TIMEOUT:
Viral Modid86bde22012-12-10 13:09:21 -08001816 case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT:
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001817 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
1818 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
Gopichand Nakkalad492d202013-05-10 02:50:47 +05301819 case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
Jeff Johnson295189b2012-06-20 16:38:30 -07001820 // These timeout messages are handled by MLM sub module
1821
1822 limProcessMlmReqMessages(pMac,
1823 limMsg);
1824
1825 break;
1826
1827 case SIR_LIM_HEART_BEAT_TIMEOUT:
1828 /** check if heart beat failed, even if one Beacon
1829 * is rcvd within the Heart Beat interval continue
1830 * normal processing
1831 */
1832
1833 #if 0
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001834 PELOG1(limLog(pMac, LOG1, FL("Heartbeat timeout, SME %d, MLME %d, #bcn %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001835 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1836 pMac->lim.gLimRxedBeaconCntDuringHB);)
1837
1838 if(pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)
1839 limIbssHeartBeatHandle(pMac); //HeartBeat for peers.
1840 else
1841 /**
1842 * Heartbeat failure occurred on STA
1843 * This is handled by LMM sub module.
1844 */
1845 limHandleHeartBeatFailure(pMac);
1846
1847 break;
1848 #endif //TO SUPPORT BT-AMP
Yathish9f22e662012-12-10 14:21:35 -08001849 if (limIsSystemInScanState(pMac))
1850 {
1851 // System is in DFS (Learn) mode
1852 // Defer processsing this message
1853 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1854 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001855 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)"),
Yathish9f22e662012-12-10 14:21:35 -08001856 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1857 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1858 limLogSessionStates(pMac);
1859 }
1860 }
1861 else
1862 {
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001863 if (NULL == limMsg->bodyptr)
1864 {
1865 limHandleHeartBeatTimeout(pMac);
1866 }
1867 else
1868 {
1869 limHandleHeartBeatTimeoutForSession(pMac, (tpPESession)limMsg->bodyptr);
1870 }
Gopichand Nakkala78a6c812013-05-13 16:39:49 +05301871 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001872 break;
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001873
Jeff Johnson295189b2012-06-20 16:38:30 -07001874 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1875 limHandleHeartBeatFailureTimeout(pMac);
1876 break;
1877
1878 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001879 /**
1880 * Background scan timeout occurred on STA.
1881 * This is handled by LMM sub module.
1882 */
1883 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
1884
1885 //We will do background scan even in bcnps mode
1886 //if (pMac->sys.gSysEnableScanMode)
1887 pMac->lim.gLimReportBackgroundScanResults = FALSE;
1888 limTriggerBackgroundScan(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001889 break;
1890
Jeff Johnson295189b2012-06-20 16:38:30 -07001891 case SIR_LIM_CNF_WAIT_TIMEOUT:
1892
1893 /*
1894 ** Does not receive CNF or dummy packet
1895 **/
1896 limHandleCnfWaitTimeout(pMac, (tANI_U16) limMsg->bodyval);
1897
1898 break;
1899
1900 case SIR_LIM_KEEPALIVE_TIMEOUT:
1901 limSendKeepAliveToPeer(pMac);
1902
1903 break;
1904
1905 case SIR_LIM_RETRY_INTERRUPT_MSG:
1906 // Message from ISR upon TFP's max retry limit interrupt
1907
1908 break;
1909
1910 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
1911 // Message from ISR upon SP's Invalid session key interrupt
1912
1913 break;
1914
1915 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
1916 // Message from ISR upon SP's Invalid key ID interrupt
1917
1918 break;
1919
1920 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
1921 // Message from ISR upon SP's Replay threshold interrupt
1922
1923 break;
1924
1925 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
1926 limProcessChannelSwitchTimeout(pMac);
1927 break;
1928
1929 case SIR_LIM_QUIET_TIMEOUT:
1930 limProcessQuietTimeout(pMac);
1931 break;
1932
1933 case SIR_LIM_QUIET_BSS_TIMEOUT:
1934 limProcessQuietBssTimeout(pMac);
1935 break;
1936
Jeff Johnson295189b2012-06-20 16:38:30 -07001937 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
1938 limHandleUpdateOlbcCache(pMac);
1939 break;
1940#if 0
1941 case SIR_LIM_WPS_OVERLAP_TIMEOUT:
1942 limProcessWPSOverlapTimeout(pMac);
1943 break;
1944#endif
1945
Jeff Johnson295189b2012-06-20 16:38:30 -07001946
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001947#ifdef FEATURE_WLAN_TDLS_INTERNAL
1948 /*
1949 * Here discovery timer expires, now we can go ahead and collect all
1950 * the dicovery responses PE has process till now and send this
1951 * responses to SME..
1952 */
1953 case SIR_LIM_TDLS_DISCOVERY_RSP_WAIT:
1954 {
1955 //fetch the sessionEntry based on the sessionId
1956 tpPESession psessionEntry = peFindSessionBySessionId(pMac,
1957 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId) ;
1958 if(NULL == psessionEntry)
1959 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001960 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID %d"), pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId);
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001961 return;
1962 }
1963
1964 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001965 ("Discovery Rsp timer expires ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001966#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
1967 /* restore RXP filters */
1968 limSetLinkState(pMac, eSIR_LINK_FINISH_TDLS_DISCOVERY_STATE,
1969 psessionEntry->bssId) ;
1970#endif
1971 limSendSmeTdlsDisRsp(pMac, eSIR_SUCCESS,
1972 eWNI_SME_TDLS_DISCOVERY_START_RSP) ;
1973 break ;
1974 }
1975
1976 /*
1977 * we initiated link setup and did not receive TDLS setup rsp
1978 * from TDLS peer STA, send failure RSP to SME.
1979 */
1980 case SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT:
1981 {
1982 tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
1983 tLimTdlsLinkSetupPeer *setupPeer = NULL ;
1984
1985 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001986 ("TDLS setup rsp timer expires ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001987 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Arif Hussaina7c8e412013-11-20 11:06:42 -08001988 ("TDLS setup rsp timer expires for peer:"
1989 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(peerMac));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001990
1991 limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
1992 if(NULL != setupPeer)
1993 {
1994 limTdlsDelLinkPeer( pMac, peerMac) ;
1995 }
1996
1997 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, peerMac,
1998 eWNI_SME_TDLS_LINK_START_RSP) ;
1999 break ;
2000 }
2001 case SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT:
2002 {
2003 tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
2004 tLimTdlsLinkSetupPeer *setupPeer = NULL ;
2005
2006 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002007 ("TDLS setup CNF timer expires ")) ;
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002008 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Arif Hussaina7c8e412013-11-20 11:06:42 -08002009 ("TDLS setup CNF timer expires for peer: "
2010 MAC_ADDRESS_STR), MAC_ADDR_ARRAY(peerMac));
Mohit Khanna698ba2a2012-12-04 15:08:18 -08002011 limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
2012 if(NULL != setupPeer)
2013 {
2014 limTdlsDelLinkPeer( pMac, peerMac) ;
2015 }
2016 break ;
2017 }
2018#endif /* FEATURE_WLAN_TDLS TIMER */
Jeff Johnson295189b2012-06-20 16:38:30 -07002019 case WDA_ADD_BSS_RSP:
2020 limProcessMlmAddBssRsp( pMac, limMsg );
2021 break;
2022
2023 case WDA_ADD_STA_RSP:
2024
2025 //call a wrapper by paasing bodyptr, their get sessionID and and call proper function from there.
2026 limProcessAddStaRsp(pMac,limMsg);
2027 break;
2028
2029 case WDA_DELETE_STA_RSP:
2030 limProcessMlmDelStaRsp(pMac, limMsg);
2031 break;
2032
2033 case WDA_ADD_STA_SELF_RSP:
2034 limProcessAddStaSelfRsp(pMac, limMsg);
2035 break;
2036 case WDA_DEL_STA_SELF_RSP:
2037 limProcessDelStaSelfRsp(pMac, limMsg);
2038 break;
2039
2040 case WDA_DELETE_BSS_RSP:
2041 limHandleDeleteBssRsp(pMac,limMsg); //wrapper routine to handle delete bss response
2042 break;
2043
2044 case WDA_SET_BSSKEY_RSP:
2045 case WDA_SET_STA_BCASTKEY_RSP:
2046 limProcessMlmSetBssKeyRsp( pMac, limMsg );
2047 break;
2048 case WDA_SET_STAKEY_RSP:
2049 limProcessMlmSetStaKeyRsp( pMac, limMsg );
2050 break;
2051 case WDA_REMOVE_BSSKEY_RSP:
2052 case WDA_REMOVE_STAKEY_RSP:
2053 limProcessMlmRemoveKeyRsp( pMac, limMsg );
2054 break;
2055 case WDA_ADDBA_RSP:
2056 limProcessMlmHalAddBARsp( pMac, limMsg );
2057 break;
2058
2059 case WDA_STA_STAT_RSP:
2060 case WDA_AGGR_STAT_RSP:
2061 case WDA_GLOBAL_STAT_RSP:
2062 case WDA_STAT_SUMM_RSP:
2063 limSendSmeStatsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
2064 break;
2065
2066 case WDA_GET_STATISTICS_RSP:
2067 limSendSmePEStatisticsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
2068 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002069#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002070 case WDA_GET_ROAM_RSSI_RSP:
2071 limSendSmePEGetRoamRssiRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
2072 break;
2073#endif
2074
Jeff Johnson295189b2012-06-20 16:38:30 -07002075
2076 case WDA_SET_MIMOPS_RSP: //limProcessSetMimoRsp(pMac, limMsg);
2077 case WDA_SET_TX_POWER_RSP: //limProcessSetTxPowerRsp(pMac, limMsg);
2078 case WDA_GET_TX_POWER_RSP: //limProcessGetTxPowerRsp(pMac, limMsg);
2079 case WDA_GET_NOISE_RSP:
2080 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2081 limMsg->bodyptr = NULL;
2082 //limProcessGetNoiseRsp(pMac, limMsg);
2083 break;
2084
2085 case WDA_SET_MAX_TX_POWER_RSP:
2086#if defined WLAN_FEATURE_VOWIFI
2087 rrmSetMaxTxPowerRsp( pMac, limMsg );
2088#endif
2089 if(limMsg->bodyptr != NULL)
2090 {
2091 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2092 limMsg->bodyptr = NULL;
2093 }
2094 break;
2095
Jeff Johnson295189b2012-06-20 16:38:30 -07002096 case SIR_LIM_ADDR2_MISS_IND:
2097 {
2098 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002099 FL("Addr2 mismatch interrupt received %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002100 limMsg->type);
2101 /*a message from HAL indicating addr2 mismatch interrupt occurred
2102 limMsg->bodyptr contains only pointer to 48-bit addr2 field*/
2103 //Dinesh fix this. the third parameter should be sessionentry.
2104 //limHandleUnknownA2IndexFrames(pMac, (void *)limMsg->bodyptr);
2105
2106 /*Free message body pointer*/
2107 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002108 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002109 break;
2110 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002111
2112#ifdef WLAN_FEATURE_VOWIFI_11R
2113 case WDA_AGGR_QOS_RSP:
2114 limProcessFTAggrQoSRsp( pMac, limMsg );
2115 break;
2116#endif
2117
2118 case WDA_SET_LINK_STATE_RSP:
2119 linkStateParams = (tLinkStateParams *)limMsg->bodyptr;
2120#if defined WLAN_FEATURE_VOWIFI_11R
2121 pSession = linkStateParams->session;
2122 if(linkStateParams->ft)
2123 {
2124 limSendReassocReqWithFTIEsMgmtFrame(pMac,
2125 pSession->pLimMlmReassocReq,
2126 pSession);
2127 }
2128#endif
2129 if( linkStateParams->callback )
2130 {
2131 linkStateParams->callback( pMac, linkStateParams->callbackArg );
2132 }
2133 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002134 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002135 break;
2136
2137#ifdef WLAN_FEATURE_PACKET_FILTERING
2138 case WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2139 pmmProcessMessage(pMac, limMsg);
2140 break;
2141#endif // WLAN_FEATURE_PACKET_FILTERING
2142
2143#ifdef WLAN_FEATURE_GTK_OFFLOAD
2144 case WDA_GTK_OFFLOAD_GETINFO_RSP:
2145 pmmProcessMessage(pMac, limMsg);
2146 break;
2147#endif // WLAN_FEATURE_GTK_OFFLOAD
Yathish9f22e662012-12-10 14:21:35 -08002148 case eWNI_SME_SET_BCN_FILTER_REQ:
2149 {
2150#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2151 tpPESession psessionEntry;
2152 tANI_U8 sessionId = (tANI_U8)limMsg->bodyval ;
2153 psessionEntry = &pMac->lim.gpSession[sessionId];
2154 if(psessionEntry != NULL && IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2155 {
2156 // sending beacon filtering information down to HAL
2157 if (limSendBeaconFilterInfo(pMac, psessionEntry) != eSIR_SUCCESS)
2158 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002159 limLog(pMac, LOGE, FL("Fail to send Beacon Filter Info "));
Yathish9f22e662012-12-10 14:21:35 -08002160 }
2161 }
Dhanashri Atred7885c22013-03-29 11:19:05 -07002162 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2163 limMsg->bodyptr = NULL;
Yathish9f22e662012-12-10 14:21:35 -08002164#endif
2165 }
2166 break;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302167 case eWNI_SME_HT40_OBSS_SCAN_IND:
2168 {
Sandeep Puligilla9f384742014-04-11 02:27:04 +05302169 tpPESession psessionEntry = NULL;
2170 tANI_U8 sessionId;
2171 tSirSmeHT40OBSSScanInd *ht40ScanInd =
Siddharth Bhald31c1252014-05-05 19:34:14 +05302172 (tSirSmeHT40OBSSScanInd *)limMsg->bodyptr;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302173
Sandeep Puligilla9f384742014-04-11 02:27:04 +05302174 psessionEntry = peFindSessionByBssid(pMac, ht40ScanInd->peerMacAddr,
Siddharth Bhald31c1252014-05-05 19:34:14 +05302175 &sessionId);
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302176
Siddharth Bhald31c1252014-05-05 19:34:14 +05302177 if (psessionEntry != NULL)
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302178 {
Siddharth Bhald31c1252014-05-05 19:34:14 +05302179 if( IS_HT40_OBSS_SCAN_FEATURE_ENABLE &&
2180 psessionEntry->htSupportedChannelWidthSet ==
2181 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE )
2182 {
2183 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
2184 "OBSS Scan Start Req: session id %d"
2185 "htSupportedChannelWidthSet %d", psessionEntry->peSessionId,
2186 psessionEntry->htSupportedChannelWidthSet);
2187 limSendHT40OBSSScanInd(pMac, psessionEntry);
2188 }
2189 else
2190 {
2191 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
2192 "OBSS Scan not started: htSupportedChannelWidthSet- %d"
2193 " session id %d", psessionEntry->htSupportedChannelWidthSet,
2194 psessionEntry->peSessionId);
2195 }
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302196 }
2197 else
2198 {
2199 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
Siddharth Bhald31c1252014-05-05 19:34:14 +05302200 "OBSS Scan not started: session id is NULL");
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302201 }
2202 vos_mem_free(limMsg->bodyptr);
2203 limMsg->bodyptr = NULL;
2204 }
2205 break;
2206 case eWNI_SME_HT40_STOP_OBSS_SCAN_IND:
2207 {
2208 tpPESession psessionEntry = NULL;
2209 tANI_U8 sessionId = (tANI_U8)limMsg->bodyval ;
2210
2211 psessionEntry = &pMac->lim.gpSession[sessionId];
2212 /* Sending LIM STOP OBSS SCAN Indication
2213 Stop command support is only for debugging purpose */
2214 if ( IS_HT40_OBSS_SCAN_FEATURE_ENABLE )
2215 limSendHT40OBSSStopScanInd(pMac, psessionEntry);
2216 else
2217 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_ERROR,
2218 "OBSS Scan Stop not started ");
2219 }
2220 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302221#ifdef FEATURE_WLAN_TDLS
2222 case WDA_SET_TDLS_LINK_ESTABLISH_REQ_RSP:
2223 {
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302224 tpPESession psessionEntry;
2225 tANI_U8 sessionId;
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05302226 tTdlsLinkEstablishParams *pTdlsLinkEstablishParams;
2227 pTdlsLinkEstablishParams = (tTdlsLinkEstablishParams*) limMsg->bodyptr;
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302228
2229 if((psessionEntry = peFindSessionByStaId(pMac,
2230 pTdlsLinkEstablishParams->staIdx,
2231 &sessionId))== NULL)
2232 {
2233 limLog(pMac, LOGE, FL("session %u does not exist.\n"), sessionId);
2234 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP message to SME
2235 with session id as zero and status as FAILURE so, that message
2236 queued in SME queue can be freed to prevent the SME cmd buffer leak */
2237 limSendSmeTdlsLinkEstablishReqRsp(pMac,
2238 0,
2239 NULL,
2240 NULL,
2241 eSIR_FAILURE);
2242 }
2243 else
2244 {
2245 limSendSmeTdlsLinkEstablishReqRsp(pMac,
2246 psessionEntry->smeSessionId,
2247 NULL,
2248 NULL,
2249 pTdlsLinkEstablishParams->status) ;
2250 }
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05302251 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2252 limMsg->bodyptr = NULL;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302253 break;
2254 }
Atul Mittal60bd4292014-08-14 12:19:27 +05302255
2256 case WDA_SET_TDLS_CHAN_SWITCH_REQ_RSP:
2257 {
2258 tpPESession psessionEntry;
2259 tANI_U8 sessionId;
2260 tTdlsChanSwitchParams *pTdlsChanSwitchParams;
2261 pTdlsChanSwitchParams = (tTdlsChanSwitchParams*) limMsg->bodyptr;
2262
2263 if((psessionEntry = peFindSessionByStaId(pMac,
2264 pTdlsChanSwitchParams->staIdx,
2265 &sessionId))== NULL)
2266 {
2267 limLog(pMac, LOGE, FL("session %u does not exist.\n"), sessionId);
2268 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP message to SME
2269 with session id as zero and status as FAILURE so, that message
2270 queued in SME queue can be freed to prevent the SME cmd buffer leak */
2271 limSendSmeTdlsChanSwitchReqRsp(pMac,
2272 0,
2273 NULL,
2274 NULL,
2275 eSIR_FAILURE);
2276 }
2277 else
2278 {
2279 limSendSmeTdlsChanSwitchReqRsp(pMac,
2280 psessionEntry->smeSessionId,
2281 NULL,
2282 NULL,
2283 pTdlsChanSwitchParams->status) ;
2284 }
2285 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2286 limMsg->bodyptr = NULL;
2287 break;
2288 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302289#endif
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05302290
2291 case WDA_RX_SCAN_EVENT:
2292 limProcessRxScanEvent(pMac, limMsg->bodyptr);
2293 break;
2294
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002295 case WDA_IBSS_PEER_INACTIVITY_IND:
2296 {
2297 limProcessIbssPeerInactivity(pMac, limMsg->bodyptr);
2298 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2299 limMsg->bodyptr = NULL;
2300 break;
2301 }
2302
Jeff Johnson295189b2012-06-20 16:38:30 -07002303 default:
2304 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2305 limMsg->bodyptr = NULL;
2306 // Unwanted messages
2307 // Log error
2308 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002309 FL("Discarding unexpected message received %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 limMsg->type);
2311 limPrintMsgName(pMac, LOGE, limMsg->type);
2312 break;
2313
2314 } // switch (limMsg->type)
2315
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002316 PELOG2(limLog(pMac, LOG2, FL("Done Processing msgType = %d, sme state = %s, mlm state = %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002317 limMsg->type, limSmeStateStr(pMac->lim.gLimSmeState),
2318 limMlmStateStr(pMac->lim.gLimMlmState));)
2319
2320} /*** end limProcessMessages() ***/
2321
2322
2323
2324/**
2325 * limProcessDeferredMessageQueue
2326 *
2327 *FUNCTION:
2328 * This function is called by LIM while exiting from Learn
2329 * mode. This function fetches messages posted to the LIM
2330 * deferred message queue limDeferredMsgQ.
2331 *
2332 *LOGIC:
2333 *
2334 *ASSUMPTIONS:
2335 * NA
2336 *
2337 *NOTE:
2338 * NA
2339 *
2340 * @param pMac - Pointer to Global MAC structure
2341 * @return None
2342 */
2343
2344void
2345limProcessDeferredMessageQueue(tpAniSirGlobal pMac)
2346{
2347 tSirMsgQ limMsg = { 0, 0, 0 };
2348
Jeff Johnson295189b2012-06-20 16:38:30 -07002349 tSirMsgQ *readMsg;
2350 tANI_U16 size;
2351
2352 /*
2353 ** check any deferred messages need to be processed
2354 **/
2355 size = pMac->lim.gLimDeferredMsgQ.size;
2356 if (size > 0)
2357 {
2358 while ((readMsg = limReadDeferredMsgQ(pMac)) != NULL)
2359 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302360 vos_mem_copy((tANI_U8*) &limMsg,
Jeff Johnson295189b2012-06-20 16:38:30 -07002361 (tANI_U8*) readMsg, sizeof(tSirMsgQ));
2362 size--;
2363 limProcessMessages(pMac, &limMsg);
2364
2365 if((limIsSystemInScanState(pMac)) || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) ||
2366 (pMac->lim.gLimSystemInScanLearnMode))
2367 break;
2368 }
2369 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002370} /*** end limProcessDeferredMessageQueue() ***/
2371
2372
2373/*
2374 * limProcessNormalHddMsg
2375 * Function: this function checks the current lim state and decide whether the message passed shall be deffered.
2376 * @param pMac - Pointer to Global MAC structure
2377 * pLimMsg -- the message need to be processed
2378 * fRspReqd -- whether return result to hdd
2379 * @return None
2380 */
2381void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd)
2382{
2383 tANI_BOOLEAN fDeferMsg = eANI_BOOLEAN_TRUE;
2384
2385 /* Added For BT-AMP Support */
2386 if ((pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_AP_ROLE )
2387 ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_STA_ROLE)
2388 ||(pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE))
2389 {
2390 /** This check is required only for the AP and in 2 cases.
2391 * 1. If we are in learn mode and we receive any of these messages,
2392 * you have to come out of scan and process the message, hence dont
2393 * defer the message here. In handler, these message could be defered
2394 * till we actually come out of scan mode.
2395 * 2. If radar is detected, you might have to defer all of these
2396 * messages except Stop BSS request/ Switch channel request. This
2397 * decision is also made inside its handler.
2398 *
2399 * Please be careful while using the flag fDeferMsg. Possibly you
2400 * might end up in an infinite loop.
2401 **/
2402 if (((pLimMsg->type == eWNI_SME_START_BSS_REQ) ||
2403 (pLimMsg->type == eWNI_SME_STOP_BSS_REQ) ||
2404 (pLimMsg->type == eWNI_SME_SWITCH_CHL_REQ) ||
2405 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ) ||
2406 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ)))
2407 {
2408 fDeferMsg = eANI_BOOLEAN_FALSE;
2409 }
2410 }
2411
2412 /* limInsystemInscanState() refers the psessionEntry, how to get session Entry????*/
Jeff Johnsone7245742012-09-05 17:12:55 -07002413 if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) /*||
2414 (LIM_IS_RADAR_DETECTED(pMac))*/) && fDeferMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002415 {
2416 // System is in DFS (Learn) mode or awaiting addts response
2417 // or if radar is detected, Defer processsing this message
2418 if (limDeferMsg(pMac, pLimMsg) != TX_SUCCESS)
2419 {
2420#ifdef WLAN_DEBUG
2421 pMac->lim.numSme++;
2422#endif
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002423 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 -07002424 pLimMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
2425 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
2426 limLogSessionStates(pMac);
2427 limPrintMsgName(pMac, LOGE, pLimMsg->type);
2428 // Release body
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302429 vos_mem_free(pLimMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002430 pLimMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002431 }
2432 }
2433 else
2434 {
2435 if(fRspReqd)
2436 {
2437 // These messages are from HDD
2438 // Since these requests may also be generated
2439 // internally within LIM module, need to
2440 // distinquish and send response to host
2441 pMac->lim.gLimRspReqd = eANI_BOOLEAN_TRUE;
2442 }
2443#ifdef WLAN_DEBUG
2444 pMac->lim.numSme++;
2445#endif
2446 if(limProcessSmeReqMessages(pMac, pLimMsg))
2447 {
2448 // Release body
2449 // limProcessSmeReqMessage consumed the buffer. We can free it.
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302450 vos_mem_free(pLimMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002451 pLimMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002452 }
2453 }
2454}
2455
2456void
Jeff Johnsone7245742012-09-05 17:12:55 -07002457handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002458{
2459 tSirMacHTCapabilityInfo macHTCapabilityInfo;
2460 tSirMacHTParametersInfo macHTParametersInfo;
2461 tSirMacHTInfoField1 macHTInfoField1;
2462 tSirMacHTInfoField2 macHTInfoField2;
2463 tSirMacHTInfoField3 macHTInfoField3;
2464 tANI_U32 cfgValue;
2465 tANI_U8 *ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002466
Jeff Johnson295189b2012-06-20 16:38:30 -07002467 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) != eSIR_SUCCESS)
2468 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002469 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002470 return ;
2471 }
2472 ptr = (tANI_U8 *) &macHTCapabilityInfo;
2473 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2474 pMac->lim.gHTLsigTXOPProtection = (tANI_U8)macHTCapabilityInfo.lsigTXOPProtection;
2475 pMac->lim.gHTMIMOPSState = (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
2476 pMac->lim.gHTGreenfield = (tANI_U8)macHTCapabilityInfo.greenField;
2477 pMac->lim.gHTMaxAmsduLength = (tANI_U8)macHTCapabilityInfo.maximalAMSDUsize;
2478 pMac->lim.gHTShortGI20Mhz = (tANI_U8)macHTCapabilityInfo.shortGI20MHz;
2479 pMac->lim.gHTShortGI40Mhz = (tANI_U8)macHTCapabilityInfo.shortGI40MHz;
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 pMac->lim.gHTPSMPSupport = (tANI_U8)macHTCapabilityInfo.psmp;
2481 pMac->lim.gHTDsssCckRate40MHzSupport = (tANI_U8)macHTCapabilityInfo.dsssCckMode40MHz;
2482
2483 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) != eSIR_SUCCESS)
2484 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002485 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002486 return ;
2487 }
2488 ptr = (tANI_U8 *) &macHTParametersInfo;
2489 *ptr = (tANI_U8) (cfgValue & 0xff);
2490 pMac->lim.gHTAMpduDensity = (tANI_U8)macHTParametersInfo.mpduDensity;
2491 pMac->lim.gHTMaxRxAMpduFactor = (tANI_U8)macHTParametersInfo.maxRxAMPDUFactor;
2492
2493 // Get HT IE Info
2494 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) != eSIR_SUCCESS)
2495 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002496 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002497 return ;
2498 }
2499 ptr = (tANI_U8 *) &macHTInfoField1;
2500 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
2501 pMac->lim.gHTServiceIntervalGranularity = (tANI_U8)macHTInfoField1.serviceIntervalGranularity;
2502 pMac->lim.gHTControlledAccessOnly = (tANI_U8)macHTInfoField1.controlledAccessOnly;
2503 pMac->lim.gHTRifsMode = (tANI_U8)macHTInfoField1.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002504
2505 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) != eSIR_SUCCESS)
2506 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002507 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002508 return ;
2509 }
2510 ptr = (tANI_U8 *) &macHTInfoField2;
2511 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2512 pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
2513
2514 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) != eSIR_SUCCESS)
2515 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002516 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002517 return ;
2518 }
2519 ptr = (tANI_U8 *) &macHTInfoField3;
2520 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2521 pMac->lim.gHTPCOActive = (tANI_U8)macHTInfoField3.pcoActive;
2522 pMac->lim.gHTPCOPhase = (tANI_U8)macHTInfoField3.pcoPhase;
Jeff Johnson295189b2012-06-20 16:38:30 -07002523 pMac->lim.gHTSecondaryBeacon = (tANI_U8)macHTInfoField3.secondaryBeacon;
2524 pMac->lim.gHTDualCTSProtection = (tANI_U8)macHTInfoField3.dualCTSProtection;
2525 pMac->lim.gHTSTBCBasicMCS = (tANI_U8)macHTInfoField3.basicSTBCMCS;
Jeff Johnsone7245742012-09-05 17:12:55 -07002526
2527 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2528 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
2529 * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
2530 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2531 */
2532 if (psessionEntry != NULL)
2533 {
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302534 psessionEntry->htCapability =
2535 IS_DOT11_MODE_HT(psessionEntry->dot11mode);
2536 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2537 (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05302538 limInitOBSSScanParams(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002539 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002540}
2541
2542void limLogSessionStates(tpAniSirGlobal pMac)
2543{
2544#ifdef WLAN_DEBUG
2545 int i;
2546
2547 for(i = 0; i < pMac->lim.maxBssId; i++)
2548 {
2549 if(pMac->lim.gpSession[i].valid)
2550 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07002551 PELOG1(limLog(pMac, LOG1, FL("Session[%d] sysRole(%d) limSmeState %d (prev sme state %d) mlm state %d (prev mlm state %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002552 i, pMac->lim.gpSession[i].limSystemRole, pMac->lim.gpSession[i].limSmeState,
2553 pMac->lim.gpSession[i].limPrevSmeState, pMac->lim.gpSession[i].limMlmState,
2554 pMac->lim.gpSession[i].limPrevMlmState);)
2555 }
2556 }
2557#endif //ifdef WLAN_DEBUG
2558}