blob: cf8a6f554fd6bbb06a78c1bdc4889ed5c6807794 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Satyanarayana Dash6f438272015-03-03 18:01:06 +05302 * Copyright (c) 2012-2015 The Linux Foundation. All rights reserved.
Kiet Lam842dad02014-02-18 18:44:02 -08003 *
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
Satyanarayana Dash6f438272015-03-03 18:01:06 +053047#include "wniCfg.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
Hema Aparna Medicharlab56b6612015-05-18 11:42:52 +0530153 (limMsg->type != WDA_ADD_TS_RSP) &&
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +0530154 (limMsg->type != WDA_LOST_LINK_PARAMS_IND) &&
Hema Aparna Medicharlab56b6612015-05-18 11:42:52 +0530155 /* Allow processing of RX frames while awaiting reception of
156 ADD TS response over the air. This logic particularly handles the
157 case when host sends ADD BA request to FW after ADD TS request
158 is sent over the air and ADD TS response received over the air */
159 !(limMsg->type == SIR_BB_XPORT_MGMT_MSG && pMac->lim.gLimAddtsSent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700160 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700161 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 -0700162 limMsgStr(limMsg->type));)
163
164 // Defer processsing this message
165 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
166 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700167 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 -0700168 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
169 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
170 limLogSessionStates(pMac);
171 limHandleDeferMsgError(pMac, limMsg);
172
173 }
174 return true;
175 }
176 }
177 return false;
178}
179
180/*
181* Beacon Handling Cases:
182* during scanning, when no session is active:
183* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
184* during scanning, when any session is active, but beacon/Pr does not belong to that session, psessionEntry will be null.
185* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
186* during scanning, when any session is active, and beacon/Pr belongs to one of the session, psessionEntry will not be null.
187* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
188* Not scanning, no session:
189* there should not be any beacon coming, if coming, should be dropped.
190* Not Scanning,
191*/
192static void
193__limHandleBeacon(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tpPESession psessionEntry)
194{
195 /* checking for global SME state...*/
196 tANI_U8 *pRxPacketInfo;
197 limGetBDfromRxPacket(pMac, pMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
198
199 //This function should not be called if beacon is received in scan state.
200 //So not doing any checks for the global state.
201
202 if(psessionEntry == NULL)
203 {
204 schBeaconProcess(pMac, pRxPacketInfo, NULL);
205 }
206 else if( (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
207 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE))
208 {
209 schBeaconProcess(pMac, pRxPacketInfo, psessionEntry);
210 }
211 else
212 limProcessBeaconFrame(pMac, pRxPacketInfo, psessionEntry);
213
214 return;
215}
216
217
218//Fucntion prototype
219void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd);
220
221/**
Jeff Johnson295189b2012-06-20 16:38:30 -0700222 * limDeferMsg()
223 *
224 *FUNCTION:
225 * This function is called to defer the messages received
226 * during Learn mode
227 *
228 *LOGIC:
229 * NA
230 *
231 *ASSUMPTIONS:
232 * NA
233 *
234 *NOTE:
235 * NA
236 *
237 * @param pMac - Pointer to Global MAC structure
238 * @param pMsg of type tSirMsgQ - Pointer to the message structure
239 * @return None
240 */
241
242tANI_U32
243limDeferMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
244{
245 tANI_U32 retCode = TX_SUCCESS;
Jeff Johnson77165482013-03-07 08:15:44 -0800246
247 retCode = limWriteDeferredMsgQ(pMac, pMsg);
248
Jeff Johnson295189b2012-06-20 16:38:30 -0700249 if (retCode == TX_SUCCESS)
Jeff Johnson77165482013-03-07 08:15:44 -0800250 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530251 limLog(pMac, LOG1,
252 FL("Deferred message(0x%X) limSmeState %d (prev sme state %d)"
253 " sysRole %d mlm state %d (prev mlm state %d)"),
254 pMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
255 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState,
256 pMac->lim.gLimPrevMlmState);
Jeff Johnson77165482013-03-07 08:15:44 -0800257 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));)
258 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700259 else
Jeff Johnson77165482013-03-07 08:15:44 -0800260 {
Agarwal Ashishe865f332014-04-08 13:20:06 +0530261 limLog(pMac, LOG1, FL("Dropped lim message (0x%X)"), pMsg->type);
Jeff Johnson77165482013-03-07 08:15:44 -0800262 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));)
263 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700264
265 return retCode;
266} /*** end limDeferMsg() ***/
267
268
269
270/**
271 * limHandleFramesInScanState()
272 *
273 *FUNCTION:
274 * This function is called to process 802.11 frames
275 * received by LIM in scan state.
276 *
277 *LOGIC:
278 * NA
279 *
280 *ASSUMPTIONS:
281 * NA
282 *
283 *NOTE:
284 * NA
285 *
286 * @param pMac - Pointer to Global MAC structure
287 * @param limMsg - Received message
288 * @param pRxPacketInfo - Pointer to Rx packet info structure
289 * @param deferMsg - Indicates whether the frame shall be deferred
290 * @return None
291 */
292
293static void
294limHandleFramesInScanState(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pRxPacketInfo, tANI_U8 *deferMsg, tpPESession psessionEntry)
295{
296 tSirMacFrameCtl fc;
297 tpSirMacMgmtHdr pHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -0700298
299 *deferMsg = false;
300 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
301 fc = pHdr->fc;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700302 limLog( pMac, LOG2, FL("ProtVersion %d, Type %d, Subtype %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700303 fc.protVer, fc.type, fc.subType );
304
Jeff Johnson295189b2012-06-20 16:38:30 -0700305 // defer all message in scan state except for Beacons and Probe Response
306 if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_BEACON))
307 {
308 if (psessionEntry == NULL)
309 limProcessBeaconFrameNoSession(pMac, pRxPacketInfo);
310 else
311 limProcessBeaconFrame(pMac, pRxPacketInfo,psessionEntry);
312 }
313 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_RSP))
314 {
315 if (psessionEntry == NULL)
316 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
317 else
318 limProcessProbeRspFrame(pMac, pRxPacketInfo,psessionEntry);
319 }
320 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_REQ))
321 {
322 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo, psessionEntry);
323 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700324 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_ACTION))
325 {
326 limProcessActionFrameNoSession( pMac, pRxPacketInfo);
327 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700328 else
329 {
330 *deferMsg = true;
331 return;
332 }
333
Jeff Johnson295189b2012-06-20 16:38:30 -0700334 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
335 return;
336
337} /*** end limHandleFramesInScanState() ***/
338
339/** ------------------------------------------------------------
340\brief This function handles Unknown Unicast (A2 Index)
341\ packets.
342\param tpAniSirGlobal pMac Global Mac data structure
343\param void *pRxPacketInfo Pointer to Buffer Descriptor
344\return none
345\
346\ -------------------------------------------------------------- */
347static void limHandleUnknownA2IndexFrames(tpAniSirGlobal pMac, void *pRxPacketInfo,tpPESession psessionEntry)
348{
Jeff Johnson295189b2012-06-20 16:38:30 -0700349 /* addr2 mismatch interrupt occurred this means previous
350 disassociation was not successful
351 In Volans pRxPacketInfo only contains pointer 48-bit address2 field */
352 /*Send disassociation message again*/
353 //Dinesh need one more arguement.
354 //limSendDisassocMgmtFrame(pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON,(tANI_U8 *) pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800355 //TODO: verify this
Jeff Johnson295189b2012-06-20 16:38:30 -0700356 //This could be a public action frame.
357 if( psessionEntry->limSystemRole == eLIM_P2P_DEVICE_ROLE )
358 limProcessActionFrameNoSession(pMac, (tANI_U8 *) pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800359
360#ifdef FEATURE_WLAN_TDLS
361 {
362 tpSirMacDataHdr3a pMacHdr;
363 pMacHdr = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
364
365 if (limIsGroupAddr(pMacHdr->addr2))
366 {
Abhishek Singh525045c2014-12-15 17:18:45 +0530367 limLog(pMac, LOG1, FL("Ignoring A2 Invalid Packet received for MC/BC:"));
368 limPrintMacAddr(pMac, pMacHdr->addr2, LOG1);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800369
370 return;
371 }
372 /* TDLS_hklee: move down here to reject Addr2 == Group (first checking above)
373 and also checking if SystemRole == STA */
374 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
375 {
376 /* ADD handling of Public Action Frame */
377 LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700378 ("limHandleUnknownA2IndexFrames: type=0x%x, subtype=0x%x"),pMacHdr->fc.type, pMacHdr->fc.subType));
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800379 switch (pMacHdr->fc.type)
380 {
381 case SIR_MAC_MGMT_FRAME:
382 {
383 switch (pMacHdr->fc.subType)
384 {
385 case SIR_MAC_MGMT_ACTION:
386 {
387 limProcessActionFrame(pMac, pRxPacketInfo, psessionEntry) ;
388 break ;
389 }
390 default:
391 {
392 break ;
393 }
394 }
395 }
396 default:
397 {
398 break ;
399 }
400 }
401 }
402 }
403#endif
404
Jeff Johnson295189b2012-06-20 16:38:30 -0700405
406 return;
407}
408
Jeff Johnson295189b2012-06-20 16:38:30 -0700409/**
410 * limCheckMgmtRegisteredFrames()
411 *
412 *FUNCTION:
413 * This function is called to process to check if received frame match with
414 * any of the registered frame from HDD. If yes pass this frame to SME.
415 *
416 *LOGIC:
417 *
418 *ASSUMPTIONS:
419 *
420 *NOTE:
421 *
422 * @param pMac Pointer to Global MAC structure
423 * @param *pBd Pointer to the received Buffer Descriptor+payload
424 * @param *psessionEntry Pointer to session on which packet is received
425 * @return None
426 */
427static tANI_BOOLEAN
428limCheckMgmtRegisteredFrames(tpAniSirGlobal pMac, tANI_U8 *pBd,
429 tpPESession psessionEntry)
430{
431 tSirMacFrameCtl fc;
432 tpSirMacMgmtHdr pHdr;
433 tANI_U8 *pBody;
434 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
435 tANI_U16 frameType;
436 tANI_U16 framelen;
437 tANI_U8 type,subType;
438 tANI_BOOLEAN match = VOS_FALSE;
439 VOS_STATUS vosStatus;
440
441 pHdr = WDA_GET_RX_MAC_HEADER(pBd);
442 fc = pHdr->fc;
443 frameType = (fc.type << 2 ) | (fc.subType << 4);
444 pBody = WDA_GET_RX_MPDU_DATA(pBd);
445 framelen = WDA_GET_RX_PAYLOAD_LEN(pBd);
446
447 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
448 (vos_list_node_t**)&pLimMgmtRegistration);
449
450 while(pLimMgmtRegistration != NULL)
451 {
452 type = (pLimMgmtRegistration->frameType >> 2) & 0x03;
453 subType = (pLimMgmtRegistration->frameType >> 4) & 0x0f;
454 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
455 && (subType == SIR_MAC_MGMT_RESERVED15) )
456 {
457 limLog( pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700458 FL("rcvd frame match with SIR_MAC_MGMT_RESERVED15"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700459 match = VOS_TRUE;
460 break;
461 }
462
463 if (pLimMgmtRegistration->frameType == frameType)
464 {
465 if (pLimMgmtRegistration->matchLen > 0)
466 {
467 if (pLimMgmtRegistration->matchLen <= framelen)
468 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530469 if (vos_mem_compare(pLimMgmtRegistration->matchData,
Jeff Johnson295189b2012-06-20 16:38:30 -0700470 pBody, pLimMgmtRegistration->matchLen))
471 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700472 /* found match! */
473 match = VOS_TRUE;
474 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700475 }
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700476 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 }
478 else
479 {
480 /* found match! */
481 match = VOS_TRUE;
482 break;
483 }
484 }
485
486 vosStatus =
487 vos_list_peek_next ( &pMac->lim.gLimMgmtFrameRegistratinQueue,
488 (vos_list_node_t*) pLimMgmtRegistration,
489 (vos_list_node_t**) &pNext );
490 pLimMgmtRegistration = pNext;
491 pNext = NULL;
492 }
493
494 if (match)
495 {
496 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700497 FL("rcvd frame match with registered frame params"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700498
499 /* Indicate this to SME */
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +0530500 limSendSmeMgmtFrameInd( pMac, pLimMgmtRegistration->sessionId,
501 pBd, psessionEntry, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700502
503 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
504 && (subType == SIR_MAC_MGMT_RESERVED15) )
505 {
506 // These packets needs to be processed by PE/SME as well as HDD.
507 // If it returns TRUE here, the packet is forwarded to HDD only.
508 match = VOS_FALSE;
509 }
510 }
511
512 return match;
513} /*** end limCheckMgmtRegisteredFrames() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700514
Dino Mycle7a76e662014-06-10 11:36:34 +0530515#ifdef WLAN_FEATURE_EXTSCAN
516
517void
518limProcessEXTScanRealTimeData(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
519{
520 tpSirMacMgmtHdr pHdr = NULL;
521 eHalStatus status;
522 void *pCallbackContext;
523 tANI_U8 rfBand = 0;
524 tANI_U8 rxChannelInBD = 0;
525 tSirMacFrameCtl fc;
526 tDot11fBeacon *pBeacon = NULL;
527 tDot11fProbeResponse *pProbeResponse = NULL;
528 tSirWifiFullScanResultEvent tEXTScanFullScanResult;
529
530 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
531 fc = pHdr->fc;
532
533 limLog(pMac, LOG2,
534 FL("Received EXTScan Real Time data with length=%d from "),
535 WDA_GET_RX_MPDU_LEN(pRxPacketInfo));
536
537 limPrintMacAddr(pMac, pHdr->sa, LOG2);
538
539 vos_mem_set((tANI_U8 *) &tEXTScanFullScanResult,
540 sizeof(tSirWifiFullScanResultEvent), 0);
541
Dino Mycle3f783bc2014-08-08 17:40:22 +0530542 tEXTScanFullScanResult.ap.ts = vos_get_monotonic_boottime();
Dino Mycle7a76e662014-06-10 11:36:34 +0530543
544 vos_mem_copy(&tEXTScanFullScanResult.ap.bssid,
545 pHdr->bssId, sizeof(tSirMacAddr));
546
Dino Myclee8843b32014-07-04 14:21:45 +0530547 limPrintMacAddr(pMac, pHdr->bssId, LOG2);
Dino Mycle7a76e662014-06-10 11:36:34 +0530548
549
550 rfBand = WDA_GET_RX_RFBAND(pRxPacketInfo);
551 rxChannelInBD = WDA_GET_RX_CH(pRxPacketInfo);
552
553 if ((!rfBand) || IS_5G_BAND(rfBand))
554 {
555 rxChannelInBD = limUnmapChannel(rxChannelInBD);
556 }
557
c_hpothu24b354c2014-09-24 18:59:33 +0530558 tEXTScanFullScanResult.ap.channel =
559 (tANI_U32)vos_chan_to_freq(rxChannelInBD);
Dino Mycle7a76e662014-06-10 11:36:34 +0530560 tEXTScanFullScanResult.ap.rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
561
562 if (fc.subType == SIR_MAC_MGMT_BEACON)
563 {
564 limLog( pMac, LOG2, FL("Beacon "));
565
566 pBeacon = vos_mem_malloc(sizeof(tDot11fBeacon));
567 if ( NULL == pBeacon ){
568 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
569 return;
570 }
571
572 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
573 // delegate to the framesc-generated code,
574 status = dot11fUnpackBeacon( pMac,
575 (tANI_U8 *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo),
576 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo), pBeacon );
577
578 if ( DOT11F_FAILED( status ) )
579 {
580 limLog(pMac, LOGE, FL("Failed to parse a Beacons"
Sushant Kaushik87787972015-09-11 16:05:00 +0530581 "(%d)"), status);
Dino Mycle7a76e662014-06-10 11:36:34 +0530582 vos_mem_free(pBeacon);
583 return;
584 }
585 if ( pBeacon->SSID.present )
586 {
587 vos_mem_copy(tEXTScanFullScanResult.ap.ssid,
588 pBeacon->SSID.ssid,
589 pBeacon->SSID.num_ssid);
590 }
591 //NULL Terminate the string.
592 tEXTScanFullScanResult.ap.ssid[pBeacon->SSID.num_ssid] = 0;
593 tEXTScanFullScanResult.ap.beaconPeriod =
594 pBeacon->BeaconInterval.interval;
595 tEXTScanFullScanResult.ap.capability =
596 *((tANI_U16 *)&pBeacon->Capabilities);
597 vos_mem_free(pBeacon);
598 }
599 else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP)
600 {
601 limLog( pMac, LOG2, FL("Probe rsp "));
602
603 pProbeResponse = vos_mem_malloc(sizeof(tDot11fProbeResponse));
604 if ( NULL == pProbeResponse ){
605 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
606 return;
607 }
608
609 vos_mem_set( ( tANI_U8* )pProbeResponse,
610 sizeof(tDot11fProbeResponse), 0);
611 //delegate to the framesc-generated code,
612 status = dot11fUnpackProbeResponse( pMac,
613 (tANI_U8 *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo),
614 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo), pProbeResponse );
615
616 if ( DOT11F_FAILED( status ) )
617 {
618 limLog(pMac, LOGE, FL("Failed to parse a Probe"
Sushant Kaushik87787972015-09-11 16:05:00 +0530619 "Response (%d"), status);
Dino Mycle7a76e662014-06-10 11:36:34 +0530620 vos_mem_free(pProbeResponse);
621 return;
622 }
623 if ( pProbeResponse->SSID.present )
624 {
625 vos_mem_copy(tEXTScanFullScanResult.ap.ssid,
626 pProbeResponse->SSID.ssid,
627 pProbeResponse->SSID.num_ssid);
628 }
629 //NULL Terminate the string.
630 tEXTScanFullScanResult.ap.ssid[pProbeResponse->SSID.num_ssid] = 0;
631 tEXTScanFullScanResult.ap.beaconPeriod =
632 pProbeResponse->BeaconInterval.interval;
633 tEXTScanFullScanResult.ap.capability =
634 *(((tANI_U16 *)&pProbeResponse->Capabilities));
635
636 vos_mem_free(pBeacon);
637 }
638 else
639 {
640 limLog( pMac, LOGE, FL("Wrong frame Type %d, Subtype %d for LFR"),
641 fc.type, fc.subType);
642 VOS_ASSERT(0);
643 return;
644 }
645
646 tEXTScanFullScanResult.requestId = pMac->sme.extScanStartReqId;
647 tEXTScanFullScanResult.ieLength =
648 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) - SIZE_OF_FIXED_PARAM;
649 tEXTScanFullScanResult.ie =(tSirInformationElement *)
650 ((tANI_U8 *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo) + SIZE_OF_FIXED_PARAM);
651
652 pCallbackContext = pMac->sme.pEXTScanCallbackContext;
653 if(pMac->sme.pEXTScanIndCb)
654 {
655 pMac->sme.pEXTScanIndCb(pCallbackContext,
656 SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND,
657 (tANI_U8 *)&tEXTScanFullScanResult);
658 }
659
660 return;
661} /*** end limProcessEXTScanRealTimeData() ***/
662#endif /* WLAN_FEATURE_EXTSCAN */
Jeff Johnson295189b2012-06-20 16:38:30 -0700663
664/**
665 * limHandle80211Frames()
666 *
667 *FUNCTION:
668 * This function is called to process 802.11 frames
669 * received by LIM.
670 *
671 *LOGIC:
672 * NA
673 *
674 *ASSUMPTIONS:
675 * NA
676 *
677 *NOTE:
678 * NA
679 *
680 * @param pMac - Pointer to Global MAC structure
681 * @param pMsg of type tSirMsgQ - Pointer to the message structure
682 * @return None
683 */
684
685static void
686limHandle80211Frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pDeferMsg)
687{
688 tANI_U8 *pRxPacketInfo = NULL;
689 tSirMacFrameCtl fc;
690 tpSirMacMgmtHdr pHdr=NULL;
691 tpPESession psessionEntry=NULL;
692 tANI_U8 sessionId;
693 tAniBool isFrmFt = FALSE;
694 tANI_U16 fcOffset = WLANHAL_RX_BD_HEADER_SIZE;
695
696 *pDeferMsg= false;
697 limGetBDfromRxPacket(pMac, limMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
698
Dino Mycle7a76e662014-06-10 11:36:34 +0530699#ifdef WLAN_FEATURE_EXTSCAN
700
701 if ( WDA_GET_EXTSCANFULLSCANRESIND(pRxPacketInfo))
702 {
703 limLog( pMac, LOG2, FL("Notify EXTSCAN scan results to the HDD"));
704 limProcessEXTScanRealTimeData(pMac, pRxPacketInfo);
705 goto end;
706 }
707#endif //WLAN_FEATURE_EXTSCAN
708
Jeff Johnson295189b2012-06-20 16:38:30 -0700709 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
710 isFrmFt = WDA_GET_RX_FT_DONE(pRxPacketInfo);
711 fcOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pRxPacketInfo);
712 fc = pHdr->fc;
713
Madan Mohan Koyyalamudi99af06e2013-08-08 02:17:17 +0530714#ifdef WLAN_DUMP_MGMTFRAMES
715 limLog( pMac, LOGE, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
716 fc.protVer, fc.type, fc.subType,
717 WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
718 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, pHdr,
719 WDA_GET_RX_MPDU_HEADER_LEN(pRxPacketInfo));
720#endif
721
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -0800722 if ((fc.type == SIR_MAC_MGMT_FRAME) &&
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -0800723 (fc.subType != SIR_MAC_MGMT_BEACON))
724 {
Sushant Kaushik60273d02014-06-13 15:31:37 +0530725 limLog(pMac, LOG1, FL("RX MGMT - Type %hu, SubType %hu, Seq.no %d"),
726 fc.type, fc.subType,
727 ((pHdr->seqControl.seqNumHi << 4) | (pHdr->seqControl.seqNumLo)));
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -0800728 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700729#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
730 if ( WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
731 {
732 limLog( pMac, LOG2, FL("Notify SME with candidate ind"));
733 //send a session 0 for now - TBD
734 limSendSmeCandidateFoundInd(pMac, 0);
735 goto end;
736 }
737 if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo))
738 {
739 if (fc.subType == SIR_MAC_MGMT_BEACON)
740 {
741 limLog( pMac, LOG2, FL("Save this beacon in LFR cache"));
742 __limHandleBeacon(pMac, limMsg, NULL);
743 }
744 else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP)
745 {
746 limLog( pMac, LOG2, FL("Save this probe rsp in LFR cache"));
747 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
748 }
749 else
750 {
751 limLog( pMac, LOGE, FL("Wrong frame Type %d, Subtype %d for LFR"),
752 fc.type, fc.subType);
753 }
754 goto end;
755 }
756#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800757#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700758 if (fc.type == SIR_MAC_DATA_FRAME && isFrmFt)
759 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800760#if 0 // Ese TBD Need to PORT
Jeff Johnson295189b2012-06-20 16:38:30 -0700761 tpSirMacDot3Hdr pDataFrmHdr;
762
763 pDataFrmHdr = (tpSirMacDot3Hdr)((tANI_U8 *)pBD+ WLANHAL_RX_BD_GET_MPDU_H_OFFSET(pBD));
764 if((psessionEntry = peFindSessionByBssid(pMac,pDataFrmHdr->sa,&sessionId))== NULL)
765 {
766 limLog( pMac, LOGE, FL("Session not found for Frm type %d, subtype %d, SA: "), fc.type, fc.subType);
767 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
768 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
769 return;
770 }
771
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800772 if (!psessionEntry->isESEconnection)
Jeff Johnson295189b2012-06-20 16:38:30 -0700773 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800774 limLog( pMac, LOGE, FL("LIM received Type %d, Subtype %d in Non ESE connection"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700775 fc.type, fc.subType);
776 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
777 return;
778 }
779 limLog( pMac, LOGE, FL("Processing IAPP Frm from SA:"));
780 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
781#else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800782 printk("%s: Need to port handling of IAPP frames to PRIMA for ESE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700783#endif
784
785
786 } else
787#endif
Siddharth Bhal4f3187c2014-10-09 21:38:08 +0530788
789 if ((fc.type == SIR_MAC_MGMT_FRAME) &&
790 (fc.subType == SIR_MAC_MGMT_PROBE_RSP) &&
791 pMac->lim.isSpoofingEnabled)
792 {
793 limLog( pMac, LOG2, FL("Probe Rsp recieved with DA: "MAC_ADDRESS_STR
794 " and selfMac Addr:"MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->da),
795 MAC_ADDR_ARRAY(pMac->lim.gSelfMacAddr));
796 if (VOS_TRUE == vos_mem_compare((v_VOID_t*) pHdr->da,
797 (v_VOID_t*) pMac->lim.spoofMacAddr, VOS_MAC_ADDRESS_LEN))
798 {
799 vos_mem_copy(pHdr->da, pMac->lim.gSelfMacAddr, VOS_MAC_ADDRESS_LEN);
800 }
801 }
802
Jeff Johnson295189b2012-06-20 16:38:30 -0700803 /* Added For BT-AMP Support */
804 if((psessionEntry = peFindSessionByBssid(pMac,pHdr->bssId,&sessionId))== NULL)
805 {
806#ifdef WLAN_FEATURE_VOWIFI_11R
807 if (fc.subType == SIR_MAC_MGMT_AUTH)
808 {
809#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800810 limLog( pMac, LOG1, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700811 fc.protVer, fc.type, fc.subType, WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800812 limPrintMacAddr(pMac, pHdr->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700813#endif
814 if (limProcessAuthFrameNoSession(pMac, pRxPacketInfo, limMsg->bodyptr) == eSIR_SUCCESS)
815 {
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +0530816 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700817 }
818 }
819#endif
820 if((fc.subType != SIR_MAC_MGMT_PROBE_RSP )&&
821 (fc.subType != SIR_MAC_MGMT_BEACON)&&
822 (fc.subType != SIR_MAC_MGMT_PROBE_REQ)
Jeff Johnson295189b2012-06-20 16:38:30 -0700823 && (fc.subType != SIR_MAC_MGMT_ACTION ) //Public action frame can be received from non-associated stations.
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 )
825 {
826
827 if((psessionEntry = peFindSessionByPeerSta(pMac,pHdr->sa,&sessionId))== NULL)
828 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700829 limLog(pMac, LOG1, FL("session does not exist for given bssId"));
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +0530830 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700831 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530832 else
833 limLog(pMac,LOG1,"SessionId:%d Session Exist for given Bssid",
834 psessionEntry->peSessionId);
Gopichand Nakkala6265d6f2013-03-20 23:32:50 +0530835 }
836 // For p2p resp frames search for valid session with DA as
837 // BSSID will be SA and session will be present with DA only
838 if(fc.subType == SIR_MAC_MGMT_ACTION )
839 {
840 psessionEntry = peFindSessionByBssid(pMac,pHdr->da,&sessionId);
841 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700842 }
843
844
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 /* Check if frame is registered by HDD */
846 if(limCheckMgmtRegisteredFrames(pMac, pRxPacketInfo, psessionEntry))
847 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700848 limLog( pMac, LOG1, FL("Received frame is passed to SME"));
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +0530849 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700850 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700851
852
Jeff Johnson295189b2012-06-20 16:38:30 -0700853
854 if (fc.protVer != SIR_MAC_PROTOCOL_VERSION)
855 { // Received Frame with non-zero Protocol Version
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700856 limLog(pMac, LOGE, FL("Unexpected frame with protVersion %d received"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700857 fc.protVer);
Jeff Johnson295189b2012-06-20 16:38:30 -0700858#ifdef WLAN_DEBUG
859 pMac->lim.numProtErr++;
860#endif
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +0530861 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700862 }
863
Gopichand Nakkala2c231c82013-06-11 17:49:16 +0530864 if (!pMac->fScanOffload)
Jeff Johnson295189b2012-06-20 16:38:30 -0700865 {
Gopichand Nakkala2c231c82013-06-11 17:49:16 +0530866 if (limIsSystemInScanState(pMac))
867 {
868 limHandleFramesInScanState(pMac, limMsg, pRxPacketInfo, pDeferMsg, psessionEntry);
869 return;
870 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700871 }
872
873/* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */
874
875#if 0
876 if (psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700877 limLog( pMac, LOGW, FL( "gLimSystemRole is %d. Exiting..." ),psessionEntry->limSystemRole );
Jeff Johnson295189b2012-06-20 16:38:30 -0700878 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
879
880#ifdef WLAN_DEBUG
881 pMac->lim.numProtErr++;
882#endif
883 return;
884 }
885 #endif //HACK to continue scanning
886
887
888#ifdef WLAN_DEBUG
889 pMac->lim.numMAC[fc.type][fc.subType]++;
890#endif
891
892 switch (fc.type)
893 {
894 case SIR_MAC_MGMT_FRAME:
895 {
896 #if 0 //TBD-RAJESH fix this
897 if (limIsReassocInProgress( pMac,psessionEntry) && (fc.subType != SIR_MAC_MGMT_DISASSOC) &&
898 (fc.subType != SIR_MAC_MGMT_DEAUTH) && (fc.subType != SIR_MAC_MGMT_REASSOC_RSP))
899 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700900 limLog(pMac, LOGE, FL("Frame with Type - %d, Subtype - %d received in ReAssoc Wait state, dropping..."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700901 fc.type, fc.subType);
902 return;
903 }
904 #endif //HACK to continue scanning
905 // Received Management frame
906 switch (fc.subType)
907 {
908 case SIR_MAC_MGMT_ASSOC_REQ:
909 // Make sure the role supports Association
910 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700911 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700912 )
913 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_ASSOC, psessionEntry);
914
915 else
916 {
917 // Unwanted messages - Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700918 limLog(pMac, LOGE, FL("unexpected message received %X"),limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700919 limPrintMsgName(pMac, LOGE, limMsg->type);
920 }
921 break;
922
923 case SIR_MAC_MGMT_ASSOC_RSP:
924 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_ASSOC,psessionEntry);
925 break;
926
927 case SIR_MAC_MGMT_REASSOC_REQ:
928 // Make sure the role supports Reassociation
929 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700930 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700931 ){
932 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_REASSOC, psessionEntry);
933 }
934 else
935 {
936 // Unwanted messages - Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700937 limLog(pMac, LOGE, FL("unexpected message received %X"),limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700938 limPrintMsgName(pMac, LOGE, limMsg->type);
939 }
940 break;
941
942 case SIR_MAC_MGMT_REASSOC_RSP:
943 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_REASSOC,psessionEntry);
944 break;
945
946 case SIR_MAC_MGMT_PROBE_REQ:
947 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo,psessionEntry);
948 break;
949
950 case SIR_MAC_MGMT_PROBE_RSP:
951 if(psessionEntry == NULL)
952 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
953 else
954 limProcessProbeRspFrame(pMac, pRxPacketInfo, psessionEntry);
955 break;
956
957 case SIR_MAC_MGMT_BEACON:
958 __limHandleBeacon(pMac, limMsg,psessionEntry);
959 break;
960
961 case SIR_MAC_MGMT_DISASSOC:
962 limProcessDisassocFrame(pMac, pRxPacketInfo,psessionEntry);
963 break;
964
965 case SIR_MAC_MGMT_AUTH:
966 limProcessAuthFrame(pMac, pRxPacketInfo,psessionEntry);
967 break;
968
969 case SIR_MAC_MGMT_DEAUTH:
970 limProcessDeauthFrame(pMac, pRxPacketInfo,psessionEntry);
971 break;
972
973 case SIR_MAC_MGMT_ACTION:
Jeff Johnson295189b2012-06-20 16:38:30 -0700974 if(psessionEntry == NULL)
975 limProcessActionFrameNoSession(pMac, pRxPacketInfo);
976 else
977 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700978 if (WDA_GET_RX_UNKNOWN_UCAST(pRxPacketInfo))
979 limHandleUnknownA2IndexFrames(pMac, pRxPacketInfo,psessionEntry);
980 else
981 limProcessActionFrame(pMac, pRxPacketInfo,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700982 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700983 break;
984 default:
985 // Received Management frame of 'reserved' subtype
986 break;
987 } // switch (fc.subType)
988
989 }
990 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700991 case SIR_MAC_DATA_FRAME:
992 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800993#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -0700994 /* We accept data frame (IAPP frame) only if Session is
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800995 * present and ese connection is established on that
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 * session
997 */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800998 if (psessionEntry && psessionEntry->isESEconnection) {
Jeff Johnson295189b2012-06-20 16:38:30 -0700999 limProcessIappFrame(pMac, pRxPacketInfo, psessionEntry);
1000 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001001#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001002 }
1003 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001004 default:
1005 // Received frame of type 'reserved'
1006 break;
1007
1008 } // switch (fc.type)
1009
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001010end:
Jeff Johnson295189b2012-06-20 16:38:30 -07001011 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr) ;
1012 return;
1013} /*** end limHandle80211Frames() ***/
1014
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301015/**
1016 * limSendStopScanOffloadReq()
1017 *
1018 *FUNCTION:
1019 * This function will be called to abort the ongoing offloaded scan
1020 * request.
1021 *
1022 *
1023 *NOTE:
1024 *
1025 * @param pMac Pointer to Global MAC structure
1026 * @return eHAL_STATUS_SUCCESS or eHAL_STATUS_FAILURE
1027 */
1028eHalStatus limSendStopScanOffloadReq(tpAniSirGlobal pMac, tANI_U8 SessionId)
1029{
1030 tSirMsgQ msg;
1031 tSirRetStatus rc = eSIR_SUCCESS;
1032 tAbortScanParams *pAbortScanParams;
1033
Kiet Lamb1233192013-11-28 13:38:20 +05301034 pAbortScanParams = vos_mem_malloc(sizeof(tAbortScanParams));
1035 if (NULL == pAbortScanParams)
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301036 {
1037 limLog(pMac, LOGP, FL("Memory allocation failed for AbortScanParams"));
1038 return eHAL_STATUS_FAILURE;
1039 }
1040
1041 pAbortScanParams->SessionId = SessionId;
1042 msg.type = WDA_STOP_SCAN_OFFLOAD_REQ;
1043 msg.bodyptr = pAbortScanParams;
1044 msg.bodyval = 0;
1045
1046 rc = wdaPostCtrlMsg(pMac, &msg);
1047 if (rc != eSIR_SUCCESS)
1048 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001049 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Kiet Lamb1233192013-11-28 13:38:20 +05301050 vos_mem_free(pAbortScanParams);
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301051 return eHAL_STATUS_FAILURE;
1052 }
1053
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301054 limLog(pMac, LOG1, FL("Abort ongoing offload scan."));
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301055 return eHAL_STATUS_SUCCESS;
1056
1057}
Jeff Johnson295189b2012-06-20 16:38:30 -07001058
1059/**
1060 * limProcessAbortScanInd()
1061 *
1062 *FUNCTION:
1063 * This function is called from HDD to abort the scan which is presently being run
1064 *
1065 *
1066 *NOTE:
1067 *
1068 * @param pMac Pointer to Global MAC structure
1069 * @param *pMsgBuf A pointer to the SME message buffer
1070 * @return None
1071 */
1072void
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301073limProcessAbortScanInd(tpAniSirGlobal pMac, tANI_U8 SessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07001074{
1075#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1076 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT, NULL, 0, 0);
1077#endif //FEATURE_WLAN_DIAG_SUPPORT
1078
1079 /* Deactivate the gLimBackgroundScanTimer as part of the abort scan.
1080 * SME should send WNI_CFG_BACKGROUND_SCAN_PERIOD indication
1081 * to start the background scan again
1082 */
Abhishek Singh525045c2014-12-15 17:18:45 +05301083 limLog(pMac, LOG1, FL("Processing AbortScan Ind"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001084
1085 limAbortBackgroundScan(pMac);
1086
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301087 if (pMac->fScanOffload)
Jeff Johnson295189b2012-06-20 16:38:30 -07001088 {
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301089 /* send stop scan cmd to fw if scan offload is enabled. */
1090 limSendStopScanOffloadReq(pMac, SessionId);
1091 }
1092 else
1093 {
1094 /* Abort the scan if its running, else just return */
1095 if(limIsSystemInScanState(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 {
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301097 if( (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
1098 (eLIM_HAL_START_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
1099 (eLIM_HAL_END_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
1100 (eLIM_HAL_FINISH_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
1101 {
1102 //Simply signal we need to abort
1103 limLog( pMac, LOGW, FL(" waiting for HAL, simply signal abort gLimHalScanState = %d"), pMac->lim.gLimHalScanState );
1104 pMac->lim.abortScan = 1;
1105 }
1106 else
1107 {
1108 //Force abort
1109 limLog( pMac, LOGW, FL(" Force aborting scan") );
1110 pMac->lim.abortScan = 0;
1111 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
1112 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
1113 //Set the resume channel to Any valid channel (invalid).
1114 //This will instruct HAL to set it to any previous valid channel.
1115 peSetResumeChannel(pMac, 0, 0);
1116 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
1117 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001118 }
1119 }
1120 return;
1121}
1122
1123/**
1124 * limMessageProcessor
1125 *
1126 *FUNCTION:
1127 * Wrapper function for limProcessMessages when handling messages received by LIM.
1128 * Could either defer messages or process them.
1129 * @param pMac Pointer to Global MAC structure
1130 * @param limMsg Received LIM message
1131 * @return None
1132 */
1133
1134void limMessageProcessor(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1135{
1136 if (eLIM_MLM_OFFLINE_STATE == pMac->lim.gLimMlmState)
1137 {
1138 peFreeMsg(pMac, limMsg);
1139 return;
1140 }
1141
1142 if (!defMsgDecision(pMac, limMsg))
1143 {
1144 limProcessMessages(pMac, limMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 // process deferred message queue if allowed
1146 {
1147 if ( (! (pMac->lim.gLimAddtsSent))
1148 &&
1149 (! (limIsSystemInScanState(pMac)))
1150 )
1151 {
1152 if (true == GET_LIM_PROCESS_DEFD_MESGS(pMac))
1153 limProcessDeferredMessageQueue(pMac);
1154 }
1155 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001156 }
1157}
1158
Jeff Johnsone7245742012-09-05 17:12:55 -07001159#ifdef FEATURE_OEM_DATA_SUPPORT
1160
1161void limOemDataRspHandleResumeLinkRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* mlmOemDataRsp)
1162{
1163 if(status != eHAL_STATUS_SUCCESS)
1164 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001165 limLog(pMac, LOGE, FL("OEM Data Rsp failed to get the response for resume link"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001166 }
1167
1168 if(NULL != pMac->lim.gpLimMlmOemDataReq)
1169 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301170 vos_mem_free(pMac->lim.gpLimMlmOemDataReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001171 pMac->lim.gpLimMlmOemDataReq = NULL;
1172 }
1173
1174 //"Failure" status doesn't mean that Oem Data Rsp did not happen
1175 //and hence we need to respond to upper layers. Only Resume link is failed, but
1176 //we got the oem data response already.
1177 //Post the meessage to MLM
1178 limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)(mlmOemDataRsp));
1179
1180 return;
1181}
1182
1183void limProcessOemDataRsp(tpAniSirGlobal pMac, tANI_U32* body)
1184{
Jeff Johnsone7245742012-09-05 17:12:55 -07001185 tpLimMlmOemDataRsp mlmOemDataRsp = NULL;
1186 tpStartOemDataRsp oemDataRsp = NULL;
1187
1188 //Process all the messages for the lim queue
1189 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1190
1191 oemDataRsp = (tpStartOemDataRsp)(body);
1192
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301193 mlmOemDataRsp = vos_mem_malloc(sizeof(tLimMlmOemDataRsp));
1194 if ( NULL == mlmOemDataRsp )
Jeff Johnsone7245742012-09-05 17:12:55 -07001195 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001196 limLog(pMac, LOGP, FL("could not allocate memory for mlmOemDataRsp"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001197 return;
1198 }
1199
1200 //copy the memory into tLimMlmOemDataRsp and free the tStartOemDataRsp
1201 //the structures tStartOemDataRsp and tLimMlmOemDataRsp have the same structure
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301202 vos_mem_copy((void*)(mlmOemDataRsp), (void*)(oemDataRsp),
1203 sizeof(tLimMlmOemDataRsp));
Jeff Johnsone7245742012-09-05 17:12:55 -07001204
1205 //Now free the incoming memory
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301206 vos_mem_free(oemDataRsp);
Jeff Johnsone7245742012-09-05 17:12:55 -07001207
1208 limResumeLink(pMac, limOemDataRspHandleResumeLinkRsp, (tANI_U32*)mlmOemDataRsp);
1209
1210 return;
1211}
1212
1213#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001214
Katya Nigam3802f202013-12-16 19:27:14 +05301215static tANI_BOOLEAN limAgeOutProbeReq( tpAniSirGlobal pMac, tpSirMsgQ limMsg,
1216 vos_pkt_t *pVosPkt )
1217{
1218 tANI_U8 *pRxPacketInfo = NULL;
1219 tSirMacFrameCtl fc;
1220 tpSirMacMgmtHdr pHdr=NULL;
1221 tANI_BOOLEAN match = VOS_FALSE;
1222
1223 limGetBDfromRxPacket(pMac, limMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
1224 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1225 fc = pHdr->fc;
1226 if ( fc.subType == SIR_MAC_MGMT_PROBE_REQ )
1227 {
1228 if( vos_timer_get_system_ticks() - pVosPkt->timestamp >= MAX_PROBEREQ_TIME )
1229 {
1230 // drop packet
1231 limLog(pMac, LOGE,
1232 FL("Dropping Aged Out probe requests. Peer MAC is "MAC_ADDRESS_STR),
1233 MAC_ADDR_ARRAY(pHdr->sa));
1234
1235 vos_pkt_return_packet(pVosPkt);
1236 match = VOS_TRUE;
1237 }
1238 }
1239 return match;
1240}
1241
Jeff Johnson295189b2012-06-20 16:38:30 -07001242/**
1243 * limProcessMessages
1244 *
1245 *FUNCTION:
1246 * This function is called by limProcessMessageQueue function. This
1247 * function processes messages received by LIM.
1248 *
1249 *LOGIC:
1250 * Depending on the message type, corresponding function will be
1251 * called, for example limProcessSmeMessages() will be called to
1252 * process SME messages received from HDD/Upper layer software module.
1253 *
1254 *ASSUMPTIONS:
1255 * NA
1256 *
1257 *NOTE:
1258 * NA
1259 *
1260 * @param pMac Pointer to Global MAC structure
1261 * @param limMsg Received LIM message
1262 * @return None
1263 */
1264
1265void
1266limProcessMessages(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1267{
1268 tANI_U8 deferMsg = false;
1269 tLinkStateParams *linkStateParams;
1270#if defined WLAN_FEATURE_VOWIFI_11R
1271 tpPESession pSession;
1272#endif
1273#if defined(ANI_DVT_DEBUG)
1274 tSirMsgQ msgQ;
1275#endif
1276 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1277 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301278 vos_mem_free(limMsg->bodyptr);
Jeff Johnsone7245742012-09-05 17:12:55 -07001279 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001280 return;
1281 }
1282#ifdef WLAN_DEBUG
1283 pMac->lim.numTot++;
1284#endif
1285
1286
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001287 PELOG3(limLog(pMac, LOG3, FL("rcvd msgType = %s, sme state = %s, mlm state = %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001288 limMsgStr(limMsg->type), limSmeStateStr(pMac->lim.gLimSmeState),
1289 limMlmStateStr(pMac->lim.gLimMlmState));)
1290
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301291 /*
1292 * MTRACE logs not captured for events received from SME
1293 * SME enums (eWNI_SME_START_REQ) starts with 0x16xx.
1294 * Compare received SME events with SIR_SME_MODULE_ID
Konamki, Sreelakshmi2bfb8b02015-07-29 11:41:24 +05301295 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001296
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301297 if (SIR_SME_MODULE_ID == (tANI_U8)MAC_TRACE_GET_MODULE_ID(limMsg->type))
1298 {
1299 MTRACE(macTrace(pMac, TRACE_CODE_RX_SME_MSG, NO_SESSION, limMsg->type));
1300 }
1301 else
1302 {
1303 /* Omitting below message types as these are too frequent and when crash
1304 * happens we loose critical trace logs if these are also logged
1305 */
1306 if (limMsg->type != SIR_LIM_MAX_CHANNEL_TIMEOUT &&
1307 limMsg->type != SIR_LIM_MIN_CHANNEL_TIMEOUT &&
1308 limMsg->type != SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT &&
1309 limMsg->type != SIR_CFG_PARAM_UPDATE_IND &&
1310 limMsg->type != SIR_BB_XPORT_MGMT_MSG)
1311 MTRACE(macTraceMsgRx(pMac, NO_SESSION,
1312 LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
1313 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001314 switch (limMsg->type)
1315 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001316
1317 case SIR_LIM_UPDATE_BEACON:
1318 limUpdateBeacon(pMac);
1319 break;
1320
Jeff Johnson295189b2012-06-20 16:38:30 -07001321 case SIR_CFG_PARAM_UPDATE_IND:
1322 /// CFG parameter updated
1323 if (limIsSystemInScanState(pMac))
1324 {
1325 // System is in DFS (Learn) mode
1326 // Defer processsing this message
1327 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1328 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001329 if(!(pMac->lim.deferredMsgCnt & 0xF))
1330 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001331 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 -07001332 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1333 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001334 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001335 limLogSessionStates(pMac);
1336 limPrintMsgName(pMac, LOGE, limMsg->type);
1337 }
1338 }
1339 else
1340 {
1341 limHandleCFGparamUpdate(pMac, limMsg->bodyval);
1342 }
1343
1344 break;
1345
1346 case WDA_INIT_SCAN_RSP:
1347 limProcessInitScanRsp(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;
1350
1351 case WDA_START_SCAN_RSP:
1352 limProcessStartScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001353 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001354 break;
1355
1356 case WDA_END_SCAN_RSP:
1357 limProcessEndScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001358 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001359 break;
1360
1361 case WDA_FINISH_SCAN_RSP:
1362 limProcessFinishScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001363 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001364 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001365#ifdef FEATURE_OEM_DATA_SUPPORT
1366 case WDA_START_OEM_DATA_RSP:
1367 limProcessOemDataRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001368 limMsg->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001369 break;
1370#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001371
1372 case WDA_SWITCH_CHANNEL_RSP:
1373 limProcessSwitchChannelRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001374 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001375 break;
1376
1377#ifdef ANI_SIR_IBSS_PEER_CACHING
1378 case WDA_IBSS_STA_ADD:
1379 limIbssStaAdd(pMac, limMsg->bodyptr);
1380 break;
1381#endif
1382 case SIR_BB_XPORT_MGMT_MSG:
1383 // These messages are from Peer MAC entity.
1384#ifdef WLAN_DEBUG
1385 pMac->lim.numBbt++;
1386#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001387 {
1388 v_U16_t pktLen = 0;
1389 vos_pkt_t *pVosPkt;
1390 VOS_STATUS vosStatus;
1391 tSirMsgQ limMsgNew;
Jeff Johnson295189b2012-06-20 16:38:30 -07001392 /* The original limMsg which we were deferring have the
1393 * bodyPointer point to 'BD' instead of 'Vos pkt'. If we don't make a copy
1394 * of limMsg, then vos_pkt_peek_data will overwrite the limMsg->bodyPointer.
1395 * and next time when we try to process the msg, we will try to use 'BD' as
1396 * 'Vos Pkt' which will cause a crash
1397 */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301398 vos_mem_copy((tANI_U8*)&limMsgNew, (tANI_U8*)limMsg,
1399 sizeof(tSirMsgQ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 pVosPkt = (vos_pkt_t *)limMsgNew.bodyptr;
1401 vos_pkt_get_packet_length(pVosPkt, &pktLen);
1402
1403 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&limMsgNew.bodyptr, VOS_FALSE );
1404
1405 if( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1406 {
Katya Nigamfdf5a522015-02-03 14:38:55 +05301407 limDecrementPendingMgmtCount(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001408 vos_pkt_return_packet(pVosPkt);
1409 break;
1410
1411 }
Katya Nigam3802f202013-12-16 19:27:14 +05301412
Padma, Santhosh Kumar30971cf2015-04-06 19:59:37 +05301413#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1414 if (WDA_GET_ROAMCANDIDATEIND(limMsgNew.bodyptr))
1415 limLog(pMac, LOG1, FL("roamCandidateInd %d"),
1416 WDA_GET_ROAMCANDIDATEIND(limMsgNew.bodyptr));
1417
1418 if (WDA_GET_OFFLOADSCANLEARN(limMsgNew.bodyptr))
1419 limLog(pMac, LOG1, FL("offloadScanLearn %d"),
1420 WDA_GET_OFFLOADSCANLEARN(limMsgNew.bodyptr));
1421#endif
1422
Katya Nigam3802f202013-12-16 19:27:14 +05301423 /*
1424 * putting a check for age out probe request frames
1425 * such that any probe req more than 0.5 sec old can directly
1426 * be dropped. With this, there won't be blocking of MC thread.
1427 */
1428
1429 if( limAgeOutProbeReq ( pMac, &limMsgNew, pVosPkt ))
1430 {
Katya Nigamfdf5a522015-02-03 14:38:55 +05301431 limDecrementPendingMgmtCount(pMac);
Katya Nigam3802f202013-12-16 19:27:14 +05301432 break;
1433 }
1434
Katya Nigam3802f202013-12-16 19:27:14 +05301435
Jeff Johnson295189b2012-06-20 16:38:30 -07001436 limHandle80211Frames(pMac, &limMsgNew, &deferMsg);
1437
1438 if ( deferMsg == true )
1439 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301440 limLog(pMac, LOG2, FL("Defer message type=%X "),
1441 limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001442 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1443 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001444 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 -07001445 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1446 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1447 limLogSessionStates(pMac);
1448 limPrintMsgName(pMac, LOGE, limMsg->type);
Katya Nigamfdf5a522015-02-03 14:38:55 +05301449 limDecrementPendingMgmtCount(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001450 vos_pkt_return_packet(pVosPkt);
1451 }
1452 }
1453 else
1454 {
1455 /* PE is not deferring this 802.11 frame so we need to call vos_pkt_return.
1456 * Asumption here is when Rx mgmt frame processing is done,
1457 * voss packet could be freed here.
1458 */
Katya Nigamfdf5a522015-02-03 14:38:55 +05301459 limDecrementPendingMgmtCount(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001460 vos_pkt_return_packet(pVosPkt);
1461 }
1462 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001463 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 case eWNI_SME_SCAN_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001465 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001466 case eWNI_SME_DISASSOC_REQ:
1467 case eWNI_SME_DEAUTH_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001468 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
Jeff Johnsone7245742012-09-05 17:12:55 -07001469#ifdef FEATURE_OEM_DATA_SUPPORT
1470 case eWNI_SME_OEM_DATA_REQ:
1471#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001472#ifdef FEATURE_WLAN_TDLS
1473 case eWNI_SME_TDLS_SEND_MGMT_REQ:
1474 case eWNI_SME_TDLS_ADD_STA_REQ:
1475 case eWNI_SME_TDLS_DEL_STA_REQ:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301476 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301477// tdlsoffchan
1478 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001479#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05301480 case eWNI_SME_RESET_AP_CAPS_CHANGED:
Jeff Johnson295189b2012-06-20 16:38:30 -07001481 // These messages are from HDD
1482 limProcessNormalHddMsg(pMac, limMsg, true); //need to response to hdd
1483 break;
1484
1485 case eWNI_SME_SCAN_ABORT_IND:
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301486 {
1487 tANI_U8 *pSessionId = (tANI_U8 *)limMsg->bodyptr;
1488 limProcessAbortScanInd(pMac, *pSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001489 vos_mem_free((v_VOID_t *)limMsg->bodyptr);
1490 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001491 break;
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301492 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001493 case eWNI_SME_START_REQ:
1494 case eWNI_SME_SYS_READY_IND:
1495#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1496 case eWNI_SME_JOIN_REQ:
1497#endif
1498 case eWNI_SME_AUTH_REQ:
1499 case eWNI_SME_REASSOC_REQ:
1500 case eWNI_SME_START_BSS_REQ:
1501 case eWNI_SME_STOP_BSS_REQ:
1502 case eWNI_SME_SWITCH_CHL_REQ:
1503 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
1504 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
1505 case eWNI_SME_SETCONTEXT_REQ:
1506 case eWNI_SME_REMOVEKEY_REQ:
1507#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1508 case eWNI_SME_PROMISCUOUS_MODE_REQ:
1509#endif
1510 case eWNI_SME_DISASSOC_CNF:
1511 case eWNI_SME_DEAUTH_CNF:
1512 case eWNI_SME_ASSOC_CNF:
1513 case eWNI_SME_REASSOC_CNF:
1514 case eWNI_SME_ADDTS_REQ:
1515 case eWNI_SME_DELTS_REQ:
1516 case eWNI_SME_DEL_BA_PEER_IND:
1517 case eWNI_SME_SET_TX_POWER_REQ:
1518 case eWNI_SME_GET_TX_POWER_REQ:
1519 case eWNI_SME_GET_NOISE_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001520 case eWNI_SME_GET_ASSOC_STAS_REQ:
1521 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
1522 case eWNI_SME_UPDATE_APWPSIE_REQ:
1523 case eWNI_SME_HIDE_SSID_REQ:
1524 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
1525 case eWNI_SME_SET_APWPARSNIEs_REQ:
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08001526 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
Jeff Johnson295189b2012-06-20 16:38:30 -07001527#if defined WLAN_FEATURE_VOWIFI
1528 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1529 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
1530#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001531#if defined FEATURE_WLAN_ESE
1532 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001533#endif
1534#ifdef WLAN_FEATURE_VOWIFI_11R
1535 case eWNI_SME_FT_UPDATE_KEY:
1536 case eWNI_SME_FT_PRE_AUTH_REQ:
1537 case eWNI_SME_FT_AGGR_QOS_REQ:
1538#endif
1539 case eWNI_SME_ADD_STA_SELF_REQ:
1540 case eWNI_SME_DEL_STA_SELF_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001541 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
1542 case eWNI_SME_UPDATE_NOA:
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301543 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
Madan Mohan Koyyalamudi44bbc152013-07-05 21:13:10 +05301544 case eWNI_SME_STA_STAT_REQ:
1545 case eWNI_SME_AGGR_STAT_REQ:
1546 case eWNI_SME_GLOBAL_STAT_REQ:
1547 case eWNI_SME_STAT_SUMM_REQ:
1548 case eWNI_SME_GET_STATISTICS_REQ:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001549#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi44bbc152013-07-05 21:13:10 +05301550 case eWNI_SME_GET_ROAM_RSSI_REQ:
1551#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001552#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001553 case eWNI_SME_GET_TSM_STATS_REQ:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001554#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05301555 case eWNI_SME_MAC_SPOOF_ADDR_IND:
Jeff Johnson295189b2012-06-20 16:38:30 -07001556 // These messages are from HDD
1557 limProcessNormalHddMsg(pMac, limMsg, false); //no need to response to hdd
1558 break;
1559
1560 //Power Save Messages From HDD
1561 case eWNI_PMC_PWR_SAVE_CFG:
1562 case eWNI_PMC_ENTER_BMPS_REQ:
1563 case eWNI_PMC_EXIT_BMPS_REQ:
1564 case eWNI_PMC_ENTER_IMPS_REQ:
1565 case eWNI_PMC_EXIT_IMPS_REQ:
1566 case eWNI_PMC_ENTER_UAPSD_REQ:
1567 case eWNI_PMC_EXIT_UAPSD_REQ:
1568 case eWNI_PMC_ENTER_WOWL_REQ:
1569 case eWNI_PMC_EXIT_WOWL_REQ:
1570 case eWNI_PMC_WOWL_ADD_BCAST_PTRN:
1571 case eWNI_PMC_WOWL_DEL_BCAST_PTRN:
1572 pmmProcessMessage(pMac, limMsg);
1573 break;
1574
1575 case eWNI_PMC_SMPS_STATE_IND :
1576 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001577 if(limMsg->bodyptr){
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301578 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001579 limMsg->bodyptr = NULL;
1580 }
1581 }
1582 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001583 case eWNI_SME_SEND_ACTION_FRAME_IND:
1584 limSendP2PActionFrame(pMac, limMsg);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301585 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001586 limMsg->bodyptr = NULL;
1587 break;
1588 case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
1589 limAbortRemainOnChan(pMac);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301590 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001591 limMsg->bodyptr = NULL;
1592 break;
1593
Viral Modid86bde22012-12-10 13:09:21 -08001594 case SIR_HAL_P2P_NOA_START_IND:
1595 {
1596 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1597 tANI_U8 i;
Viral Modid440e682013-03-06 02:25:31 -08001598 tANI_U8 p2pGOExists = 0;
Gopichand Nakkala78a6c812013-05-13 16:39:49 +05301599
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001600 limLog(pMac, LOG1, "LIM received NOA start %x", limMsg->type);
Viral Modid440e682013-03-06 02:25:31 -08001601
1602 /* Since insert NOA is done and NOA start msg received, we should deactivate the Insert NOA timer */
1603 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
1604
Viral Modid86bde22012-12-10 13:09:21 -08001605 for(i=0; i < pMac->lim.maxBssId; i++)
1606 {
1607 psessionEntry = &pMac->lim.gpSession[i];
1608 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
1609 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1610 { //Save P2P NOA start attributes for P2P Go persona
Viral Modid440e682013-03-06 02:25:31 -08001611 p2pGOExists = 1;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301612 vos_mem_copy(&psessionEntry->p2pGoPsNoaStartInd, limMsg->bodyptr,
1613 sizeof(tSirP2PNoaStart));
Viral Modid440e682013-03-06 02:25:31 -08001614 if (psessionEntry->p2pGoPsNoaStartInd.status != eHAL_STATUS_SUCCESS)
Viral Modid86bde22012-12-10 13:09:21 -08001615 {
Viral Modid440e682013-03-06 02:25:31 -08001616 limLog(pMac, LOGW, FL("GO NOA start failure status %d reported by FW."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001617 " - still go ahead with deferred sme req. This is just info"),
Viral Modid440e682013-03-06 02:25:31 -08001618 psessionEntry->p2pGoPsNoaStartInd.status);
Viral Modid86bde22012-12-10 13:09:21 -08001619 }
Viral Modid86bde22012-12-10 13:09:21 -08001620 break;
1621 }
1622 }
Viral Modid440e682013-03-06 02:25:31 -08001623
1624 if (p2pGOExists == 0)
1625 {
1626 limLog(pMac, LOGW, FL("By the time, we received NOA start, GO is already removed."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001627 " - still go ahead with deferred sme req. This is just info"));
Viral Modid440e682013-03-06 02:25:31 -08001628 }
1629
1630 /* We received the NOA start indication. Now we can send down the SME request which requires off-channel operation */
1631 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301632 vos_mem_free(limMsg->bodyptr);
Viral Modid86bde22012-12-10 13:09:21 -08001633 limMsg->bodyptr = NULL;
Viral Modid440e682013-03-06 02:25:31 -08001634 }
Viral Modid86bde22012-12-10 13:09:21 -08001635 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301636#ifdef FEATURE_WLAN_TDLS
1637 case SIR_HAL_TDLS_IND:
1638 {
1639 tSirTdlsInd *pTdlsInd = (tpSirTdlsInd)limMsg->bodyptr ;
1640 tpDphHashNode pStaDs = NULL ;
1641 tpPESession psessionEntry = NULL;
1642 tANI_U8 sessionId;
1643 if((psessionEntry = peFindSessionByStaId(pMac,pTdlsInd->staIdx,&sessionId))== NULL)
1644 {
1645 limLog(pMac, LOG1, FL("session does not exist for given bssId\n"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301646 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301647 limMsg->bodyptr = NULL;
1648 return;
1649 }
1650 if ((pStaDs = dphGetHashEntry(pMac, pTdlsInd->assocId, &psessionEntry->dph.dphHashTable)) == NULL)
1651 {
1652 limLog(pMac, LOG1, FL("pStaDs Does not exist for given staId\n"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301653 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301654 limMsg->bodyptr = NULL;
1655 return;
1656 }
Viral Modid86bde22012-12-10 13:09:21 -08001657
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301658 if ((STA_ENTRY_TDLS_PEER == pStaDs->staType))
1659 {
1660 limLog(pMac, LOGE,
1661 FL("received TDLS Indication from the Firmware with Reason Code %d "),
1662 pTdlsInd->reasonCode);
1663 limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry,
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05301664 pTdlsInd->reasonCode);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301665 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301666 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301667 limMsg->bodyptr = NULL;
1668 }
1669 break;
1670#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001671 case SIR_HAL_P2P_NOA_ATTR_IND:
1672 {
1673 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1674 tANI_U8 i;
1675
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001676 limLog(pMac, LOGW, FL("Received message Noa_ATTR %x"), limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001677 for(i=0; i < pMac->lim.maxBssId; i++)
1678 {
Viral Modid86bde22012-12-10 13:09:21 -08001679 psessionEntry = &pMac->lim.gpSession[i];
1680 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001681 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1682 { //Save P2P attributes for P2P Go persona
1683
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301684 vos_mem_copy(&psessionEntry->p2pGoPsUpdate, limMsg->bodyptr,
1685 sizeof(tSirP2PNoaAttr));
1686
Arif Hussain24bafea2013-11-15 15:10:03 -08001687 limLog(pMac, LOG2, FL(" &psessionEntry->bssId "
1688 MAC_ADDRESS_STR " ctWin=%d oppPsFlag=%d"),
1689 MAC_ADDR_ARRAY(psessionEntry->bssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001690 psessionEntry->p2pGoPsUpdate.ctWin,
1691 psessionEntry->p2pGoPsUpdate.oppPsFlag);
1692
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001693 limLog(pMac, LOG2, FL(" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt,
1695 psessionEntry->p2pGoPsUpdate.uNoa1Duration,
1696 psessionEntry->p2pGoPsUpdate.uNoa1Interval,
1697 psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
1698
1699
1700 break;
1701 }
1702 }
1703
1704 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301705 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001706 limMsg->bodyptr = NULL;
1707
1708 break;
1709
1710
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 /* eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER Message comes after the
1712 * device comes out of full power for the full power request sent
1713 * because of channel switch with switch count as 0, so call the same
1714 * function used in timeout case(i.e SIR_LIM_CHANNEL_SWITCH_TIMEOUT)
1715 * for switching the channel*/
1716 case eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER:
Jeff Johnsone7245742012-09-05 17:12:55 -07001717 if ( !tx_timer_running(&pMac->lim.limTimers.gLimChannelSwitchTimer) )
1718 {
1719 limProcessChannelSwitchTimeout(pMac);
1720 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301721 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001722 limMsg->bodyptr = NULL;
1723 break;
1724
1725 //Power Save Related Messages From HAL
1726 case WDA_ENTER_BMPS_RSP:
1727 case WDA_EXIT_BMPS_RSP:
1728 case WDA_EXIT_BMPS_IND:
1729 case WDA_ENTER_IMPS_RSP:
1730 case WDA_EXIT_IMPS_RSP:
1731 case WDA_ENTER_UAPSD_RSP:
1732 case WDA_EXIT_UAPSD_RSP:
1733 case WDA_WOWL_ENTER_RSP:
1734 case WDA_WOWL_EXIT_RSP:
1735 pmmProcessMessage(pMac, limMsg);
1736 break;
1737
1738 case WDA_LOW_RSSI_IND:
1739 //limHandleLowRssiInd(pMac);
1740 break;
1741
1742 case WDA_BMPS_STATUS_IND:
1743 limHandleBmpsStatusInd(pMac);
1744 break;
1745
1746 case WDA_MISSED_BEACON_IND:
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001747 limHandleMissedBeaconInd(pMac, limMsg);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301748 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001749 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001750 break;
1751 case WDA_MIC_FAILURE_IND:
1752 limMicFailureInd(pMac, limMsg);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301753 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001754 limMsg->bodyptr = NULL;
1755 break;
1756
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +05301757 case WDA_LOST_LINK_PARAMS_IND:
1758 limProcessLostLinkParamsInd(pMac,limMsg);
1759 vos_mem_free(limMsg->bodyptr);
1760 limMsg->bodyptr = NULL;
1761 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001762
1763 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1764 limProcessSmeReqMessages(pMac,limMsg);
1765 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001766#ifdef FEATURE_WLAN_ESE
1767 case SIR_LIM_ESE_TSM_TIMEOUT:
1768#ifndef FEATURE_WLAN_ESE_UPLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001769 limProcessTsmTimeoutHandler(pMac,limMsg);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001770#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001771 break;
1772 case WDA_TSM_STATS_RSP:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001773#ifdef FEATURE_WLAN_ESE_UPLOAD
1774 limSendSmePEEseTsmRsp(pMac, (tAniGetTsmStatsRsp *)limMsg->bodyptr);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001775#else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001776 limProcessHalEseTsmRsp(pMac, limMsg);
1777#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001778 break;
1779#endif
1780 case WDA_ADD_TS_RSP:
1781 limProcessHalAddTsRsp(pMac, limMsg);
1782 break;
1783
1784 case SIR_LIM_DEL_TS_IND:
1785 limProcessDelTsInd(pMac, limMsg);
Madan Mohan Koyyalamudif244d8f2012-11-29 11:21:05 -08001786 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001787 case SIR_LIM_ADD_BA_IND:
1788 limProcessAddBaInd(pMac, limMsg);
1789 break;
1790 case SIR_LIM_DEL_BA_ALL_IND:
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001791 limDelAllBASessions(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001792 break;
1793 case SIR_LIM_DEL_BA_IND:
1794 limProcessMlmHalBADeleteInd( pMac, limMsg );
1795 break;
1796
1797 case SIR_LIM_BEACON_GEN_IND: {
Jeff Johnson295189b2012-06-20 16:38:30 -07001798
Jeff Johnson295189b2012-06-20 16:38:30 -07001799 if( pMac->lim.gLimSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07001800 schProcessPreBeaconInd(pMac, limMsg);
1801
1802 }
1803 break;
1804
1805 case SIR_LIM_DELETE_STA_CONTEXT_IND:
1806 limDeleteStaContext(pMac, limMsg);
1807 break;
1808
1809 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1810 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1811 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1812 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001813 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001814 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1815 case SIR_LIM_AUTH_RSP_TIMEOUT:
1816 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1817 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1818#ifdef WLAN_FEATURE_VOWIFI_11R
1819 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
1820#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001821 case SIR_LIM_REMAIN_CHN_TIMEOUT:
Viral Modid86bde22012-12-10 13:09:21 -08001822 case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT:
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001823 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
1824 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
Gopichand Nakkalad492d202013-05-10 02:50:47 +05301825 case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
Sushant Kaushik9e923872015-04-02 17:09:31 +05301826 case SIR_LIM_AUTH_RETRY_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001827 // These timeout messages are handled by MLM sub module
1828
1829 limProcessMlmReqMessages(pMac,
1830 limMsg);
1831
1832 break;
1833
1834 case SIR_LIM_HEART_BEAT_TIMEOUT:
1835 /** check if heart beat failed, even if one Beacon
1836 * is rcvd within the Heart Beat interval continue
1837 * normal processing
1838 */
1839
1840 #if 0
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001841 PELOG1(limLog(pMac, LOG1, FL("Heartbeat timeout, SME %d, MLME %d, #bcn %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001842 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1843 pMac->lim.gLimRxedBeaconCntDuringHB);)
1844
1845 if(pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)
1846 limIbssHeartBeatHandle(pMac); //HeartBeat for peers.
1847 else
1848 /**
1849 * Heartbeat failure occurred on STA
1850 * This is handled by LMM sub module.
1851 */
1852 limHandleHeartBeatFailure(pMac);
1853
1854 break;
1855 #endif //TO SUPPORT BT-AMP
Yathish9f22e662012-12-10 14:21:35 -08001856 if (limIsSystemInScanState(pMac))
1857 {
1858 // System is in DFS (Learn) mode
1859 // Defer processsing this message
1860 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1861 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001862 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 -08001863 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1864 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1865 limLogSessionStates(pMac);
1866 }
1867 }
1868 else
1869 {
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001870 if (NULL == limMsg->bodyptr)
1871 {
1872 limHandleHeartBeatTimeout(pMac);
1873 }
1874 else
1875 {
1876 limHandleHeartBeatTimeoutForSession(pMac, (tpPESession)limMsg->bodyptr);
1877 }
Gopichand Nakkala78a6c812013-05-13 16:39:49 +05301878 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001879 break;
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001880
Jeff Johnson295189b2012-06-20 16:38:30 -07001881 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1882 limHandleHeartBeatFailureTimeout(pMac);
1883 break;
1884
1885 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001886 /**
1887 * Background scan timeout occurred on STA.
1888 * This is handled by LMM sub module.
1889 */
1890 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
1891
1892 //We will do background scan even in bcnps mode
1893 //if (pMac->sys.gSysEnableScanMode)
1894 pMac->lim.gLimReportBackgroundScanResults = FALSE;
1895 limTriggerBackgroundScan(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001896 break;
1897
Jeff Johnson295189b2012-06-20 16:38:30 -07001898 case SIR_LIM_CNF_WAIT_TIMEOUT:
1899
1900 /*
1901 ** Does not receive CNF or dummy packet
1902 **/
1903 limHandleCnfWaitTimeout(pMac, (tANI_U16) limMsg->bodyval);
1904
1905 break;
1906
1907 case SIR_LIM_KEEPALIVE_TIMEOUT:
1908 limSendKeepAliveToPeer(pMac);
1909
1910 break;
1911
1912 case SIR_LIM_RETRY_INTERRUPT_MSG:
1913 // Message from ISR upon TFP's max retry limit interrupt
1914
1915 break;
1916
1917 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
1918 // Message from ISR upon SP's Invalid session key interrupt
1919
1920 break;
1921
1922 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
1923 // Message from ISR upon SP's Invalid key ID interrupt
1924
1925 break;
1926
1927 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
1928 // Message from ISR upon SP's Replay threshold interrupt
1929
1930 break;
1931
1932 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
1933 limProcessChannelSwitchTimeout(pMac);
1934 break;
1935
1936 case SIR_LIM_QUIET_TIMEOUT:
1937 limProcessQuietTimeout(pMac);
1938 break;
1939
1940 case SIR_LIM_QUIET_BSS_TIMEOUT:
1941 limProcessQuietBssTimeout(pMac);
1942 break;
1943
Jeff Johnson295189b2012-06-20 16:38:30 -07001944 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
1945 limHandleUpdateOlbcCache(pMac);
1946 break;
1947#if 0
1948 case SIR_LIM_WPS_OVERLAP_TIMEOUT:
1949 limProcessWPSOverlapTimeout(pMac);
1950 break;
1951#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001952 case WDA_ADD_BSS_RSP:
1953 limProcessMlmAddBssRsp( pMac, limMsg );
1954 break;
1955
1956 case WDA_ADD_STA_RSP:
1957
1958 //call a wrapper by paasing bodyptr, their get sessionID and and call proper function from there.
1959 limProcessAddStaRsp(pMac,limMsg);
1960 break;
1961
1962 case WDA_DELETE_STA_RSP:
1963 limProcessMlmDelStaRsp(pMac, limMsg);
1964 break;
1965
1966 case WDA_ADD_STA_SELF_RSP:
1967 limProcessAddStaSelfRsp(pMac, limMsg);
1968 break;
1969 case WDA_DEL_STA_SELF_RSP:
1970 limProcessDelStaSelfRsp(pMac, limMsg);
1971 break;
1972
1973 case WDA_DELETE_BSS_RSP:
1974 limHandleDeleteBssRsp(pMac,limMsg); //wrapper routine to handle delete bss response
1975 break;
1976
1977 case WDA_SET_BSSKEY_RSP:
1978 case WDA_SET_STA_BCASTKEY_RSP:
1979 limProcessMlmSetBssKeyRsp( pMac, limMsg );
1980 break;
1981 case WDA_SET_STAKEY_RSP:
1982 limProcessMlmSetStaKeyRsp( pMac, limMsg );
1983 break;
1984 case WDA_REMOVE_BSSKEY_RSP:
1985 case WDA_REMOVE_STAKEY_RSP:
1986 limProcessMlmRemoveKeyRsp( pMac, limMsg );
1987 break;
1988 case WDA_ADDBA_RSP:
1989 limProcessMlmHalAddBARsp( pMac, limMsg );
1990 break;
1991
1992 case WDA_STA_STAT_RSP:
1993 case WDA_AGGR_STAT_RSP:
1994 case WDA_GLOBAL_STAT_RSP:
1995 case WDA_STAT_SUMM_RSP:
1996 limSendSmeStatsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1997 break;
1998
1999 case WDA_GET_STATISTICS_RSP:
2000 limSendSmePEStatisticsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
2001 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002002#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002003 case WDA_GET_ROAM_RSSI_RSP:
2004 limSendSmePEGetRoamRssiRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
2005 break;
2006#endif
2007
Jeff Johnson295189b2012-06-20 16:38:30 -07002008
2009 case WDA_SET_MIMOPS_RSP: //limProcessSetMimoRsp(pMac, limMsg);
2010 case WDA_SET_TX_POWER_RSP: //limProcessSetTxPowerRsp(pMac, limMsg);
2011 case WDA_GET_TX_POWER_RSP: //limProcessGetTxPowerRsp(pMac, limMsg);
2012 case WDA_GET_NOISE_RSP:
2013 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2014 limMsg->bodyptr = NULL;
2015 //limProcessGetNoiseRsp(pMac, limMsg);
2016 break;
2017
2018 case WDA_SET_MAX_TX_POWER_RSP:
2019#if defined WLAN_FEATURE_VOWIFI
2020 rrmSetMaxTxPowerRsp( pMac, limMsg );
2021#endif
2022 if(limMsg->bodyptr != NULL)
2023 {
2024 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2025 limMsg->bodyptr = NULL;
2026 }
2027 break;
2028
Jeff Johnson295189b2012-06-20 16:38:30 -07002029 case SIR_LIM_ADDR2_MISS_IND:
2030 {
2031 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002032 FL("Addr2 mismatch interrupt received %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 limMsg->type);
2034 /*a message from HAL indicating addr2 mismatch interrupt occurred
2035 limMsg->bodyptr contains only pointer to 48-bit addr2 field*/
2036 //Dinesh fix this. the third parameter should be sessionentry.
2037 //limHandleUnknownA2IndexFrames(pMac, (void *)limMsg->bodyptr);
2038
2039 /*Free message body pointer*/
2040 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002041 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002042 break;
2043 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002044
2045#ifdef WLAN_FEATURE_VOWIFI_11R
2046 case WDA_AGGR_QOS_RSP:
2047 limProcessFTAggrQoSRsp( pMac, limMsg );
2048 break;
2049#endif
2050
2051 case WDA_SET_LINK_STATE_RSP:
2052 linkStateParams = (tLinkStateParams *)limMsg->bodyptr;
2053#if defined WLAN_FEATURE_VOWIFI_11R
2054 pSession = linkStateParams->session;
2055 if(linkStateParams->ft)
2056 {
2057 limSendReassocReqWithFTIEsMgmtFrame(pMac,
2058 pSession->pLimMlmReassocReq,
2059 pSession);
2060 }
2061#endif
2062 if( linkStateParams->callback )
2063 {
2064 linkStateParams->callback( pMac, linkStateParams->callbackArg );
2065 }
2066 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002067 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002068 break;
2069
2070#ifdef WLAN_FEATURE_PACKET_FILTERING
2071 case WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2072 pmmProcessMessage(pMac, limMsg);
2073 break;
2074#endif // WLAN_FEATURE_PACKET_FILTERING
2075
2076#ifdef WLAN_FEATURE_GTK_OFFLOAD
2077 case WDA_GTK_OFFLOAD_GETINFO_RSP:
2078 pmmProcessMessage(pMac, limMsg);
2079 break;
2080#endif // WLAN_FEATURE_GTK_OFFLOAD
Yathish9f22e662012-12-10 14:21:35 -08002081 case eWNI_SME_SET_BCN_FILTER_REQ:
2082 {
2083#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2084 tpPESession psessionEntry;
2085 tANI_U8 sessionId = (tANI_U8)limMsg->bodyval ;
2086 psessionEntry = &pMac->lim.gpSession[sessionId];
2087 if(psessionEntry != NULL && IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2088 {
2089 // sending beacon filtering information down to HAL
2090 if (limSendBeaconFilterInfo(pMac, psessionEntry) != eSIR_SUCCESS)
2091 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002092 limLog(pMac, LOGE, FL("Fail to send Beacon Filter Info "));
Yathish9f22e662012-12-10 14:21:35 -08002093 }
2094 }
Dhanashri Atred7885c22013-03-29 11:19:05 -07002095 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2096 limMsg->bodyptr = NULL;
Yathish9f22e662012-12-10 14:21:35 -08002097#endif
2098 }
2099 break;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302100 case eWNI_SME_HT40_OBSS_SCAN_IND:
2101 {
Sandeep Puligilla9f384742014-04-11 02:27:04 +05302102 tpPESession psessionEntry = NULL;
2103 tANI_U8 sessionId;
2104 tSirSmeHT40OBSSScanInd *ht40ScanInd =
Siddharth Bhald31c1252014-05-05 19:34:14 +05302105 (tSirSmeHT40OBSSScanInd *)limMsg->bodyptr;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302106
Sandeep Puligilla9f384742014-04-11 02:27:04 +05302107 psessionEntry = peFindSessionByBssid(pMac, ht40ScanInd->peerMacAddr,
Siddharth Bhald31c1252014-05-05 19:34:14 +05302108 &sessionId);
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302109
Siddharth Bhald31c1252014-05-05 19:34:14 +05302110 if (psessionEntry != NULL)
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302111 {
Siddharth Bhald31c1252014-05-05 19:34:14 +05302112 if( IS_HT40_OBSS_SCAN_FEATURE_ENABLE &&
2113 psessionEntry->htSupportedChannelWidthSet ==
2114 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE )
2115 {
2116 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
2117 "OBSS Scan Start Req: session id %d"
2118 "htSupportedChannelWidthSet %d", psessionEntry->peSessionId,
2119 psessionEntry->htSupportedChannelWidthSet);
2120 limSendHT40OBSSScanInd(pMac, psessionEntry);
2121 }
2122 else
2123 {
2124 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
2125 "OBSS Scan not started: htSupportedChannelWidthSet- %d"
2126 " session id %d", psessionEntry->htSupportedChannelWidthSet,
2127 psessionEntry->peSessionId);
2128 }
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302129 }
2130 else
2131 {
2132 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
Siddharth Bhald31c1252014-05-05 19:34:14 +05302133 "OBSS Scan not started: session id is NULL");
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302134 }
2135 vos_mem_free(limMsg->bodyptr);
2136 limMsg->bodyptr = NULL;
2137 }
2138 break;
2139 case eWNI_SME_HT40_STOP_OBSS_SCAN_IND:
2140 {
2141 tpPESession psessionEntry = NULL;
2142 tANI_U8 sessionId = (tANI_U8)limMsg->bodyval ;
2143
2144 psessionEntry = &pMac->lim.gpSession[sessionId];
2145 /* Sending LIM STOP OBSS SCAN Indication
2146 Stop command support is only for debugging purpose */
2147 if ( IS_HT40_OBSS_SCAN_FEATURE_ENABLE )
2148 limSendHT40OBSSStopScanInd(pMac, psessionEntry);
2149 else
2150 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_ERROR,
2151 "OBSS Scan Stop not started ");
2152 }
2153 break;
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05302154#ifdef WLAN_FEATURE_AP_HT40_24G
2155 case eWNI_SME_SET_HT_2040_MODE:
2156 limProcessSmeReqMessages(pMac, limMsg);
2157 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2158 limMsg->bodyptr = NULL;
2159 break;
2160#endif
2161
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302162#ifdef FEATURE_WLAN_TDLS
2163 case WDA_SET_TDLS_LINK_ESTABLISH_REQ_RSP:
2164 {
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302165 tpPESession psessionEntry;
2166 tANI_U8 sessionId;
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05302167 tTdlsLinkEstablishParams *pTdlsLinkEstablishParams;
2168 pTdlsLinkEstablishParams = (tTdlsLinkEstablishParams*) limMsg->bodyptr;
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302169
2170 if((psessionEntry = peFindSessionByStaId(pMac,
2171 pTdlsLinkEstablishParams->staIdx,
2172 &sessionId))== NULL)
2173 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302174 limLog(pMac, LOGE, FL("session %u does not exist"), sessionId);
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302175 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP message to SME
2176 with session id as zero and status as FAILURE so, that message
2177 queued in SME queue can be freed to prevent the SME cmd buffer leak */
2178 limSendSmeTdlsLinkEstablishReqRsp(pMac,
2179 0,
2180 NULL,
2181 NULL,
2182 eSIR_FAILURE);
2183 }
2184 else
2185 {
2186 limSendSmeTdlsLinkEstablishReqRsp(pMac,
2187 psessionEntry->smeSessionId,
2188 NULL,
2189 NULL,
2190 pTdlsLinkEstablishParams->status) ;
2191 }
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05302192 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2193 limMsg->bodyptr = NULL;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302194 break;
2195 }
Atul Mittal60bd4292014-08-14 12:19:27 +05302196
2197 case WDA_SET_TDLS_CHAN_SWITCH_REQ_RSP:
2198 {
2199 tpPESession psessionEntry;
2200 tANI_U8 sessionId;
2201 tTdlsChanSwitchParams *pTdlsChanSwitchParams;
2202 pTdlsChanSwitchParams = (tTdlsChanSwitchParams*) limMsg->bodyptr;
2203
2204 if((psessionEntry = peFindSessionByStaId(pMac,
2205 pTdlsChanSwitchParams->staIdx,
2206 &sessionId))== NULL)
2207 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302208 limLog(pMac, LOGE, FL("session %u does not exist"), sessionId);
Atul Mittal60bd4292014-08-14 12:19:27 +05302209 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP message to SME
2210 with session id as zero and status as FAILURE so, that message
2211 queued in SME queue can be freed to prevent the SME cmd buffer leak */
2212 limSendSmeTdlsChanSwitchReqRsp(pMac,
2213 0,
2214 NULL,
2215 NULL,
2216 eSIR_FAILURE);
2217 }
2218 else
2219 {
2220 limSendSmeTdlsChanSwitchReqRsp(pMac,
2221 psessionEntry->smeSessionId,
2222 NULL,
2223 NULL,
2224 pTdlsChanSwitchParams->status) ;
2225 }
2226 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2227 limMsg->bodyptr = NULL;
2228 break;
2229 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302230#endif
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05302231
2232 case WDA_RX_SCAN_EVENT:
2233 limProcessRxScanEvent(pMac, limMsg->bodyptr);
2234 break;
2235
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002236 case WDA_IBSS_PEER_INACTIVITY_IND:
2237 {
2238 limProcessIbssPeerInactivity(pMac, limMsg->bodyptr);
2239 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2240 limMsg->bodyptr = NULL;
2241 break;
2242 }
2243
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05302244 case WDA_SPOOF_MAC_ADDR_RSP:
2245 limProcessMlmSpoofMacAddrRsp(pMac, (tSirRetStatus)limMsg->bodyval);
2246 break;
2247
Pradeep Reddy POTTETI31505892015-04-16 16:47:54 +05302248 case eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ:
2249 limProcessSmeSetTdls2040BSSCoexReq(pMac, limMsg->bodyptr);
2250 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2251 limMsg->bodyptr = NULL;
2252 break;
2253
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +05302254 case eWNI_SME_DEL_ALL_TDLS_PEERS:
2255 limProcessSmeDelAllTdlsPeers(pMac, limMsg->bodyptr);
2256 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2257 limMsg->bodyptr = NULL;
2258 break;
2259
Jeff Johnson295189b2012-06-20 16:38:30 -07002260 default:
2261 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2262 limMsg->bodyptr = NULL;
2263 // Unwanted messages
2264 // Log error
2265 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002266 FL("Discarding unexpected message received %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002267 limMsg->type);
2268 limPrintMsgName(pMac, LOGE, limMsg->type);
2269 break;
2270
2271 } // switch (limMsg->type)
2272
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002273 PELOG2(limLog(pMac, LOG2, FL("Done Processing msgType = %d, sme state = %s, mlm state = %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002274 limMsg->type, limSmeStateStr(pMac->lim.gLimSmeState),
2275 limMlmStateStr(pMac->lim.gLimMlmState));)
2276
2277} /*** end limProcessMessages() ***/
2278
2279
2280
2281/**
2282 * limProcessDeferredMessageQueue
2283 *
2284 *FUNCTION:
2285 * This function is called by LIM while exiting from Learn
2286 * mode. This function fetches messages posted to the LIM
2287 * deferred message queue limDeferredMsgQ.
2288 *
2289 *LOGIC:
2290 *
2291 *ASSUMPTIONS:
2292 * NA
2293 *
2294 *NOTE:
2295 * NA
2296 *
2297 * @param pMac - Pointer to Global MAC structure
2298 * @return None
2299 */
2300
2301void
2302limProcessDeferredMessageQueue(tpAniSirGlobal pMac)
2303{
2304 tSirMsgQ limMsg = { 0, 0, 0 };
2305
Jeff Johnson295189b2012-06-20 16:38:30 -07002306 tSirMsgQ *readMsg;
2307 tANI_U16 size;
2308
2309 /*
2310 ** check any deferred messages need to be processed
2311 **/
2312 size = pMac->lim.gLimDeferredMsgQ.size;
2313 if (size > 0)
2314 {
2315 while ((readMsg = limReadDeferredMsgQ(pMac)) != NULL)
2316 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302317 vos_mem_copy((tANI_U8*) &limMsg,
Jeff Johnson295189b2012-06-20 16:38:30 -07002318 (tANI_U8*) readMsg, sizeof(tSirMsgQ));
2319 size--;
2320 limProcessMessages(pMac, &limMsg);
2321
2322 if((limIsSystemInScanState(pMac)) || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) ||
Hema Aparna Medicharlab56b6612015-05-18 11:42:52 +05302323 (pMac->lim.gLimSystemInScanLearnMode) || pMac->lim.gLimAddtsSent)
Jeff Johnson295189b2012-06-20 16:38:30 -07002324 break;
2325 }
2326 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002327} /*** end limProcessDeferredMessageQueue() ***/
2328
2329
2330/*
2331 * limProcessNormalHddMsg
2332 * Function: this function checks the current lim state and decide whether the message passed shall be deffered.
2333 * @param pMac - Pointer to Global MAC structure
2334 * pLimMsg -- the message need to be processed
2335 * fRspReqd -- whether return result to hdd
2336 * @return None
2337 */
2338void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd)
2339{
2340 tANI_BOOLEAN fDeferMsg = eANI_BOOLEAN_TRUE;
2341
2342 /* Added For BT-AMP Support */
2343 if ((pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_AP_ROLE )
2344 ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_STA_ROLE)
2345 ||(pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE))
2346 {
2347 /** This check is required only for the AP and in 2 cases.
2348 * 1. If we are in learn mode and we receive any of these messages,
2349 * you have to come out of scan and process the message, hence dont
2350 * defer the message here. In handler, these message could be defered
2351 * till we actually come out of scan mode.
2352 * 2. If radar is detected, you might have to defer all of these
2353 * messages except Stop BSS request/ Switch channel request. This
2354 * decision is also made inside its handler.
2355 *
2356 * Please be careful while using the flag fDeferMsg. Possibly you
2357 * might end up in an infinite loop.
2358 **/
2359 if (((pLimMsg->type == eWNI_SME_START_BSS_REQ) ||
2360 (pLimMsg->type == eWNI_SME_STOP_BSS_REQ) ||
2361 (pLimMsg->type == eWNI_SME_SWITCH_CHL_REQ) ||
2362 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ) ||
2363 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ)))
2364 {
2365 fDeferMsg = eANI_BOOLEAN_FALSE;
2366 }
2367 }
2368
2369 /* limInsystemInscanState() refers the psessionEntry, how to get session Entry????*/
Jeff Johnsone7245742012-09-05 17:12:55 -07002370 if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) /*||
2371 (LIM_IS_RADAR_DETECTED(pMac))*/) && fDeferMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002372 {
2373 // System is in DFS (Learn) mode or awaiting addts response
2374 // or if radar is detected, Defer processsing this message
2375 if (limDeferMsg(pMac, pLimMsg) != TX_SUCCESS)
2376 {
2377#ifdef WLAN_DEBUG
2378 pMac->lim.numSme++;
2379#endif
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002380 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 -07002381 pLimMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
2382 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
2383 limLogSessionStates(pMac);
2384 limPrintMsgName(pMac, LOGE, pLimMsg->type);
2385 // Release body
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302386 vos_mem_free(pLimMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002387 pLimMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002388 }
2389 }
2390 else
2391 {
2392 if(fRspReqd)
2393 {
2394 // These messages are from HDD
2395 // Since these requests may also be generated
2396 // internally within LIM module, need to
2397 // distinquish and send response to host
2398 pMac->lim.gLimRspReqd = eANI_BOOLEAN_TRUE;
2399 }
2400#ifdef WLAN_DEBUG
2401 pMac->lim.numSme++;
2402#endif
2403 if(limProcessSmeReqMessages(pMac, pLimMsg))
2404 {
2405 // Release body
2406 // limProcessSmeReqMessage consumed the buffer. We can free it.
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302407 vos_mem_free(pLimMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002408 pLimMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002409 }
2410 }
2411}
2412
2413void
Jeff Johnsone7245742012-09-05 17:12:55 -07002414handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002415{
2416 tSirMacHTCapabilityInfo macHTCapabilityInfo;
2417 tSirMacHTParametersInfo macHTParametersInfo;
2418 tSirMacHTInfoField1 macHTInfoField1;
2419 tSirMacHTInfoField2 macHTInfoField2;
2420 tSirMacHTInfoField3 macHTInfoField3;
2421 tANI_U32 cfgValue;
2422 tANI_U8 *ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002423
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) != eSIR_SUCCESS)
2425 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002426 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002427 return ;
2428 }
2429 ptr = (tANI_U8 *) &macHTCapabilityInfo;
2430 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2431 pMac->lim.gHTLsigTXOPProtection = (tANI_U8)macHTCapabilityInfo.lsigTXOPProtection;
2432 pMac->lim.gHTMIMOPSState = (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
2433 pMac->lim.gHTGreenfield = (tANI_U8)macHTCapabilityInfo.greenField;
2434 pMac->lim.gHTMaxAmsduLength = (tANI_U8)macHTCapabilityInfo.maximalAMSDUsize;
2435 pMac->lim.gHTShortGI20Mhz = (tANI_U8)macHTCapabilityInfo.shortGI20MHz;
2436 pMac->lim.gHTShortGI40Mhz = (tANI_U8)macHTCapabilityInfo.shortGI40MHz;
Jeff Johnson295189b2012-06-20 16:38:30 -07002437 pMac->lim.gHTPSMPSupport = (tANI_U8)macHTCapabilityInfo.psmp;
2438 pMac->lim.gHTDsssCckRate40MHzSupport = (tANI_U8)macHTCapabilityInfo.dsssCckMode40MHz;
2439
2440 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) != eSIR_SUCCESS)
2441 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002442 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002443 return ;
2444 }
2445 ptr = (tANI_U8 *) &macHTParametersInfo;
2446 *ptr = (tANI_U8) (cfgValue & 0xff);
2447 pMac->lim.gHTAMpduDensity = (tANI_U8)macHTParametersInfo.mpduDensity;
2448 pMac->lim.gHTMaxRxAMpduFactor = (tANI_U8)macHTParametersInfo.maxRxAMPDUFactor;
2449
2450 // Get HT IE Info
2451 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) != eSIR_SUCCESS)
2452 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002453 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002454 return ;
2455 }
2456 ptr = (tANI_U8 *) &macHTInfoField1;
2457 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
2458 pMac->lim.gHTServiceIntervalGranularity = (tANI_U8)macHTInfoField1.serviceIntervalGranularity;
2459 pMac->lim.gHTControlledAccessOnly = (tANI_U8)macHTInfoField1.controlledAccessOnly;
2460 pMac->lim.gHTRifsMode = (tANI_U8)macHTInfoField1.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002461
2462 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) != eSIR_SUCCESS)
2463 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002464 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002465 return ;
2466 }
2467 ptr = (tANI_U8 *) &macHTInfoField2;
2468 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2469 pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
2470
2471 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) != eSIR_SUCCESS)
2472 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002473 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002474 return ;
2475 }
2476 ptr = (tANI_U8 *) &macHTInfoField3;
2477 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2478 pMac->lim.gHTPCOActive = (tANI_U8)macHTInfoField3.pcoActive;
2479 pMac->lim.gHTPCOPhase = (tANI_U8)macHTInfoField3.pcoPhase;
Jeff Johnson295189b2012-06-20 16:38:30 -07002480 pMac->lim.gHTSecondaryBeacon = (tANI_U8)macHTInfoField3.secondaryBeacon;
2481 pMac->lim.gHTDualCTSProtection = (tANI_U8)macHTInfoField3.dualCTSProtection;
2482 pMac->lim.gHTSTBCBasicMCS = (tANI_U8)macHTInfoField3.basicSTBCMCS;
Jeff Johnsone7245742012-09-05 17:12:55 -07002483
2484 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2485 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
2486 * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
2487 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2488 */
2489 if (psessionEntry != NULL)
2490 {
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302491 psessionEntry->htCapability =
2492 IS_DOT11_MODE_HT(psessionEntry->dot11mode);
2493 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2494 (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05302495 limInitOBSSScanParams(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002496 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002497}
2498
2499void limLogSessionStates(tpAniSirGlobal pMac)
2500{
2501#ifdef WLAN_DEBUG
2502 int i;
2503
2504 for(i = 0; i < pMac->lim.maxBssId; i++)
2505 {
2506 if(pMac->lim.gpSession[i].valid)
2507 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302508 limLog(pMac, LOG1, FL("Session[%d] sysRole(%d) limSmeState %d "
2509 "(prev sme state %d) mlm state %d (prev mlm state %d)"),
2510 i, pMac->lim.gpSession[i].limSystemRole,
2511 pMac->lim.gpSession[i].limSmeState,
2512 pMac->lim.gpSession[i].limPrevSmeState,
2513 pMac->lim.gpSession[i].limMlmState,
2514 pMac->lim.gpSession[i].limPrevMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002515 }
2516 }
2517#endif //ifdef WLAN_DEBUG
2518}