blob: a654ce9b5cbc5d86949b18758ccdb7bb6cac182f [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Abhinav Kumar8eed0362019-08-05 14:26:07 +05302 * Copyright (c) 2011-2017, 2019 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
Abhishek Singh00b71972016-01-07 10:51:04 +053078#ifdef WLAN_FEATURE_RMC
79#include "limRMC.h"
80#endif
81
Jeff Johnson295189b2012-06-20 16:38:30 -070082#include "vos_types.h"
83#include "vos_packet.h"
84#include "vos_memory.h"
Abhinav Kumard9664da2019-08-05 17:11:25 +053085#include "limSecurityUtils.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070086
Katya Nigam3802f202013-12-16 19:27:14 +053087/* This value corresponds to 500 ms */
Abhishek Singh849366d2015-11-26 16:53:47 +053088#define MAX_PROBEREQ_TIME 50
Katya Nigam3802f202013-12-16 19:27:14 +053089
Dino Mycle7a76e662014-06-10 11:36:34 +053090#ifdef WLAN_FEATURE_EXTSCAN
91#define SIZE_OF_FIXED_PARAM 12
92#endif
93
Masti, Narayanraddif10fd792015-12-15 15:01:01 +053094#define CHECK_BIT(value, mask) ((value) & (1 << (mask)))
95
Abhinav Kumard9664da2019-08-05 17:11:25 +053096#define IEEE80211_STATUS_SUCCESS 0
97
Jeff Johnson295189b2012-06-20 16:38:30 -070098void limLogSessionStates(tpAniSirGlobal pMac);
99
Abhinav Kumard9664da2019-08-05 17:11:25 +0530100#ifdef WLAN_FEATURE_SAE
101/**
102 * lim_process_sae_msg() - Process SAE message
103 * @mac: Global MAC pointer
104 * @body: Buffer pointer
105 *
106 * Return: None
107 */
108static void lim_process_sae_msg(tpAniSirGlobal mac, struct sir_sae_msg *body)
109{
110 struct sir_sae_msg *sae_msg = body;
111 tpPESession session;
112
113 if (!sae_msg) {
114 limLog(mac, LOGE, FL("SAE msg is NULL"));
115 return;
116 }
117
118 session = pe_find_session_by_sme_session_id(mac, sae_msg->session_id);
119 if (session == NULL) {
120 limLog(mac, LOGE, FL("SAE:Unable to find session"));
121 return;
122 }
123
124 if (session->pePersona != VOS_STA_MODE) {
125 limLog(mac, LOGE, FL("SAE:Not supported in this mode %d"),
126 session->pePersona);
127 return;
128 }
129
130 limLog(mac, LOG1, FL("SAE:status %d limMlmState %d pePersona %d"),
131 sae_msg->sae_status, session->limMlmState,
132 session->pePersona);
133 switch (session->limMlmState) {
134 case eLIM_MLM_WT_SAE_AUTH_STATE:
135 /* SAE authentication is completed. Restore from auth state */
136 if (tx_timer_running(&mac->lim.limTimers.sae_auth_timer))
137 limDeactivateAndChangeTimer(mac, eLIM_AUTH_SAE_TIMER);
138 /* success */
139 if (sae_msg->sae_status == IEEE80211_STATUS_SUCCESS)
140 limRestoreFromAuthState(mac, eSIR_SME_SUCCESS,
141 eSIR_MAC_SUCCESS_STATUS, session);
142 else
143 limRestoreFromAuthState(mac, eSIR_SME_AUTH_REFUSED,
144 eSIR_MAC_UNSPEC_FAILURE_STATUS, session);
145 break;
146 default:
147 /* SAE msg is received in unexpected state */
148 limLog(mac, LOGE, FL("received SAE msg in state %X"),
149 session->limMlmState);
150 limPrintMlmState(mac, LOGE, session->limMlmState);
151 break;
152 }
153}
154#else
155static void lim_process_sae_msg(tpAniSirGlobal mac, struct sir_sae_msg *body)
156{}
157#endif
158
Jeff Johnson295189b2012-06-20 16:38:30 -0700159/** -------------------------------------------------------------
160\fn defMsgDecision
161\brief The function decides whether to defer a message or not in limProcessMessage function
162\param tpAniSirGlobal pMac
163\param tSirMsgQ limMsg
164\param tSirMacTspecIE *ppInfo
165\return none
166 -------------------------------------------------------------*/
167
168tANI_U8 static
169defMsgDecision(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
170{
171
172
173/* this function should not changed */
Jeff Johnsone7245742012-09-05 17:12:55 -0700174 if(pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700175 {
176 // Defer processsing this message
177 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
178 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700179 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 -0700180 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
181 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
182 limLogSessionStates(pMac);
183 limHandleDeferMsgError(pMac, limMsg);
184 }
185 return true;
186 }
187
188 //When defer is requested then defer all the messages except HAL responses.
189 if((!limIsSystemInScanState(pMac)) && (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) &&
190 !pMac->lim.gLimSystemInScanLearnMode)
191 {
192 if((limMsg->type != WDA_ADD_BSS_RSP) &&
193 (limMsg->type != WDA_DELETE_BSS_RSP) &&
194 (limMsg->type != WDA_ADD_STA_RSP) &&
195 (limMsg->type != WDA_ADD_STA_SELF_RSP) &&
196 (limMsg->type != WDA_DEL_STA_SELF_RSP) &&
197 (limMsg->type != WDA_DELETE_STA_RSP)&&
198 (limMsg->type != WDA_SET_BSSKEY_RSP)&&
199 (limMsg->type != WDA_SET_STAKEY_RSP)&&
200 (limMsg->type != WDA_SET_STA_BCASTKEY_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700201 (limMsg->type != eWNI_SME_START_REQ) &&
202 (limMsg->type != WDA_AGGR_QOS_RSP) &&
203 (limMsg->type != WDA_REMOVE_BSSKEY_RSP) &&
204 (limMsg->type != WDA_REMOVE_STAKEY_RSP) &&
205 (limMsg->type != WDA_SET_MIMOPS_RSP)&&
206 (limMsg->type != WDA_ADDBA_RSP) &&
207 (limMsg->type != WDA_ENTER_BMPS_RSP) &&
208 (limMsg->type != WDA_EXIT_BMPS_RSP) &&
209 (limMsg->type != WDA_ENTER_IMPS_RSP) &&
210 (limMsg->type != WDA_EXIT_IMPS_RSP) &&
211 (limMsg->type != WDA_ENTER_UAPSD_RSP) &&
212 (limMsg->type != WDA_EXIT_UAPSD_RSP) &&
213 (limMsg->type != WDA_WOWL_ENTER_RSP) &&
214 (limMsg->type != WDA_WOWL_EXIT_RSP) &&
215 (limMsg->type != WDA_SWITCH_CHANNEL_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700216 (limMsg->type != WDA_P2P_NOA_ATTR_IND) &&
Viral Modid440e682013-03-06 02:25:31 -0800217 (limMsg->type != WDA_P2P_NOA_START_IND) &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700218#ifdef FEATURE_OEM_DATA_SUPPORT
219 (limMsg->type != WDA_START_OEM_DATA_RSP) &&
220#endif
Hema Aparna Medicharlab56b6612015-05-18 11:42:52 +0530221 (limMsg->type != WDA_ADD_TS_RSP) &&
Hanumantha Reddy Pothula3de8d4c2015-10-07 12:06:37 +0530222
223 /* LIM won't process any defer queue commands if gLimAddtsSent is set to
224 TRUE. gLimAddtsSent will be set TRUE to while sending ADDTS REQ. Say,
225 when deferring is enabled, if SIR_LIM_ADDTS_RSP_TIMEOUT is posted
226 (because of not receiving ADDTS RSP) then this command will be added
227 to defer queue and as gLimAddtsSent is set TRUE LIM will never
228 process any commands from defer queue, including
229 SIR_LIM_ADDTS_RSP_TIMEOUT. Hence allowing SIR_LIM_ADDTS_RSP_TIMEOUT
230 command to be processed with deferring enabled, so that this will be
231 processed immediately and sets gLimAddtsSent to FALSE.
232 */
233 (limMsg->type != SIR_LIM_ADDTS_RSP_TIMEOUT) &&
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +0530234 (limMsg->type != WDA_LOST_LINK_PARAMS_IND) &&
Hema Aparna Medicharlab56b6612015-05-18 11:42:52 +0530235 /* Allow processing of RX frames while awaiting reception of
236 ADD TS response over the air. This logic particularly handles the
237 case when host sends ADD BA request to FW after ADD TS request
238 is sent over the air and ADD TS response received over the air */
239 !(limMsg->type == SIR_BB_XPORT_MGMT_MSG && pMac->lim.gLimAddtsSent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700240 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700241 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 -0700242 limMsgStr(limMsg->type));)
243
244 // Defer processsing this message
245 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
246 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700247 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 -0700248 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
249 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
250 limLogSessionStates(pMac);
251 limHandleDeferMsgError(pMac, limMsg);
252
253 }
254 return true;
255 }
256 }
257 return false;
258}
259
260/*
261* Beacon Handling Cases:
262* during scanning, when no session is active:
263* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
264* during scanning, when any session is active, but beacon/Pr does not belong to that session, psessionEntry will be null.
265* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
266* during scanning, when any session is active, and beacon/Pr belongs to one of the session, psessionEntry will not be null.
267* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
268* Not scanning, no session:
269* there should not be any beacon coming, if coming, should be dropped.
270* Not Scanning,
271*/
272static void
273__limHandleBeacon(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tpPESession psessionEntry)
274{
275 /* checking for global SME state...*/
276 tANI_U8 *pRxPacketInfo;
277 limGetBDfromRxPacket(pMac, pMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
278
279 //This function should not be called if beacon is received in scan state.
280 //So not doing any checks for the global state.
281
282 if(psessionEntry == NULL)
283 {
284 schBeaconProcess(pMac, pRxPacketInfo, NULL);
285 }
286 else if( (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
287 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE))
288 {
289 schBeaconProcess(pMac, pRxPacketInfo, psessionEntry);
290 }
291 else
292 limProcessBeaconFrame(pMac, pRxPacketInfo, psessionEntry);
293
294 return;
295}
296
297
298//Fucntion prototype
299void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd);
300
301/**
Jeff Johnson295189b2012-06-20 16:38:30 -0700302 * limDeferMsg()
303 *
304 *FUNCTION:
305 * This function is called to defer the messages received
306 * during Learn mode
307 *
308 *LOGIC:
309 * NA
310 *
311 *ASSUMPTIONS:
312 * NA
313 *
314 *NOTE:
315 * NA
316 *
317 * @param pMac - Pointer to Global MAC structure
318 * @param pMsg of type tSirMsgQ - Pointer to the message structure
319 * @return None
320 */
321
322tANI_U32
323limDeferMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
324{
325 tANI_U32 retCode = TX_SUCCESS;
Jeff Johnson77165482013-03-07 08:15:44 -0800326
327 retCode = limWriteDeferredMsgQ(pMac, pMsg);
328
Jeff Johnson295189b2012-06-20 16:38:30 -0700329 if (retCode == TX_SUCCESS)
Jeff Johnson77165482013-03-07 08:15:44 -0800330 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530331 limLog(pMac, LOG1,
332 FL("Deferred message(0x%X) limSmeState %d (prev sme state %d)"
333 " sysRole %d mlm state %d (prev mlm state %d)"),
334 pMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
335 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState,
336 pMac->lim.gLimPrevMlmState);
Jeff Johnson77165482013-03-07 08:15:44 -0800337 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));)
338 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700339 else
Jeff Johnson77165482013-03-07 08:15:44 -0800340 {
Agarwal Ashishe865f332014-04-08 13:20:06 +0530341 limLog(pMac, LOG1, FL("Dropped lim message (0x%X)"), pMsg->type);
Jeff Johnson77165482013-03-07 08:15:44 -0800342 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));)
343 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700344
345 return retCode;
346} /*** end limDeferMsg() ***/
347
348
349
350/**
351 * limHandleFramesInScanState()
352 *
353 *FUNCTION:
354 * This function is called to process 802.11 frames
355 * received by LIM in scan state.
356 *
357 *LOGIC:
358 * NA
359 *
360 *ASSUMPTIONS:
361 * NA
362 *
363 *NOTE:
364 * NA
365 *
366 * @param pMac - Pointer to Global MAC structure
367 * @param limMsg - Received message
368 * @param pRxPacketInfo - Pointer to Rx packet info structure
369 * @param deferMsg - Indicates whether the frame shall be deferred
370 * @return None
371 */
372
373static void
374limHandleFramesInScanState(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pRxPacketInfo, tANI_U8 *deferMsg, tpPESession psessionEntry)
375{
376 tSirMacFrameCtl fc;
377 tpSirMacMgmtHdr pHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -0700378
379 *deferMsg = false;
380 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
381 fc = pHdr->fc;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700382 limLog( pMac, LOG2, FL("ProtVersion %d, Type %d, Subtype %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700383 fc.protVer, fc.type, fc.subType );
384
Jeff Johnson295189b2012-06-20 16:38:30 -0700385 // defer all message in scan state except for Beacons and Probe Response
386 if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_BEACON))
387 {
388 if (psessionEntry == NULL)
389 limProcessBeaconFrameNoSession(pMac, pRxPacketInfo);
390 else
391 limProcessBeaconFrame(pMac, pRxPacketInfo,psessionEntry);
392 }
393 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_RSP))
394 {
395 if (psessionEntry == NULL)
396 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
397 else
398 limProcessProbeRspFrame(pMac, pRxPacketInfo,psessionEntry);
399 }
400 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_REQ))
401 {
402 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo, psessionEntry);
403 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700404 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_ACTION))
405 {
Yeshwanth Sriram Guntuka9ae407c2018-06-28 12:58:28 +0530406 if (psessionEntry != NULL)
407 limProcessActionFrame(pMac, pRxPacketInfo, psessionEntry);
408 else
409 limProcessActionFrameNoSession(pMac, pRxPacketInfo);
Jeff Johnson295189b2012-06-20 16:38:30 -0700410 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700411 else
412 {
413 *deferMsg = true;
414 return;
415 }
416
Jeff Johnson295189b2012-06-20 16:38:30 -0700417 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
418 return;
419
420} /*** end limHandleFramesInScanState() ***/
421
422/** ------------------------------------------------------------
423\brief This function handles Unknown Unicast (A2 Index)
424\ packets.
425\param tpAniSirGlobal pMac Global Mac data structure
426\param void *pRxPacketInfo Pointer to Buffer Descriptor
427\return none
428\
429\ -------------------------------------------------------------- */
430static void limHandleUnknownA2IndexFrames(tpAniSirGlobal pMac, void *pRxPacketInfo,tpPESession psessionEntry)
431{
Jeff Johnson295189b2012-06-20 16:38:30 -0700432 /* addr2 mismatch interrupt occurred this means previous
433 disassociation was not successful
434 In Volans pRxPacketInfo only contains pointer 48-bit address2 field */
435 /*Send disassociation message again*/
436 //Dinesh need one more arguement.
437 //limSendDisassocMgmtFrame(pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON,(tANI_U8 *) pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800438 //TODO: verify this
Jeff Johnson295189b2012-06-20 16:38:30 -0700439 //This could be a public action frame.
440 if( psessionEntry->limSystemRole == eLIM_P2P_DEVICE_ROLE )
441 limProcessActionFrameNoSession(pMac, (tANI_U8 *) pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800442
443#ifdef FEATURE_WLAN_TDLS
444 {
445 tpSirMacDataHdr3a pMacHdr;
446 pMacHdr = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
447
448 if (limIsGroupAddr(pMacHdr->addr2))
449 {
Abhishek Singh525045c2014-12-15 17:18:45 +0530450 limLog(pMac, LOG1, FL("Ignoring A2 Invalid Packet received for MC/BC:"));
451 limPrintMacAddr(pMac, pMacHdr->addr2, LOG1);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800452
453 return;
454 }
455 /* TDLS_hklee: move down here to reject Addr2 == Group (first checking above)
456 and also checking if SystemRole == STA */
457 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
458 {
459 /* ADD handling of Public Action Frame */
460 LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700461 ("limHandleUnknownA2IndexFrames: type=0x%x, subtype=0x%x"),pMacHdr->fc.type, pMacHdr->fc.subType));
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800462 switch (pMacHdr->fc.type)
463 {
464 case SIR_MAC_MGMT_FRAME:
465 {
466 switch (pMacHdr->fc.subType)
467 {
468 case SIR_MAC_MGMT_ACTION:
469 {
470 limProcessActionFrame(pMac, pRxPacketInfo, psessionEntry) ;
471 break ;
472 }
473 default:
474 {
475 break ;
476 }
477 }
478 }
479 default:
480 {
481 break ;
482 }
483 }
484 }
485 }
486#endif
487
Jeff Johnson295189b2012-06-20 16:38:30 -0700488
489 return;
490}
491
Jeff Johnson295189b2012-06-20 16:38:30 -0700492/**
493 * limCheckMgmtRegisteredFrames()
494 *
495 *FUNCTION:
496 * This function is called to process to check if received frame match with
497 * any of the registered frame from HDD. If yes pass this frame to SME.
498 *
499 *LOGIC:
500 *
501 *ASSUMPTIONS:
502 *
503 *NOTE:
504 *
505 * @param pMac Pointer to Global MAC structure
506 * @param *pBd Pointer to the received Buffer Descriptor+payload
507 * @param *psessionEntry Pointer to session on which packet is received
508 * @return None
509 */
510static tANI_BOOLEAN
511limCheckMgmtRegisteredFrames(tpAniSirGlobal pMac, tANI_U8 *pBd,
512 tpPESession psessionEntry)
513{
514 tSirMacFrameCtl fc;
515 tpSirMacMgmtHdr pHdr;
516 tANI_U8 *pBody;
517 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
518 tANI_U16 frameType;
519 tANI_U16 framelen;
520 tANI_U8 type,subType;
521 tANI_BOOLEAN match = VOS_FALSE;
522 VOS_STATUS vosStatus;
523
524 pHdr = WDA_GET_RX_MAC_HEADER(pBd);
525 fc = pHdr->fc;
526 frameType = (fc.type << 2 ) | (fc.subType << 4);
527 pBody = WDA_GET_RX_MPDU_DATA(pBd);
528 framelen = WDA_GET_RX_PAYLOAD_LEN(pBd);
529
530 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
531 (vos_list_node_t**)&pLimMgmtRegistration);
532
533 while(pLimMgmtRegistration != NULL)
534 {
535 type = (pLimMgmtRegistration->frameType >> 2) & 0x03;
536 subType = (pLimMgmtRegistration->frameType >> 4) & 0x0f;
537 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
538 && (subType == SIR_MAC_MGMT_RESERVED15) )
539 {
540 limLog( pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700541 FL("rcvd frame match with SIR_MAC_MGMT_RESERVED15"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700542 match = VOS_TRUE;
543 break;
544 }
545
546 if (pLimMgmtRegistration->frameType == frameType)
547 {
548 if (pLimMgmtRegistration->matchLen > 0)
549 {
550 if (pLimMgmtRegistration->matchLen <= framelen)
551 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530552 if (vos_mem_compare(pLimMgmtRegistration->matchData,
Jeff Johnson295189b2012-06-20 16:38:30 -0700553 pBody, pLimMgmtRegistration->matchLen))
554 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700555 /* found match! */
556 match = VOS_TRUE;
557 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700558 }
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700559 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700560 }
561 else
562 {
563 /* found match! */
564 match = VOS_TRUE;
565 break;
566 }
567 }
568
569 vosStatus =
570 vos_list_peek_next ( &pMac->lim.gLimMgmtFrameRegistratinQueue,
571 (vos_list_node_t*) pLimMgmtRegistration,
572 (vos_list_node_t**) &pNext );
573 pLimMgmtRegistration = pNext;
574 pNext = NULL;
575 }
576
577 if (match)
578 {
579 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700580 FL("rcvd frame match with registered frame params"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700581
582 /* Indicate this to SME */
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +0530583 limSendSmeMgmtFrameInd( pMac, pLimMgmtRegistration->sessionId,
yeshwanth sriram guntukac1046a52017-04-25 16:34:50 +0530584 pBd, psessionEntry, WDA_GET_RX_RSSI_DB(pBd));
Jeff Johnson295189b2012-06-20 16:38:30 -0700585
586 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
587 && (subType == SIR_MAC_MGMT_RESERVED15) )
588 {
589 // These packets needs to be processed by PE/SME as well as HDD.
590 // If it returns TRUE here, the packet is forwarded to HDD only.
591 match = VOS_FALSE;
592 }
593 }
594
595 return match;
596} /*** end limCheckMgmtRegisteredFrames() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700597
Dino Mycle7a76e662014-06-10 11:36:34 +0530598#ifdef WLAN_FEATURE_EXTSCAN
599
600void
601limProcessEXTScanRealTimeData(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
602{
603 tpSirMacMgmtHdr pHdr = NULL;
604 eHalStatus status;
605 void *pCallbackContext;
606 tANI_U8 rfBand = 0;
607 tANI_U8 rxChannelInBD = 0;
608 tSirMacFrameCtl fc;
609 tDot11fBeacon *pBeacon = NULL;
610 tDot11fProbeResponse *pProbeResponse = NULL;
611 tSirWifiFullScanResultEvent tEXTScanFullScanResult;
612
613 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
614 fc = pHdr->fc;
615
616 limLog(pMac, LOG2,
617 FL("Received EXTScan Real Time data with length=%d from "),
618 WDA_GET_RX_MPDU_LEN(pRxPacketInfo));
619
620 limPrintMacAddr(pMac, pHdr->sa, LOG2);
621
622 vos_mem_set((tANI_U8 *) &tEXTScanFullScanResult,
623 sizeof(tSirWifiFullScanResultEvent), 0);
624
Dino Mycle3f783bc2014-08-08 17:40:22 +0530625 tEXTScanFullScanResult.ap.ts = vos_get_monotonic_boottime();
Dino Mycle7a76e662014-06-10 11:36:34 +0530626
627 vos_mem_copy(&tEXTScanFullScanResult.ap.bssid,
628 pHdr->bssId, sizeof(tSirMacAddr));
629
Dino Myclee8843b32014-07-04 14:21:45 +0530630 limPrintMacAddr(pMac, pHdr->bssId, LOG2);
Dino Mycle7a76e662014-06-10 11:36:34 +0530631
632
633 rfBand = WDA_GET_RX_RFBAND(pRxPacketInfo);
634 rxChannelInBD = WDA_GET_RX_CH(pRxPacketInfo);
635
636 if ((!rfBand) || IS_5G_BAND(rfBand))
637 {
638 rxChannelInBD = limUnmapChannel(rxChannelInBD);
639 }
640
c_hpothu24b354c2014-09-24 18:59:33 +0530641 tEXTScanFullScanResult.ap.channel =
642 (tANI_U32)vos_chan_to_freq(rxChannelInBD);
Dino Mycle7a76e662014-06-10 11:36:34 +0530643 tEXTScanFullScanResult.ap.rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
644
645 if (fc.subType == SIR_MAC_MGMT_BEACON)
646 {
647 limLog( pMac, LOG2, FL("Beacon "));
648
649 pBeacon = vos_mem_malloc(sizeof(tDot11fBeacon));
650 if ( NULL == pBeacon ){
651 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
652 return;
653 }
654
655 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
656 // delegate to the framesc-generated code,
657 status = dot11fUnpackBeacon( pMac,
658 (tANI_U8 *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo),
659 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo), pBeacon );
660
661 if ( DOT11F_FAILED( status ) )
662 {
663 limLog(pMac, LOGE, FL("Failed to parse a Beacons"
Sushant Kaushik87787972015-09-11 16:05:00 +0530664 "(%d)"), status);
Dino Mycle7a76e662014-06-10 11:36:34 +0530665 vos_mem_free(pBeacon);
666 return;
667 }
668 if ( pBeacon->SSID.present )
669 {
670 vos_mem_copy(tEXTScanFullScanResult.ap.ssid,
671 pBeacon->SSID.ssid,
672 pBeacon->SSID.num_ssid);
673 }
674 //NULL Terminate the string.
675 tEXTScanFullScanResult.ap.ssid[pBeacon->SSID.num_ssid] = 0;
676 tEXTScanFullScanResult.ap.beaconPeriod =
677 pBeacon->BeaconInterval.interval;
678 tEXTScanFullScanResult.ap.capability =
679 *((tANI_U16 *)&pBeacon->Capabilities);
680 vos_mem_free(pBeacon);
681 }
682 else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP)
683 {
684 limLog( pMac, LOG2, FL("Probe rsp "));
685
686 pProbeResponse = vos_mem_malloc(sizeof(tDot11fProbeResponse));
687 if ( NULL == pProbeResponse ){
688 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
689 return;
690 }
691
692 vos_mem_set( ( tANI_U8* )pProbeResponse,
693 sizeof(tDot11fProbeResponse), 0);
694 //delegate to the framesc-generated code,
695 status = dot11fUnpackProbeResponse( pMac,
696 (tANI_U8 *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo),
697 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo), pProbeResponse );
698
699 if ( DOT11F_FAILED( status ) )
700 {
701 limLog(pMac, LOGE, FL("Failed to parse a Probe"
Sushant Kaushik87787972015-09-11 16:05:00 +0530702 "Response (%d"), status);
Dino Mycle7a76e662014-06-10 11:36:34 +0530703 vos_mem_free(pProbeResponse);
704 return;
705 }
706 if ( pProbeResponse->SSID.present )
707 {
708 vos_mem_copy(tEXTScanFullScanResult.ap.ssid,
709 pProbeResponse->SSID.ssid,
710 pProbeResponse->SSID.num_ssid);
711 }
712 //NULL Terminate the string.
713 tEXTScanFullScanResult.ap.ssid[pProbeResponse->SSID.num_ssid] = 0;
714 tEXTScanFullScanResult.ap.beaconPeriod =
715 pProbeResponse->BeaconInterval.interval;
716 tEXTScanFullScanResult.ap.capability =
717 *(((tANI_U16 *)&pProbeResponse->Capabilities));
718
Gupta, Kapil4a5e1902016-02-01 19:54:14 +0530719 vos_mem_free(pProbeResponse);
Dino Mycle7a76e662014-06-10 11:36:34 +0530720 }
721 else
722 {
723 limLog( pMac, LOGE, FL("Wrong frame Type %d, Subtype %d for LFR"),
724 fc.type, fc.subType);
725 VOS_ASSERT(0);
726 return;
727 }
728
729 tEXTScanFullScanResult.requestId = pMac->sme.extScanStartReqId;
730 tEXTScanFullScanResult.ieLength =
731 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) - SIZE_OF_FIXED_PARAM;
732 tEXTScanFullScanResult.ie =(tSirInformationElement *)
733 ((tANI_U8 *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo) + SIZE_OF_FIXED_PARAM);
734
735 pCallbackContext = pMac->sme.pEXTScanCallbackContext;
736 if(pMac->sme.pEXTScanIndCb)
737 {
738 pMac->sme.pEXTScanIndCb(pCallbackContext,
739 SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND,
740 (tANI_U8 *)&tEXTScanFullScanResult);
741 }
742
743 return;
744} /*** end limProcessEXTScanRealTimeData() ***/
745#endif /* WLAN_FEATURE_EXTSCAN */
Jeff Johnson295189b2012-06-20 16:38:30 -0700746
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530747#ifdef SAP_AUTH_OFFLOAD
748/*
749 * lim_process_sap_offload_indication: function to process add sta/ del sta
750 * indication for SAP auth offload.
751 *
752 * @pMac: mac context
753 * @pRxPacketInfo: rx buffer
754 *
755 * This Function will go through buffer and if
756 * indication type is ADD_STA_IND, function will extract all data related to
757 * client and will call limAddSta
758 * and if indication type is DEL_STA_IND, function will call
759 * limSendSmeDisassocInd to do cleanup for station.
760 *
761 * Return : none
762 */
763static void lim_process_sap_offload_indication(tpAniSirGlobal pMac,
764 tANI_U8 *pRxPacketInfo)
765{
766 int i = 0;
767 tSapOfldIndications *sap_offload_indication_rx_buf =
768 (tSapOfldIndications *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
769 tSapOfldInd *sap_offload_ind =
770 (tSapOfldInd*)sap_offload_indication_rx_buf->indications;
771
772 limLog( pMac, LOG1,
773 FL("Notify SME with Sap Offload ind and indication type is %d num_indication %d \n"),
774 sap_offload_ind->indType,
775 (tANI_U8) sap_offload_indication_rx_buf->num_indications);
776
777 for (i=1; i <= (tANI_U8)(sap_offload_indication_rx_buf->num_indications);
778 i++)
779 {
780 if (sap_offload_ind->indType == SAP_OFFLOAD_ADD_STA_IND)
781 {
782 tSapOfldAddStaIndMsg *add_sta;
Agrawal Ashish7c5ed342017-01-11 17:32:46 +0530783 limLog( pMac, LOG1,
784 FL("Indication type is SAP_OFFLOAD_ADD_STA_IND"));
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530785 add_sta = (tSapOfldAddStaIndMsg *)sap_offload_ind->indication;
786 lim_sap_offload_add_sta(pMac, add_sta);
787 if (sap_offload_indication_rx_buf->num_indications > 1)
788 sap_offload_ind =
789 (tSapOfldInd *)((tANI_U8 *)sap_offload_ind +
Agrawal Ashish7c5ed342017-01-11 17:32:46 +0530790 sizeof(tSapOfldAddStaIndMsg) - sizeof(tANI_U8)+
791 add_sta->data_len + sizeof(tANI_U32));
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530792 }
793 else if (sap_offload_ind->indType == SAP_OFFLOAD_DEL_STA_IND)
794 {
795 tSapOfldDelStaIndMsg *del_sta;
Agrawal Ashish7c5ed342017-01-11 17:32:46 +0530796 limLog( pMac, LOG1,
797 FL("Indication type is SAP_OFFLOAD_DEL_STA_IND"));
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530798 del_sta = (tSapOfldDelStaIndMsg *)sap_offload_ind->indication;
799 lim_sap_offload_del_sta(pMac, del_sta);
800 sap_offload_ind = (tSapOfldInd *)((tANI_U8 *)sap_offload_ind +
Agrawal Ashish7c5ed342017-01-11 17:32:46 +0530801 sizeof(tSapOfldDelStaIndMsg) + sizeof(tANI_U32));
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530802 }
803 else
804 {
805 limLog(pMac, LOGE, FL("No Valid indication for connected station"));
806 }
807 }
808
809}
810#endif
811
Jeff Johnson295189b2012-06-20 16:38:30 -0700812/**
813 * limHandle80211Frames()
814 *
815 *FUNCTION:
816 * This function is called to process 802.11 frames
817 * received by LIM.
818 *
819 *LOGIC:
820 * NA
821 *
822 *ASSUMPTIONS:
823 * NA
824 *
825 *NOTE:
826 * NA
827 *
828 * @param pMac - Pointer to Global MAC structure
829 * @param pMsg of type tSirMsgQ - Pointer to the message structure
830 * @return None
831 */
832
833static void
Sushant Kaushik33200572015-08-05 16:46:20 +0530834
Jeff Johnson295189b2012-06-20 16:38:30 -0700835limHandle80211Frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pDeferMsg)
836{
837 tANI_U8 *pRxPacketInfo = NULL;
838 tSirMacFrameCtl fc;
839 tpSirMacMgmtHdr pHdr=NULL;
840 tpPESession psessionEntry=NULL;
841 tANI_U8 sessionId;
842 tAniBool isFrmFt = FALSE;
843 tANI_U16 fcOffset = WLANHAL_RX_BD_HEADER_SIZE;
Padma, Santhosh Kumar5a3054e2017-02-13 19:05:54 +0530844 tANI_S8 pe_sessionid = -1;
Jeff Johnson295189b2012-06-20 16:38:30 -0700845
846 *pDeferMsg= false;
847 limGetBDfromRxPacket(pMac, limMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
848
Agrawal Ashisha8e8a722016-10-18 19:07:45 +0530849#ifdef SAP_AUTH_OFFLOAD
850 if ((WDA_GET_SAP_AUTHOFFLOADIND(pRxPacketInfo) == 1) &&
851 pMac->sap_auth_offload)
852 {
853 lim_process_sap_offload_indication(pMac, pRxPacketInfo);
854 goto end;
855 }
856#endif
857
Dino Mycle7a76e662014-06-10 11:36:34 +0530858#ifdef WLAN_FEATURE_EXTSCAN
859
860 if ( WDA_GET_EXTSCANFULLSCANRESIND(pRxPacketInfo))
861 {
862 limLog( pMac, LOG2, FL("Notify EXTSCAN scan results to the HDD"));
863 limProcessEXTScanRealTimeData(pMac, pRxPacketInfo);
864 goto end;
865 }
866#endif //WLAN_FEATURE_EXTSCAN
867
Jeff Johnson295189b2012-06-20 16:38:30 -0700868 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
869 isFrmFt = WDA_GET_RX_FT_DONE(pRxPacketInfo);
870 fcOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pRxPacketInfo);
871 fc = pHdr->fc;
872
Madan Mohan Koyyalamudi99af06e2013-08-08 02:17:17 +0530873#ifdef WLAN_DUMP_MGMTFRAMES
874 limLog( pMac, LOGE, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
875 fc.protVer, fc.type, fc.subType,
876 WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
877 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, pHdr,
878 WDA_GET_RX_MPDU_HEADER_LEN(pRxPacketInfo));
879#endif
880
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -0800881 if ((fc.type == SIR_MAC_MGMT_FRAME) &&
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -0800882 (fc.subType != SIR_MAC_MGMT_BEACON))
883 {
Rajeev Kumar Sirasanagandla63f85cf2016-06-29 16:52:15 +0530884 limLog(pMac, LOG1, FL("RX MGMT - Type %hu, SubType %hu,"
885 "Seq.no %d, Source mac-addr "
886 MAC_ADDRESS_STR), fc.type, fc.subType,
887 ((pHdr->seqControl.seqNumHi << 4) |
888 (pHdr->seqControl.seqNumLo)),
889 MAC_ADDR_ARRAY(pHdr->sa));
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -0800890 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700891#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Kapil Gupta04ab1992016-06-26 13:36:51 +0530892 if (WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700893 {
Rajeev Kumar Sirasanagandla8f11d542017-11-14 17:56:55 +0530894 if (vos_check_monitor_state())
895 {
896 limLog( pMac, LOGW, FL("Ignore raom candidate when roam started"));
897 goto end;
898 }
Kapil Gupta04ab1992016-06-26 13:36:51 +0530899 limLog( pMac, LOGW, FL("Notify SME with candidate ind"));
900
901 if (WDA_IF_PER_ROAMCANDIDATEIND(pRxPacketInfo) &&
902 IS_FEATURE_SUPPORTED_BY_FW(PER_BASED_ROAMING) &&
903 pMac->roam.configParam.isPERRoamEnabled)
904 {
905 tSirPerRoamScanResult *candidateChanInfo =
906 (tSirPerRoamScanResult *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
907 int chanInfoLen = WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo)
908 - sizeof(tANI_U32);
909
910 /* Translate network buffer into system buffer */
911 vos_buff_to_hl_buff((v_U8_t *)candidateChanInfo,
912 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo));
913
914 /* Max candidates allowed */
Kapil Gupta3fd32832016-08-31 17:55:19 +0530915 if (candidateChanInfo->candidateCount >
916 SIR_PER_ROAM_MAX_CANDIDATE_CNT)
Kapil Gupta04ab1992016-06-26 13:36:51 +0530917 {
918 limLog(pMac, LOGE,
Kapil Gupta3fd32832016-08-31 17:55:19 +0530919 FL("Got maximum candidates as %d, setting count as %d"),
920 candidateChanInfo->candidateCount,
921 SIR_PER_ROAM_MAX_CANDIDATE_CNT);
922 candidateChanInfo->candidateCount =
923 SIR_PER_ROAM_MAX_CANDIDATE_CNT;
Kapil Gupta04ab1992016-06-26 13:36:51 +0530924 }
925
926 vos_mem_set(&pMac->candidateChannelInfo,
927 sizeof(tSirCandidateChanInfo) *
928 SIR_PER_ROAM_MAX_CANDIDATE_CNT, 0);
929
930 vos_mem_copy(&pMac->candidateChannelInfo,
931 candidateChanInfo->channelInfo,
932 (sizeof(tSirCandidateChanInfo) *
933 SIR_PER_ROAM_MAX_CANDIDATE_CNT) < chanInfoLen ?
934 (sizeof(tSirCandidateChanInfo) *
935 SIR_PER_ROAM_MAX_CANDIDATE_CNT):
936 chanInfoLen);
937
938 limLog(pMac, LOG1,
939 FL("PER based Roam candidates %d"),
940 candidateChanInfo->candidateCount);
941
942 pMac->PERroamCandidatesCnt = candidateChanInfo->candidateCount;
943 } else
944 {
945 /* Normal RSSI based roaming */
946 pMac->PERroamCandidatesCnt = 0;
947 }
948
Padma, Santhosh Kumar5a3054e2017-02-13 19:05:54 +0530949 pe_sessionid = limGetInfraSessionId(pMac);
950 if (pe_sessionid != -1) {
951 psessionEntry = peFindSessionBySessionId(pMac, pe_sessionid);
952 if (psessionEntry != NULL)
953 {
954 if ((psessionEntry->limSmeState == eLIM_SME_WT_DEAUTH_STATE) ||
955 (psessionEntry->limSmeState == eLIM_SME_WT_DISASSOC_STATE))
956 {
957 limLog(pMac, LOG1,
958 FL("Drop candidate ind as deauth/disassoc in progress"));
959 goto end;
960 }
961 }
962 }
963 else
964 limLog(pMac, LOGE,
965 FL("session id doesn't exist for infra"));
966
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700967 //send a session 0 for now - TBD
968 limSendSmeCandidateFoundInd(pMac, 0);
969 goto end;
970 }
971 if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo))
972 {
973 if (fc.subType == SIR_MAC_MGMT_BEACON)
974 {
975 limLog( pMac, LOG2, FL("Save this beacon in LFR cache"));
976 __limHandleBeacon(pMac, limMsg, NULL);
977 }
978 else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP)
979 {
980 limLog( pMac, LOG2, FL("Save this probe rsp in LFR cache"));
981 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
982 }
983 else
984 {
985 limLog( pMac, LOGE, FL("Wrong frame Type %d, Subtype %d for LFR"),
986 fc.type, fc.subType);
987 }
988 goto end;
989 }
990#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800991#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700992 if (fc.type == SIR_MAC_DATA_FRAME && isFrmFt)
993 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800994#if 0 // Ese TBD Need to PORT
Jeff Johnson295189b2012-06-20 16:38:30 -0700995 tpSirMacDot3Hdr pDataFrmHdr;
996
997 pDataFrmHdr = (tpSirMacDot3Hdr)((tANI_U8 *)pBD+ WLANHAL_RX_BD_GET_MPDU_H_OFFSET(pBD));
998 if((psessionEntry = peFindSessionByBssid(pMac,pDataFrmHdr->sa,&sessionId))== NULL)
999 {
1000 limLog( pMac, LOGE, FL("Session not found for Frm type %d, subtype %d, SA: "), fc.type, fc.subType);
1001 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
1002 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
1003 return;
1004 }
1005
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001006 if (!psessionEntry->isESEconnection)
Jeff Johnson295189b2012-06-20 16:38:30 -07001007 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001008 limLog( pMac, LOGE, FL("LIM received Type %d, Subtype %d in Non ESE connection"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001009 fc.type, fc.subType);
1010 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
1011 return;
1012 }
1013 limLog( pMac, LOGE, FL("Processing IAPP Frm from SA:"));
1014 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
1015#else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001016 printk("%s: Need to port handling of IAPP frames to PRIMA for ESE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -07001017#endif
1018
1019
1020 } else
1021#endif
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05301022
1023 if ((fc.type == SIR_MAC_MGMT_FRAME) &&
1024 (fc.subType == SIR_MAC_MGMT_PROBE_RSP) &&
1025 pMac->lim.isSpoofingEnabled)
1026 {
1027 limLog( pMac, LOG2, FL("Probe Rsp recieved with DA: "MAC_ADDRESS_STR
1028 " and selfMac Addr:"MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->da),
1029 MAC_ADDR_ARRAY(pMac->lim.gSelfMacAddr));
1030 if (VOS_TRUE == vos_mem_compare((v_VOID_t*) pHdr->da,
1031 (v_VOID_t*) pMac->lim.spoofMacAddr, VOS_MAC_ADDRESS_LEN))
1032 {
1033 vos_mem_copy(pHdr->da, pMac->lim.gSelfMacAddr, VOS_MAC_ADDRESS_LEN);
1034 }
1035 }
1036
Jeff Johnson295189b2012-06-20 16:38:30 -07001037 /* Added For BT-AMP Support */
1038 if((psessionEntry = peFindSessionByBssid(pMac,pHdr->bssId,&sessionId))== NULL)
1039 {
1040#ifdef WLAN_FEATURE_VOWIFI_11R
1041 if (fc.subType == SIR_MAC_MGMT_AUTH)
1042 {
1043#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001044 limLog( pMac, LOG1, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001045 fc.protVer, fc.type, fc.subType, WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -08001046 limPrintMacAddr(pMac, pHdr->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -07001047#endif
1048 if (limProcessAuthFrameNoSession(pMac, pRxPacketInfo, limMsg->bodyptr) == eSIR_SUCCESS)
1049 {
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +05301050 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07001051 }
1052 }
1053#endif
1054 if((fc.subType != SIR_MAC_MGMT_PROBE_RSP )&&
1055 (fc.subType != SIR_MAC_MGMT_BEACON)&&
1056 (fc.subType != SIR_MAC_MGMT_PROBE_REQ)
Jeff Johnson295189b2012-06-20 16:38:30 -07001057 && (fc.subType != SIR_MAC_MGMT_ACTION ) //Public action frame can be received from non-associated stations.
Jeff Johnson295189b2012-06-20 16:38:30 -07001058 )
1059 {
1060
1061 if((psessionEntry = peFindSessionByPeerSta(pMac,pHdr->sa,&sessionId))== NULL)
1062 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001063 limLog(pMac, LOG1, FL("session does not exist for given bssId"));
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +05301064 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07001065 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +05301066 else
1067 limLog(pMac,LOG1,"SessionId:%d Session Exist for given Bssid",
1068 psessionEntry->peSessionId);
Gopichand Nakkala6265d6f2013-03-20 23:32:50 +05301069 }
1070 // For p2p resp frames search for valid session with DA as
1071 // BSSID will be SA and session will be present with DA only
1072 if(fc.subType == SIR_MAC_MGMT_ACTION )
1073 {
1074 psessionEntry = peFindSessionByBssid(pMac,pHdr->da,&sessionId);
1075 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001076 }
1077
1078
Jeff Johnson295189b2012-06-20 16:38:30 -07001079 /* Check if frame is registered by HDD */
1080 if(limCheckMgmtRegisteredFrames(pMac, pRxPacketInfo, psessionEntry))
1081 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001082 limLog( pMac, LOG1, FL("Received frame is passed to SME"));
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +05301083 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07001084 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001085
1086
Jeff Johnson295189b2012-06-20 16:38:30 -07001087
1088 if (fc.protVer != SIR_MAC_PROTOCOL_VERSION)
1089 { // Received Frame with non-zero Protocol Version
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001090 limLog(pMac, LOGE, FL("Unexpected frame with protVersion %d received"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001091 fc.protVer);
Jeff Johnson295189b2012-06-20 16:38:30 -07001092#ifdef WLAN_DEBUG
1093 pMac->lim.numProtErr++;
1094#endif
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +05301095 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -07001096 }
1097
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05301098 if (!pMac->fScanOffload)
Jeff Johnson295189b2012-06-20 16:38:30 -07001099 {
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05301100 if (limIsSystemInScanState(pMac))
1101 {
1102 limHandleFramesInScanState(pMac, limMsg, pRxPacketInfo, pDeferMsg, psessionEntry);
1103 return;
1104 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001105 }
1106
1107/* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */
1108
1109#if 0
1110 if (psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001111 limLog( pMac, LOGW, FL( "gLimSystemRole is %d. Exiting..." ),psessionEntry->limSystemRole );
Jeff Johnson295189b2012-06-20 16:38:30 -07001112 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
1113
1114#ifdef WLAN_DEBUG
1115 pMac->lim.numProtErr++;
1116#endif
1117 return;
1118 }
1119 #endif //HACK to continue scanning
1120
1121
1122#ifdef WLAN_DEBUG
1123 pMac->lim.numMAC[fc.type][fc.subType]++;
1124#endif
1125
1126 switch (fc.type)
1127 {
1128 case SIR_MAC_MGMT_FRAME:
1129 {
1130 #if 0 //TBD-RAJESH fix this
1131 if (limIsReassocInProgress( pMac,psessionEntry) && (fc.subType != SIR_MAC_MGMT_DISASSOC) &&
1132 (fc.subType != SIR_MAC_MGMT_DEAUTH) && (fc.subType != SIR_MAC_MGMT_REASSOC_RSP))
1133 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001134 limLog(pMac, LOGE, FL("Frame with Type - %d, Subtype - %d received in ReAssoc Wait state, dropping..."),
Jeff Johnson295189b2012-06-20 16:38:30 -07001135 fc.type, fc.subType);
1136 return;
1137 }
1138 #endif //HACK to continue scanning
1139 // Received Management frame
1140 switch (fc.subType)
1141 {
1142 case SIR_MAC_MGMT_ASSOC_REQ:
1143 // Make sure the role supports Association
1144 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001145 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001146 )
1147 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_ASSOC, psessionEntry);
1148
1149 else
1150 {
1151 // Unwanted messages - Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001152 limLog(pMac, LOGE, FL("unexpected message received %X"),limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001153 limPrintMsgName(pMac, LOGE, limMsg->type);
1154 }
1155 break;
1156
1157 case SIR_MAC_MGMT_ASSOC_RSP:
1158 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_ASSOC,psessionEntry);
1159 break;
1160
1161 case SIR_MAC_MGMT_REASSOC_REQ:
1162 // Make sure the role supports Reassociation
1163 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001164 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -07001165 ){
1166 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_REASSOC, psessionEntry);
1167 }
1168 else
1169 {
1170 // Unwanted messages - Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001171 limLog(pMac, LOGE, FL("unexpected message received %X"),limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001172 limPrintMsgName(pMac, LOGE, limMsg->type);
1173 }
1174 break;
1175
1176 case SIR_MAC_MGMT_REASSOC_RSP:
1177 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_REASSOC,psessionEntry);
1178 break;
1179
1180 case SIR_MAC_MGMT_PROBE_REQ:
1181 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo,psessionEntry);
1182 break;
1183
1184 case SIR_MAC_MGMT_PROBE_RSP:
1185 if(psessionEntry == NULL)
1186 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
1187 else
1188 limProcessProbeRspFrame(pMac, pRxPacketInfo, psessionEntry);
1189 break;
1190
1191 case SIR_MAC_MGMT_BEACON:
1192 __limHandleBeacon(pMac, limMsg,psessionEntry);
1193 break;
1194
1195 case SIR_MAC_MGMT_DISASSOC:
1196 limProcessDisassocFrame(pMac, pRxPacketInfo,psessionEntry);
1197 break;
1198
1199 case SIR_MAC_MGMT_AUTH:
1200 limProcessAuthFrame(pMac, pRxPacketInfo,psessionEntry);
1201 break;
1202
1203 case SIR_MAC_MGMT_DEAUTH:
1204 limProcessDeauthFrame(pMac, pRxPacketInfo,psessionEntry);
1205 break;
1206
1207 case SIR_MAC_MGMT_ACTION:
Jeff Johnson295189b2012-06-20 16:38:30 -07001208 if(psessionEntry == NULL)
1209 limProcessActionFrameNoSession(pMac, pRxPacketInfo);
1210 else
1211 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001212 if (WDA_GET_RX_UNKNOWN_UCAST(pRxPacketInfo))
1213 limHandleUnknownA2IndexFrames(pMac, pRxPacketInfo,psessionEntry);
1214 else
1215 limProcessActionFrame(pMac, pRxPacketInfo,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001216 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001217 break;
1218 default:
1219 // Received Management frame of 'reserved' subtype
1220 break;
1221 } // switch (fc.subType)
1222
1223 }
1224 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001225 case SIR_MAC_DATA_FRAME:
1226 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001227#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001228 /* We accept data frame (IAPP frame) only if Session is
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001229 * present and ese connection is established on that
Jeff Johnson295189b2012-06-20 16:38:30 -07001230 * session
1231 */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001232 if (psessionEntry && psessionEntry->isESEconnection) {
Jeff Johnson295189b2012-06-20 16:38:30 -07001233 limProcessIappFrame(pMac, pRxPacketInfo, psessionEntry);
1234 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001235#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001236 }
1237 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001238 default:
1239 // Received frame of type 'reserved'
1240 break;
1241
1242 } // switch (fc.type)
1243
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001244end:
Jeff Johnson295189b2012-06-20 16:38:30 -07001245 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr) ;
1246 return;
1247} /*** end limHandle80211Frames() ***/
1248
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301249/**
1250 * limSendStopScanOffloadReq()
1251 *
1252 *FUNCTION:
1253 * This function will be called to abort the ongoing offloaded scan
1254 * request.
1255 *
1256 *
1257 *NOTE:
1258 *
1259 * @param pMac Pointer to Global MAC structure
1260 * @return eHAL_STATUS_SUCCESS or eHAL_STATUS_FAILURE
1261 */
1262eHalStatus limSendStopScanOffloadReq(tpAniSirGlobal pMac, tANI_U8 SessionId)
1263{
1264 tSirMsgQ msg;
1265 tSirRetStatus rc = eSIR_SUCCESS;
1266 tAbortScanParams *pAbortScanParams;
1267
Kiet Lamb1233192013-11-28 13:38:20 +05301268 pAbortScanParams = vos_mem_malloc(sizeof(tAbortScanParams));
1269 if (NULL == pAbortScanParams)
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301270 {
1271 limLog(pMac, LOGP, FL("Memory allocation failed for AbortScanParams"));
1272 return eHAL_STATUS_FAILURE;
1273 }
1274
1275 pAbortScanParams->SessionId = SessionId;
1276 msg.type = WDA_STOP_SCAN_OFFLOAD_REQ;
1277 msg.bodyptr = pAbortScanParams;
1278 msg.bodyval = 0;
1279
1280 rc = wdaPostCtrlMsg(pMac, &msg);
1281 if (rc != eSIR_SUCCESS)
1282 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001283 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Kiet Lamb1233192013-11-28 13:38:20 +05301284 vos_mem_free(pAbortScanParams);
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301285 return eHAL_STATUS_FAILURE;
1286 }
1287
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301288 limLog(pMac, LOG1, FL("Abort ongoing offload scan."));
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301289 return eHAL_STATUS_SUCCESS;
1290
1291}
Jeff Johnson295189b2012-06-20 16:38:30 -07001292
1293/**
1294 * limProcessAbortScanInd()
1295 *
1296 *FUNCTION:
1297 * This function is called from HDD to abort the scan which is presently being run
1298 *
1299 *
1300 *NOTE:
1301 *
1302 * @param pMac Pointer to Global MAC structure
1303 * @param *pMsgBuf A pointer to the SME message buffer
1304 * @return None
1305 */
1306void
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301307limProcessAbortScanInd(tpAniSirGlobal pMac, tANI_U8 SessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07001308{
1309#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1310 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT, NULL, 0, 0);
1311#endif //FEATURE_WLAN_DIAG_SUPPORT
1312
1313 /* Deactivate the gLimBackgroundScanTimer as part of the abort scan.
1314 * SME should send WNI_CFG_BACKGROUND_SCAN_PERIOD indication
1315 * to start the background scan again
1316 */
Abhishek Singh525045c2014-12-15 17:18:45 +05301317 limLog(pMac, LOG1, FL("Processing AbortScan Ind"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001318
1319 limAbortBackgroundScan(pMac);
1320
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301321 if (pMac->fScanOffload)
Jeff Johnson295189b2012-06-20 16:38:30 -07001322 {
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301323 /* send stop scan cmd to fw if scan offload is enabled. */
1324 limSendStopScanOffloadReq(pMac, SessionId);
1325 }
1326 else
1327 {
1328 /* Abort the scan if its running, else just return */
1329 if(limIsSystemInScanState(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07001330 {
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301331 if( (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
1332 (eLIM_HAL_START_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
1333 (eLIM_HAL_END_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
1334 (eLIM_HAL_FINISH_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
1335 {
1336 //Simply signal we need to abort
1337 limLog( pMac, LOGW, FL(" waiting for HAL, simply signal abort gLimHalScanState = %d"), pMac->lim.gLimHalScanState );
1338 pMac->lim.abortScan = 1;
1339 }
1340 else
1341 {
1342 //Force abort
1343 limLog( pMac, LOGW, FL(" Force aborting scan") );
1344 pMac->lim.abortScan = 0;
1345 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
1346 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
1347 //Set the resume channel to Any valid channel (invalid).
1348 //This will instruct HAL to set it to any previous valid channel.
1349 peSetResumeChannel(pMac, 0, 0);
1350 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
1351 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001352 }
1353 }
1354 return;
1355}
1356
1357/**
1358 * limMessageProcessor
1359 *
1360 *FUNCTION:
1361 * Wrapper function for limProcessMessages when handling messages received by LIM.
1362 * Could either defer messages or process them.
1363 * @param pMac Pointer to Global MAC structure
1364 * @param limMsg Received LIM message
1365 * @return None
1366 */
1367
1368void limMessageProcessor(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1369{
1370 if (eLIM_MLM_OFFLINE_STATE == pMac->lim.gLimMlmState)
1371 {
1372 peFreeMsg(pMac, limMsg);
1373 return;
1374 }
1375
1376 if (!defMsgDecision(pMac, limMsg))
1377 {
1378 limProcessMessages(pMac, limMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001379 // process deferred message queue if allowed
1380 {
1381 if ( (! (pMac->lim.gLimAddtsSent))
1382 &&
1383 (! (limIsSystemInScanState(pMac)))
1384 )
1385 {
1386 if (true == GET_LIM_PROCESS_DEFD_MESGS(pMac))
1387 limProcessDeferredMessageQueue(pMac);
1388 }
1389 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001390 }
1391}
1392
Jeff Johnsone7245742012-09-05 17:12:55 -07001393#ifdef FEATURE_OEM_DATA_SUPPORT
1394
1395void limOemDataRspHandleResumeLinkRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* mlmOemDataRsp)
1396{
1397 if(status != eHAL_STATUS_SUCCESS)
1398 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001399 limLog(pMac, LOGE, FL("OEM Data Rsp failed to get the response for resume link"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001400 }
1401
1402 if(NULL != pMac->lim.gpLimMlmOemDataReq)
1403 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301404 vos_mem_free(pMac->lim.gpLimMlmOemDataReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001405 pMac->lim.gpLimMlmOemDataReq = NULL;
1406 }
1407
1408 //"Failure" status doesn't mean that Oem Data Rsp did not happen
1409 //and hence we need to respond to upper layers. Only Resume link is failed, but
1410 //we got the oem data response already.
1411 //Post the meessage to MLM
1412 limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)(mlmOemDataRsp));
1413
1414 return;
1415}
1416
1417void limProcessOemDataRsp(tpAniSirGlobal pMac, tANI_U32* body)
1418{
Jeff Johnsone7245742012-09-05 17:12:55 -07001419 tpLimMlmOemDataRsp mlmOemDataRsp = NULL;
1420 tpStartOemDataRsp oemDataRsp = NULL;
1421
1422 //Process all the messages for the lim queue
1423 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1424
1425 oemDataRsp = (tpStartOemDataRsp)(body);
1426
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301427 mlmOemDataRsp = vos_mem_malloc(sizeof(tLimMlmOemDataRsp));
1428 if ( NULL == mlmOemDataRsp )
Jeff Johnsone7245742012-09-05 17:12:55 -07001429 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001430 limLog(pMac, LOGP, FL("could not allocate memory for mlmOemDataRsp"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001431 return;
1432 }
1433
1434 //copy the memory into tLimMlmOemDataRsp and free the tStartOemDataRsp
1435 //the structures tStartOemDataRsp and tLimMlmOemDataRsp have the same structure
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301436 vos_mem_copy((void*)(mlmOemDataRsp), (void*)(oemDataRsp),
1437 sizeof(tLimMlmOemDataRsp));
Jeff Johnsone7245742012-09-05 17:12:55 -07001438
1439 //Now free the incoming memory
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301440 vos_mem_free(oemDataRsp);
Jeff Johnsone7245742012-09-05 17:12:55 -07001441
1442 limResumeLink(pMac, limOemDataRspHandleResumeLinkRsp, (tANI_U32*)mlmOemDataRsp);
1443
1444 return;
1445}
1446
1447#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001448
Katya Nigam3802f202013-12-16 19:27:14 +05301449static tANI_BOOLEAN limAgeOutProbeReq( tpAniSirGlobal pMac, tpSirMsgQ limMsg,
1450 vos_pkt_t *pVosPkt )
1451{
1452 tANI_U8 *pRxPacketInfo = NULL;
1453 tSirMacFrameCtl fc;
1454 tpSirMacMgmtHdr pHdr=NULL;
1455 tANI_BOOLEAN match = VOS_FALSE;
1456
1457 limGetBDfromRxPacket(pMac, limMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
1458 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1459 fc = pHdr->fc;
1460 if ( fc.subType == SIR_MAC_MGMT_PROBE_REQ )
1461 {
1462 if( vos_timer_get_system_ticks() - pVosPkt->timestamp >= MAX_PROBEREQ_TIME )
1463 {
1464 // drop packet
1465 limLog(pMac, LOGE,
1466 FL("Dropping Aged Out probe requests. Peer MAC is "MAC_ADDRESS_STR),
1467 MAC_ADDR_ARRAY(pHdr->sa));
1468
1469 vos_pkt_return_packet(pVosPkt);
1470 match = VOS_TRUE;
1471 }
1472 }
1473 return match;
1474}
1475
Jeff Johnson295189b2012-06-20 16:38:30 -07001476/**
1477 * limProcessMessages
1478 *
1479 *FUNCTION:
1480 * This function is called by limProcessMessageQueue function. This
1481 * function processes messages received by LIM.
1482 *
1483 *LOGIC:
1484 * Depending on the message type, corresponding function will be
1485 * called, for example limProcessSmeMessages() will be called to
1486 * process SME messages received from HDD/Upper layer software module.
1487 *
1488 *ASSUMPTIONS:
1489 * NA
1490 *
1491 *NOTE:
1492 * NA
1493 *
1494 * @param pMac Pointer to Global MAC structure
1495 * @param limMsg Received LIM message
1496 * @return None
1497 */
1498
1499void
1500limProcessMessages(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1501{
1502 tANI_U8 deferMsg = false;
1503 tLinkStateParams *linkStateParams;
1504#if defined WLAN_FEATURE_VOWIFI_11R
1505 tpPESession pSession;
1506#endif
1507#if defined(ANI_DVT_DEBUG)
1508 tSirMsgQ msgQ;
1509#endif
1510 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1511 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301512 vos_mem_free(limMsg->bodyptr);
Jeff Johnsone7245742012-09-05 17:12:55 -07001513 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001514 return;
1515 }
1516#ifdef WLAN_DEBUG
1517 pMac->lim.numTot++;
1518#endif
1519
1520
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001521 PELOG3(limLog(pMac, LOG3, FL("rcvd msgType = %s, sme state = %s, mlm state = %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001522 limMsgStr(limMsg->type), limSmeStateStr(pMac->lim.gLimSmeState),
1523 limMlmStateStr(pMac->lim.gLimMlmState));)
1524
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301525 /*
1526 * MTRACE logs not captured for events received from SME
1527 * SME enums (eWNI_SME_START_REQ) starts with 0x16xx.
1528 * Compare received SME events with SIR_SME_MODULE_ID
Konamki, Sreelakshmi2bfb8b02015-07-29 11:41:24 +05301529 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001530
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301531 if (SIR_SME_MODULE_ID == (tANI_U8)MAC_TRACE_GET_MODULE_ID(limMsg->type))
1532 {
1533 MTRACE(macTrace(pMac, TRACE_CODE_RX_SME_MSG, NO_SESSION, limMsg->type));
1534 }
1535 else
1536 {
1537 /* Omitting below message types as these are too frequent and when crash
1538 * happens we loose critical trace logs if these are also logged
1539 */
1540 if (limMsg->type != SIR_LIM_MAX_CHANNEL_TIMEOUT &&
1541 limMsg->type != SIR_LIM_MIN_CHANNEL_TIMEOUT &&
1542 limMsg->type != SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT &&
1543 limMsg->type != SIR_CFG_PARAM_UPDATE_IND &&
1544 limMsg->type != SIR_BB_XPORT_MGMT_MSG)
1545 MTRACE(macTraceMsgRx(pMac, NO_SESSION,
1546 LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
1547 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001548 switch (limMsg->type)
1549 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001550
1551 case SIR_LIM_UPDATE_BEACON:
1552 limUpdateBeacon(pMac);
1553 break;
1554
Jeff Johnson295189b2012-06-20 16:38:30 -07001555 case SIR_CFG_PARAM_UPDATE_IND:
1556 /// CFG parameter updated
1557 if (limIsSystemInScanState(pMac))
1558 {
1559 // System is in DFS (Learn) mode
1560 // Defer processsing this message
1561 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1562 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001563 if(!(pMac->lim.deferredMsgCnt & 0xF))
1564 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001565 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 -07001566 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1567 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001568 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001569 limLogSessionStates(pMac);
1570 limPrintMsgName(pMac, LOGE, limMsg->type);
1571 }
1572 }
1573 else
1574 {
1575 limHandleCFGparamUpdate(pMac, limMsg->bodyval);
1576 }
1577
1578 break;
1579
1580 case WDA_INIT_SCAN_RSP:
1581 limProcessInitScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001582 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001583 break;
1584
1585 case WDA_START_SCAN_RSP:
1586 limProcessStartScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001587 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001588 break;
1589
1590 case WDA_END_SCAN_RSP:
1591 limProcessEndScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001592 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001593 break;
1594
1595 case WDA_FINISH_SCAN_RSP:
1596 limProcessFinishScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001597 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001598 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001599#ifdef FEATURE_OEM_DATA_SUPPORT
1600 case WDA_START_OEM_DATA_RSP:
1601 limProcessOemDataRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001602 limMsg->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001603 break;
1604#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001605
1606 case WDA_SWITCH_CHANNEL_RSP:
1607 limProcessSwitchChannelRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001608 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001609 break;
1610
1611#ifdef ANI_SIR_IBSS_PEER_CACHING
1612 case WDA_IBSS_STA_ADD:
1613 limIbssStaAdd(pMac, limMsg->bodyptr);
1614 break;
1615#endif
1616 case SIR_BB_XPORT_MGMT_MSG:
1617 // These messages are from Peer MAC entity.
1618#ifdef WLAN_DEBUG
1619 pMac->lim.numBbt++;
1620#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001621 {
1622 v_U16_t pktLen = 0;
1623 vos_pkt_t *pVosPkt;
1624 VOS_STATUS vosStatus;
1625 tSirMsgQ limMsgNew;
Jeff Johnson295189b2012-06-20 16:38:30 -07001626 /* The original limMsg which we were deferring have the
1627 * bodyPointer point to 'BD' instead of 'Vos pkt'. If we don't make a copy
1628 * of limMsg, then vos_pkt_peek_data will overwrite the limMsg->bodyPointer.
1629 * and next time when we try to process the msg, we will try to use 'BD' as
1630 * 'Vos Pkt' which will cause a crash
1631 */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301632 vos_mem_copy((tANI_U8*)&limMsgNew, (tANI_U8*)limMsg,
1633 sizeof(tSirMsgQ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001634 pVosPkt = (vos_pkt_t *)limMsgNew.bodyptr;
1635 vos_pkt_get_packet_length(pVosPkt, &pktLen);
1636
1637 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&limMsgNew.bodyptr, VOS_FALSE );
1638
1639 if( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1640 {
Katya Nigamfdf5a522015-02-03 14:38:55 +05301641 limDecrementPendingMgmtCount(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001642 vos_pkt_return_packet(pVosPkt);
1643 break;
1644
1645 }
Katya Nigam3802f202013-12-16 19:27:14 +05301646
Padma, Santhosh Kumar30971cf2015-04-06 19:59:37 +05301647#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1648 if (WDA_GET_ROAMCANDIDATEIND(limMsgNew.bodyptr))
1649 limLog(pMac, LOG1, FL("roamCandidateInd %d"),
1650 WDA_GET_ROAMCANDIDATEIND(limMsgNew.bodyptr));
1651
1652 if (WDA_GET_OFFLOADSCANLEARN(limMsgNew.bodyptr))
1653 limLog(pMac, LOG1, FL("offloadScanLearn %d"),
1654 WDA_GET_OFFLOADSCANLEARN(limMsgNew.bodyptr));
1655#endif
1656
Katya Nigam3802f202013-12-16 19:27:14 +05301657 /*
1658 * putting a check for age out probe request frames
1659 * such that any probe req more than 0.5 sec old can directly
1660 * be dropped. With this, there won't be blocking of MC thread.
1661 */
1662
1663 if( limAgeOutProbeReq ( pMac, &limMsgNew, pVosPkt ))
1664 {
Katya Nigamfdf5a522015-02-03 14:38:55 +05301665 limDecrementPendingMgmtCount(pMac);
Katya Nigam3802f202013-12-16 19:27:14 +05301666 break;
1667 }
1668
Katya Nigam3802f202013-12-16 19:27:14 +05301669
Jeff Johnson295189b2012-06-20 16:38:30 -07001670 limHandle80211Frames(pMac, &limMsgNew, &deferMsg);
1671
1672 if ( deferMsg == true )
1673 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301674 limLog(pMac, LOG2, FL("Defer message type=%X "),
1675 limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001676 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1677 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001678 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 -07001679 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1680 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1681 limLogSessionStates(pMac);
1682 limPrintMsgName(pMac, LOGE, limMsg->type);
Katya Nigamfdf5a522015-02-03 14:38:55 +05301683 limDecrementPendingMgmtCount(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001684 vos_pkt_return_packet(pVosPkt);
1685 }
1686 }
1687 else
1688 {
1689 /* PE is not deferring this 802.11 frame so we need to call vos_pkt_return.
1690 * Asumption here is when Rx mgmt frame processing is done,
1691 * voss packet could be freed here.
1692 */
Katya Nigamfdf5a522015-02-03 14:38:55 +05301693 limDecrementPendingMgmtCount(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001694 vos_pkt_return_packet(pVosPkt);
1695 }
1696 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001697 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001698 case eWNI_SME_SCAN_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001699 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001700 case eWNI_SME_DISASSOC_REQ:
1701 case eWNI_SME_DEAUTH_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001702 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
Jeff Johnsone7245742012-09-05 17:12:55 -07001703#ifdef FEATURE_OEM_DATA_SUPPORT
1704 case eWNI_SME_OEM_DATA_REQ:
1705#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001706#ifdef FEATURE_WLAN_TDLS
1707 case eWNI_SME_TDLS_SEND_MGMT_REQ:
1708 case eWNI_SME_TDLS_ADD_STA_REQ:
1709 case eWNI_SME_TDLS_DEL_STA_REQ:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301710 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301711// tdlsoffchan
1712 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001713#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05301714 case eWNI_SME_RESET_AP_CAPS_CHANGED:
Jeff Johnson295189b2012-06-20 16:38:30 -07001715 // These messages are from HDD
1716 limProcessNormalHddMsg(pMac, limMsg, true); //need to response to hdd
1717 break;
1718
1719 case eWNI_SME_SCAN_ABORT_IND:
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301720 {
1721 tANI_U8 *pSessionId = (tANI_U8 *)limMsg->bodyptr;
1722 limProcessAbortScanInd(pMac, *pSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001723 vos_mem_free((v_VOID_t *)limMsg->bodyptr);
1724 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001725 break;
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301726 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001727 case eWNI_SME_START_REQ:
1728 case eWNI_SME_SYS_READY_IND:
1729#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1730 case eWNI_SME_JOIN_REQ:
1731#endif
1732 case eWNI_SME_AUTH_REQ:
1733 case eWNI_SME_REASSOC_REQ:
1734 case eWNI_SME_START_BSS_REQ:
1735 case eWNI_SME_STOP_BSS_REQ:
1736 case eWNI_SME_SWITCH_CHL_REQ:
1737 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
1738 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
1739 case eWNI_SME_SETCONTEXT_REQ:
1740 case eWNI_SME_REMOVEKEY_REQ:
1741#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1742 case eWNI_SME_PROMISCUOUS_MODE_REQ:
1743#endif
1744 case eWNI_SME_DISASSOC_CNF:
1745 case eWNI_SME_DEAUTH_CNF:
1746 case eWNI_SME_ASSOC_CNF:
1747 case eWNI_SME_REASSOC_CNF:
1748 case eWNI_SME_ADDTS_REQ:
1749 case eWNI_SME_DELTS_REQ:
1750 case eWNI_SME_DEL_BA_PEER_IND:
1751 case eWNI_SME_SET_TX_POWER_REQ:
1752 case eWNI_SME_GET_TX_POWER_REQ:
1753 case eWNI_SME_GET_NOISE_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001754 case eWNI_SME_GET_ASSOC_STAS_REQ:
1755 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
1756 case eWNI_SME_UPDATE_APWPSIE_REQ:
1757 case eWNI_SME_HIDE_SSID_REQ:
1758 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
1759 case eWNI_SME_SET_APWPARSNIEs_REQ:
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08001760 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
Jeff Johnson295189b2012-06-20 16:38:30 -07001761#if defined WLAN_FEATURE_VOWIFI
1762 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1763 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
1764#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001765#if defined FEATURE_WLAN_ESE
1766 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001767#endif
1768#ifdef WLAN_FEATURE_VOWIFI_11R
1769 case eWNI_SME_FT_UPDATE_KEY:
1770 case eWNI_SME_FT_PRE_AUTH_REQ:
1771 case eWNI_SME_FT_AGGR_QOS_REQ:
1772#endif
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05301773#ifdef WLAN_FEATURE_LFR_MBB
1774 case eWNI_SME_MBB_PRE_AUTH_REASSOC_REQ:
1775#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001776 case eWNI_SME_ADD_STA_SELF_REQ:
1777 case eWNI_SME_DEL_STA_SELF_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001778 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
1779 case eWNI_SME_UPDATE_NOA:
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301780 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
Madan Mohan Koyyalamudi44bbc152013-07-05 21:13:10 +05301781 case eWNI_SME_STA_STAT_REQ:
1782 case eWNI_SME_AGGR_STAT_REQ:
1783 case eWNI_SME_GLOBAL_STAT_REQ:
1784 case eWNI_SME_STAT_SUMM_REQ:
1785 case eWNI_SME_GET_STATISTICS_REQ:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001786#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi44bbc152013-07-05 21:13:10 +05301787 case eWNI_SME_GET_ROAM_RSSI_REQ:
1788#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001789#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001790 case eWNI_SME_GET_TSM_STATS_REQ:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001791#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05301792 case eWNI_SME_MAC_SPOOF_ADDR_IND:
Abhishek Singh7d624e12015-11-30 14:29:27 +05301793 case eWNI_SME_REGISTER_MGMT_FRAME_CB:
Abhishek Singh02605092017-10-25 14:06:12 +05301794 case eWNI_SME_SET_CHAN_SW_IE_REQ:
Abhishek Singh550aa8c2017-10-30 17:34:53 +05301795 case eWNI_SME_ECSA_CHAN_CHANGE_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001796 // These messages are from HDD
1797 limProcessNormalHddMsg(pMac, limMsg, false); //no need to response to hdd
1798 break;
1799
1800 //Power Save Messages From HDD
1801 case eWNI_PMC_PWR_SAVE_CFG:
1802 case eWNI_PMC_ENTER_BMPS_REQ:
1803 case eWNI_PMC_EXIT_BMPS_REQ:
1804 case eWNI_PMC_ENTER_IMPS_REQ:
1805 case eWNI_PMC_EXIT_IMPS_REQ:
1806 case eWNI_PMC_ENTER_UAPSD_REQ:
1807 case eWNI_PMC_EXIT_UAPSD_REQ:
1808 case eWNI_PMC_ENTER_WOWL_REQ:
1809 case eWNI_PMC_EXIT_WOWL_REQ:
1810 case eWNI_PMC_WOWL_ADD_BCAST_PTRN:
1811 case eWNI_PMC_WOWL_DEL_BCAST_PTRN:
1812 pmmProcessMessage(pMac, limMsg);
1813 break;
1814
1815 case eWNI_PMC_SMPS_STATE_IND :
1816 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001817 if(limMsg->bodyptr){
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301818 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001819 limMsg->bodyptr = NULL;
1820 }
1821 }
1822 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001823 case eWNI_SME_SEND_ACTION_FRAME_IND:
1824 limSendP2PActionFrame(pMac, limMsg);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301825 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001826 limMsg->bodyptr = NULL;
1827 break;
1828 case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
1829 limAbortRemainOnChan(pMac);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301830 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001831 limMsg->bodyptr = NULL;
1832 break;
1833
Abhinav Kumar8eed0362019-08-05 14:26:07 +05301834 case eWNI_SME_SEND_MGMT_FRAME_TX:
1835 lim_send_mgmt_frame_tx(pMac, limMsg);
1836 vos_mem_free(limMsg->bodyptr);
1837 limMsg->bodyptr = NULL;
1838 break;
1839
Abhishek Singh00b71972016-01-07 10:51:04 +05301840#ifdef WLAN_FEATURE_RMC
1841 case eWNI_SME_ENABLE_RMC_REQ:
1842 case eWNI_SME_DISABLE_RMC_REQ:
1843 /*
1844 * These messages are from HDD
1845 * No need to response to hdd
1846 */
1847 limProcessSmeReqMessages(pMac,limMsg);
1848 break;
1849#endif /* WLAN_FEATURE_RMC */
1850
Viral Modid86bde22012-12-10 13:09:21 -08001851 case SIR_HAL_P2P_NOA_START_IND:
1852 {
1853 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1854 tANI_U8 i;
Viral Modid440e682013-03-06 02:25:31 -08001855 tANI_U8 p2pGOExists = 0;
Gopichand Nakkala78a6c812013-05-13 16:39:49 +05301856
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001857 limLog(pMac, LOG1, "LIM received NOA start %x", limMsg->type);
Viral Modid440e682013-03-06 02:25:31 -08001858
1859 /* Since insert NOA is done and NOA start msg received, we should deactivate the Insert NOA timer */
1860 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
1861
Viral Modid86bde22012-12-10 13:09:21 -08001862 for(i=0; i < pMac->lim.maxBssId; i++)
1863 {
1864 psessionEntry = &pMac->lim.gpSession[i];
1865 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
1866 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1867 { //Save P2P NOA start attributes for P2P Go persona
Viral Modid440e682013-03-06 02:25:31 -08001868 p2pGOExists = 1;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301869 vos_mem_copy(&psessionEntry->p2pGoPsNoaStartInd, limMsg->bodyptr,
1870 sizeof(tSirP2PNoaStart));
Viral Modid440e682013-03-06 02:25:31 -08001871 if (psessionEntry->p2pGoPsNoaStartInd.status != eHAL_STATUS_SUCCESS)
Viral Modid86bde22012-12-10 13:09:21 -08001872 {
Viral Modid440e682013-03-06 02:25:31 -08001873 limLog(pMac, LOGW, FL("GO NOA start failure status %d reported by FW."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001874 " - still go ahead with deferred sme req. This is just info"),
Viral Modid440e682013-03-06 02:25:31 -08001875 psessionEntry->p2pGoPsNoaStartInd.status);
Viral Modid86bde22012-12-10 13:09:21 -08001876 }
Viral Modid86bde22012-12-10 13:09:21 -08001877 break;
1878 }
1879 }
Viral Modid440e682013-03-06 02:25:31 -08001880
1881 if (p2pGOExists == 0)
1882 {
1883 limLog(pMac, LOGW, FL("By the time, we received NOA start, GO is already removed."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001884 " - still go ahead with deferred sme req. This is just info"));
Viral Modid440e682013-03-06 02:25:31 -08001885 }
1886
1887 /* We received the NOA start indication. Now we can send down the SME request which requires off-channel operation */
1888 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301889 vos_mem_free(limMsg->bodyptr);
Viral Modid86bde22012-12-10 13:09:21 -08001890 limMsg->bodyptr = NULL;
Viral Modid440e682013-03-06 02:25:31 -08001891 }
Viral Modid86bde22012-12-10 13:09:21 -08001892 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301893#ifdef FEATURE_WLAN_TDLS
1894 case SIR_HAL_TDLS_IND:
1895 {
1896 tSirTdlsInd *pTdlsInd = (tpSirTdlsInd)limMsg->bodyptr ;
1897 tpDphHashNode pStaDs = NULL ;
1898 tpPESession psessionEntry = NULL;
1899 tANI_U8 sessionId;
1900 if((psessionEntry = peFindSessionByStaId(pMac,pTdlsInd->staIdx,&sessionId))== NULL)
1901 {
1902 limLog(pMac, LOG1, FL("session does not exist for given bssId\n"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301903 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301904 limMsg->bodyptr = NULL;
1905 return;
1906 }
1907 if ((pStaDs = dphGetHashEntry(pMac, pTdlsInd->assocId, &psessionEntry->dph.dphHashTable)) == NULL)
1908 {
1909 limLog(pMac, LOG1, FL("pStaDs Does not exist for given staId\n"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301910 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301911 limMsg->bodyptr = NULL;
1912 return;
1913 }
Viral Modid86bde22012-12-10 13:09:21 -08001914
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301915 if ((STA_ENTRY_TDLS_PEER == pStaDs->staType))
1916 {
1917 limLog(pMac, LOGE,
1918 FL("received TDLS Indication from the Firmware with Reason Code %d "),
1919 pTdlsInd->reasonCode);
1920 limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry,
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05301921 pTdlsInd->reasonCode);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301922 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301923 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301924 limMsg->bodyptr = NULL;
1925 }
1926 break;
1927#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001928 case SIR_HAL_P2P_NOA_ATTR_IND:
1929 {
1930 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1931 tANI_U8 i;
1932
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001933 limLog(pMac, LOGW, FL("Received message Noa_ATTR %x"), limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001934 for(i=0; i < pMac->lim.maxBssId; i++)
1935 {
Viral Modid86bde22012-12-10 13:09:21 -08001936 psessionEntry = &pMac->lim.gpSession[i];
1937 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001938 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1939 { //Save P2P attributes for P2P Go persona
1940
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301941 vos_mem_copy(&psessionEntry->p2pGoPsUpdate, limMsg->bodyptr,
1942 sizeof(tSirP2PNoaAttr));
1943
Arif Hussain24bafea2013-11-15 15:10:03 -08001944 limLog(pMac, LOG2, FL(" &psessionEntry->bssId "
1945 MAC_ADDRESS_STR " ctWin=%d oppPsFlag=%d"),
1946 MAC_ADDR_ARRAY(psessionEntry->bssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001947 psessionEntry->p2pGoPsUpdate.ctWin,
1948 psessionEntry->p2pGoPsUpdate.oppPsFlag);
1949
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001950 limLog(pMac, LOG2, FL(" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001951 psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt,
1952 psessionEntry->p2pGoPsUpdate.uNoa1Duration,
1953 psessionEntry->p2pGoPsUpdate.uNoa1Interval,
1954 psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
1955
1956
1957 break;
1958 }
1959 }
1960
1961 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301962 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001963 limMsg->bodyptr = NULL;
1964
1965 break;
1966
1967
Jeff Johnson295189b2012-06-20 16:38:30 -07001968 /* eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER Message comes after the
1969 * device comes out of full power for the full power request sent
1970 * because of channel switch with switch count as 0, so call the same
1971 * function used in timeout case(i.e SIR_LIM_CHANNEL_SWITCH_TIMEOUT)
1972 * for switching the channel*/
1973 case eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER:
Jeff Johnsone7245742012-09-05 17:12:55 -07001974 if ( !tx_timer_running(&pMac->lim.limTimers.gLimChannelSwitchTimer) )
1975 {
1976 limProcessChannelSwitchTimeout(pMac);
1977 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301978 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001979 limMsg->bodyptr = NULL;
1980 break;
1981
1982 //Power Save Related Messages From HAL
1983 case WDA_ENTER_BMPS_RSP:
1984 case WDA_EXIT_BMPS_RSP:
1985 case WDA_EXIT_BMPS_IND:
1986 case WDA_ENTER_IMPS_RSP:
1987 case WDA_EXIT_IMPS_RSP:
1988 case WDA_ENTER_UAPSD_RSP:
1989 case WDA_EXIT_UAPSD_RSP:
1990 case WDA_WOWL_ENTER_RSP:
1991 case WDA_WOWL_EXIT_RSP:
1992 pmmProcessMessage(pMac, limMsg);
1993 break;
1994
1995 case WDA_LOW_RSSI_IND:
1996 //limHandleLowRssiInd(pMac);
1997 break;
1998
1999 case WDA_BMPS_STATUS_IND:
2000 limHandleBmpsStatusInd(pMac);
2001 break;
2002
Kapil Gupta7a3d9b12016-12-20 20:36:38 +05302003#ifdef WLAN_FEATURE_APFIND
2004 case WDA_AP_FIND_IND:
2005 limHandleAPFindInd(pMac);
2006 break;
2007#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002008 case WDA_MISSED_BEACON_IND:
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002009 limHandleMissedBeaconInd(pMac, limMsg);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302010 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002011 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002012 break;
2013 case WDA_MIC_FAILURE_IND:
2014 limMicFailureInd(pMac, limMsg);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302015 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07002016 limMsg->bodyptr = NULL;
2017 break;
2018
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +05302019 case WDA_LOST_LINK_PARAMS_IND:
2020 limProcessLostLinkParamsInd(pMac,limMsg);
2021 vos_mem_free(limMsg->bodyptr);
2022 limMsg->bodyptr = NULL;
2023 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002024
2025 case SIR_LIM_ADDTS_RSP_TIMEOUT:
2026 limProcessSmeReqMessages(pMac,limMsg);
2027 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002028#ifdef FEATURE_WLAN_ESE
2029 case SIR_LIM_ESE_TSM_TIMEOUT:
2030#ifndef FEATURE_WLAN_ESE_UPLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07002031 limProcessTsmTimeoutHandler(pMac,limMsg);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002032#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07002033 break;
2034 case WDA_TSM_STATS_RSP:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002035#ifdef FEATURE_WLAN_ESE_UPLOAD
2036 limSendSmePEEseTsmRsp(pMac, (tAniGetTsmStatsRsp *)limMsg->bodyptr);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07002037#else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002038 limProcessHalEseTsmRsp(pMac, limMsg);
2039#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07002040 break;
2041#endif
2042 case WDA_ADD_TS_RSP:
2043 limProcessHalAddTsRsp(pMac, limMsg);
2044 break;
2045
2046 case SIR_LIM_DEL_TS_IND:
2047 limProcessDelTsInd(pMac, limMsg);
Madan Mohan Koyyalamudif244d8f2012-11-29 11:21:05 -08002048 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002049 case SIR_LIM_ADD_BA_IND:
2050 limProcessAddBaInd(pMac, limMsg);
2051 break;
2052 case SIR_LIM_DEL_BA_ALL_IND:
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07002053 limDelAllBASessions(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002054 break;
2055 case SIR_LIM_DEL_BA_IND:
2056 limProcessMlmHalBADeleteInd( pMac, limMsg );
2057 break;
2058
2059 case SIR_LIM_BEACON_GEN_IND: {
Jeff Johnson295189b2012-06-20 16:38:30 -07002060
Jeff Johnson295189b2012-06-20 16:38:30 -07002061 if( pMac->lim.gLimSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07002062 schProcessPreBeaconInd(pMac, limMsg);
2063
2064 }
2065 break;
2066
2067 case SIR_LIM_DELETE_STA_CONTEXT_IND:
2068 limDeleteStaContext(pMac, limMsg);
2069 break;
2070
2071 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
2072 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
2073 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
2074 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08002075 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07002076 case SIR_LIM_AUTH_FAIL_TIMEOUT:
2077 case SIR_LIM_AUTH_RSP_TIMEOUT:
2078 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
2079 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
2080#ifdef WLAN_FEATURE_VOWIFI_11R
2081 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
2082#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002083 case SIR_LIM_REMAIN_CHN_TIMEOUT:
Viral Modid86bde22012-12-10 13:09:21 -08002084 case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT:
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08002085 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
2086 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
Gopichand Nakkalad492d202013-05-10 02:50:47 +05302087 case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
Sushant Kaushik9e923872015-04-02 17:09:31 +05302088 case SIR_LIM_AUTH_RETRY_TIMEOUT:
Abhishek Singh550aa8c2017-10-30 17:34:53 +05302089 case SIR_LIM_SAP_ECSA_TIMEOUT:
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05302090#ifdef WLAN_FEATURE_LFR_MBB
2091 case SIR_LIM_PREAUTH_MBB_RSP_TIMEOUT:
Padma, Santhosh Kumarf4966dc2017-01-03 18:56:00 +05302092 case SIR_LIM_REASSOC_MBB_RSP_TIMEOUT:
Padma, Santhosh Kumar67f479b2016-12-28 15:43:42 +05302093#endif
Abhinav Kumar3b0eaa32020-04-02 14:20:26 +05302094 case SIR_LIM_AUTH_SAE_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07002095 // These timeout messages are handled by MLM sub module
2096
2097 limProcessMlmReqMessages(pMac,
2098 limMsg);
2099
2100 break;
2101
2102 case SIR_LIM_HEART_BEAT_TIMEOUT:
2103 /** check if heart beat failed, even if one Beacon
2104 * is rcvd within the Heart Beat interval continue
2105 * normal processing
2106 */
2107
2108 #if 0
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002109 PELOG1(limLog(pMac, LOG1, FL("Heartbeat timeout, SME %d, MLME %d, #bcn %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002110 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
2111 pMac->lim.gLimRxedBeaconCntDuringHB);)
2112
2113 if(pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)
2114 limIbssHeartBeatHandle(pMac); //HeartBeat for peers.
2115 else
2116 /**
2117 * Heartbeat failure occurred on STA
2118 * This is handled by LMM sub module.
2119 */
2120 limHandleHeartBeatFailure(pMac);
2121
2122 break;
2123 #endif //TO SUPPORT BT-AMP
Yathish9f22e662012-12-10 14:21:35 -08002124 if (limIsSystemInScanState(pMac))
2125 {
2126 // System is in DFS (Learn) mode
2127 // Defer processsing this message
2128 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
2129 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002130 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 -08002131 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
2132 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
2133 limLogSessionStates(pMac);
2134 }
2135 }
2136 else
2137 {
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002138 if (NULL == limMsg->bodyptr)
2139 {
2140 limHandleHeartBeatTimeout(pMac);
2141 }
2142 else
2143 {
2144 limHandleHeartBeatTimeoutForSession(pMac, (tpPESession)limMsg->bodyptr);
2145 }
Gopichand Nakkala78a6c812013-05-13 16:39:49 +05302146 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002147 break;
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08002148
Jeff Johnson295189b2012-06-20 16:38:30 -07002149 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
2150 limHandleHeartBeatFailureTimeout(pMac);
2151 break;
2152
2153 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07002154 /**
2155 * Background scan timeout occurred on STA.
2156 * This is handled by LMM sub module.
2157 */
2158 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
2159
2160 //We will do background scan even in bcnps mode
2161 //if (pMac->sys.gSysEnableScanMode)
2162 pMac->lim.gLimReportBackgroundScanResults = FALSE;
2163 limTriggerBackgroundScan(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07002164 break;
2165
Jeff Johnson295189b2012-06-20 16:38:30 -07002166 case SIR_LIM_CNF_WAIT_TIMEOUT:
2167
2168 /*
2169 ** Does not receive CNF or dummy packet
2170 **/
2171 limHandleCnfWaitTimeout(pMac, (tANI_U16) limMsg->bodyval);
2172
2173 break;
2174
2175 case SIR_LIM_KEEPALIVE_TIMEOUT:
2176 limSendKeepAliveToPeer(pMac);
2177
2178 break;
2179
2180 case SIR_LIM_RETRY_INTERRUPT_MSG:
2181 // Message from ISR upon TFP's max retry limit interrupt
2182
2183 break;
2184
2185 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
2186 // Message from ISR upon SP's Invalid session key interrupt
2187
2188 break;
2189
2190 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
2191 // Message from ISR upon SP's Invalid key ID interrupt
2192
2193 break;
2194
2195 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
2196 // Message from ISR upon SP's Replay threshold interrupt
2197
2198 break;
2199
2200 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
2201 limProcessChannelSwitchTimeout(pMac);
2202 break;
2203
2204 case SIR_LIM_QUIET_TIMEOUT:
2205 limProcessQuietTimeout(pMac);
2206 break;
2207
2208 case SIR_LIM_QUIET_BSS_TIMEOUT:
2209 limProcessQuietBssTimeout(pMac);
2210 break;
2211
Jeff Johnson295189b2012-06-20 16:38:30 -07002212 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
2213 limHandleUpdateOlbcCache(pMac);
2214 break;
2215#if 0
2216 case SIR_LIM_WPS_OVERLAP_TIMEOUT:
2217 limProcessWPSOverlapTimeout(pMac);
2218 break;
2219#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07002220 case WDA_ADD_BSS_RSP:
2221 limProcessMlmAddBssRsp( pMac, limMsg );
2222 break;
2223
2224 case WDA_ADD_STA_RSP:
2225
2226 //call a wrapper by paasing bodyptr, their get sessionID and and call proper function from there.
2227 limProcessAddStaRsp(pMac,limMsg);
2228 break;
2229
2230 case WDA_DELETE_STA_RSP:
2231 limProcessMlmDelStaRsp(pMac, limMsg);
2232 break;
2233
2234 case WDA_ADD_STA_SELF_RSP:
2235 limProcessAddStaSelfRsp(pMac, limMsg);
2236 break;
2237 case WDA_DEL_STA_SELF_RSP:
2238 limProcessDelStaSelfRsp(pMac, limMsg);
2239 break;
2240
2241 case WDA_DELETE_BSS_RSP:
2242 limHandleDeleteBssRsp(pMac,limMsg); //wrapper routine to handle delete bss response
2243 break;
2244
2245 case WDA_SET_BSSKEY_RSP:
2246 case WDA_SET_STA_BCASTKEY_RSP:
2247 limProcessMlmSetBssKeyRsp( pMac, limMsg );
2248 break;
2249 case WDA_SET_STAKEY_RSP:
2250 limProcessMlmSetStaKeyRsp( pMac, limMsg );
2251 break;
2252 case WDA_REMOVE_BSSKEY_RSP:
2253 case WDA_REMOVE_STAKEY_RSP:
2254 limProcessMlmRemoveKeyRsp( pMac, limMsg );
2255 break;
2256 case WDA_ADDBA_RSP:
2257 limProcessMlmHalAddBARsp( pMac, limMsg );
2258 break;
2259
2260 case WDA_STA_STAT_RSP:
2261 case WDA_AGGR_STAT_RSP:
2262 case WDA_GLOBAL_STAT_RSP:
2263 case WDA_STAT_SUMM_RSP:
2264 limSendSmeStatsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
2265 break;
2266
2267 case WDA_GET_STATISTICS_RSP:
2268 limSendSmePEStatisticsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
2269 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002270#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002271 case WDA_GET_ROAM_RSSI_RSP:
2272 limSendSmePEGetRoamRssiRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
2273 break;
2274#endif
2275
Jeff Johnson295189b2012-06-20 16:38:30 -07002276
2277 case WDA_SET_MIMOPS_RSP: //limProcessSetMimoRsp(pMac, limMsg);
2278 case WDA_SET_TX_POWER_RSP: //limProcessSetTxPowerRsp(pMac, limMsg);
2279 case WDA_GET_TX_POWER_RSP: //limProcessGetTxPowerRsp(pMac, limMsg);
2280 case WDA_GET_NOISE_RSP:
2281 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2282 limMsg->bodyptr = NULL;
2283 //limProcessGetNoiseRsp(pMac, limMsg);
2284 break;
2285
2286 case WDA_SET_MAX_TX_POWER_RSP:
2287#if defined WLAN_FEATURE_VOWIFI
2288 rrmSetMaxTxPowerRsp( pMac, limMsg );
2289#endif
2290 if(limMsg->bodyptr != NULL)
2291 {
2292 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2293 limMsg->bodyptr = NULL;
2294 }
2295 break;
2296
Jeff Johnson295189b2012-06-20 16:38:30 -07002297 case SIR_LIM_ADDR2_MISS_IND:
2298 {
2299 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002300 FL("Addr2 mismatch interrupt received %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002301 limMsg->type);
2302 /*a message from HAL indicating addr2 mismatch interrupt occurred
2303 limMsg->bodyptr contains only pointer to 48-bit addr2 field*/
2304 //Dinesh fix this. the third parameter should be sessionentry.
2305 //limHandleUnknownA2IndexFrames(pMac, (void *)limMsg->bodyptr);
2306
2307 /*Free message body pointer*/
2308 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002309 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002310 break;
2311 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002312
2313#ifdef WLAN_FEATURE_VOWIFI_11R
2314 case WDA_AGGR_QOS_RSP:
2315 limProcessFTAggrQoSRsp( pMac, limMsg );
2316 break;
2317#endif
2318
2319 case WDA_SET_LINK_STATE_RSP:
2320 linkStateParams = (tLinkStateParams *)limMsg->bodyptr;
2321#if defined WLAN_FEATURE_VOWIFI_11R
2322 pSession = linkStateParams->session;
2323 if(linkStateParams->ft)
2324 {
2325 limSendReassocReqWithFTIEsMgmtFrame(pMac,
2326 pSession->pLimMlmReassocReq,
2327 pSession);
2328 }
2329#endif
2330 if( linkStateParams->callback )
2331 {
2332 linkStateParams->callback( pMac, linkStateParams->callbackArg );
2333 }
2334 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002335 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002336 break;
2337
2338#ifdef WLAN_FEATURE_PACKET_FILTERING
2339 case WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2340 pmmProcessMessage(pMac, limMsg);
2341 break;
2342#endif // WLAN_FEATURE_PACKET_FILTERING
2343
2344#ifdef WLAN_FEATURE_GTK_OFFLOAD
2345 case WDA_GTK_OFFLOAD_GETINFO_RSP:
2346 pmmProcessMessage(pMac, limMsg);
2347 break;
2348#endif // WLAN_FEATURE_GTK_OFFLOAD
Yathish9f22e662012-12-10 14:21:35 -08002349 case eWNI_SME_SET_BCN_FILTER_REQ:
2350 {
2351#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2352 tpPESession psessionEntry;
Sreelakshmi Konamkidb3f75a2016-05-26 15:41:04 +05302353 tANI_U8 sessionId;
2354 tSirSetActiveModeSetBncFilterReq *bcnFilterReq =
2355 (tSirSetActiveModeSetBncFilterReq *)limMsg->bodyptr;
2356 psessionEntry = peFindSessionByBssid(pMac, bcnFilterReq->bssid,
2357 &sessionId);
Yathish9f22e662012-12-10 14:21:35 -08002358 if(psessionEntry != NULL && IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2359 {
2360 // sending beacon filtering information down to HAL
2361 if (limSendBeaconFilterInfo(pMac, psessionEntry) != eSIR_SUCCESS)
2362 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002363 limLog(pMac, LOGE, FL("Fail to send Beacon Filter Info "));
Yathish9f22e662012-12-10 14:21:35 -08002364 }
2365 }
Dhanashri Atred7885c22013-03-29 11:19:05 -07002366 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2367 limMsg->bodyptr = NULL;
Yathish9f22e662012-12-10 14:21:35 -08002368#endif
2369 }
2370 break;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302371 case eWNI_SME_HT40_OBSS_SCAN_IND:
2372 {
Sandeep Puligilla9f384742014-04-11 02:27:04 +05302373 tpPESession psessionEntry = NULL;
2374 tANI_U8 sessionId;
2375 tSirSmeHT40OBSSScanInd *ht40ScanInd =
Siddharth Bhald31c1252014-05-05 19:34:14 +05302376 (tSirSmeHT40OBSSScanInd *)limMsg->bodyptr;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302377
Sandeep Puligilla9f384742014-04-11 02:27:04 +05302378 psessionEntry = peFindSessionByBssid(pMac, ht40ScanInd->peerMacAddr,
Siddharth Bhald31c1252014-05-05 19:34:14 +05302379 &sessionId);
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302380
Siddharth Bhald31c1252014-05-05 19:34:14 +05302381 if (psessionEntry != NULL)
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302382 {
Siddharth Bhald31c1252014-05-05 19:34:14 +05302383 if( IS_HT40_OBSS_SCAN_FEATURE_ENABLE &&
2384 psessionEntry->htSupportedChannelWidthSet ==
2385 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE )
2386 {
2387 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
2388 "OBSS Scan Start Req: session id %d"
2389 "htSupportedChannelWidthSet %d", psessionEntry->peSessionId,
2390 psessionEntry->htSupportedChannelWidthSet);
2391 limSendHT40OBSSScanInd(pMac, psessionEntry);
2392 }
2393 else
2394 {
2395 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
2396 "OBSS Scan not started: htSupportedChannelWidthSet- %d"
2397 " session id %d", psessionEntry->htSupportedChannelWidthSet,
2398 psessionEntry->peSessionId);
2399 }
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302400 }
2401 else
2402 {
2403 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
Siddharth Bhald31c1252014-05-05 19:34:14 +05302404 "OBSS Scan not started: session id is NULL");
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302405 }
2406 vos_mem_free(limMsg->bodyptr);
2407 limMsg->bodyptr = NULL;
2408 }
2409 break;
2410 case eWNI_SME_HT40_STOP_OBSS_SCAN_IND:
2411 {
2412 tpPESession psessionEntry = NULL;
Sreelakshmi Konamkidb3f75a2016-05-26 15:41:04 +05302413 tANI_U8 sessionId;
2414 tSirSmeHT40OBSSStopScanInd *ht40StopScanInd =
2415 (tSirSmeHT40OBSSStopScanInd *)limMsg->bodyptr;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302416
Sreelakshmi Konamkidb3f75a2016-05-26 15:41:04 +05302417 psessionEntry = peFindSessionByBssid(pMac,
2418 ht40StopScanInd->bssid, &sessionId);;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302419 /* Sending LIM STOP OBSS SCAN Indication
2420 Stop command support is only for debugging purpose */
Sreelakshmi Konamkidb3f75a2016-05-26 15:41:04 +05302421 if (psessionEntry && IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302422 limSendHT40OBSSStopScanInd(pMac, psessionEntry);
2423 else
2424 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_ERROR,
2425 "OBSS Scan Stop not started ");
2426 }
Sreelakshmi Konamkidb3f75a2016-05-26 15:41:04 +05302427 vos_mem_free(limMsg->bodyptr);
2428 limMsg->bodyptr = NULL;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302429 break;
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05302430#ifdef WLAN_FEATURE_AP_HT40_24G
2431 case eWNI_SME_SET_HT_2040_MODE:
2432 limProcessSmeReqMessages(pMac, limMsg);
2433 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2434 limMsg->bodyptr = NULL;
2435 break;
2436#endif
2437
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302438#ifdef FEATURE_WLAN_TDLS
2439 case WDA_SET_TDLS_LINK_ESTABLISH_REQ_RSP:
2440 {
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302441 tpPESession psessionEntry;
2442 tANI_U8 sessionId;
Sreelakshmi Konamkifff0f9e2016-07-20 15:02:28 +05302443 tDphHashNode *pStaDs = NULL;
Masti, Narayanraddif10fd792015-12-15 15:01:01 +05302444 int i, aid;
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05302445 tTdlsLinkEstablishParams *pTdlsLinkEstablishParams;
2446 pTdlsLinkEstablishParams = (tTdlsLinkEstablishParams*) limMsg->bodyptr;
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302447
2448 if((psessionEntry = peFindSessionByStaId(pMac,
2449 pTdlsLinkEstablishParams->staIdx,
2450 &sessionId))== NULL)
2451 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302452 limLog(pMac, LOGE, FL("session %u does not exist"), sessionId);
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302453 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP message to SME
2454 with session id as zero and status as FAILURE so, that message
2455 queued in SME queue can be freed to prevent the SME cmd buffer leak */
2456 limSendSmeTdlsLinkEstablishReqRsp(pMac,
2457 0,
2458 NULL,
2459 NULL,
2460 eSIR_FAILURE);
2461 }
2462 else
2463 {
Masti, Narayanraddif10fd792015-12-15 15:01:01 +05302464 for (i = 0;
2465 i < sizeof(psessionEntry->peerAIDBitmap)/sizeof(tANI_U32);
2466 i++) {
2467 for (aid = 0; aid < (sizeof(tANI_U32) << 3); aid++) {
2468 if (CHECK_BIT(psessionEntry->peerAIDBitmap[i], aid)) {
2469 pStaDs = dphGetHashEntry(pMac,
2470 (aid + i*(sizeof(tANI_U32) << 3)),
2471 &psessionEntry->dph.dphHashTable);
2472 if ((NULL != pStaDs) &&
2473 (pTdlsLinkEstablishParams->staIdx ==
2474 pStaDs->staIndex))
2475 goto send_link_resp;
2476 }
2477 }
2478 }
2479send_link_resp:
Sreelakshmi Konamkifff0f9e2016-07-20 15:02:28 +05302480 if (pStaDs)
2481 limSendSmeTdlsLinkEstablishReqRsp(pMac,
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302482 psessionEntry->smeSessionId,
Masti, Narayanraddif10fd792015-12-15 15:01:01 +05302483 pStaDs->staAddr,
2484 pStaDs,
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302485 pTdlsLinkEstablishParams->status) ;
Sreelakshmi Konamkifff0f9e2016-07-20 15:02:28 +05302486 else
2487 limSendSmeTdlsLinkEstablishReqRsp(pMac,
2488 psessionEntry->smeSessionId,
2489 NULL, NULL,
2490 pTdlsLinkEstablishParams->status) ;
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302491 }
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05302492 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2493 limMsg->bodyptr = NULL;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302494 break;
2495 }
Atul Mittal60bd4292014-08-14 12:19:27 +05302496
2497 case WDA_SET_TDLS_CHAN_SWITCH_REQ_RSP:
2498 {
2499 tpPESession psessionEntry;
2500 tANI_U8 sessionId;
Sreelakshmi Konamkifff0f9e2016-07-20 15:02:28 +05302501 tDphHashNode *pStaDs = NULL;
Masti, Narayanraddi36c67622016-01-06 16:07:34 +05302502 int i, aid;
Atul Mittal60bd4292014-08-14 12:19:27 +05302503 tTdlsChanSwitchParams *pTdlsChanSwitchParams;
2504 pTdlsChanSwitchParams = (tTdlsChanSwitchParams*) limMsg->bodyptr;
2505
2506 if((psessionEntry = peFindSessionByStaId(pMac,
2507 pTdlsChanSwitchParams->staIdx,
2508 &sessionId))== NULL)
2509 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302510 limLog(pMac, LOGE, FL("session %u does not exist"), sessionId);
Atul Mittal60bd4292014-08-14 12:19:27 +05302511 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP message to SME
2512 with session id as zero and status as FAILURE so, that message
2513 queued in SME queue can be freed to prevent the SME cmd buffer leak */
2514 limSendSmeTdlsChanSwitchReqRsp(pMac,
2515 0,
2516 NULL,
2517 NULL,
2518 eSIR_FAILURE);
2519 }
2520 else
2521 {
Masti, Narayanraddi36c67622016-01-06 16:07:34 +05302522 for (i = 0;
2523 i < sizeof(psessionEntry->peerAIDBitmap)/sizeof(tANI_U32);
2524 i++) {
2525 for (aid = 0; aid < (sizeof(tANI_U32) << 3); aid++) {
2526 if (CHECK_BIT(psessionEntry->peerAIDBitmap[i], aid)) {
2527 pStaDs = dphGetHashEntry(pMac,
2528 (aid + i*(sizeof(tANI_U32) << 3)),
2529 &psessionEntry->dph.dphHashTable);
2530 if ((NULL != pStaDs) &&
2531 (pTdlsChanSwitchParams->staIdx ==
2532 pStaDs->staIndex))
2533 goto send_chan_switch_resp;
2534 }
2535 }
2536 }
2537send_chan_switch_resp:
Sreelakshmi Konamkifff0f9e2016-07-20 15:02:28 +05302538 if (pStaDs)
2539 limSendSmeTdlsChanSwitchReqRsp(pMac,
Atul Mittal60bd4292014-08-14 12:19:27 +05302540 psessionEntry->smeSessionId,
Masti, Narayanraddi36c67622016-01-06 16:07:34 +05302541 pStaDs->staAddr,
2542 pStaDs,
Sreelakshmi Konamkifff0f9e2016-07-20 15:02:28 +05302543 pTdlsChanSwitchParams->status);
2544 else
2545 limSendSmeTdlsChanSwitchReqRsp(pMac,
2546 psessionEntry->smeSessionId,
2547 NULL, NULL,
2548 pTdlsChanSwitchParams->status);
Atul Mittal60bd4292014-08-14 12:19:27 +05302549 }
2550 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2551 limMsg->bodyptr = NULL;
2552 break;
2553 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302554#endif
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05302555
2556 case WDA_RX_SCAN_EVENT:
2557 limProcessRxScanEvent(pMac, limMsg->bodyptr);
2558 break;
2559
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002560 case WDA_IBSS_PEER_INACTIVITY_IND:
2561 {
2562 limProcessIbssPeerInactivity(pMac, limMsg->bodyptr);
2563 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2564 limMsg->bodyptr = NULL;
2565 break;
2566 }
Abhishek Singh00b71972016-01-07 10:51:04 +05302567#ifdef WLAN_FEATURE_RMC
2568 case WDA_RMC_BECOME_RULER:
2569 limProcessRMCMessages(pMac, eLIM_RMC_BECOME_RULER_RESP,
2570 (void *)limMsg->bodyptr);
2571 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2572 limMsg->bodyptr = NULL;
2573 break ;
2574
2575 case WDA_RMC_RULER_SELECT_RESP:
2576 limProcessRMCMessages(pMac, eLIM_RMC_RULER_SELECT_RESP,
2577 (void *)limMsg->bodyptr);
2578 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2579 limMsg->bodyptr = NULL;
2580 break ;
2581
2582 case WDA_RMC_UPDATE_IND:
2583 limProcessRMCMessages(pMac, eLIM_RMC_RULER_PICK_NEW,
2584 (void *)limMsg->bodyptr);
2585 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2586 limMsg->bodyptr = NULL;
2587 break ;
2588#endif /* WLAN_FEATURE_RMC */
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002589
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05302590 case WDA_SPOOF_MAC_ADDR_RSP:
2591 limProcessMlmSpoofMacAddrRsp(pMac, (tSirRetStatus)limMsg->bodyval);
2592 break;
2593
Pradeep Reddy POTTETI31505892015-04-16 16:47:54 +05302594 case eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ:
2595 limProcessSmeSetTdls2040BSSCoexReq(pMac, limMsg->bodyptr);
2596 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2597 limMsg->bodyptr = NULL;
2598 break;
2599
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +05302600 case eWNI_SME_DEL_ALL_TDLS_PEERS:
2601 limProcessSmeDelAllTdlsPeers(pMac, limMsg->bodyptr);
2602 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2603 limMsg->bodyptr = NULL;
2604 break;
Manjeet Singh3ed79242017-01-11 19:04:32 +05302605
2606 case eWNI_SME_CAP_TSF_REQ:
2607 lim_process_sme_cap_tsf_req(pMac, limMsg->bodyptr);
2608 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2609 limMsg->bodyptr = NULL;
2610 break;
2611
2612 case eWNI_SME_GET_TSF_REQ:
2613 lim_process_sme_get_tsf_req(pMac, limMsg->bodyptr);
2614 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2615 limMsg->bodyptr = NULL;
2616 break;
SaidiReddy Yenugac341fbf2017-02-01 20:22:45 +05302617 case eWNI_SME_DEL_BA_SES_REQ:
2618 lim_process_sme_del_ba_ses_req(pMac, limMsg->bodyptr);
2619 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2620 limMsg->bodyptr = NULL;
2621 break;
Yeshwanth Sriram Guntuka8d9b29c2017-12-12 15:44:57 +05302622 case eWNI_SME_STA_DEL_BA_REQ:
2623 limStaDelBASession(pMac);
2624 break;
Abhinav Kumard9664da2019-08-05 17:11:25 +05302625 case eWNI_SME_SEND_SAE_MSG:
2626 lim_process_sae_msg(pMac, limMsg->bodyptr);
2627 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2628 limMsg->bodyptr = NULL;
2629 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07002630 default:
2631 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2632 limMsg->bodyptr = NULL;
2633 // Unwanted messages
2634 // Log error
2635 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002636 FL("Discarding unexpected message received %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002637 limMsg->type);
2638 limPrintMsgName(pMac, LOGE, limMsg->type);
2639 break;
2640
2641 } // switch (limMsg->type)
2642
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002643 PELOG2(limLog(pMac, LOG2, FL("Done Processing msgType = %d, sme state = %s, mlm state = %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002644 limMsg->type, limSmeStateStr(pMac->lim.gLimSmeState),
2645 limMlmStateStr(pMac->lim.gLimMlmState));)
2646
2647} /*** end limProcessMessages() ***/
2648
2649
2650
2651/**
2652 * limProcessDeferredMessageQueue
2653 *
2654 *FUNCTION:
2655 * This function is called by LIM while exiting from Learn
2656 * mode. This function fetches messages posted to the LIM
2657 * deferred message queue limDeferredMsgQ.
2658 *
2659 *LOGIC:
2660 *
2661 *ASSUMPTIONS:
2662 * NA
2663 *
2664 *NOTE:
2665 * NA
2666 *
2667 * @param pMac - Pointer to Global MAC structure
2668 * @return None
2669 */
2670
2671void
2672limProcessDeferredMessageQueue(tpAniSirGlobal pMac)
2673{
2674 tSirMsgQ limMsg = { 0, 0, 0 };
2675
Jeff Johnson295189b2012-06-20 16:38:30 -07002676 tSirMsgQ *readMsg;
2677 tANI_U16 size;
2678
2679 /*
2680 ** check any deferred messages need to be processed
2681 **/
2682 size = pMac->lim.gLimDeferredMsgQ.size;
2683 if (size > 0)
2684 {
2685 while ((readMsg = limReadDeferredMsgQ(pMac)) != NULL)
2686 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302687 vos_mem_copy((tANI_U8*) &limMsg,
Jeff Johnson295189b2012-06-20 16:38:30 -07002688 (tANI_U8*) readMsg, sizeof(tSirMsgQ));
2689 size--;
2690 limProcessMessages(pMac, &limMsg);
2691
2692 if((limIsSystemInScanState(pMac)) || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) ||
Hema Aparna Medicharlab56b6612015-05-18 11:42:52 +05302693 (pMac->lim.gLimSystemInScanLearnMode) || pMac->lim.gLimAddtsSent)
Jeff Johnson295189b2012-06-20 16:38:30 -07002694 break;
2695 }
2696 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002697} /*** end limProcessDeferredMessageQueue() ***/
2698
2699
2700/*
2701 * limProcessNormalHddMsg
2702 * Function: this function checks the current lim state and decide whether the message passed shall be deffered.
2703 * @param pMac - Pointer to Global MAC structure
2704 * pLimMsg -- the message need to be processed
2705 * fRspReqd -- whether return result to hdd
2706 * @return None
2707 */
2708void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd)
2709{
2710 tANI_BOOLEAN fDeferMsg = eANI_BOOLEAN_TRUE;
2711
2712 /* Added For BT-AMP Support */
2713 if ((pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_AP_ROLE )
2714 ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_STA_ROLE)
2715 ||(pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE))
2716 {
2717 /** This check is required only for the AP and in 2 cases.
2718 * 1. If we are in learn mode and we receive any of these messages,
2719 * you have to come out of scan and process the message, hence dont
2720 * defer the message here. In handler, these message could be defered
2721 * till we actually come out of scan mode.
2722 * 2. If radar is detected, you might have to defer all of these
2723 * messages except Stop BSS request/ Switch channel request. This
2724 * decision is also made inside its handler.
2725 *
2726 * Please be careful while using the flag fDeferMsg. Possibly you
2727 * might end up in an infinite loop.
2728 **/
2729 if (((pLimMsg->type == eWNI_SME_START_BSS_REQ) ||
2730 (pLimMsg->type == eWNI_SME_STOP_BSS_REQ) ||
2731 (pLimMsg->type == eWNI_SME_SWITCH_CHL_REQ) ||
2732 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ) ||
2733 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ)))
2734 {
2735 fDeferMsg = eANI_BOOLEAN_FALSE;
2736 }
2737 }
2738
2739 /* limInsystemInscanState() refers the psessionEntry, how to get session Entry????*/
Jeff Johnsone7245742012-09-05 17:12:55 -07002740 if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) /*||
2741 (LIM_IS_RADAR_DETECTED(pMac))*/) && fDeferMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002742 {
2743 // System is in DFS (Learn) mode or awaiting addts response
2744 // or if radar is detected, Defer processsing this message
2745 if (limDeferMsg(pMac, pLimMsg) != TX_SUCCESS)
2746 {
2747#ifdef WLAN_DEBUG
2748 pMac->lim.numSme++;
2749#endif
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002750 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 -07002751 pLimMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
2752 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
2753 limLogSessionStates(pMac);
2754 limPrintMsgName(pMac, LOGE, pLimMsg->type);
2755 // Release body
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302756 vos_mem_free(pLimMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002757 pLimMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002758 }
2759 }
2760 else
2761 {
2762 if(fRspReqd)
2763 {
2764 // These messages are from HDD
2765 // Since these requests may also be generated
2766 // internally within LIM module, need to
2767 // distinquish and send response to host
2768 pMac->lim.gLimRspReqd = eANI_BOOLEAN_TRUE;
2769 }
2770#ifdef WLAN_DEBUG
2771 pMac->lim.numSme++;
2772#endif
2773 if(limProcessSmeReqMessages(pMac, pLimMsg))
2774 {
2775 // Release body
2776 // limProcessSmeReqMessage consumed the buffer. We can free it.
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302777 vos_mem_free(pLimMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002778 pLimMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002779 }
2780 }
2781}
2782
2783void
Jeff Johnsone7245742012-09-05 17:12:55 -07002784handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002785{
2786 tSirMacHTCapabilityInfo macHTCapabilityInfo;
2787 tSirMacHTParametersInfo macHTParametersInfo;
2788 tSirMacHTInfoField1 macHTInfoField1;
2789 tSirMacHTInfoField2 macHTInfoField2;
2790 tSirMacHTInfoField3 macHTInfoField3;
2791 tANI_U32 cfgValue;
2792 tANI_U8 *ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002793
Jeff Johnson295189b2012-06-20 16:38:30 -07002794 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) != eSIR_SUCCESS)
2795 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002796 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002797 return ;
2798 }
2799 ptr = (tANI_U8 *) &macHTCapabilityInfo;
2800 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2801 pMac->lim.gHTLsigTXOPProtection = (tANI_U8)macHTCapabilityInfo.lsigTXOPProtection;
2802 pMac->lim.gHTMIMOPSState = (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
2803 pMac->lim.gHTGreenfield = (tANI_U8)macHTCapabilityInfo.greenField;
2804 pMac->lim.gHTMaxAmsduLength = (tANI_U8)macHTCapabilityInfo.maximalAMSDUsize;
2805 pMac->lim.gHTShortGI20Mhz = (tANI_U8)macHTCapabilityInfo.shortGI20MHz;
2806 pMac->lim.gHTShortGI40Mhz = (tANI_U8)macHTCapabilityInfo.shortGI40MHz;
Jeff Johnson295189b2012-06-20 16:38:30 -07002807 pMac->lim.gHTPSMPSupport = (tANI_U8)macHTCapabilityInfo.psmp;
2808 pMac->lim.gHTDsssCckRate40MHzSupport = (tANI_U8)macHTCapabilityInfo.dsssCckMode40MHz;
2809
2810 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) != eSIR_SUCCESS)
2811 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002812 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002813 return ;
2814 }
2815 ptr = (tANI_U8 *) &macHTParametersInfo;
2816 *ptr = (tANI_U8) (cfgValue & 0xff);
2817 pMac->lim.gHTAMpduDensity = (tANI_U8)macHTParametersInfo.mpduDensity;
2818 pMac->lim.gHTMaxRxAMpduFactor = (tANI_U8)macHTParametersInfo.maxRxAMPDUFactor;
2819
2820 // Get HT IE Info
2821 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) != eSIR_SUCCESS)
2822 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002823 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002824 return ;
2825 }
2826 ptr = (tANI_U8 *) &macHTInfoField1;
2827 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
2828 pMac->lim.gHTServiceIntervalGranularity = (tANI_U8)macHTInfoField1.serviceIntervalGranularity;
2829 pMac->lim.gHTControlledAccessOnly = (tANI_U8)macHTInfoField1.controlledAccessOnly;
2830 pMac->lim.gHTRifsMode = (tANI_U8)macHTInfoField1.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002831
2832 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) != eSIR_SUCCESS)
2833 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002834 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002835 return ;
2836 }
2837 ptr = (tANI_U8 *) &macHTInfoField2;
2838 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2839 pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
2840
2841 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) != eSIR_SUCCESS)
2842 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002843 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002844 return ;
2845 }
2846 ptr = (tANI_U8 *) &macHTInfoField3;
2847 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2848 pMac->lim.gHTPCOActive = (tANI_U8)macHTInfoField3.pcoActive;
2849 pMac->lim.gHTPCOPhase = (tANI_U8)macHTInfoField3.pcoPhase;
Jeff Johnson295189b2012-06-20 16:38:30 -07002850 pMac->lim.gHTSecondaryBeacon = (tANI_U8)macHTInfoField3.secondaryBeacon;
2851 pMac->lim.gHTDualCTSProtection = (tANI_U8)macHTInfoField3.dualCTSProtection;
2852 pMac->lim.gHTSTBCBasicMCS = (tANI_U8)macHTInfoField3.basicSTBCMCS;
Jeff Johnsone7245742012-09-05 17:12:55 -07002853
2854 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2855 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
2856 * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
2857 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2858 */
2859 if (psessionEntry != NULL)
2860 {
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302861 psessionEntry->htCapability =
2862 IS_DOT11_MODE_HT(psessionEntry->dot11mode);
2863 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2864 (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05302865 limInitOBSSScanParams(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002866 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002867}
2868
2869void limLogSessionStates(tpAniSirGlobal pMac)
2870{
2871#ifdef WLAN_DEBUG
2872 int i;
2873
2874 for(i = 0; i < pMac->lim.maxBssId; i++)
2875 {
2876 if(pMac->lim.gpSession[i].valid)
2877 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302878 limLog(pMac, LOG1, FL("Session[%d] sysRole(%d) limSmeState %d "
2879 "(prev sme state %d) mlm state %d (prev mlm state %d)"),
2880 i, pMac->lim.gpSession[i].limSystemRole,
2881 pMac->lim.gpSession[i].limSmeState,
2882 pMac->lim.gpSession[i].limPrevSmeState,
2883 pMac->lim.gpSession[i].limMlmState,
2884 pMac->lim.gpSession[i].limPrevMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002885 }
2886 }
2887#endif //ifdef WLAN_DEBUG
2888}