blob: 878984f1c913b6d7376719162c94a58fd9137427 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Masti, Narayanraddie1892a52015-12-15 15:01:01 +05302 * Copyright (c) 2011-2016 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 Singh7cd040e2016-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"
Jeff Johnson295189b2012-06-20 16:38:30 -070085
Katya Nigam3802f202013-12-16 19:27:14 +053086/* This value corresponds to 500 ms */
Abhishek Singhb74bfc02015-11-26 16:53:47 +053087#define MAX_PROBEREQ_TIME 50
Katya Nigam3802f202013-12-16 19:27:14 +053088
Dino Mycle7a76e662014-06-10 11:36:34 +053089#ifdef WLAN_FEATURE_EXTSCAN
90#define SIZE_OF_FIXED_PARAM 12
91#endif
92
Masti, Narayanraddie1892a52015-12-15 15:01:01 +053093#define CHECK_BIT(value, mask) ((value) & (1 << (mask)))
94
Jeff Johnson295189b2012-06-20 16:38:30 -070095void limLogSessionStates(tpAniSirGlobal pMac);
96
97/** -------------------------------------------------------------
98\fn defMsgDecision
99\brief The function decides whether to defer a message or not in limProcessMessage function
100\param tpAniSirGlobal pMac
101\param tSirMsgQ limMsg
102\param tSirMacTspecIE *ppInfo
103\return none
104 -------------------------------------------------------------*/
105
106tANI_U8 static
107defMsgDecision(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
108{
109
110
111/* this function should not changed */
Jeff Johnsone7245742012-09-05 17:12:55 -0700112 if(pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700113 {
114 // Defer processsing this message
115 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
116 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700117 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 -0700118 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
119 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
120 limLogSessionStates(pMac);
121 limHandleDeferMsgError(pMac, limMsg);
122 }
123 return true;
124 }
125
126 //When defer is requested then defer all the messages except HAL responses.
127 if((!limIsSystemInScanState(pMac)) && (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) &&
128 !pMac->lim.gLimSystemInScanLearnMode)
129 {
130 if((limMsg->type != WDA_ADD_BSS_RSP) &&
131 (limMsg->type != WDA_DELETE_BSS_RSP) &&
132 (limMsg->type != WDA_ADD_STA_RSP) &&
133 (limMsg->type != WDA_ADD_STA_SELF_RSP) &&
134 (limMsg->type != WDA_DEL_STA_SELF_RSP) &&
135 (limMsg->type != WDA_DELETE_STA_RSP)&&
136 (limMsg->type != WDA_SET_BSSKEY_RSP)&&
137 (limMsg->type != WDA_SET_STAKEY_RSP)&&
138 (limMsg->type != WDA_SET_STA_BCASTKEY_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700139 (limMsg->type != eWNI_SME_START_REQ) &&
140 (limMsg->type != WDA_AGGR_QOS_RSP) &&
141 (limMsg->type != WDA_REMOVE_BSSKEY_RSP) &&
142 (limMsg->type != WDA_REMOVE_STAKEY_RSP) &&
143 (limMsg->type != WDA_SET_MIMOPS_RSP)&&
144 (limMsg->type != WDA_ADDBA_RSP) &&
145 (limMsg->type != WDA_ENTER_BMPS_RSP) &&
146 (limMsg->type != WDA_EXIT_BMPS_RSP) &&
147 (limMsg->type != WDA_ENTER_IMPS_RSP) &&
148 (limMsg->type != WDA_EXIT_IMPS_RSP) &&
149 (limMsg->type != WDA_ENTER_UAPSD_RSP) &&
150 (limMsg->type != WDA_EXIT_UAPSD_RSP) &&
151 (limMsg->type != WDA_WOWL_ENTER_RSP) &&
152 (limMsg->type != WDA_WOWL_EXIT_RSP) &&
153 (limMsg->type != WDA_SWITCH_CHANNEL_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700154 (limMsg->type != WDA_P2P_NOA_ATTR_IND) &&
Viral Modid440e682013-03-06 02:25:31 -0800155 (limMsg->type != WDA_P2P_NOA_START_IND) &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700156#ifdef FEATURE_OEM_DATA_SUPPORT
157 (limMsg->type != WDA_START_OEM_DATA_RSP) &&
158#endif
Hema Aparna Medicharlab56b6612015-05-18 11:42:52 +0530159 (limMsg->type != WDA_ADD_TS_RSP) &&
Hanumantha Reddy Pothula3de8d4c2015-10-07 12:06:37 +0530160
161 /* LIM won't process any defer queue commands if gLimAddtsSent is set to
162 TRUE. gLimAddtsSent will be set TRUE to while sending ADDTS REQ. Say,
163 when deferring is enabled, if SIR_LIM_ADDTS_RSP_TIMEOUT is posted
164 (because of not receiving ADDTS RSP) then this command will be added
165 to defer queue and as gLimAddtsSent is set TRUE LIM will never
166 process any commands from defer queue, including
167 SIR_LIM_ADDTS_RSP_TIMEOUT. Hence allowing SIR_LIM_ADDTS_RSP_TIMEOUT
168 command to be processed with deferring enabled, so that this will be
169 processed immediately and sets gLimAddtsSent to FALSE.
170 */
171 (limMsg->type != SIR_LIM_ADDTS_RSP_TIMEOUT) &&
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +0530172 (limMsg->type != WDA_LOST_LINK_PARAMS_IND) &&
Hema Aparna Medicharlab56b6612015-05-18 11:42:52 +0530173 /* Allow processing of RX frames while awaiting reception of
174 ADD TS response over the air. This logic particularly handles the
175 case when host sends ADD BA request to FW after ADD TS request
176 is sent over the air and ADD TS response received over the air */
177 !(limMsg->type == SIR_BB_XPORT_MGMT_MSG && pMac->lim.gLimAddtsSent))
Jeff Johnson295189b2012-06-20 16:38:30 -0700178 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700179 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 -0700180 limMsgStr(limMsg->type));)
181
182 // Defer processsing this message
183 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
184 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700185 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 -0700186 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
187 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
188 limLogSessionStates(pMac);
189 limHandleDeferMsgError(pMac, limMsg);
190
191 }
192 return true;
193 }
194 }
195 return false;
196}
197
198/*
199* Beacon Handling Cases:
200* during scanning, when no session is active:
201* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
202* during scanning, when any session is active, but beacon/Pr does not belong to that session, psessionEntry will be null.
203* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
204* during scanning, when any session is active, and beacon/Pr belongs to one of the session, psessionEntry will not be null.
205* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
206* Not scanning, no session:
207* there should not be any beacon coming, if coming, should be dropped.
208* Not Scanning,
209*/
210static void
211__limHandleBeacon(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tpPESession psessionEntry)
212{
213 /* checking for global SME state...*/
214 tANI_U8 *pRxPacketInfo;
215 limGetBDfromRxPacket(pMac, pMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
216
217 //This function should not be called if beacon is received in scan state.
218 //So not doing any checks for the global state.
219
220 if(psessionEntry == NULL)
221 {
222 schBeaconProcess(pMac, pRxPacketInfo, NULL);
223 }
224 else if( (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
225 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE))
226 {
227 schBeaconProcess(pMac, pRxPacketInfo, psessionEntry);
228 }
229 else
230 limProcessBeaconFrame(pMac, pRxPacketInfo, psessionEntry);
231
232 return;
233}
234
235
236//Fucntion prototype
237void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd);
238
239/**
Jeff Johnson295189b2012-06-20 16:38:30 -0700240 * limDeferMsg()
241 *
242 *FUNCTION:
243 * This function is called to defer the messages received
244 * during Learn mode
245 *
246 *LOGIC:
247 * NA
248 *
249 *ASSUMPTIONS:
250 * NA
251 *
252 *NOTE:
253 * NA
254 *
255 * @param pMac - Pointer to Global MAC structure
256 * @param pMsg of type tSirMsgQ - Pointer to the message structure
257 * @return None
258 */
259
260tANI_U32
261limDeferMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
262{
263 tANI_U32 retCode = TX_SUCCESS;
Jeff Johnson77165482013-03-07 08:15:44 -0800264
265 retCode = limWriteDeferredMsgQ(pMac, pMsg);
266
Jeff Johnson295189b2012-06-20 16:38:30 -0700267 if (retCode == TX_SUCCESS)
Jeff Johnson77165482013-03-07 08:15:44 -0800268 {
Rashmi Ramanna6c13a342014-01-07 11:44:07 +0530269 limLog(pMac, LOG1,
270 FL("Deferred message(0x%X) limSmeState %d (prev sme state %d)"
271 " sysRole %d mlm state %d (prev mlm state %d)"),
272 pMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
273 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState,
274 pMac->lim.gLimPrevMlmState);
Jeff Johnson77165482013-03-07 08:15:44 -0800275 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));)
276 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700277 else
Jeff Johnson77165482013-03-07 08:15:44 -0800278 {
Agarwal Ashishe865f332014-04-08 13:20:06 +0530279 limLog(pMac, LOG1, FL("Dropped lim message (0x%X)"), pMsg->type);
Jeff Johnson77165482013-03-07 08:15:44 -0800280 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));)
281 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700282
283 return retCode;
284} /*** end limDeferMsg() ***/
285
286
287
288/**
289 * limHandleFramesInScanState()
290 *
291 *FUNCTION:
292 * This function is called to process 802.11 frames
293 * received by LIM in scan state.
294 *
295 *LOGIC:
296 * NA
297 *
298 *ASSUMPTIONS:
299 * NA
300 *
301 *NOTE:
302 * NA
303 *
304 * @param pMac - Pointer to Global MAC structure
305 * @param limMsg - Received message
306 * @param pRxPacketInfo - Pointer to Rx packet info structure
307 * @param deferMsg - Indicates whether the frame shall be deferred
308 * @return None
309 */
310
311static void
312limHandleFramesInScanState(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pRxPacketInfo, tANI_U8 *deferMsg, tpPESession psessionEntry)
313{
314 tSirMacFrameCtl fc;
315 tpSirMacMgmtHdr pHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -0700316
317 *deferMsg = false;
318 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
319 fc = pHdr->fc;
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700320 limLog( pMac, LOG2, FL("ProtVersion %d, Type %d, Subtype %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700321 fc.protVer, fc.type, fc.subType );
322
Jeff Johnson295189b2012-06-20 16:38:30 -0700323 // defer all message in scan state except for Beacons and Probe Response
324 if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_BEACON))
325 {
326 if (psessionEntry == NULL)
327 limProcessBeaconFrameNoSession(pMac, pRxPacketInfo);
328 else
329 limProcessBeaconFrame(pMac, pRxPacketInfo,psessionEntry);
330 }
331 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_RSP))
332 {
333 if (psessionEntry == NULL)
334 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
335 else
336 limProcessProbeRspFrame(pMac, pRxPacketInfo,psessionEntry);
337 }
338 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_REQ))
339 {
340 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo, psessionEntry);
341 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700342 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_ACTION))
343 {
344 limProcessActionFrameNoSession( pMac, pRxPacketInfo);
345 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700346 else
347 {
348 *deferMsg = true;
349 return;
350 }
351
Jeff Johnson295189b2012-06-20 16:38:30 -0700352 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
353 return;
354
355} /*** end limHandleFramesInScanState() ***/
356
357/** ------------------------------------------------------------
358\brief This function handles Unknown Unicast (A2 Index)
359\ packets.
360\param tpAniSirGlobal pMac Global Mac data structure
361\param void *pRxPacketInfo Pointer to Buffer Descriptor
362\return none
363\
364\ -------------------------------------------------------------- */
365static void limHandleUnknownA2IndexFrames(tpAniSirGlobal pMac, void *pRxPacketInfo,tpPESession psessionEntry)
366{
Jeff Johnson295189b2012-06-20 16:38:30 -0700367 /* addr2 mismatch interrupt occurred this means previous
368 disassociation was not successful
369 In Volans pRxPacketInfo only contains pointer 48-bit address2 field */
370 /*Send disassociation message again*/
371 //Dinesh need one more arguement.
372 //limSendDisassocMgmtFrame(pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON,(tANI_U8 *) pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800373 //TODO: verify this
Jeff Johnson295189b2012-06-20 16:38:30 -0700374 //This could be a public action frame.
375 if( psessionEntry->limSystemRole == eLIM_P2P_DEVICE_ROLE )
376 limProcessActionFrameNoSession(pMac, (tANI_U8 *) pRxPacketInfo);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800377
378#ifdef FEATURE_WLAN_TDLS
379 {
380 tpSirMacDataHdr3a pMacHdr;
381 pMacHdr = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
382
383 if (limIsGroupAddr(pMacHdr->addr2))
384 {
Abhishek Singh525045c2014-12-15 17:18:45 +0530385 limLog(pMac, LOG1, FL("Ignoring A2 Invalid Packet received for MC/BC:"));
386 limPrintMacAddr(pMac, pMacHdr->addr2, LOG1);
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800387
388 return;
389 }
390 /* TDLS_hklee: move down here to reject Addr2 == Group (first checking above)
391 and also checking if SystemRole == STA */
392 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
393 {
394 /* ADD handling of Public Action Frame */
395 LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700396 ("limHandleUnknownA2IndexFrames: type=0x%x, subtype=0x%x"),pMacHdr->fc.type, pMacHdr->fc.subType));
Mohit Khanna698ba2a2012-12-04 15:08:18 -0800397 switch (pMacHdr->fc.type)
398 {
399 case SIR_MAC_MGMT_FRAME:
400 {
401 switch (pMacHdr->fc.subType)
402 {
403 case SIR_MAC_MGMT_ACTION:
404 {
405 limProcessActionFrame(pMac, pRxPacketInfo, psessionEntry) ;
406 break ;
407 }
408 default:
409 {
410 break ;
411 }
412 }
413 }
414 default:
415 {
416 break ;
417 }
418 }
419 }
420 }
421#endif
422
Jeff Johnson295189b2012-06-20 16:38:30 -0700423
424 return;
425}
426
Jeff Johnson295189b2012-06-20 16:38:30 -0700427/**
428 * limCheckMgmtRegisteredFrames()
429 *
430 *FUNCTION:
431 * This function is called to process to check if received frame match with
432 * any of the registered frame from HDD. If yes pass this frame to SME.
433 *
434 *LOGIC:
435 *
436 *ASSUMPTIONS:
437 *
438 *NOTE:
439 *
440 * @param pMac Pointer to Global MAC structure
441 * @param *pBd Pointer to the received Buffer Descriptor+payload
442 * @param *psessionEntry Pointer to session on which packet is received
443 * @return None
444 */
445static tANI_BOOLEAN
446limCheckMgmtRegisteredFrames(tpAniSirGlobal pMac, tANI_U8 *pBd,
447 tpPESession psessionEntry)
448{
449 tSirMacFrameCtl fc;
450 tpSirMacMgmtHdr pHdr;
451 tANI_U8 *pBody;
452 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
453 tANI_U16 frameType;
454 tANI_U16 framelen;
455 tANI_U8 type,subType;
456 tANI_BOOLEAN match = VOS_FALSE;
457 VOS_STATUS vosStatus;
458
459 pHdr = WDA_GET_RX_MAC_HEADER(pBd);
460 fc = pHdr->fc;
461 frameType = (fc.type << 2 ) | (fc.subType << 4);
462 pBody = WDA_GET_RX_MPDU_DATA(pBd);
463 framelen = WDA_GET_RX_PAYLOAD_LEN(pBd);
464
465 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
466 (vos_list_node_t**)&pLimMgmtRegistration);
467
468 while(pLimMgmtRegistration != NULL)
469 {
470 type = (pLimMgmtRegistration->frameType >> 2) & 0x03;
471 subType = (pLimMgmtRegistration->frameType >> 4) & 0x0f;
472 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
473 && (subType == SIR_MAC_MGMT_RESERVED15) )
474 {
475 limLog( pMac, LOG3,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700476 FL("rcvd frame match with SIR_MAC_MGMT_RESERVED15"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700477 match = VOS_TRUE;
478 break;
479 }
480
481 if (pLimMgmtRegistration->frameType == frameType)
482 {
483 if (pLimMgmtRegistration->matchLen > 0)
484 {
485 if (pLimMgmtRegistration->matchLen <= framelen)
486 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +0530487 if (vos_mem_compare(pLimMgmtRegistration->matchData,
Jeff Johnson295189b2012-06-20 16:38:30 -0700488 pBody, pLimMgmtRegistration->matchLen))
489 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700490 /* found match! */
491 match = VOS_TRUE;
492 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700493 }
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700494 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700495 }
496 else
497 {
498 /* found match! */
499 match = VOS_TRUE;
500 break;
501 }
502 }
503
504 vosStatus =
505 vos_list_peek_next ( &pMac->lim.gLimMgmtFrameRegistratinQueue,
506 (vos_list_node_t*) pLimMgmtRegistration,
507 (vos_list_node_t**) &pNext );
508 pLimMgmtRegistration = pNext;
509 pNext = NULL;
510 }
511
512 if (match)
513 {
514 limLog( pMac, LOG1,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700515 FL("rcvd frame match with registered frame params"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700516
517 /* Indicate this to SME */
Rashmi Ramanna0d0adec2014-02-05 20:35:37 +0530518 limSendSmeMgmtFrameInd( pMac, pLimMgmtRegistration->sessionId,
519 pBd, psessionEntry, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700520
521 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
522 && (subType == SIR_MAC_MGMT_RESERVED15) )
523 {
524 // These packets needs to be processed by PE/SME as well as HDD.
525 // If it returns TRUE here, the packet is forwarded to HDD only.
526 match = VOS_FALSE;
527 }
528 }
529
530 return match;
531} /*** end limCheckMgmtRegisteredFrames() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700532
Dino Mycle7a76e662014-06-10 11:36:34 +0530533#ifdef WLAN_FEATURE_EXTSCAN
534
535void
536limProcessEXTScanRealTimeData(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo)
537{
538 tpSirMacMgmtHdr pHdr = NULL;
539 eHalStatus status;
540 void *pCallbackContext;
541 tANI_U8 rfBand = 0;
542 tANI_U8 rxChannelInBD = 0;
543 tSirMacFrameCtl fc;
544 tDot11fBeacon *pBeacon = NULL;
545 tDot11fProbeResponse *pProbeResponse = NULL;
546 tSirWifiFullScanResultEvent tEXTScanFullScanResult;
547
548 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
549 fc = pHdr->fc;
550
551 limLog(pMac, LOG2,
552 FL("Received EXTScan Real Time data with length=%d from "),
553 WDA_GET_RX_MPDU_LEN(pRxPacketInfo));
554
555 limPrintMacAddr(pMac, pHdr->sa, LOG2);
556
557 vos_mem_set((tANI_U8 *) &tEXTScanFullScanResult,
558 sizeof(tSirWifiFullScanResultEvent), 0);
559
Dino Mycle3f783bc2014-08-08 17:40:22 +0530560 tEXTScanFullScanResult.ap.ts = vos_get_monotonic_boottime();
Dino Mycle7a76e662014-06-10 11:36:34 +0530561
562 vos_mem_copy(&tEXTScanFullScanResult.ap.bssid,
563 pHdr->bssId, sizeof(tSirMacAddr));
564
Dino Myclee8843b32014-07-04 14:21:45 +0530565 limPrintMacAddr(pMac, pHdr->bssId, LOG2);
Dino Mycle7a76e662014-06-10 11:36:34 +0530566
567
568 rfBand = WDA_GET_RX_RFBAND(pRxPacketInfo);
569 rxChannelInBD = WDA_GET_RX_CH(pRxPacketInfo);
570
571 if ((!rfBand) || IS_5G_BAND(rfBand))
572 {
573 rxChannelInBD = limUnmapChannel(rxChannelInBD);
574 }
575
c_hpothu24b354c2014-09-24 18:59:33 +0530576 tEXTScanFullScanResult.ap.channel =
577 (tANI_U32)vos_chan_to_freq(rxChannelInBD);
Dino Mycle7a76e662014-06-10 11:36:34 +0530578 tEXTScanFullScanResult.ap.rssi = WDA_GET_RX_RSSI_DB(pRxPacketInfo);
579
580 if (fc.subType == SIR_MAC_MGMT_BEACON)
581 {
582 limLog( pMac, LOG2, FL("Beacon "));
583
584 pBeacon = vos_mem_malloc(sizeof(tDot11fBeacon));
585 if ( NULL == pBeacon ){
586 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
587 return;
588 }
589
590 vos_mem_set( ( tANI_U8* )pBeacon, sizeof(tDot11fBeacon), 0 );
591 // delegate to the framesc-generated code,
592 status = dot11fUnpackBeacon( pMac,
593 (tANI_U8 *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo),
594 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo), pBeacon );
595
596 if ( DOT11F_FAILED( status ) )
597 {
598 limLog(pMac, LOGE, FL("Failed to parse a Beacons"
Sushant Kaushik87787972015-09-11 16:05:00 +0530599 "(%d)"), status);
Dino Mycle7a76e662014-06-10 11:36:34 +0530600 vos_mem_free(pBeacon);
601 return;
602 }
603 if ( pBeacon->SSID.present )
604 {
605 vos_mem_copy(tEXTScanFullScanResult.ap.ssid,
606 pBeacon->SSID.ssid,
607 pBeacon->SSID.num_ssid);
608 }
609 //NULL Terminate the string.
610 tEXTScanFullScanResult.ap.ssid[pBeacon->SSID.num_ssid] = 0;
611 tEXTScanFullScanResult.ap.beaconPeriod =
612 pBeacon->BeaconInterval.interval;
613 tEXTScanFullScanResult.ap.capability =
614 *((tANI_U16 *)&pBeacon->Capabilities);
615 vos_mem_free(pBeacon);
616 }
617 else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP)
618 {
619 limLog( pMac, LOG2, FL("Probe rsp "));
620
621 pProbeResponse = vos_mem_malloc(sizeof(tDot11fProbeResponse));
622 if ( NULL == pProbeResponse ){
623 limLog(pMac, LOGE, FL("Failed to allocate memory\n") );
624 return;
625 }
626
627 vos_mem_set( ( tANI_U8* )pProbeResponse,
628 sizeof(tDot11fProbeResponse), 0);
629 //delegate to the framesc-generated code,
630 status = dot11fUnpackProbeResponse( pMac,
631 (tANI_U8 *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo),
632 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo), pProbeResponse );
633
634 if ( DOT11F_FAILED( status ) )
635 {
636 limLog(pMac, LOGE, FL("Failed to parse a Probe"
Sushant Kaushik87787972015-09-11 16:05:00 +0530637 "Response (%d"), status);
Dino Mycle7a76e662014-06-10 11:36:34 +0530638 vos_mem_free(pProbeResponse);
639 return;
640 }
641 if ( pProbeResponse->SSID.present )
642 {
643 vos_mem_copy(tEXTScanFullScanResult.ap.ssid,
644 pProbeResponse->SSID.ssid,
645 pProbeResponse->SSID.num_ssid);
646 }
647 //NULL Terminate the string.
648 tEXTScanFullScanResult.ap.ssid[pProbeResponse->SSID.num_ssid] = 0;
649 tEXTScanFullScanResult.ap.beaconPeriod =
650 pProbeResponse->BeaconInterval.interval;
651 tEXTScanFullScanResult.ap.capability =
652 *(((tANI_U16 *)&pProbeResponse->Capabilities));
653
Gupta, Kapild25b8c02016-02-01 19:54:14 +0530654 vos_mem_free(pProbeResponse);
Dino Mycle7a76e662014-06-10 11:36:34 +0530655 }
656 else
657 {
658 limLog( pMac, LOGE, FL("Wrong frame Type %d, Subtype %d for LFR"),
659 fc.type, fc.subType);
660 VOS_ASSERT(0);
661 return;
662 }
663
664 tEXTScanFullScanResult.requestId = pMac->sme.extScanStartReqId;
665 tEXTScanFullScanResult.ieLength =
666 WDA_GET_RX_PAYLOAD_LEN(pRxPacketInfo) - SIZE_OF_FIXED_PARAM;
667 tEXTScanFullScanResult.ie =(tSirInformationElement *)
668 ((tANI_U8 *)WDA_GET_RX_MPDU_DATA(pRxPacketInfo) + SIZE_OF_FIXED_PARAM);
669
670 pCallbackContext = pMac->sme.pEXTScanCallbackContext;
671 if(pMac->sme.pEXTScanIndCb)
672 {
673 pMac->sme.pEXTScanIndCb(pCallbackContext,
674 SIR_HAL_EXTSCAN_FULL_SCAN_RESULT_IND,
675 (tANI_U8 *)&tEXTScanFullScanResult);
676 }
677
678 return;
679} /*** end limProcessEXTScanRealTimeData() ***/
680#endif /* WLAN_FEATURE_EXTSCAN */
Jeff Johnson295189b2012-06-20 16:38:30 -0700681
682/**
683 * limHandle80211Frames()
684 *
685 *FUNCTION:
686 * This function is called to process 802.11 frames
687 * received by LIM.
688 *
689 *LOGIC:
690 * NA
691 *
692 *ASSUMPTIONS:
693 * NA
694 *
695 *NOTE:
696 * NA
697 *
698 * @param pMac - Pointer to Global MAC structure
699 * @param pMsg of type tSirMsgQ - Pointer to the message structure
700 * @return None
701 */
702
703static void
Sushant Kaushik33200572015-08-05 16:46:20 +0530704
Jeff Johnson295189b2012-06-20 16:38:30 -0700705limHandle80211Frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pDeferMsg)
706{
707 tANI_U8 *pRxPacketInfo = NULL;
708 tSirMacFrameCtl fc;
709 tpSirMacMgmtHdr pHdr=NULL;
710 tpPESession psessionEntry=NULL;
711 tANI_U8 sessionId;
712 tAniBool isFrmFt = FALSE;
713 tANI_U16 fcOffset = WLANHAL_RX_BD_HEADER_SIZE;
714
715 *pDeferMsg= false;
716 limGetBDfromRxPacket(pMac, limMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
717
Dino Mycle7a76e662014-06-10 11:36:34 +0530718#ifdef WLAN_FEATURE_EXTSCAN
719
720 if ( WDA_GET_EXTSCANFULLSCANRESIND(pRxPacketInfo))
721 {
722 limLog( pMac, LOG2, FL("Notify EXTSCAN scan results to the HDD"));
723 limProcessEXTScanRealTimeData(pMac, pRxPacketInfo);
724 goto end;
725 }
726#endif //WLAN_FEATURE_EXTSCAN
727
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
729 isFrmFt = WDA_GET_RX_FT_DONE(pRxPacketInfo);
730 fcOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pRxPacketInfo);
731 fc = pHdr->fc;
732
Madan Mohan Koyyalamudi99af06e2013-08-08 02:17:17 +0530733#ifdef WLAN_DUMP_MGMTFRAMES
734 limLog( pMac, LOGE, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
735 fc.protVer, fc.type, fc.subType,
736 WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
737 VOS_TRACE_HEX_DUMP(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, pHdr,
738 WDA_GET_RX_MPDU_HEADER_LEN(pRxPacketInfo));
739#endif
740
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -0800741 if ((fc.type == SIR_MAC_MGMT_FRAME) &&
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -0800742 (fc.subType != SIR_MAC_MGMT_BEACON))
743 {
Rajeev Kumar Sirasanagandlaade0a332016-06-29 16:52:15 +0530744 limLog(pMac, LOG1, FL("RX MGMT - Type %hu, SubType %hu,"
745 "Seq.no %d, Source mac-addr "
746 MAC_ADDRESS_STR), fc.type, fc.subType,
747 ((pHdr->seqControl.seqNumHi << 4) |
748 (pHdr->seqControl.seqNumLo)),
749 MAC_ADDR_ARRAY(pHdr->sa));
Tushnim Bhattacharyyaed4d0c22014-01-30 11:56:44 -0800750 }
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -0700751#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
752 if ( WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
753 {
754 limLog( pMac, LOG2, FL("Notify SME with candidate ind"));
755 //send a session 0 for now - TBD
756 limSendSmeCandidateFoundInd(pMac, 0);
757 goto end;
758 }
759 if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo))
760 {
761 if (fc.subType == SIR_MAC_MGMT_BEACON)
762 {
763 limLog( pMac, LOG2, FL("Save this beacon in LFR cache"));
764 __limHandleBeacon(pMac, limMsg, NULL);
765 }
766 else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP)
767 {
768 limLog( pMac, LOG2, FL("Save this probe rsp in LFR cache"));
769 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
770 }
771 else
772 {
773 limLog( pMac, LOGE, FL("Wrong frame Type %d, Subtype %d for LFR"),
774 fc.type, fc.subType);
775 }
776 goto end;
777 }
778#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800779#ifdef FEATURE_WLAN_ESE
Jeff Johnson295189b2012-06-20 16:38:30 -0700780 if (fc.type == SIR_MAC_DATA_FRAME && isFrmFt)
781 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800782#if 0 // Ese TBD Need to PORT
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 tpSirMacDot3Hdr pDataFrmHdr;
784
785 pDataFrmHdr = (tpSirMacDot3Hdr)((tANI_U8 *)pBD+ WLANHAL_RX_BD_GET_MPDU_H_OFFSET(pBD));
786 if((psessionEntry = peFindSessionByBssid(pMac,pDataFrmHdr->sa,&sessionId))== NULL)
787 {
788 limLog( pMac, LOGE, FL("Session not found for Frm type %d, subtype %d, SA: "), fc.type, fc.subType);
789 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
790 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
791 return;
792 }
793
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800794 if (!psessionEntry->isESEconnection)
Jeff Johnson295189b2012-06-20 16:38:30 -0700795 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800796 limLog( pMac, LOGE, FL("LIM received Type %d, Subtype %d in Non ESE connection"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700797 fc.type, fc.subType);
798 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
799 return;
800 }
801 limLog( pMac, LOGE, FL("Processing IAPP Frm from SA:"));
802 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
803#else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -0800804 printk("%s: Need to port handling of IAPP frames to PRIMA for ESE", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700805#endif
806
807
808 } else
809#endif
Siddharth Bhal4f3187c2014-10-09 21:38:08 +0530810
811 if ((fc.type == SIR_MAC_MGMT_FRAME) &&
812 (fc.subType == SIR_MAC_MGMT_PROBE_RSP) &&
813 pMac->lim.isSpoofingEnabled)
814 {
815 limLog( pMac, LOG2, FL("Probe Rsp recieved with DA: "MAC_ADDRESS_STR
816 " and selfMac Addr:"MAC_ADDRESS_STR), MAC_ADDR_ARRAY(pHdr->da),
817 MAC_ADDR_ARRAY(pMac->lim.gSelfMacAddr));
818 if (VOS_TRUE == vos_mem_compare((v_VOID_t*) pHdr->da,
819 (v_VOID_t*) pMac->lim.spoofMacAddr, VOS_MAC_ADDRESS_LEN))
820 {
821 vos_mem_copy(pHdr->da, pMac->lim.gSelfMacAddr, VOS_MAC_ADDRESS_LEN);
822 }
823 }
824
Jeff Johnson295189b2012-06-20 16:38:30 -0700825 /* Added For BT-AMP Support */
826 if((psessionEntry = peFindSessionByBssid(pMac,pHdr->bssId,&sessionId))== NULL)
827 {
828#ifdef WLAN_FEATURE_VOWIFI_11R
829 if (fc.subType == SIR_MAC_MGMT_AUTH)
830 {
831#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800832 limLog( pMac, LOG1, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700833 fc.protVer, fc.type, fc.subType, WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
Varun Reddy Yeturuf68abd62013-02-11 14:05:06 -0800834 limPrintMacAddr(pMac, pHdr->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700835#endif
836 if (limProcessAuthFrameNoSession(pMac, pRxPacketInfo, limMsg->bodyptr) == eSIR_SUCCESS)
837 {
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +0530838 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700839 }
840 }
841#endif
842 if((fc.subType != SIR_MAC_MGMT_PROBE_RSP )&&
843 (fc.subType != SIR_MAC_MGMT_BEACON)&&
844 (fc.subType != SIR_MAC_MGMT_PROBE_REQ)
Jeff Johnson295189b2012-06-20 16:38:30 -0700845 && (fc.subType != SIR_MAC_MGMT_ACTION ) //Public action frame can be received from non-associated stations.
Jeff Johnson295189b2012-06-20 16:38:30 -0700846 )
847 {
848
849 if((psessionEntry = peFindSessionByPeerSta(pMac,pHdr->sa,&sessionId))== NULL)
850 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700851 limLog(pMac, LOG1, FL("session does not exist for given bssId"));
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +0530852 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700853 }
Padma, Santhosh Kumar2b47ca82014-01-03 16:57:27 +0530854 else
855 limLog(pMac,LOG1,"SessionId:%d Session Exist for given Bssid",
856 psessionEntry->peSessionId);
Gopichand Nakkala6265d6f2013-03-20 23:32:50 +0530857 }
858 // For p2p resp frames search for valid session with DA as
859 // BSSID will be SA and session will be present with DA only
860 if(fc.subType == SIR_MAC_MGMT_ACTION )
861 {
862 psessionEntry = peFindSessionByBssid(pMac,pHdr->da,&sessionId);
863 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700864 }
865
866
Jeff Johnson295189b2012-06-20 16:38:30 -0700867 /* Check if frame is registered by HDD */
868 if(limCheckMgmtRegisteredFrames(pMac, pRxPacketInfo, psessionEntry))
869 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700870 limLog( pMac, LOG1, FL("Received frame is passed to SME"));
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +0530871 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700872 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700873
874
Jeff Johnson295189b2012-06-20 16:38:30 -0700875
876 if (fc.protVer != SIR_MAC_PROTOCOL_VERSION)
877 { // Received Frame with non-zero Protocol Version
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700878 limLog(pMac, LOGE, FL("Unexpected frame with protVersion %d received"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700879 fc.protVer);
Jeff Johnson295189b2012-06-20 16:38:30 -0700880#ifdef WLAN_DEBUG
881 pMac->lim.numProtErr++;
882#endif
Kanchanapally, Vidyullathac796fc62015-03-17 10:45:28 +0530883 goto end;
Jeff Johnson295189b2012-06-20 16:38:30 -0700884 }
885
Gopichand Nakkala2c231c82013-06-11 17:49:16 +0530886 if (!pMac->fScanOffload)
Jeff Johnson295189b2012-06-20 16:38:30 -0700887 {
Gopichand Nakkala2c231c82013-06-11 17:49:16 +0530888 if (limIsSystemInScanState(pMac))
889 {
890 limHandleFramesInScanState(pMac, limMsg, pRxPacketInfo, pDeferMsg, psessionEntry);
891 return;
892 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700893 }
894
895/* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */
896
897#if 0
898 if (psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE) {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700899 limLog( pMac, LOGW, FL( "gLimSystemRole is %d. Exiting..." ),psessionEntry->limSystemRole );
Jeff Johnson295189b2012-06-20 16:38:30 -0700900 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
901
902#ifdef WLAN_DEBUG
903 pMac->lim.numProtErr++;
904#endif
905 return;
906 }
907 #endif //HACK to continue scanning
908
909
910#ifdef WLAN_DEBUG
911 pMac->lim.numMAC[fc.type][fc.subType]++;
912#endif
913
914 switch (fc.type)
915 {
916 case SIR_MAC_MGMT_FRAME:
917 {
918 #if 0 //TBD-RAJESH fix this
919 if (limIsReassocInProgress( pMac,psessionEntry) && (fc.subType != SIR_MAC_MGMT_DISASSOC) &&
920 (fc.subType != SIR_MAC_MGMT_DEAUTH) && (fc.subType != SIR_MAC_MGMT_REASSOC_RSP))
921 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700922 limLog(pMac, LOGE, FL("Frame with Type - %d, Subtype - %d received in ReAssoc Wait state, dropping..."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700923 fc.type, fc.subType);
924 return;
925 }
926 #endif //HACK to continue scanning
927 // Received Management frame
928 switch (fc.subType)
929 {
930 case SIR_MAC_MGMT_ASSOC_REQ:
931 // Make sure the role supports Association
932 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700933 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700934 )
935 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_ASSOC, psessionEntry);
936
937 else
938 {
939 // Unwanted messages - Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700940 limLog(pMac, LOGE, FL("unexpected message received %X"),limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700941 limPrintMsgName(pMac, LOGE, limMsg->type);
942 }
943 break;
944
945 case SIR_MAC_MGMT_ASSOC_RSP:
946 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_ASSOC,psessionEntry);
947 break;
948
949 case SIR_MAC_MGMT_REASSOC_REQ:
950 // Make sure the role supports Reassociation
951 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700952 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700953 ){
954 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_REASSOC, psessionEntry);
955 }
956 else
957 {
958 // Unwanted messages - Log error
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -0700959 limLog(pMac, LOGE, FL("unexpected message received %X"),limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700960 limPrintMsgName(pMac, LOGE, limMsg->type);
961 }
962 break;
963
964 case SIR_MAC_MGMT_REASSOC_RSP:
965 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_REASSOC,psessionEntry);
966 break;
967
968 case SIR_MAC_MGMT_PROBE_REQ:
969 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo,psessionEntry);
970 break;
971
972 case SIR_MAC_MGMT_PROBE_RSP:
973 if(psessionEntry == NULL)
974 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
975 else
976 limProcessProbeRspFrame(pMac, pRxPacketInfo, psessionEntry);
977 break;
978
979 case SIR_MAC_MGMT_BEACON:
980 __limHandleBeacon(pMac, limMsg,psessionEntry);
981 break;
982
983 case SIR_MAC_MGMT_DISASSOC:
984 limProcessDisassocFrame(pMac, pRxPacketInfo,psessionEntry);
985 break;
986
987 case SIR_MAC_MGMT_AUTH:
988 limProcessAuthFrame(pMac, pRxPacketInfo,psessionEntry);
989 break;
990
991 case SIR_MAC_MGMT_DEAUTH:
992 limProcessDeauthFrame(pMac, pRxPacketInfo,psessionEntry);
993 break;
994
995 case SIR_MAC_MGMT_ACTION:
Jeff Johnson295189b2012-06-20 16:38:30 -0700996 if(psessionEntry == NULL)
997 limProcessActionFrameNoSession(pMac, pRxPacketInfo);
998 else
999 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001000 if (WDA_GET_RX_UNKNOWN_UCAST(pRxPacketInfo))
1001 limHandleUnknownA2IndexFrames(pMac, pRxPacketInfo,psessionEntry);
1002 else
1003 limProcessActionFrame(pMac, pRxPacketInfo,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -07001004 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001005 break;
1006 default:
1007 // Received Management frame of 'reserved' subtype
1008 break;
1009 } // switch (fc.subType)
1010
1011 }
1012 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001013 case SIR_MAC_DATA_FRAME:
1014 {
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001015#if defined(FEATURE_WLAN_ESE) && !defined(FEATURE_WLAN_ESE_UPLOAD)
Jeff Johnson295189b2012-06-20 16:38:30 -07001016 /* We accept data frame (IAPP frame) only if Session is
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001017 * present and ese connection is established on that
Jeff Johnson295189b2012-06-20 16:38:30 -07001018 * session
1019 */
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001020 if (psessionEntry && psessionEntry->isESEconnection) {
Jeff Johnson295189b2012-06-20 16:38:30 -07001021 limProcessIappFrame(pMac, pRxPacketInfo, psessionEntry);
1022 }
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001023#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001024 }
1025 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001026 default:
1027 // Received frame of type 'reserved'
1028 break;
1029
1030 } // switch (fc.type)
1031
Varun Reddy Yeturud0a3f252013-04-15 21:58:13 -07001032end:
Jeff Johnson295189b2012-06-20 16:38:30 -07001033 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr) ;
1034 return;
1035} /*** end limHandle80211Frames() ***/
1036
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301037/**
1038 * limSendStopScanOffloadReq()
1039 *
1040 *FUNCTION:
1041 * This function will be called to abort the ongoing offloaded scan
1042 * request.
1043 *
1044 *
1045 *NOTE:
1046 *
1047 * @param pMac Pointer to Global MAC structure
1048 * @return eHAL_STATUS_SUCCESS or eHAL_STATUS_FAILURE
1049 */
1050eHalStatus limSendStopScanOffloadReq(tpAniSirGlobal pMac, tANI_U8 SessionId)
1051{
1052 tSirMsgQ msg;
1053 tSirRetStatus rc = eSIR_SUCCESS;
1054 tAbortScanParams *pAbortScanParams;
1055
Kiet Lamb1233192013-11-28 13:38:20 +05301056 pAbortScanParams = vos_mem_malloc(sizeof(tAbortScanParams));
1057 if (NULL == pAbortScanParams)
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301058 {
1059 limLog(pMac, LOGP, FL("Memory allocation failed for AbortScanParams"));
1060 return eHAL_STATUS_FAILURE;
1061 }
1062
1063 pAbortScanParams->SessionId = SessionId;
1064 msg.type = WDA_STOP_SCAN_OFFLOAD_REQ;
1065 msg.bodyptr = pAbortScanParams;
1066 msg.bodyval = 0;
1067
1068 rc = wdaPostCtrlMsg(pMac, &msg);
1069 if (rc != eSIR_SUCCESS)
1070 {
Jeff Johnson0f4d0bc2013-11-03 17:48:50 -08001071 limLog(pMac, LOGE, FL("wdaPostCtrlMsg() return failure"));
Kiet Lamb1233192013-11-28 13:38:20 +05301072 vos_mem_free(pAbortScanParams);
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301073 return eHAL_STATUS_FAILURE;
1074 }
1075
Rashmi Ramanna6c13a342014-01-07 11:44:07 +05301076 limLog(pMac, LOG1, FL("Abort ongoing offload scan."));
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301077 return eHAL_STATUS_SUCCESS;
1078
1079}
Jeff Johnson295189b2012-06-20 16:38:30 -07001080
1081/**
1082 * limProcessAbortScanInd()
1083 *
1084 *FUNCTION:
1085 * This function is called from HDD to abort the scan which is presently being run
1086 *
1087 *
1088 *NOTE:
1089 *
1090 * @param pMac Pointer to Global MAC structure
1091 * @param *pMsgBuf A pointer to the SME message buffer
1092 * @return None
1093 */
1094void
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301095limProcessAbortScanInd(tpAniSirGlobal pMac, tANI_U8 SessionId)
Jeff Johnson295189b2012-06-20 16:38:30 -07001096{
1097#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
1098 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT, NULL, 0, 0);
1099#endif //FEATURE_WLAN_DIAG_SUPPORT
1100
1101 /* Deactivate the gLimBackgroundScanTimer as part of the abort scan.
1102 * SME should send WNI_CFG_BACKGROUND_SCAN_PERIOD indication
1103 * to start the background scan again
1104 */
Abhishek Singh525045c2014-12-15 17:18:45 +05301105 limLog(pMac, LOG1, FL("Processing AbortScan Ind"));
Jeff Johnson295189b2012-06-20 16:38:30 -07001106
1107 limAbortBackgroundScan(pMac);
1108
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301109 if (pMac->fScanOffload)
Jeff Johnson295189b2012-06-20 16:38:30 -07001110 {
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301111 /* send stop scan cmd to fw if scan offload is enabled. */
1112 limSendStopScanOffloadReq(pMac, SessionId);
1113 }
1114 else
1115 {
1116 /* Abort the scan if its running, else just return */
1117 if(limIsSystemInScanState(pMac))
Jeff Johnson295189b2012-06-20 16:38:30 -07001118 {
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301119 if( (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
1120 (eLIM_HAL_START_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
1121 (eLIM_HAL_END_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
1122 (eLIM_HAL_FINISH_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
1123 {
1124 //Simply signal we need to abort
1125 limLog( pMac, LOGW, FL(" waiting for HAL, simply signal abort gLimHalScanState = %d"), pMac->lim.gLimHalScanState );
1126 pMac->lim.abortScan = 1;
1127 }
1128 else
1129 {
1130 //Force abort
1131 limLog( pMac, LOGW, FL(" Force aborting scan") );
1132 pMac->lim.abortScan = 0;
1133 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
1134 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
1135 //Set the resume channel to Any valid channel (invalid).
1136 //This will instruct HAL to set it to any previous valid channel.
1137 peSetResumeChannel(pMac, 0, 0);
1138 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
1139 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001140 }
1141 }
1142 return;
1143}
1144
1145/**
1146 * limMessageProcessor
1147 *
1148 *FUNCTION:
1149 * Wrapper function for limProcessMessages when handling messages received by LIM.
1150 * Could either defer messages or process them.
1151 * @param pMac Pointer to Global MAC structure
1152 * @param limMsg Received LIM message
1153 * @return None
1154 */
1155
1156void limMessageProcessor(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1157{
1158 if (eLIM_MLM_OFFLINE_STATE == pMac->lim.gLimMlmState)
1159 {
1160 peFreeMsg(pMac, limMsg);
1161 return;
1162 }
1163
1164 if (!defMsgDecision(pMac, limMsg))
1165 {
1166 limProcessMessages(pMac, limMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -07001167 // process deferred message queue if allowed
1168 {
1169 if ( (! (pMac->lim.gLimAddtsSent))
1170 &&
1171 (! (limIsSystemInScanState(pMac)))
1172 )
1173 {
1174 if (true == GET_LIM_PROCESS_DEFD_MESGS(pMac))
1175 limProcessDeferredMessageQueue(pMac);
1176 }
1177 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001178 }
1179}
1180
Jeff Johnsone7245742012-09-05 17:12:55 -07001181#ifdef FEATURE_OEM_DATA_SUPPORT
1182
1183void limOemDataRspHandleResumeLinkRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* mlmOemDataRsp)
1184{
1185 if(status != eHAL_STATUS_SUCCESS)
1186 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001187 limLog(pMac, LOGE, FL("OEM Data Rsp failed to get the response for resume link"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001188 }
1189
1190 if(NULL != pMac->lim.gpLimMlmOemDataReq)
1191 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301192 vos_mem_free(pMac->lim.gpLimMlmOemDataReq);
Jeff Johnsone7245742012-09-05 17:12:55 -07001193 pMac->lim.gpLimMlmOemDataReq = NULL;
1194 }
1195
1196 //"Failure" status doesn't mean that Oem Data Rsp did not happen
1197 //and hence we need to respond to upper layers. Only Resume link is failed, but
1198 //we got the oem data response already.
1199 //Post the meessage to MLM
1200 limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)(mlmOemDataRsp));
1201
1202 return;
1203}
1204
1205void limProcessOemDataRsp(tpAniSirGlobal pMac, tANI_U32* body)
1206{
Jeff Johnsone7245742012-09-05 17:12:55 -07001207 tpLimMlmOemDataRsp mlmOemDataRsp = NULL;
1208 tpStartOemDataRsp oemDataRsp = NULL;
1209
1210 //Process all the messages for the lim queue
1211 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
1212
1213 oemDataRsp = (tpStartOemDataRsp)(body);
1214
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301215 mlmOemDataRsp = vos_mem_malloc(sizeof(tLimMlmOemDataRsp));
1216 if ( NULL == mlmOemDataRsp )
Jeff Johnsone7245742012-09-05 17:12:55 -07001217 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001218 limLog(pMac, LOGP, FL("could not allocate memory for mlmOemDataRsp"));
Jeff Johnsone7245742012-09-05 17:12:55 -07001219 return;
1220 }
1221
1222 //copy the memory into tLimMlmOemDataRsp and free the tStartOemDataRsp
1223 //the structures tStartOemDataRsp and tLimMlmOemDataRsp have the same structure
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301224 vos_mem_copy((void*)(mlmOemDataRsp), (void*)(oemDataRsp),
1225 sizeof(tLimMlmOemDataRsp));
Jeff Johnsone7245742012-09-05 17:12:55 -07001226
1227 //Now free the incoming memory
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301228 vos_mem_free(oemDataRsp);
Jeff Johnsone7245742012-09-05 17:12:55 -07001229
1230 limResumeLink(pMac, limOemDataRspHandleResumeLinkRsp, (tANI_U32*)mlmOemDataRsp);
1231
1232 return;
1233}
1234
1235#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001236
Katya Nigam3802f202013-12-16 19:27:14 +05301237static tANI_BOOLEAN limAgeOutProbeReq( tpAniSirGlobal pMac, tpSirMsgQ limMsg,
1238 vos_pkt_t *pVosPkt )
1239{
1240 tANI_U8 *pRxPacketInfo = NULL;
1241 tSirMacFrameCtl fc;
1242 tpSirMacMgmtHdr pHdr=NULL;
1243 tANI_BOOLEAN match = VOS_FALSE;
1244
1245 limGetBDfromRxPacket(pMac, limMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
1246 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
1247 fc = pHdr->fc;
1248 if ( fc.subType == SIR_MAC_MGMT_PROBE_REQ )
1249 {
1250 if( vos_timer_get_system_ticks() - pVosPkt->timestamp >= MAX_PROBEREQ_TIME )
1251 {
1252 // drop packet
1253 limLog(pMac, LOGE,
1254 FL("Dropping Aged Out probe requests. Peer MAC is "MAC_ADDRESS_STR),
1255 MAC_ADDR_ARRAY(pHdr->sa));
1256
1257 vos_pkt_return_packet(pVosPkt);
1258 match = VOS_TRUE;
1259 }
1260 }
1261 return match;
1262}
1263
Jeff Johnson295189b2012-06-20 16:38:30 -07001264/**
1265 * limProcessMessages
1266 *
1267 *FUNCTION:
1268 * This function is called by limProcessMessageQueue function. This
1269 * function processes messages received by LIM.
1270 *
1271 *LOGIC:
1272 * Depending on the message type, corresponding function will be
1273 * called, for example limProcessSmeMessages() will be called to
1274 * process SME messages received from HDD/Upper layer software module.
1275 *
1276 *ASSUMPTIONS:
1277 * NA
1278 *
1279 *NOTE:
1280 * NA
1281 *
1282 * @param pMac Pointer to Global MAC structure
1283 * @param limMsg Received LIM message
1284 * @return None
1285 */
1286
1287void
1288limProcessMessages(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1289{
1290 tANI_U8 deferMsg = false;
1291 tLinkStateParams *linkStateParams;
1292#if defined WLAN_FEATURE_VOWIFI_11R
1293 tpPESession pSession;
1294#endif
1295#if defined(ANI_DVT_DEBUG)
1296 tSirMsgQ msgQ;
1297#endif
1298 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1299 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301300 vos_mem_free(limMsg->bodyptr);
Jeff Johnsone7245742012-09-05 17:12:55 -07001301 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001302 return;
1303 }
1304#ifdef WLAN_DEBUG
1305 pMac->lim.numTot++;
1306#endif
1307
1308
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001309 PELOG3(limLog(pMac, LOG3, FL("rcvd msgType = %s, sme state = %s, mlm state = %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001310 limMsgStr(limMsg->type), limSmeStateStr(pMac->lim.gLimSmeState),
1311 limMlmStateStr(pMac->lim.gLimMlmState));)
1312
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301313 /*
1314 * MTRACE logs not captured for events received from SME
1315 * SME enums (eWNI_SME_START_REQ) starts with 0x16xx.
1316 * Compare received SME events with SIR_SME_MODULE_ID
Konamki, Sreelakshmi2bfb8b02015-07-29 11:41:24 +05301317 */
Jeff Johnson295189b2012-06-20 16:38:30 -07001318
Konamki, Sreelakshmi824f93e2015-07-31 12:55:48 +05301319 if (SIR_SME_MODULE_ID == (tANI_U8)MAC_TRACE_GET_MODULE_ID(limMsg->type))
1320 {
1321 MTRACE(macTrace(pMac, TRACE_CODE_RX_SME_MSG, NO_SESSION, limMsg->type));
1322 }
1323 else
1324 {
1325 /* Omitting below message types as these are too frequent and when crash
1326 * happens we loose critical trace logs if these are also logged
1327 */
1328 if (limMsg->type != SIR_LIM_MAX_CHANNEL_TIMEOUT &&
1329 limMsg->type != SIR_LIM_MIN_CHANNEL_TIMEOUT &&
1330 limMsg->type != SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT &&
1331 limMsg->type != SIR_CFG_PARAM_UPDATE_IND &&
1332 limMsg->type != SIR_BB_XPORT_MGMT_MSG)
1333 MTRACE(macTraceMsgRx(pMac, NO_SESSION,
1334 LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
1335 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001336 switch (limMsg->type)
1337 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001338
1339 case SIR_LIM_UPDATE_BEACON:
1340 limUpdateBeacon(pMac);
1341 break;
1342
Jeff Johnson295189b2012-06-20 16:38:30 -07001343 case SIR_CFG_PARAM_UPDATE_IND:
1344 /// CFG parameter updated
1345 if (limIsSystemInScanState(pMac))
1346 {
1347 // System is in DFS (Learn) mode
1348 // Defer processsing this message
1349 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1350 {
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001351 if(!(pMac->lim.deferredMsgCnt & 0xF))
1352 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001353 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 -07001354 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1355 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
Leela Venkata Kiran Kumar Reddy Chirala2247e962013-03-22 19:21:10 -07001356 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001357 limLogSessionStates(pMac);
1358 limPrintMsgName(pMac, LOGE, limMsg->type);
1359 }
1360 }
1361 else
1362 {
1363 limHandleCFGparamUpdate(pMac, limMsg->bodyval);
1364 }
1365
1366 break;
1367
1368 case WDA_INIT_SCAN_RSP:
1369 limProcessInitScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001370 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001371 break;
1372
1373 case WDA_START_SCAN_RSP:
1374 limProcessStartScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001375 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001376 break;
1377
1378 case WDA_END_SCAN_RSP:
1379 limProcessEndScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001380 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001381 break;
1382
1383 case WDA_FINISH_SCAN_RSP:
1384 limProcessFinishScanRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001385 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001386 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001387#ifdef FEATURE_OEM_DATA_SUPPORT
1388 case WDA_START_OEM_DATA_RSP:
1389 limProcessOemDataRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001390 limMsg->bodyptr = NULL;
Jeff Johnsone7245742012-09-05 17:12:55 -07001391 break;
1392#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001393
1394 case WDA_SWITCH_CHANNEL_RSP:
1395 limProcessSwitchChannelRsp(pMac, limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08001396 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001397 break;
1398
1399#ifdef ANI_SIR_IBSS_PEER_CACHING
1400 case WDA_IBSS_STA_ADD:
1401 limIbssStaAdd(pMac, limMsg->bodyptr);
1402 break;
1403#endif
1404 case SIR_BB_XPORT_MGMT_MSG:
1405 // These messages are from Peer MAC entity.
1406#ifdef WLAN_DEBUG
1407 pMac->lim.numBbt++;
1408#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001409 {
1410 v_U16_t pktLen = 0;
1411 vos_pkt_t *pVosPkt;
1412 VOS_STATUS vosStatus;
1413 tSirMsgQ limMsgNew;
Jeff Johnson295189b2012-06-20 16:38:30 -07001414 /* The original limMsg which we were deferring have the
1415 * bodyPointer point to 'BD' instead of 'Vos pkt'. If we don't make a copy
1416 * of limMsg, then vos_pkt_peek_data will overwrite the limMsg->bodyPointer.
1417 * and next time when we try to process the msg, we will try to use 'BD' as
1418 * 'Vos Pkt' which will cause a crash
1419 */
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301420 vos_mem_copy((tANI_U8*)&limMsgNew, (tANI_U8*)limMsg,
1421 sizeof(tSirMsgQ));
Jeff Johnson295189b2012-06-20 16:38:30 -07001422 pVosPkt = (vos_pkt_t *)limMsgNew.bodyptr;
1423 vos_pkt_get_packet_length(pVosPkt, &pktLen);
1424
1425 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&limMsgNew.bodyptr, VOS_FALSE );
1426
1427 if( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1428 {
Katya Nigamfdf5a522015-02-03 14:38:55 +05301429 limDecrementPendingMgmtCount(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001430 vos_pkt_return_packet(pVosPkt);
1431 break;
1432
1433 }
Katya Nigam3802f202013-12-16 19:27:14 +05301434
Padma, Santhosh Kumar30971cf2015-04-06 19:59:37 +05301435#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
1436 if (WDA_GET_ROAMCANDIDATEIND(limMsgNew.bodyptr))
1437 limLog(pMac, LOG1, FL("roamCandidateInd %d"),
1438 WDA_GET_ROAMCANDIDATEIND(limMsgNew.bodyptr));
1439
1440 if (WDA_GET_OFFLOADSCANLEARN(limMsgNew.bodyptr))
1441 limLog(pMac, LOG1, FL("offloadScanLearn %d"),
1442 WDA_GET_OFFLOADSCANLEARN(limMsgNew.bodyptr));
1443#endif
1444
Katya Nigam3802f202013-12-16 19:27:14 +05301445 /*
1446 * putting a check for age out probe request frames
1447 * such that any probe req more than 0.5 sec old can directly
1448 * be dropped. With this, there won't be blocking of MC thread.
1449 */
1450
1451 if( limAgeOutProbeReq ( pMac, &limMsgNew, pVosPkt ))
1452 {
Katya Nigamfdf5a522015-02-03 14:38:55 +05301453 limDecrementPendingMgmtCount(pMac);
Katya Nigam3802f202013-12-16 19:27:14 +05301454 break;
1455 }
1456
Katya Nigam3802f202013-12-16 19:27:14 +05301457
Jeff Johnson295189b2012-06-20 16:38:30 -07001458 limHandle80211Frames(pMac, &limMsgNew, &deferMsg);
1459
1460 if ( deferMsg == true )
1461 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05301462 limLog(pMac, LOG2, FL("Defer message type=%X "),
1463 limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001464 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1465 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001466 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 -07001467 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1468 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1469 limLogSessionStates(pMac);
1470 limPrintMsgName(pMac, LOGE, limMsg->type);
Katya Nigamfdf5a522015-02-03 14:38:55 +05301471 limDecrementPendingMgmtCount(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001472 vos_pkt_return_packet(pVosPkt);
1473 }
1474 }
1475 else
1476 {
1477 /* PE is not deferring this 802.11 frame so we need to call vos_pkt_return.
1478 * Asumption here is when Rx mgmt frame processing is done,
1479 * voss packet could be freed here.
1480 */
Katya Nigamfdf5a522015-02-03 14:38:55 +05301481 limDecrementPendingMgmtCount(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001482 vos_pkt_return_packet(pVosPkt);
1483 }
1484 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001485 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001486 case eWNI_SME_SCAN_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001487 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001488 case eWNI_SME_DISASSOC_REQ:
1489 case eWNI_SME_DEAUTH_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001490 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
Jeff Johnsone7245742012-09-05 17:12:55 -07001491#ifdef FEATURE_OEM_DATA_SUPPORT
1492 case eWNI_SME_OEM_DATA_REQ:
1493#endif
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001494#ifdef FEATURE_WLAN_TDLS
1495 case eWNI_SME_TDLS_SEND_MGMT_REQ:
1496 case eWNI_SME_TDLS_ADD_STA_REQ:
1497 case eWNI_SME_TDLS_DEL_STA_REQ:
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301498 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
Atul Mittalc0f739f2014-07-31 13:47:47 +05301499// tdlsoffchan
1500 case eWNI_SME_TDLS_CHANNEL_SWITCH_REQ:
Mohit Khanna698ba2a2012-12-04 15:08:18 -08001501#endif
Gopichand Nakkalacca24d12013-03-07 17:05:07 +05301502 case eWNI_SME_RESET_AP_CAPS_CHANGED:
Jeff Johnson295189b2012-06-20 16:38:30 -07001503 // These messages are from HDD
1504 limProcessNormalHddMsg(pMac, limMsg, true); //need to response to hdd
1505 break;
1506
1507 case eWNI_SME_SCAN_ABORT_IND:
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301508 {
1509 tANI_U8 *pSessionId = (tANI_U8 *)limMsg->bodyptr;
1510 limProcessAbortScanInd(pMac, *pSessionId);
Jeff Johnson295189b2012-06-20 16:38:30 -07001511 vos_mem_free((v_VOID_t *)limMsg->bodyptr);
1512 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 break;
Madan Mohan Koyyalamudiff3a7152013-06-13 14:47:55 +05301514 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001515 case eWNI_SME_START_REQ:
1516 case eWNI_SME_SYS_READY_IND:
1517#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1518 case eWNI_SME_JOIN_REQ:
1519#endif
1520 case eWNI_SME_AUTH_REQ:
1521 case eWNI_SME_REASSOC_REQ:
1522 case eWNI_SME_START_BSS_REQ:
1523 case eWNI_SME_STOP_BSS_REQ:
1524 case eWNI_SME_SWITCH_CHL_REQ:
1525 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
1526 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
1527 case eWNI_SME_SETCONTEXT_REQ:
1528 case eWNI_SME_REMOVEKEY_REQ:
1529#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1530 case eWNI_SME_PROMISCUOUS_MODE_REQ:
1531#endif
1532 case eWNI_SME_DISASSOC_CNF:
1533 case eWNI_SME_DEAUTH_CNF:
1534 case eWNI_SME_ASSOC_CNF:
1535 case eWNI_SME_REASSOC_CNF:
1536 case eWNI_SME_ADDTS_REQ:
1537 case eWNI_SME_DELTS_REQ:
1538 case eWNI_SME_DEL_BA_PEER_IND:
1539 case eWNI_SME_SET_TX_POWER_REQ:
1540 case eWNI_SME_GET_TX_POWER_REQ:
1541 case eWNI_SME_GET_NOISE_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001542 case eWNI_SME_GET_ASSOC_STAS_REQ:
1543 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
1544 case eWNI_SME_UPDATE_APWPSIE_REQ:
1545 case eWNI_SME_HIDE_SSID_REQ:
1546 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
1547 case eWNI_SME_SET_APWPARSNIEs_REQ:
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08001548 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
Jeff Johnson295189b2012-06-20 16:38:30 -07001549#if defined WLAN_FEATURE_VOWIFI
1550 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1551 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
1552#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001553#if defined FEATURE_WLAN_ESE
1554 case eWNI_SME_ESE_ADJACENT_AP_REPORT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001555#endif
1556#ifdef WLAN_FEATURE_VOWIFI_11R
1557 case eWNI_SME_FT_UPDATE_KEY:
1558 case eWNI_SME_FT_PRE_AUTH_REQ:
1559 case eWNI_SME_FT_AGGR_QOS_REQ:
1560#endif
1561 case eWNI_SME_ADD_STA_SELF_REQ:
1562 case eWNI_SME_DEL_STA_SELF_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001563 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
1564 case eWNI_SME_UPDATE_NOA:
Gopichand Nakkalac178ac82013-05-30 19:53:39 +05301565 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
Madan Mohan Koyyalamudi44bbc152013-07-05 21:13:10 +05301566 case eWNI_SME_STA_STAT_REQ:
1567 case eWNI_SME_AGGR_STAT_REQ:
1568 case eWNI_SME_GLOBAL_STAT_REQ:
1569 case eWNI_SME_STAT_SUMM_REQ:
1570 case eWNI_SME_GET_STATISTICS_REQ:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001571#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Madan Mohan Koyyalamudi44bbc152013-07-05 21:13:10 +05301572 case eWNI_SME_GET_ROAM_RSSI_REQ:
1573#endif
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001574#if defined(FEATURE_WLAN_ESE) && defined(FEATURE_WLAN_ESE_UPLOAD)
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001575 case eWNI_SME_GET_TSM_STATS_REQ:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001576#endif /* FEATURE_WLAN_ESE && FEATURE_WLAN_ESE_UPLOAD */
Siddharth Bhal6af5d4e2014-09-29 21:11:16 +05301577 case eWNI_SME_MAC_SPOOF_ADDR_IND:
Abhishek Singh16e05762015-11-30 14:29:27 +05301578 case eWNI_SME_REGISTER_MGMT_FRAME_CB:
Jeff Johnson295189b2012-06-20 16:38:30 -07001579 // These messages are from HDD
1580 limProcessNormalHddMsg(pMac, limMsg, false); //no need to response to hdd
1581 break;
1582
1583 //Power Save Messages From HDD
1584 case eWNI_PMC_PWR_SAVE_CFG:
1585 case eWNI_PMC_ENTER_BMPS_REQ:
1586 case eWNI_PMC_EXIT_BMPS_REQ:
1587 case eWNI_PMC_ENTER_IMPS_REQ:
1588 case eWNI_PMC_EXIT_IMPS_REQ:
1589 case eWNI_PMC_ENTER_UAPSD_REQ:
1590 case eWNI_PMC_EXIT_UAPSD_REQ:
1591 case eWNI_PMC_ENTER_WOWL_REQ:
1592 case eWNI_PMC_EXIT_WOWL_REQ:
1593 case eWNI_PMC_WOWL_ADD_BCAST_PTRN:
1594 case eWNI_PMC_WOWL_DEL_BCAST_PTRN:
1595 pmmProcessMessage(pMac, limMsg);
1596 break;
1597
1598 case eWNI_PMC_SMPS_STATE_IND :
1599 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001600 if(limMsg->bodyptr){
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301601 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001602 limMsg->bodyptr = NULL;
1603 }
1604 }
1605 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001606 case eWNI_SME_SEND_ACTION_FRAME_IND:
1607 limSendP2PActionFrame(pMac, limMsg);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301608 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001609 limMsg->bodyptr = NULL;
1610 break;
1611 case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
1612 limAbortRemainOnChan(pMac);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301613 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001614 limMsg->bodyptr = NULL;
1615 break;
1616
Abhishek Singh7cd040e2016-01-07 10:51:04 +05301617#ifdef WLAN_FEATURE_RMC
1618 case eWNI_SME_ENABLE_RMC_REQ:
1619 case eWNI_SME_DISABLE_RMC_REQ:
1620 /*
1621 * These messages are from HDD
1622 * No need to response to hdd
1623 */
1624 limProcessSmeReqMessages(pMac,limMsg);
1625 break;
1626#endif /* WLAN_FEATURE_RMC */
1627
Viral Modid86bde22012-12-10 13:09:21 -08001628 case SIR_HAL_P2P_NOA_START_IND:
1629 {
1630 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1631 tANI_U8 i;
Viral Modid440e682013-03-06 02:25:31 -08001632 tANI_U8 p2pGOExists = 0;
Gopichand Nakkala78a6c812013-05-13 16:39:49 +05301633
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001634 limLog(pMac, LOG1, "LIM received NOA start %x", limMsg->type);
Viral Modid440e682013-03-06 02:25:31 -08001635
1636 /* Since insert NOA is done and NOA start msg received, we should deactivate the Insert NOA timer */
1637 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
1638
Viral Modid86bde22012-12-10 13:09:21 -08001639 for(i=0; i < pMac->lim.maxBssId; i++)
1640 {
1641 psessionEntry = &pMac->lim.gpSession[i];
1642 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
1643 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1644 { //Save P2P NOA start attributes for P2P Go persona
Viral Modid440e682013-03-06 02:25:31 -08001645 p2pGOExists = 1;
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301646 vos_mem_copy(&psessionEntry->p2pGoPsNoaStartInd, limMsg->bodyptr,
1647 sizeof(tSirP2PNoaStart));
Viral Modid440e682013-03-06 02:25:31 -08001648 if (psessionEntry->p2pGoPsNoaStartInd.status != eHAL_STATUS_SUCCESS)
Viral Modid86bde22012-12-10 13:09:21 -08001649 {
Viral Modid440e682013-03-06 02:25:31 -08001650 limLog(pMac, LOGW, FL("GO NOA start failure status %d reported by FW."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001651 " - still go ahead with deferred sme req. This is just info"),
Viral Modid440e682013-03-06 02:25:31 -08001652 psessionEntry->p2pGoPsNoaStartInd.status);
Viral Modid86bde22012-12-10 13:09:21 -08001653 }
Viral Modid86bde22012-12-10 13:09:21 -08001654 break;
1655 }
1656 }
Viral Modid440e682013-03-06 02:25:31 -08001657
1658 if (p2pGOExists == 0)
1659 {
1660 limLog(pMac, LOGW, FL("By the time, we received NOA start, GO is already removed."
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001661 " - still go ahead with deferred sme req. This is just info"));
Viral Modid440e682013-03-06 02:25:31 -08001662 }
1663
1664 /* We received the NOA start indication. Now we can send down the SME request which requires off-channel operation */
1665 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301666 vos_mem_free(limMsg->bodyptr);
Viral Modid86bde22012-12-10 13:09:21 -08001667 limMsg->bodyptr = NULL;
Viral Modid440e682013-03-06 02:25:31 -08001668 }
Viral Modid86bde22012-12-10 13:09:21 -08001669 break;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301670#ifdef FEATURE_WLAN_TDLS
1671 case SIR_HAL_TDLS_IND:
1672 {
1673 tSirTdlsInd *pTdlsInd = (tpSirTdlsInd)limMsg->bodyptr ;
1674 tpDphHashNode pStaDs = NULL ;
1675 tpPESession psessionEntry = NULL;
1676 tANI_U8 sessionId;
1677 if((psessionEntry = peFindSessionByStaId(pMac,pTdlsInd->staIdx,&sessionId))== NULL)
1678 {
1679 limLog(pMac, LOG1, FL("session does not exist for given bssId\n"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301680 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301681 limMsg->bodyptr = NULL;
1682 return;
1683 }
1684 if ((pStaDs = dphGetHashEntry(pMac, pTdlsInd->assocId, &psessionEntry->dph.dphHashTable)) == NULL)
1685 {
1686 limLog(pMac, LOG1, FL("pStaDs Does not exist for given staId\n"));
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301687 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301688 limMsg->bodyptr = NULL;
1689 return;
1690 }
Viral Modid86bde22012-12-10 13:09:21 -08001691
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301692 if ((STA_ENTRY_TDLS_PEER == pStaDs->staType))
1693 {
1694 limLog(pMac, LOGE,
1695 FL("received TDLS Indication from the Firmware with Reason Code %d "),
1696 pTdlsInd->reasonCode);
1697 limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry,
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05301698 pTdlsInd->reasonCode);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301699 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301700 vos_mem_free(limMsg->bodyptr);
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05301701 limMsg->bodyptr = NULL;
1702 }
1703 break;
1704#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001705 case SIR_HAL_P2P_NOA_ATTR_IND:
1706 {
1707 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1708 tANI_U8 i;
1709
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001710 limLog(pMac, LOGW, FL("Received message Noa_ATTR %x"), limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001711 for(i=0; i < pMac->lim.maxBssId; i++)
1712 {
Viral Modid86bde22012-12-10 13:09:21 -08001713 psessionEntry = &pMac->lim.gpSession[i];
1714 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001715 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1716 { //Save P2P attributes for P2P Go persona
1717
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301718 vos_mem_copy(&psessionEntry->p2pGoPsUpdate, limMsg->bodyptr,
1719 sizeof(tSirP2PNoaAttr));
1720
Arif Hussain24bafea2013-11-15 15:10:03 -08001721 limLog(pMac, LOG2, FL(" &psessionEntry->bssId "
1722 MAC_ADDRESS_STR " ctWin=%d oppPsFlag=%d"),
1723 MAC_ADDR_ARRAY(psessionEntry->bssId),
Jeff Johnson295189b2012-06-20 16:38:30 -07001724 psessionEntry->p2pGoPsUpdate.ctWin,
1725 psessionEntry->p2pGoPsUpdate.oppPsFlag);
1726
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001727 limLog(pMac, LOG2, FL(" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001728 psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt,
1729 psessionEntry->p2pGoPsUpdate.uNoa1Duration,
1730 psessionEntry->p2pGoPsUpdate.uNoa1Interval,
1731 psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
1732
1733
1734 break;
1735 }
1736 }
1737
1738 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301739 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001740 limMsg->bodyptr = NULL;
1741
1742 break;
1743
1744
Jeff Johnson295189b2012-06-20 16:38:30 -07001745 /* eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER Message comes after the
1746 * device comes out of full power for the full power request sent
1747 * because of channel switch with switch count as 0, so call the same
1748 * function used in timeout case(i.e SIR_LIM_CHANNEL_SWITCH_TIMEOUT)
1749 * for switching the channel*/
1750 case eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER:
Jeff Johnsone7245742012-09-05 17:12:55 -07001751 if ( !tx_timer_running(&pMac->lim.limTimers.gLimChannelSwitchTimer) )
1752 {
1753 limProcessChannelSwitchTimeout(pMac);
1754 }
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301755 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001756 limMsg->bodyptr = NULL;
1757 break;
1758
1759 //Power Save Related Messages From HAL
1760 case WDA_ENTER_BMPS_RSP:
1761 case WDA_EXIT_BMPS_RSP:
1762 case WDA_EXIT_BMPS_IND:
1763 case WDA_ENTER_IMPS_RSP:
1764 case WDA_EXIT_IMPS_RSP:
1765 case WDA_ENTER_UAPSD_RSP:
1766 case WDA_EXIT_UAPSD_RSP:
1767 case WDA_WOWL_ENTER_RSP:
1768 case WDA_WOWL_EXIT_RSP:
1769 pmmProcessMessage(pMac, limMsg);
1770 break;
1771
1772 case WDA_LOW_RSSI_IND:
1773 //limHandleLowRssiInd(pMac);
1774 break;
1775
1776 case WDA_BMPS_STATUS_IND:
1777 limHandleBmpsStatusInd(pMac);
1778 break;
1779
1780 case WDA_MISSED_BEACON_IND:
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001781 limHandleMissedBeaconInd(pMac, limMsg);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301782 vos_mem_free(limMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001783 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001784 break;
1785 case WDA_MIC_FAILURE_IND:
1786 limMicFailureInd(pMac, limMsg);
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05301787 vos_mem_free(limMsg->bodyptr);
Jeff Johnson295189b2012-06-20 16:38:30 -07001788 limMsg->bodyptr = NULL;
1789 break;
1790
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +05301791 case WDA_LOST_LINK_PARAMS_IND:
1792 limProcessLostLinkParamsInd(pMac,limMsg);
1793 vos_mem_free(limMsg->bodyptr);
1794 limMsg->bodyptr = NULL;
1795 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001796
1797 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1798 limProcessSmeReqMessages(pMac,limMsg);
1799 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001800#ifdef FEATURE_WLAN_ESE
1801 case SIR_LIM_ESE_TSM_TIMEOUT:
1802#ifndef FEATURE_WLAN_ESE_UPLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -07001803 limProcessTsmTimeoutHandler(pMac,limMsg);
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001804#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001805 break;
1806 case WDA_TSM_STATS_RSP:
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001807#ifdef FEATURE_WLAN_ESE_UPLOAD
1808 limSendSmePEEseTsmRsp(pMac, (tAniGetTsmStatsRsp *)limMsg->bodyptr);
Srinivas Girigowda5cecb202013-10-08 09:13:25 -07001809#else
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08001810 limProcessHalEseTsmRsp(pMac, limMsg);
1811#endif /* FEATURE_WLAN_ESE_UPLOAD */
Jeff Johnson295189b2012-06-20 16:38:30 -07001812 break;
1813#endif
1814 case WDA_ADD_TS_RSP:
1815 limProcessHalAddTsRsp(pMac, limMsg);
1816 break;
1817
1818 case SIR_LIM_DEL_TS_IND:
1819 limProcessDelTsInd(pMac, limMsg);
Madan Mohan Koyyalamudif244d8f2012-11-29 11:21:05 -08001820 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001821 case SIR_LIM_ADD_BA_IND:
1822 limProcessAddBaInd(pMac, limMsg);
1823 break;
1824 case SIR_LIM_DEL_BA_ALL_IND:
Kiran Kumar Lokere458d7322013-05-29 14:29:43 -07001825 limDelAllBASessions(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001826 break;
1827 case SIR_LIM_DEL_BA_IND:
1828 limProcessMlmHalBADeleteInd( pMac, limMsg );
1829 break;
1830
1831 case SIR_LIM_BEACON_GEN_IND: {
Jeff Johnson295189b2012-06-20 16:38:30 -07001832
Jeff Johnson295189b2012-06-20 16:38:30 -07001833 if( pMac->lim.gLimSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07001834 schProcessPreBeaconInd(pMac, limMsg);
1835
1836 }
1837 break;
1838
1839 case SIR_LIM_DELETE_STA_CONTEXT_IND:
1840 limDeleteStaContext(pMac, limMsg);
1841 break;
1842
1843 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1844 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1845 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1846 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001847 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001848 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1849 case SIR_LIM_AUTH_RSP_TIMEOUT:
1850 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1851 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1852#ifdef WLAN_FEATURE_VOWIFI_11R
1853 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
1854#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001855 case SIR_LIM_REMAIN_CHN_TIMEOUT:
Viral Modid86bde22012-12-10 13:09:21 -08001856 case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT:
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001857 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
1858 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
Gopichand Nakkalad492d202013-05-10 02:50:47 +05301859 case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
Sushant Kaushik9e923872015-04-02 17:09:31 +05301860 case SIR_LIM_AUTH_RETRY_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001861 // These timeout messages are handled by MLM sub module
1862
1863 limProcessMlmReqMessages(pMac,
1864 limMsg);
1865
1866 break;
1867
1868 case SIR_LIM_HEART_BEAT_TIMEOUT:
1869 /** check if heart beat failed, even if one Beacon
1870 * is rcvd within the Heart Beat interval continue
1871 * normal processing
1872 */
1873
1874 #if 0
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001875 PELOG1(limLog(pMac, LOG1, FL("Heartbeat timeout, SME %d, MLME %d, #bcn %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001876 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1877 pMac->lim.gLimRxedBeaconCntDuringHB);)
1878
1879 if(pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)
1880 limIbssHeartBeatHandle(pMac); //HeartBeat for peers.
1881 else
1882 /**
1883 * Heartbeat failure occurred on STA
1884 * This is handled by LMM sub module.
1885 */
1886 limHandleHeartBeatFailure(pMac);
1887
1888 break;
1889 #endif //TO SUPPORT BT-AMP
Yathish9f22e662012-12-10 14:21:35 -08001890 if (limIsSystemInScanState(pMac))
1891 {
1892 // System is in DFS (Learn) mode
1893 // Defer processsing this message
1894 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1895 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07001896 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 -08001897 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1898 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1899 limLogSessionStates(pMac);
1900 }
1901 }
1902 else
1903 {
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001904 if (NULL == limMsg->bodyptr)
1905 {
1906 limHandleHeartBeatTimeout(pMac);
1907 }
1908 else
1909 {
1910 limHandleHeartBeatTimeoutForSession(pMac, (tpPESession)limMsg->bodyptr);
1911 }
Gopichand Nakkala78a6c812013-05-13 16:39:49 +05301912 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001913 break;
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -08001914
Jeff Johnson295189b2012-06-20 16:38:30 -07001915 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1916 limHandleHeartBeatFailureTimeout(pMac);
1917 break;
1918
1919 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001920 /**
1921 * Background scan timeout occurred on STA.
1922 * This is handled by LMM sub module.
1923 */
1924 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
1925
1926 //We will do background scan even in bcnps mode
1927 //if (pMac->sys.gSysEnableScanMode)
1928 pMac->lim.gLimReportBackgroundScanResults = FALSE;
1929 limTriggerBackgroundScan(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001930 break;
1931
Jeff Johnson295189b2012-06-20 16:38:30 -07001932 case SIR_LIM_CNF_WAIT_TIMEOUT:
1933
1934 /*
1935 ** Does not receive CNF or dummy packet
1936 **/
1937 limHandleCnfWaitTimeout(pMac, (tANI_U16) limMsg->bodyval);
1938
1939 break;
1940
1941 case SIR_LIM_KEEPALIVE_TIMEOUT:
1942 limSendKeepAliveToPeer(pMac);
1943
1944 break;
1945
1946 case SIR_LIM_RETRY_INTERRUPT_MSG:
1947 // Message from ISR upon TFP's max retry limit interrupt
1948
1949 break;
1950
1951 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
1952 // Message from ISR upon SP's Invalid session key interrupt
1953
1954 break;
1955
1956 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
1957 // Message from ISR upon SP's Invalid key ID interrupt
1958
1959 break;
1960
1961 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
1962 // Message from ISR upon SP's Replay threshold interrupt
1963
1964 break;
1965
1966 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
1967 limProcessChannelSwitchTimeout(pMac);
1968 break;
1969
1970 case SIR_LIM_QUIET_TIMEOUT:
1971 limProcessQuietTimeout(pMac);
1972 break;
1973
1974 case SIR_LIM_QUIET_BSS_TIMEOUT:
1975 limProcessQuietBssTimeout(pMac);
1976 break;
1977
Jeff Johnson295189b2012-06-20 16:38:30 -07001978 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
1979 limHandleUpdateOlbcCache(pMac);
1980 break;
1981#if 0
1982 case SIR_LIM_WPS_OVERLAP_TIMEOUT:
1983 limProcessWPSOverlapTimeout(pMac);
1984 break;
1985#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001986 case WDA_ADD_BSS_RSP:
1987 limProcessMlmAddBssRsp( pMac, limMsg );
1988 break;
1989
1990 case WDA_ADD_STA_RSP:
1991
1992 //call a wrapper by paasing bodyptr, their get sessionID and and call proper function from there.
1993 limProcessAddStaRsp(pMac,limMsg);
1994 break;
1995
1996 case WDA_DELETE_STA_RSP:
1997 limProcessMlmDelStaRsp(pMac, limMsg);
1998 break;
1999
2000 case WDA_ADD_STA_SELF_RSP:
2001 limProcessAddStaSelfRsp(pMac, limMsg);
2002 break;
2003 case WDA_DEL_STA_SELF_RSP:
2004 limProcessDelStaSelfRsp(pMac, limMsg);
2005 break;
2006
2007 case WDA_DELETE_BSS_RSP:
2008 limHandleDeleteBssRsp(pMac,limMsg); //wrapper routine to handle delete bss response
2009 break;
2010
2011 case WDA_SET_BSSKEY_RSP:
2012 case WDA_SET_STA_BCASTKEY_RSP:
2013 limProcessMlmSetBssKeyRsp( pMac, limMsg );
2014 break;
2015 case WDA_SET_STAKEY_RSP:
2016 limProcessMlmSetStaKeyRsp( pMac, limMsg );
2017 break;
2018 case WDA_REMOVE_BSSKEY_RSP:
2019 case WDA_REMOVE_STAKEY_RSP:
2020 limProcessMlmRemoveKeyRsp( pMac, limMsg );
2021 break;
2022 case WDA_ADDBA_RSP:
2023 limProcessMlmHalAddBARsp( pMac, limMsg );
2024 break;
2025
2026 case WDA_STA_STAT_RSP:
2027 case WDA_AGGR_STAT_RSP:
2028 case WDA_GLOBAL_STAT_RSP:
2029 case WDA_STAT_SUMM_RSP:
2030 limSendSmeStatsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
2031 break;
2032
2033 case WDA_GET_STATISTICS_RSP:
2034 limSendSmePEStatisticsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
2035 break;
Varun Reddy Yeturu5d5e2c62014-02-27 13:31:29 -08002036#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_ESE || defined(FEATURE_WLAN_LFR)
Srinivas Girigowdad34cedb2013-01-25 13:33:11 -08002037 case WDA_GET_ROAM_RSSI_RSP:
2038 limSendSmePEGetRoamRssiRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
2039 break;
2040#endif
2041
Jeff Johnson295189b2012-06-20 16:38:30 -07002042
2043 case WDA_SET_MIMOPS_RSP: //limProcessSetMimoRsp(pMac, limMsg);
2044 case WDA_SET_TX_POWER_RSP: //limProcessSetTxPowerRsp(pMac, limMsg);
2045 case WDA_GET_TX_POWER_RSP: //limProcessGetTxPowerRsp(pMac, limMsg);
2046 case WDA_GET_NOISE_RSP:
2047 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2048 limMsg->bodyptr = NULL;
2049 //limProcessGetNoiseRsp(pMac, limMsg);
2050 break;
2051
2052 case WDA_SET_MAX_TX_POWER_RSP:
2053#if defined WLAN_FEATURE_VOWIFI
2054 rrmSetMaxTxPowerRsp( pMac, limMsg );
2055#endif
2056 if(limMsg->bodyptr != NULL)
2057 {
2058 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2059 limMsg->bodyptr = NULL;
2060 }
2061 break;
2062
Jeff Johnson295189b2012-06-20 16:38:30 -07002063 case SIR_LIM_ADDR2_MISS_IND:
2064 {
2065 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002066 FL("Addr2 mismatch interrupt received %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002067 limMsg->type);
2068 /*a message from HAL indicating addr2 mismatch interrupt occurred
2069 limMsg->bodyptr contains only pointer to 48-bit addr2 field*/
2070 //Dinesh fix this. the third parameter should be sessionentry.
2071 //limHandleUnknownA2IndexFrames(pMac, (void *)limMsg->bodyptr);
2072
2073 /*Free message body pointer*/
2074 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002075 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002076 break;
2077 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002078
2079#ifdef WLAN_FEATURE_VOWIFI_11R
2080 case WDA_AGGR_QOS_RSP:
2081 limProcessFTAggrQoSRsp( pMac, limMsg );
2082 break;
2083#endif
2084
2085 case WDA_SET_LINK_STATE_RSP:
2086 linkStateParams = (tLinkStateParams *)limMsg->bodyptr;
2087#if defined WLAN_FEATURE_VOWIFI_11R
2088 pSession = linkStateParams->session;
2089 if(linkStateParams->ft)
2090 {
2091 limSendReassocReqWithFTIEsMgmtFrame(pMac,
2092 pSession->pLimMlmReassocReq,
2093 pSession);
2094 }
2095#endif
2096 if( linkStateParams->callback )
2097 {
2098 linkStateParams->callback( pMac, linkStateParams->callbackArg );
2099 }
2100 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002101 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002102 break;
2103
2104#ifdef WLAN_FEATURE_PACKET_FILTERING
2105 case WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
2106 pmmProcessMessage(pMac, limMsg);
2107 break;
2108#endif // WLAN_FEATURE_PACKET_FILTERING
2109
2110#ifdef WLAN_FEATURE_GTK_OFFLOAD
2111 case WDA_GTK_OFFLOAD_GETINFO_RSP:
2112 pmmProcessMessage(pMac, limMsg);
2113 break;
2114#endif // WLAN_FEATURE_GTK_OFFLOAD
Yathish9f22e662012-12-10 14:21:35 -08002115 case eWNI_SME_SET_BCN_FILTER_REQ:
2116 {
2117#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
2118 tpPESession psessionEntry;
Sreelakshmi Konamki45d12332016-05-26 15:41:04 +05302119 tANI_U8 sessionId;
2120 tSirSetActiveModeSetBncFilterReq *bcnFilterReq =
2121 (tSirSetActiveModeSetBncFilterReq *)limMsg->bodyptr;
2122 psessionEntry = peFindSessionByBssid(pMac, bcnFilterReq->bssid,
2123 &sessionId);
Yathish9f22e662012-12-10 14:21:35 -08002124 if(psessionEntry != NULL && IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
2125 {
2126 // sending beacon filtering information down to HAL
2127 if (limSendBeaconFilterInfo(pMac, psessionEntry) != eSIR_SUCCESS)
2128 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002129 limLog(pMac, LOGE, FL("Fail to send Beacon Filter Info "));
Yathish9f22e662012-12-10 14:21:35 -08002130 }
2131 }
Dhanashri Atred7885c22013-03-29 11:19:05 -07002132 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2133 limMsg->bodyptr = NULL;
Yathish9f22e662012-12-10 14:21:35 -08002134#endif
2135 }
2136 break;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302137 case eWNI_SME_HT40_OBSS_SCAN_IND:
2138 {
Sandeep Puligilla9f384742014-04-11 02:27:04 +05302139 tpPESession psessionEntry = NULL;
2140 tANI_U8 sessionId;
2141 tSirSmeHT40OBSSScanInd *ht40ScanInd =
Siddharth Bhald31c1252014-05-05 19:34:14 +05302142 (tSirSmeHT40OBSSScanInd *)limMsg->bodyptr;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302143
Sandeep Puligilla9f384742014-04-11 02:27:04 +05302144 psessionEntry = peFindSessionByBssid(pMac, ht40ScanInd->peerMacAddr,
Siddharth Bhald31c1252014-05-05 19:34:14 +05302145 &sessionId);
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302146
Siddharth Bhald31c1252014-05-05 19:34:14 +05302147 if (psessionEntry != NULL)
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302148 {
Siddharth Bhald31c1252014-05-05 19:34:14 +05302149 if( IS_HT40_OBSS_SCAN_FEATURE_ENABLE &&
2150 psessionEntry->htSupportedChannelWidthSet ==
2151 WNI_CFG_CHANNEL_BONDING_MODE_ENABLE )
2152 {
2153 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
2154 "OBSS Scan Start Req: session id %d"
2155 "htSupportedChannelWidthSet %d", psessionEntry->peSessionId,
2156 psessionEntry->htSupportedChannelWidthSet);
2157 limSendHT40OBSSScanInd(pMac, psessionEntry);
2158 }
2159 else
2160 {
2161 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
2162 "OBSS Scan not started: htSupportedChannelWidthSet- %d"
2163 " session id %d", psessionEntry->htSupportedChannelWidthSet,
2164 psessionEntry->peSessionId);
2165 }
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302166 }
2167 else
2168 {
2169 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_INFO,
Siddharth Bhald31c1252014-05-05 19:34:14 +05302170 "OBSS Scan not started: session id is NULL");
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302171 }
2172 vos_mem_free(limMsg->bodyptr);
2173 limMsg->bodyptr = NULL;
2174 }
2175 break;
2176 case eWNI_SME_HT40_STOP_OBSS_SCAN_IND:
2177 {
2178 tpPESession psessionEntry = NULL;
Sreelakshmi Konamki45d12332016-05-26 15:41:04 +05302179 tANI_U8 sessionId;
2180 tSirSmeHT40OBSSStopScanInd *ht40StopScanInd =
2181 (tSirSmeHT40OBSSStopScanInd *)limMsg->bodyptr;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302182
Sreelakshmi Konamki45d12332016-05-26 15:41:04 +05302183 psessionEntry = peFindSessionByBssid(pMac,
2184 ht40StopScanInd->bssid, &sessionId);;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302185 /* Sending LIM STOP OBSS SCAN Indication
2186 Stop command support is only for debugging purpose */
Sreelakshmi Konamki45d12332016-05-26 15:41:04 +05302187 if (psessionEntry && IS_HT40_OBSS_SCAN_FEATURE_ENABLE)
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302188 limSendHT40OBSSStopScanInd(pMac, psessionEntry);
2189 else
2190 VOS_TRACE(VOS_MODULE_ID_PE,VOS_TRACE_LEVEL_ERROR,
2191 "OBSS Scan Stop not started ");
2192 }
Sreelakshmi Konamki45d12332016-05-26 15:41:04 +05302193 vos_mem_free(limMsg->bodyptr);
2194 limMsg->bodyptr = NULL;
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302195 break;
Hardik Kantilal Patel62a3a762014-11-21 12:55:57 +05302196#ifdef WLAN_FEATURE_AP_HT40_24G
2197 case eWNI_SME_SET_HT_2040_MODE:
2198 limProcessSmeReqMessages(pMac, limMsg);
2199 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2200 limMsg->bodyptr = NULL;
2201 break;
2202#endif
2203
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302204#ifdef FEATURE_WLAN_TDLS
2205 case WDA_SET_TDLS_LINK_ESTABLISH_REQ_RSP:
2206 {
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302207 tpPESession psessionEntry;
2208 tANI_U8 sessionId;
Masti, Narayanraddie1892a52015-12-15 15:01:01 +05302209 tDphHashNode *pStaDs;
2210 int i, aid;
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05302211 tTdlsLinkEstablishParams *pTdlsLinkEstablishParams;
2212 pTdlsLinkEstablishParams = (tTdlsLinkEstablishParams*) limMsg->bodyptr;
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302213
2214 if((psessionEntry = peFindSessionByStaId(pMac,
2215 pTdlsLinkEstablishParams->staIdx,
2216 &sessionId))== NULL)
2217 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302218 limLog(pMac, LOGE, FL("session %u does not exist"), sessionId);
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302219 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP message to SME
2220 with session id as zero and status as FAILURE so, that message
2221 queued in SME queue can be freed to prevent the SME cmd buffer leak */
2222 limSendSmeTdlsLinkEstablishReqRsp(pMac,
2223 0,
2224 NULL,
2225 NULL,
2226 eSIR_FAILURE);
2227 }
2228 else
2229 {
Masti, Narayanraddie1892a52015-12-15 15:01:01 +05302230 for (i = 0;
2231 i < sizeof(psessionEntry->peerAIDBitmap)/sizeof(tANI_U32);
2232 i++) {
2233 for (aid = 0; aid < (sizeof(tANI_U32) << 3); aid++) {
2234 if (CHECK_BIT(psessionEntry->peerAIDBitmap[i], aid)) {
2235 pStaDs = dphGetHashEntry(pMac,
2236 (aid + i*(sizeof(tANI_U32) << 3)),
2237 &psessionEntry->dph.dphHashTable);
2238 if ((NULL != pStaDs) &&
2239 (pTdlsLinkEstablishParams->staIdx ==
2240 pStaDs->staIndex))
2241 goto send_link_resp;
2242 }
2243 }
2244 }
2245send_link_resp:
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302246 limSendSmeTdlsLinkEstablishReqRsp(pMac,
2247 psessionEntry->smeSessionId,
Masti, Narayanraddie1892a52015-12-15 15:01:01 +05302248 pStaDs->staAddr,
2249 pStaDs,
Gopichand Nakkala24be5312013-07-02 16:47:12 +05302250 pTdlsLinkEstablishParams->status) ;
2251 }
Gopichand Nakkala574f6d12013-06-27 19:38:43 +05302252 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2253 limMsg->bodyptr = NULL;
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302254 break;
2255 }
Atul Mittal60bd4292014-08-14 12:19:27 +05302256
2257 case WDA_SET_TDLS_CHAN_SWITCH_REQ_RSP:
2258 {
2259 tpPESession psessionEntry;
2260 tANI_U8 sessionId;
Masti, Narayanraddi764dd912016-01-06 16:07:34 +05302261 tDphHashNode *pStaDs;
2262 int i, aid;
Atul Mittal60bd4292014-08-14 12:19:27 +05302263 tTdlsChanSwitchParams *pTdlsChanSwitchParams;
2264 pTdlsChanSwitchParams = (tTdlsChanSwitchParams*) limMsg->bodyptr;
2265
2266 if((psessionEntry = peFindSessionByStaId(pMac,
2267 pTdlsChanSwitchParams->staIdx,
2268 &sessionId))== NULL)
2269 {
Sushant Kaushik87787972015-09-11 16:05:00 +05302270 limLog(pMac, LOGE, FL("session %u does not exist"), sessionId);
Atul Mittal60bd4292014-08-14 12:19:27 +05302271 /* Still send the eWNI_SME_TDLS_LINK_ESTABLISH_RSP message to SME
2272 with session id as zero and status as FAILURE so, that message
2273 queued in SME queue can be freed to prevent the SME cmd buffer leak */
2274 limSendSmeTdlsChanSwitchReqRsp(pMac,
2275 0,
2276 NULL,
2277 NULL,
2278 eSIR_FAILURE);
2279 }
2280 else
2281 {
Masti, Narayanraddi764dd912016-01-06 16:07:34 +05302282 for (i = 0;
2283 i < sizeof(psessionEntry->peerAIDBitmap)/sizeof(tANI_U32);
2284 i++) {
2285 for (aid = 0; aid < (sizeof(tANI_U32) << 3); aid++) {
2286 if (CHECK_BIT(psessionEntry->peerAIDBitmap[i], aid)) {
2287 pStaDs = dphGetHashEntry(pMac,
2288 (aid + i*(sizeof(tANI_U32) << 3)),
2289 &psessionEntry->dph.dphHashTable);
2290 if ((NULL != pStaDs) &&
2291 (pTdlsChanSwitchParams->staIdx ==
2292 pStaDs->staIndex))
2293 goto send_chan_switch_resp;
2294 }
2295 }
2296 }
2297send_chan_switch_resp:
Atul Mittal60bd4292014-08-14 12:19:27 +05302298 limSendSmeTdlsChanSwitchReqRsp(pMac,
2299 psessionEntry->smeSessionId,
Masti, Narayanraddi764dd912016-01-06 16:07:34 +05302300 pStaDs->staAddr,
2301 pStaDs,
Atul Mittal60bd4292014-08-14 12:19:27 +05302302 pTdlsChanSwitchParams->status) ;
2303 }
2304 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2305 limMsg->bodyptr = NULL;
2306 break;
2307 }
Gopichand Nakkala79ff85d2013-05-27 17:05:29 +05302308#endif
Gopichand Nakkala2c231c82013-06-11 17:49:16 +05302309
2310 case WDA_RX_SCAN_EVENT:
2311 limProcessRxScanEvent(pMac, limMsg->bodyptr);
2312 break;
2313
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002314 case WDA_IBSS_PEER_INACTIVITY_IND:
2315 {
2316 limProcessIbssPeerInactivity(pMac, limMsg->bodyptr);
2317 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
2318 limMsg->bodyptr = NULL;
2319 break;
2320 }
Abhishek Singh7cd040e2016-01-07 10:51:04 +05302321#ifdef WLAN_FEATURE_RMC
2322 case WDA_RMC_BECOME_RULER:
2323 limProcessRMCMessages(pMac, eLIM_RMC_BECOME_RULER_RESP,
2324 (void *)limMsg->bodyptr);
2325 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2326 limMsg->bodyptr = NULL;
2327 break ;
2328
2329 case WDA_RMC_RULER_SELECT_RESP:
2330 limProcessRMCMessages(pMac, eLIM_RMC_RULER_SELECT_RESP,
2331 (void *)limMsg->bodyptr);
2332 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2333 limMsg->bodyptr = NULL;
2334 break ;
2335
2336 case WDA_RMC_UPDATE_IND:
2337 limProcessRMCMessages(pMac, eLIM_RMC_RULER_PICK_NEW,
2338 (void *)limMsg->bodyptr);
2339 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2340 limMsg->bodyptr = NULL;
2341 break ;
2342#endif /* WLAN_FEATURE_RMC */
Ravi Joshid2ca7c42013-07-23 08:37:49 -07002343
Siddharth Bhal4f3187c2014-10-09 21:38:08 +05302344 case WDA_SPOOF_MAC_ADDR_RSP:
2345 limProcessMlmSpoofMacAddrRsp(pMac, (tSirRetStatus)limMsg->bodyval);
2346 break;
2347
Pradeep Reddy POTTETI31505892015-04-16 16:47:54 +05302348 case eWNI_SME_SET_TDLS_2040_BSSCOEX_REQ:
2349 limProcessSmeSetTdls2040BSSCoexReq(pMac, limMsg->bodyptr);
2350 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2351 limMsg->bodyptr = NULL;
2352 break;
2353
Masti, Narayanraddi1fb32a92015-06-29 13:14:06 +05302354 case eWNI_SME_DEL_ALL_TDLS_PEERS:
2355 limProcessSmeDelAllTdlsPeers(pMac, limMsg->bodyptr);
2356 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2357 limMsg->bodyptr = NULL;
2358 break;
2359
Jeff Johnson295189b2012-06-20 16:38:30 -07002360 default:
2361 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
2362 limMsg->bodyptr = NULL;
2363 // Unwanted messages
2364 // Log error
2365 limLog(pMac, LOGE,
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002366 FL("Discarding unexpected message received %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002367 limMsg->type);
2368 limPrintMsgName(pMac, LOGE, limMsg->type);
2369 break;
2370
2371 } // switch (limMsg->type)
2372
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002373 PELOG2(limLog(pMac, LOG2, FL("Done Processing msgType = %d, sme state = %s, mlm state = %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002374 limMsg->type, limSmeStateStr(pMac->lim.gLimSmeState),
2375 limMlmStateStr(pMac->lim.gLimMlmState));)
2376
2377} /*** end limProcessMessages() ***/
2378
2379
2380
2381/**
2382 * limProcessDeferredMessageQueue
2383 *
2384 *FUNCTION:
2385 * This function is called by LIM while exiting from Learn
2386 * mode. This function fetches messages posted to the LIM
2387 * deferred message queue limDeferredMsgQ.
2388 *
2389 *LOGIC:
2390 *
2391 *ASSUMPTIONS:
2392 * NA
2393 *
2394 *NOTE:
2395 * NA
2396 *
2397 * @param pMac - Pointer to Global MAC structure
2398 * @return None
2399 */
2400
2401void
2402limProcessDeferredMessageQueue(tpAniSirGlobal pMac)
2403{
2404 tSirMsgQ limMsg = { 0, 0, 0 };
2405
Jeff Johnson295189b2012-06-20 16:38:30 -07002406 tSirMsgQ *readMsg;
2407 tANI_U16 size;
2408
2409 /*
2410 ** check any deferred messages need to be processed
2411 **/
2412 size = pMac->lim.gLimDeferredMsgQ.size;
2413 if (size > 0)
2414 {
2415 while ((readMsg = limReadDeferredMsgQ(pMac)) != NULL)
2416 {
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302417 vos_mem_copy((tANI_U8*) &limMsg,
Jeff Johnson295189b2012-06-20 16:38:30 -07002418 (tANI_U8*) readMsg, sizeof(tSirMsgQ));
2419 size--;
2420 limProcessMessages(pMac, &limMsg);
2421
2422 if((limIsSystemInScanState(pMac)) || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) ||
Hema Aparna Medicharlab56b6612015-05-18 11:42:52 +05302423 (pMac->lim.gLimSystemInScanLearnMode) || pMac->lim.gLimAddtsSent)
Jeff Johnson295189b2012-06-20 16:38:30 -07002424 break;
2425 }
2426 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002427} /*** end limProcessDeferredMessageQueue() ***/
2428
2429
2430/*
2431 * limProcessNormalHddMsg
2432 * Function: this function checks the current lim state and decide whether the message passed shall be deffered.
2433 * @param pMac - Pointer to Global MAC structure
2434 * pLimMsg -- the message need to be processed
2435 * fRspReqd -- whether return result to hdd
2436 * @return None
2437 */
2438void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd)
2439{
2440 tANI_BOOLEAN fDeferMsg = eANI_BOOLEAN_TRUE;
2441
2442 /* Added For BT-AMP Support */
2443 if ((pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_AP_ROLE )
2444 ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_STA_ROLE)
2445 ||(pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE))
2446 {
2447 /** This check is required only for the AP and in 2 cases.
2448 * 1. If we are in learn mode and we receive any of these messages,
2449 * you have to come out of scan and process the message, hence dont
2450 * defer the message here. In handler, these message could be defered
2451 * till we actually come out of scan mode.
2452 * 2. If radar is detected, you might have to defer all of these
2453 * messages except Stop BSS request/ Switch channel request. This
2454 * decision is also made inside its handler.
2455 *
2456 * Please be careful while using the flag fDeferMsg. Possibly you
2457 * might end up in an infinite loop.
2458 **/
2459 if (((pLimMsg->type == eWNI_SME_START_BSS_REQ) ||
2460 (pLimMsg->type == eWNI_SME_STOP_BSS_REQ) ||
2461 (pLimMsg->type == eWNI_SME_SWITCH_CHL_REQ) ||
2462 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ) ||
2463 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ)))
2464 {
2465 fDeferMsg = eANI_BOOLEAN_FALSE;
2466 }
2467 }
2468
2469 /* limInsystemInscanState() refers the psessionEntry, how to get session Entry????*/
Jeff Johnsone7245742012-09-05 17:12:55 -07002470 if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) /*||
2471 (LIM_IS_RADAR_DETECTED(pMac))*/) && fDeferMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002472 {
2473 // System is in DFS (Learn) mode or awaiting addts response
2474 // or if radar is detected, Defer processsing this message
2475 if (limDeferMsg(pMac, pLimMsg) != TX_SUCCESS)
2476 {
2477#ifdef WLAN_DEBUG
2478 pMac->lim.numSme++;
2479#endif
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002480 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 -07002481 pLimMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
2482 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
2483 limLogSessionStates(pMac);
2484 limPrintMsgName(pMac, LOGE, pLimMsg->type);
2485 // Release body
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302486 vos_mem_free(pLimMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002487 pLimMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002488 }
2489 }
2490 else
2491 {
2492 if(fRspReqd)
2493 {
2494 // These messages are from HDD
2495 // Since these requests may also be generated
2496 // internally within LIM module, need to
2497 // distinquish and send response to host
2498 pMac->lim.gLimRspReqd = eANI_BOOLEAN_TRUE;
2499 }
2500#ifdef WLAN_DEBUG
2501 pMac->lim.numSme++;
2502#endif
2503 if(limProcessSmeReqMessages(pMac, pLimMsg))
2504 {
2505 // Release body
2506 // limProcessSmeReqMessage consumed the buffer. We can free it.
Bansidhar Gopalachari1d9c6162013-07-11 10:24:30 +05302507 vos_mem_free(pLimMsg->bodyptr);
Leela Venkata Kiran Kumar Reddy Chiralad6c0fe22013-12-11 19:10:50 -08002508 pLimMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07002509 }
2510 }
2511}
2512
2513void
Jeff Johnsone7245742012-09-05 17:12:55 -07002514handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002515{
2516 tSirMacHTCapabilityInfo macHTCapabilityInfo;
2517 tSirMacHTParametersInfo macHTParametersInfo;
2518 tSirMacHTInfoField1 macHTInfoField1;
2519 tSirMacHTInfoField2 macHTInfoField2;
2520 tSirMacHTInfoField3 macHTInfoField3;
2521 tANI_U32 cfgValue;
2522 tANI_U8 *ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002523
Jeff Johnson295189b2012-06-20 16:38:30 -07002524 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) != eSIR_SUCCESS)
2525 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002526 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002527 return ;
2528 }
2529 ptr = (tANI_U8 *) &macHTCapabilityInfo;
2530 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2531 pMac->lim.gHTLsigTXOPProtection = (tANI_U8)macHTCapabilityInfo.lsigTXOPProtection;
2532 pMac->lim.gHTMIMOPSState = (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
2533 pMac->lim.gHTGreenfield = (tANI_U8)macHTCapabilityInfo.greenField;
2534 pMac->lim.gHTMaxAmsduLength = (tANI_U8)macHTCapabilityInfo.maximalAMSDUsize;
2535 pMac->lim.gHTShortGI20Mhz = (tANI_U8)macHTCapabilityInfo.shortGI20MHz;
2536 pMac->lim.gHTShortGI40Mhz = (tANI_U8)macHTCapabilityInfo.shortGI40MHz;
Jeff Johnson295189b2012-06-20 16:38:30 -07002537 pMac->lim.gHTPSMPSupport = (tANI_U8)macHTCapabilityInfo.psmp;
2538 pMac->lim.gHTDsssCckRate40MHzSupport = (tANI_U8)macHTCapabilityInfo.dsssCckMode40MHz;
2539
2540 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) != eSIR_SUCCESS)
2541 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002542 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002543 return ;
2544 }
2545 ptr = (tANI_U8 *) &macHTParametersInfo;
2546 *ptr = (tANI_U8) (cfgValue & 0xff);
2547 pMac->lim.gHTAMpduDensity = (tANI_U8)macHTParametersInfo.mpduDensity;
2548 pMac->lim.gHTMaxRxAMpduFactor = (tANI_U8)macHTParametersInfo.maxRxAMPDUFactor;
2549
2550 // Get HT IE Info
2551 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) != eSIR_SUCCESS)
2552 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002553 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002554 return ;
2555 }
2556 ptr = (tANI_U8 *) &macHTInfoField1;
2557 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
2558 pMac->lim.gHTServiceIntervalGranularity = (tANI_U8)macHTInfoField1.serviceIntervalGranularity;
2559 pMac->lim.gHTControlledAccessOnly = (tANI_U8)macHTInfoField1.controlledAccessOnly;
2560 pMac->lim.gHTRifsMode = (tANI_U8)macHTInfoField1.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002561
2562 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) != eSIR_SUCCESS)
2563 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002564 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002565 return ;
2566 }
2567 ptr = (tANI_U8 *) &macHTInfoField2;
2568 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2569 pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
2570
2571 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) != eSIR_SUCCESS)
2572 {
Kiran Kumar Lokere531ca702013-04-01 13:24:23 -07002573 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002574 return ;
2575 }
2576 ptr = (tANI_U8 *) &macHTInfoField3;
2577 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2578 pMac->lim.gHTPCOActive = (tANI_U8)macHTInfoField3.pcoActive;
2579 pMac->lim.gHTPCOPhase = (tANI_U8)macHTInfoField3.pcoPhase;
Jeff Johnson295189b2012-06-20 16:38:30 -07002580 pMac->lim.gHTSecondaryBeacon = (tANI_U8)macHTInfoField3.secondaryBeacon;
2581 pMac->lim.gHTDualCTSProtection = (tANI_U8)macHTInfoField3.dualCTSProtection;
2582 pMac->lim.gHTSTBCBasicMCS = (tANI_U8)macHTInfoField3.basicSTBCMCS;
Jeff Johnsone7245742012-09-05 17:12:55 -07002583
2584 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2585 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
2586 * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
2587 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2588 */
2589 if (psessionEntry != NULL)
2590 {
Sandeep Puligilla11d49a62014-01-30 12:05:16 +05302591 psessionEntry->htCapability =
2592 IS_DOT11_MODE_HT(psessionEntry->dot11mode);
2593 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport =
2594 (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
Sandeep Puligilla70b6b162014-04-19 02:06:04 +05302595 limInitOBSSScanParams(pMac, psessionEntry);
Jeff Johnsone7245742012-09-05 17:12:55 -07002596 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002597}
2598
2599void limLogSessionStates(tpAniSirGlobal pMac)
2600{
2601#ifdef WLAN_DEBUG
2602 int i;
2603
2604 for(i = 0; i < pMac->lim.maxBssId; i++)
2605 {
2606 if(pMac->lim.gpSession[i].valid)
2607 {
Abhishek Singh3cbf6052014-12-15 16:46:42 +05302608 limLog(pMac, LOG1, FL("Session[%d] sysRole(%d) limSmeState %d "
2609 "(prev sme state %d) mlm state %d (prev mlm state %d)"),
2610 i, pMac->lim.gpSession[i].limSystemRole,
2611 pMac->lim.gpSession[i].limSmeState,
2612 pMac->lim.gpSession[i].limPrevSmeState,
2613 pMac->lim.gpSession[i].limMlmState,
2614 pMac->lim.gpSession[i].limPrevMlmState);
Jeff Johnson295189b2012-06-20 16:38:30 -07002615 }
2616 }
2617#endif //ifdef WLAN_DEBUG
2618}