blob: 22a56618ce37204373fa99f85cb2ee3227f33868 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Gopichand Nakkala9c070ad2013-01-08 21:16:34 -08002 * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
3 *
4 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5 *
6 *
7 * Permission to use, copy, modify, and/or distribute this software for
8 * any purpose with or without fee is hereby granted, provided that the
9 * above copyright notice and this permission notice appear in all
10 * copies.
11 *
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19 * PERFORMANCE OF THIS SOFTWARE.
20 */
21/*
Jeff Johnson32d95a32012-09-10 13:15:23 -070022 * Copyright (c) 2012, The Linux Foundation. All rights reserved.
Jeff Johnson295189b2012-06-20 16:38:30 -070023 *
24 * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
25 *
26 *
27 * Permission to use, copy, modify, and/or distribute this software for
28 * any purpose with or without fee is hereby granted, provided that the
29 * above copyright notice and this permission notice appear in all
30 * copies.
31 *
32 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
33 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
34 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
35 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
36 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
37 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
38 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
39 * PERFORMANCE OF THIS SOFTWARE.
40 */
Jeff Johnson295189b2012-06-20 16:38:30 -070041/*
42 * Airgo Networks, Inc proprietary. All rights reserved.
43 * This file lim ProcessMessageQueue.cc contains the code
44 * for processing LIM message Queue.
45 * Author: Chandra Modumudi
46 * Date: 02/11/02
47 * History:-
48 * Date Modified by Modification Information
49 * --------------------------------------------------------------------
50 *
51 */
52#include "palTypes.h"
53#include "wniApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070054#include "wlan_qct_wdi_ds.h"
55#include "wlan_qct_pal_packet.h"
56#include "wlan_qct_wda.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070057
Jeff Johnson295189b2012-06-20 16:38:30 -070058#include "wniCfgSta.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070059#include "cfgApi.h"
60#include "sirCommon.h"
61#include "utilsApi.h"
62#include "limTypes.h"
63#include "limUtils.h"
64#include "limAssocUtils.h"
65#include "limPropExtsUtils.h"
66
67#include "limAdmitControl.h"
68#include "pmmApi.h"
69#include "limIbssPeerMgmt.h"
70#include "schApi.h"
71#include "limSession.h"
Yathishd8713192012-12-10 14:21:35 -080072#include "limSendMessages.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070073
74#if defined WLAN_FEATURE_VOWIFI
75#include "rrmApi.h"
76#endif
77#if defined FEATURE_WLAN_CCX
78#include "ccxApi.h"
79#endif
80
81#if defined WLAN_FEATURE_VOWIFI_11R
82#include "limFT.h"
83#endif
84
85#ifdef WMM_APSD
86#include "wmmApsd.h"
87#endif
88
Jeff Johnson295189b2012-06-20 16:38:30 -070089#include "vos_types.h"
90#include "vos_packet.h"
91#include "vos_memory.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070092
93void limLogSessionStates(tpAniSirGlobal pMac);
94
95/** -------------------------------------------------------------
96\fn defMsgDecision
97\brief The function decides whether to defer a message or not in limProcessMessage function
98\param tpAniSirGlobal pMac
99\param tSirMsgQ limMsg
100\param tSirMacTspecIE *ppInfo
101\return none
102 -------------------------------------------------------------*/
103
104tANI_U8 static
105defMsgDecision(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
106{
107
108
109/* this function should not changed */
Jeff Johnsone7245742012-09-05 17:12:55 -0700110 if(pMac->lim.gLimSmeState == eLIM_SME_OFFLINE_STATE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700111 {
112 // Defer processsing this message
113 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
114 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700115 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 -0700116 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
117 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
118 limLogSessionStates(pMac);
119 limHandleDeferMsgError(pMac, limMsg);
120 }
121 return true;
122 }
123
124 //When defer is requested then defer all the messages except HAL responses.
125 if((!limIsSystemInScanState(pMac)) && (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) &&
126 !pMac->lim.gLimSystemInScanLearnMode)
127 {
128 if((limMsg->type != WDA_ADD_BSS_RSP) &&
129 (limMsg->type != WDA_DELETE_BSS_RSP) &&
130 (limMsg->type != WDA_ADD_STA_RSP) &&
131 (limMsg->type != WDA_ADD_STA_SELF_RSP) &&
132 (limMsg->type != WDA_DEL_STA_SELF_RSP) &&
133 (limMsg->type != WDA_DELETE_STA_RSP)&&
134 (limMsg->type != WDA_SET_BSSKEY_RSP)&&
135 (limMsg->type != WDA_SET_STAKEY_RSP)&&
136 (limMsg->type != WDA_SET_STA_BCASTKEY_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700137 (limMsg->type != eWNI_SME_START_REQ) &&
138 (limMsg->type != WDA_AGGR_QOS_RSP) &&
139 (limMsg->type != WDA_REMOVE_BSSKEY_RSP) &&
140 (limMsg->type != WDA_REMOVE_STAKEY_RSP) &&
141 (limMsg->type != WDA_SET_MIMOPS_RSP)&&
142 (limMsg->type != WDA_ADDBA_RSP) &&
143 (limMsg->type != WDA_ENTER_BMPS_RSP) &&
144 (limMsg->type != WDA_EXIT_BMPS_RSP) &&
145 (limMsg->type != WDA_ENTER_IMPS_RSP) &&
146 (limMsg->type != WDA_EXIT_IMPS_RSP) &&
147 (limMsg->type != WDA_ENTER_UAPSD_RSP) &&
148 (limMsg->type != WDA_EXIT_UAPSD_RSP) &&
149 (limMsg->type != WDA_WOWL_ENTER_RSP) &&
150 (limMsg->type != WDA_WOWL_EXIT_RSP) &&
151 (limMsg->type != WDA_SWITCH_CHANNEL_RSP) &&
Jeff Johnson295189b2012-06-20 16:38:30 -0700152 (limMsg->type != WDA_P2P_NOA_ATTR_IND) &&
Viral Modid871f222013-03-06 02:25:31 -0800153 (limMsg->type != WDA_P2P_NOA_START_IND) &&
Jeff Johnsone7245742012-09-05 17:12:55 -0700154#ifdef FEATURE_OEM_DATA_SUPPORT
155 (limMsg->type != WDA_START_OEM_DATA_RSP) &&
156#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700157 (limMsg->type != WDA_ADD_TS_RSP))
158 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700159 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 -0700160 limMsgStr(limMsg->type));)
161
162 // Defer processsing this message
163 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
164 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -0700165 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 -0700166 limMsg->type, limMsgStr(limMsg->type), pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
167 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
168 limLogSessionStates(pMac);
169 limHandleDeferMsgError(pMac, limMsg);
170
171 }
172 return true;
173 }
174 }
175 return false;
176}
177
178/*
179* Beacon Handling Cases:
180* during scanning, when no session is active:
181* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
182* during scanning, when any session is active, but beacon/Pr does not belong to that session, psessionEntry will be null.
183* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
184* during scanning, when any session is active, and beacon/Pr belongs to one of the session, psessionEntry will not be null.
185* handled by limHandleFramesInScanState before __limHandleBeacon call is invoked.
186* Not scanning, no session:
187* there should not be any beacon coming, if coming, should be dropped.
188* Not Scanning,
189*/
190static void
191__limHandleBeacon(tpAniSirGlobal pMac, tpSirMsgQ pMsg, tpPESession psessionEntry)
192{
193 /* checking for global SME state...*/
194 tANI_U8 *pRxPacketInfo;
195 limGetBDfromRxPacket(pMac, pMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
196
197 //This function should not be called if beacon is received in scan state.
198 //So not doing any checks for the global state.
199
200 if(psessionEntry == NULL)
201 {
202 schBeaconProcess(pMac, pRxPacketInfo, NULL);
203 }
204 else if( (psessionEntry->limSmeState == eLIM_SME_LINK_EST_STATE) ||
205 (psessionEntry->limSmeState == eLIM_SME_NORMAL_STATE))
206 {
207 schBeaconProcess(pMac, pRxPacketInfo, psessionEntry);
208 }
209 else
210 limProcessBeaconFrame(pMac, pRxPacketInfo, psessionEntry);
211
212 return;
213}
214
215
216//Fucntion prototype
217void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd);
218
219/**
Jeff Johnson295189b2012-06-20 16:38:30 -0700220 * limDeferMsg()
221 *
222 *FUNCTION:
223 * This function is called to defer the messages received
224 * during Learn mode
225 *
226 *LOGIC:
227 * NA
228 *
229 *ASSUMPTIONS:
230 * NA
231 *
232 *NOTE:
233 * NA
234 *
235 * @param pMac - Pointer to Global MAC structure
236 * @param pMsg of type tSirMsgQ - Pointer to the message structure
237 * @return None
238 */
239
240tANI_U32
241limDeferMsg(tpAniSirGlobal pMac, tSirMsgQ *pMsg)
242{
243 tANI_U32 retCode = TX_SUCCESS;
Jeff Johnson8347b442013-03-07 08:15:44 -0800244
245 retCode = limWriteDeferredMsgQ(pMac, pMsg);
246
Jeff Johnson295189b2012-06-20 16:38:30 -0700247 if (retCode == TX_SUCCESS)
Jeff Johnson8347b442013-03-07 08:15:44 -0800248 {
249 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DEFERRED));)
250 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700251 else
Jeff Johnson8347b442013-03-07 08:15:44 -0800252 {
253 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(pMsg->type, LIM_MSG_DROPPED));)
254 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700255
256 return retCode;
257} /*** end limDeferMsg() ***/
258
259
260
261/**
262 * limHandleFramesInScanState()
263 *
264 *FUNCTION:
265 * This function is called to process 802.11 frames
266 * received by LIM in scan state.
267 *
268 *LOGIC:
269 * NA
270 *
271 *ASSUMPTIONS:
272 * NA
273 *
274 *NOTE:
275 * NA
276 *
277 * @param pMac - Pointer to Global MAC structure
278 * @param limMsg - Received message
279 * @param pRxPacketInfo - Pointer to Rx packet info structure
280 * @param deferMsg - Indicates whether the frame shall be deferred
281 * @return None
282 */
283
284static void
285limHandleFramesInScanState(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pRxPacketInfo, tANI_U8 *deferMsg, tpPESession psessionEntry)
286{
287 tSirMacFrameCtl fc;
288 tpSirMacMgmtHdr pHdr;
Jeff Johnson295189b2012-06-20 16:38:30 -0700289
290 *deferMsg = false;
291 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
292 fc = pHdr->fc;
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700293 limLog( pMac, LOG2, FL("ProtVersion %d, Type %d, Subtype %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700294 fc.protVer, fc.type, fc.subType );
295
Jeff Johnson295189b2012-06-20 16:38:30 -0700296 // defer all message in scan state except for Beacons and Probe Response
297 if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_BEACON))
298 {
299 if (psessionEntry == NULL)
300 limProcessBeaconFrameNoSession(pMac, pRxPacketInfo);
301 else
302 limProcessBeaconFrame(pMac, pRxPacketInfo,psessionEntry);
303 }
304 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_RSP))
305 {
306 if (psessionEntry == NULL)
307 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
308 else
309 limProcessProbeRspFrame(pMac, pRxPacketInfo,psessionEntry);
310 }
311 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_PROBE_REQ))
312 {
313 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo, psessionEntry);
314 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700315 else if ((fc.type == SIR_MAC_MGMT_FRAME) && (fc.subType == SIR_MAC_MGMT_ACTION))
316 {
317 limProcessActionFrameNoSession( pMac, pRxPacketInfo);
318 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700319 else
320 {
321 *deferMsg = true;
322 return;
323 }
324
Jeff Johnson295189b2012-06-20 16:38:30 -0700325 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
326 return;
327
328} /*** end limHandleFramesInScanState() ***/
329
330/** ------------------------------------------------------------
331\brief This function handles Unknown Unicast (A2 Index)
332\ packets.
333\param tpAniSirGlobal pMac Global Mac data structure
334\param void *pRxPacketInfo Pointer to Buffer Descriptor
335\return none
336\
337\ -------------------------------------------------------------- */
338static void limHandleUnknownA2IndexFrames(tpAniSirGlobal pMac, void *pRxPacketInfo,tpPESession psessionEntry)
339{
Jeff Johnson295189b2012-06-20 16:38:30 -0700340 /* addr2 mismatch interrupt occurred this means previous
341 disassociation was not successful
342 In Volans pRxPacketInfo only contains pointer 48-bit address2 field */
343 /*Send disassociation message again*/
344 //Dinesh need one more arguement.
345 //limSendDisassocMgmtFrame(pMac, eSIR_MAC_CLASS3_FRAME_FROM_NON_ASSOC_STA_REASON,(tANI_U8 *) pRxPacketInfo);
Mohit Khannac0b992f2012-12-04 15:08:18 -0800346 //TODO: verify this
Jeff Johnson295189b2012-06-20 16:38:30 -0700347 //This could be a public action frame.
348 if( psessionEntry->limSystemRole == eLIM_P2P_DEVICE_ROLE )
349 limProcessActionFrameNoSession(pMac, (tANI_U8 *) pRxPacketInfo);
Mohit Khannac0b992f2012-12-04 15:08:18 -0800350
351#ifdef FEATURE_WLAN_TDLS
352 {
353 tpSirMacDataHdr3a pMacHdr;
354 pMacHdr = WDA_GET_RX_MPDUHEADER3A(pRxPacketInfo);
355
356 if (limIsGroupAddr(pMacHdr->addr2))
357 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700358 PELOG2(limLog(pMac, LOG2, FL("Ignoring A2 Invalid Packet received for MC/BC:"));
Mohit Khannac0b992f2012-12-04 15:08:18 -0800359 limPrintMacAddr(pMac, pMacHdr->addr2, LOG2);)
360
361 return;
362 }
363 /* TDLS_hklee: move down here to reject Addr2 == Group (first checking above)
364 and also checking if SystemRole == STA */
365 if (psessionEntry->limSystemRole == eLIM_STA_ROLE)
366 {
367 /* ADD handling of Public Action Frame */
368 LIM_LOG_TDLS(VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR, \
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700369 ("limHandleUnknownA2IndexFrames: type=0x%x, subtype=0x%x"),pMacHdr->fc.type, pMacHdr->fc.subType));
Mohit Khannac0b992f2012-12-04 15:08:18 -0800370 switch (pMacHdr->fc.type)
371 {
372 case SIR_MAC_MGMT_FRAME:
373 {
374 switch (pMacHdr->fc.subType)
375 {
376 case SIR_MAC_MGMT_ACTION:
377 {
378 limProcessActionFrame(pMac, pRxPacketInfo, psessionEntry) ;
379 break ;
380 }
381 default:
382 {
383 break ;
384 }
385 }
386 }
387 default:
388 {
389 break ;
390 }
391 }
392 }
393 }
394#endif
395
Jeff Johnson295189b2012-06-20 16:38:30 -0700396
397 return;
398}
399
Jeff Johnson295189b2012-06-20 16:38:30 -0700400/**
401 * limCheckMgmtRegisteredFrames()
402 *
403 *FUNCTION:
404 * This function is called to process to check if received frame match with
405 * any of the registered frame from HDD. If yes pass this frame to SME.
406 *
407 *LOGIC:
408 *
409 *ASSUMPTIONS:
410 *
411 *NOTE:
412 *
413 * @param pMac Pointer to Global MAC structure
414 * @param *pBd Pointer to the received Buffer Descriptor+payload
415 * @param *psessionEntry Pointer to session on which packet is received
416 * @return None
417 */
418static tANI_BOOLEAN
419limCheckMgmtRegisteredFrames(tpAniSirGlobal pMac, tANI_U8 *pBd,
420 tpPESession psessionEntry)
421{
422 tSirMacFrameCtl fc;
423 tpSirMacMgmtHdr pHdr;
424 tANI_U8 *pBody;
425 tpLimMgmtFrameRegistration pLimMgmtRegistration = NULL, pNext = NULL;
426 tANI_U16 frameType;
427 tANI_U16 framelen;
428 tANI_U8 type,subType;
429 tANI_BOOLEAN match = VOS_FALSE;
430 VOS_STATUS vosStatus;
431
432 pHdr = WDA_GET_RX_MAC_HEADER(pBd);
433 fc = pHdr->fc;
434 frameType = (fc.type << 2 ) | (fc.subType << 4);
435 pBody = WDA_GET_RX_MPDU_DATA(pBd);
436 framelen = WDA_GET_RX_PAYLOAD_LEN(pBd);
437
438 vos_list_peek_front(&pMac->lim.gLimMgmtFrameRegistratinQueue,
439 (vos_list_node_t**)&pLimMgmtRegistration);
440
441 while(pLimMgmtRegistration != NULL)
442 {
443 type = (pLimMgmtRegistration->frameType >> 2) & 0x03;
444 subType = (pLimMgmtRegistration->frameType >> 4) & 0x0f;
445 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
446 && (subType == SIR_MAC_MGMT_RESERVED15) )
447 {
448 limLog( pMac, LOG3,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700449 FL("rcvd frame match with SIR_MAC_MGMT_RESERVED15"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700450 match = VOS_TRUE;
451 break;
452 }
453
454 if (pLimMgmtRegistration->frameType == frameType)
455 {
456 if (pLimMgmtRegistration->matchLen > 0)
457 {
458 if (pLimMgmtRegistration->matchLen <= framelen)
459 {
460 if (palEqualMemory(pMac, pLimMgmtRegistration->matchData,
461 pBody, pLimMgmtRegistration->matchLen))
462 {
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700463 /* found match! */
464 match = VOS_TRUE;
465 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700466 }
Madan Mohan Koyyalamudic537df22012-10-22 15:07:08 -0700467 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700468 }
469 else
470 {
471 /* found match! */
472 match = VOS_TRUE;
473 break;
474 }
475 }
476
477 vosStatus =
478 vos_list_peek_next ( &pMac->lim.gLimMgmtFrameRegistratinQueue,
479 (vos_list_node_t*) pLimMgmtRegistration,
480 (vos_list_node_t**) &pNext );
481 pLimMgmtRegistration = pNext;
482 pNext = NULL;
483 }
484
485 if (match)
486 {
487 limLog( pMac, LOG1,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700488 FL("rcvd frame match with registered frame params"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700489
490 /* Indicate this to SME */
491 limSendSmeMgmtFrameInd( pMac, pHdr->fc.subType, (tANI_U8*)pHdr,
492 WDA_GET_RX_PAYLOAD_LEN(pBd) + sizeof(tSirMacMgmtHdr),
493 pLimMgmtRegistration->sessionId,
Chilam NGde0b4112013-01-19 12:27:36 +0530494 WDA_GET_RX_CH(pBd), psessionEntry, 0);
Jeff Johnson295189b2012-06-20 16:38:30 -0700495
496 if ( (type == SIR_MAC_MGMT_FRAME) && (fc.type == SIR_MAC_MGMT_FRAME)
497 && (subType == SIR_MAC_MGMT_RESERVED15) )
498 {
499 // These packets needs to be processed by PE/SME as well as HDD.
500 // If it returns TRUE here, the packet is forwarded to HDD only.
501 match = VOS_FALSE;
502 }
503 }
504
505 return match;
506} /*** end limCheckMgmtRegisteredFrames() ***/
Jeff Johnson295189b2012-06-20 16:38:30 -0700507
508
509/**
510 * limHandle80211Frames()
511 *
512 *FUNCTION:
513 * This function is called to process 802.11 frames
514 * received by LIM.
515 *
516 *LOGIC:
517 * NA
518 *
519 *ASSUMPTIONS:
520 * NA
521 *
522 *NOTE:
523 * NA
524 *
525 * @param pMac - Pointer to Global MAC structure
526 * @param pMsg of type tSirMsgQ - Pointer to the message structure
527 * @return None
528 */
529
530static void
531limHandle80211Frames(tpAniSirGlobal pMac, tpSirMsgQ limMsg, tANI_U8 *pDeferMsg)
532{
533 tANI_U8 *pRxPacketInfo = NULL;
534 tSirMacFrameCtl fc;
535 tpSirMacMgmtHdr pHdr=NULL;
536 tpPESession psessionEntry=NULL;
537 tANI_U8 sessionId;
538 tAniBool isFrmFt = FALSE;
539 tANI_U16 fcOffset = WLANHAL_RX_BD_HEADER_SIZE;
540
541 *pDeferMsg= false;
542 limGetBDfromRxPacket(pMac, limMsg->bodyptr, (tANI_U32 **)&pRxPacketInfo);
543
544 pHdr = WDA_GET_RX_MAC_HEADER(pRxPacketInfo);
545 isFrmFt = WDA_GET_RX_FT_DONE(pRxPacketInfo);
546 fcOffset = (v_U8_t)WDA_GET_RX_MPDU_HEADER_OFFSET(pRxPacketInfo);
547 fc = pHdr->fc;
548
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700549 limLog( pMac, LOG4, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700550 fc.protVer, fc.type, fc.subType, WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
551
Varun Reddy Yeturu08614702013-04-15 21:58:13 -0700552#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
553 if ( WDA_GET_ROAMCANDIDATEIND(pRxPacketInfo))
554 {
555 limLog( pMac, LOG2, FL("Notify SME with candidate ind"));
556 //send a session 0 for now - TBD
557 limSendSmeCandidateFoundInd(pMac, 0);
558 goto end;
559 }
560 if (WDA_GET_OFFLOADSCANLEARN(pRxPacketInfo))
561 {
562 if (fc.subType == SIR_MAC_MGMT_BEACON)
563 {
564 limLog( pMac, LOG2, FL("Save this beacon in LFR cache"));
565 __limHandleBeacon(pMac, limMsg, NULL);
566 }
567 else if (fc.subType == SIR_MAC_MGMT_PROBE_RSP)
568 {
569 limLog( pMac, LOG2, FL("Save this probe rsp in LFR cache"));
570 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
571 }
572 else
573 {
574 limLog( pMac, LOGE, FL("Wrong frame Type %d, Subtype %d for LFR"),
575 fc.type, fc.subType);
576 }
577 goto end;
578 }
579#endif //WLAN_FEATURE_ROAM_SCAN_OFFLOAD
Jeff Johnson295189b2012-06-20 16:38:30 -0700580#ifdef FEATURE_WLAN_CCX
581 if (fc.type == SIR_MAC_DATA_FRAME && isFrmFt)
582 {
583#if 0 // CCX TBD Need to PORT
584 tpSirMacDot3Hdr pDataFrmHdr;
585
586 pDataFrmHdr = (tpSirMacDot3Hdr)((tANI_U8 *)pBD+ WLANHAL_RX_BD_GET_MPDU_H_OFFSET(pBD));
587 if((psessionEntry = peFindSessionByBssid(pMac,pDataFrmHdr->sa,&sessionId))== NULL)
588 {
589 limLog( pMac, LOGE, FL("Session not found for Frm type %d, subtype %d, SA: "), fc.type, fc.subType);
590 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
591 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
592 return;
593 }
594
595 if (!psessionEntry->isCCXconnection)
596 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700597 limLog( pMac, LOGE, FL("LIM received Type %d, Subtype %d in Non CCX connection"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700598 fc.type, fc.subType);
599 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pBD, limMsg->bodyptr);
600 return;
601 }
602 limLog( pMac, LOGE, FL("Processing IAPP Frm from SA:"));
603 limPrintMacAddr(pMac, pDataFrmHdr->sa, LOGE);
604#else
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700605 printk("%s: Need to port handling of IAPP frames to PRIMA for CCX", __func__);
Jeff Johnson295189b2012-06-20 16:38:30 -0700606#endif
607
608
609 } else
610#endif
611 /* Added For BT-AMP Support */
612 if((psessionEntry = peFindSessionByBssid(pMac,pHdr->bssId,&sessionId))== NULL)
613 {
614#ifdef WLAN_FEATURE_VOWIFI_11R
615 if (fc.subType == SIR_MAC_MGMT_AUTH)
616 {
617#ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG
Varun Reddy Yeturu9163b672013-02-11 14:05:06 -0800618 limLog( pMac, LOG1, FL("ProtVersion %d, Type %d, Subtype %d rateIndex=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700619 fc.protVer, fc.type, fc.subType, WDA_GET_RX_MAC_RATE_IDX(pRxPacketInfo));
Varun Reddy Yeturu9163b672013-02-11 14:05:06 -0800620 limPrintMacAddr(pMac, pHdr->bssId, LOG1);
Jeff Johnson295189b2012-06-20 16:38:30 -0700621#endif
622 if (limProcessAuthFrameNoSession(pMac, pRxPacketInfo, limMsg->bodyptr) == eSIR_SUCCESS)
623 {
624 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
625 return;
626 }
627 }
628#endif
629 if((fc.subType != SIR_MAC_MGMT_PROBE_RSP )&&
630 (fc.subType != SIR_MAC_MGMT_BEACON)&&
631 (fc.subType != SIR_MAC_MGMT_PROBE_REQ)
Jeff Johnson295189b2012-06-20 16:38:30 -0700632 && (fc.subType != SIR_MAC_MGMT_ACTION ) //Public action frame can be received from non-associated stations.
Jeff Johnson295189b2012-06-20 16:38:30 -0700633 )
634 {
635
636 if((psessionEntry = peFindSessionByPeerSta(pMac,pHdr->sa,&sessionId))== NULL)
637 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700638 limLog(pMac, LOG1, FL("session does not exist for given bssId"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700639 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
640 return;
641 }
Gopichand Nakkala035315f2013-03-20 23:32:50 +0530642 }
643 // For p2p resp frames search for valid session with DA as
644 // BSSID will be SA and session will be present with DA only
645 if(fc.subType == SIR_MAC_MGMT_ACTION )
646 {
647 psessionEntry = peFindSessionByBssid(pMac,pHdr->da,&sessionId);
648 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700649 }
650
651
Jeff Johnson295189b2012-06-20 16:38:30 -0700652 /* Check if frame is registered by HDD */
653 if(limCheckMgmtRegisteredFrames(pMac, pRxPacketInfo, psessionEntry))
654 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700655 limLog( pMac, LOG1, FL("Received frame is passed to SME"));
Jeff Johnson295189b2012-06-20 16:38:30 -0700656 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, limMsg->bodyptr);
657 return;
658 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700659
660
Jeff Johnson295189b2012-06-20 16:38:30 -0700661
662 if (fc.protVer != SIR_MAC_PROTOCOL_VERSION)
663 { // Received Frame with non-zero Protocol Version
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700664 limLog(pMac, LOGE, FL("Unexpected frame with protVersion %d received"),
Jeff Johnson295189b2012-06-20 16:38:30 -0700665 fc.protVer);
666 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
667#ifdef WLAN_DEBUG
668 pMac->lim.numProtErr++;
669#endif
670 return;
671 }
672
Gopichand Nakkalae0078ce2013-06-11 17:49:16 +0530673 if (!pMac->fScanOffload)
Jeff Johnson295189b2012-06-20 16:38:30 -0700674 {
Gopichand Nakkalae0078ce2013-06-11 17:49:16 +0530675 if (limIsSystemInScanState(pMac))
676 {
677 limHandleFramesInScanState(pMac, limMsg, pRxPacketInfo, pDeferMsg, psessionEntry);
678 return;
679 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700680 }
681
682/* Chance of crashing : to be done BT-AMP ........happens when broadcast probe req is received */
683
684#if 0
685 if (psessionEntry->limSystemRole == eLIM_UNKNOWN_ROLE) {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700686 limLog( pMac, LOGW, FL( "gLimSystemRole is %d. Exiting..." ),psessionEntry->limSystemRole );
Jeff Johnson295189b2012-06-20 16:38:30 -0700687 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr);
688
689#ifdef WLAN_DEBUG
690 pMac->lim.numProtErr++;
691#endif
692 return;
693 }
694 #endif //HACK to continue scanning
695
696
697#ifdef WLAN_DEBUG
698 pMac->lim.numMAC[fc.type][fc.subType]++;
699#endif
700
701 switch (fc.type)
702 {
703 case SIR_MAC_MGMT_FRAME:
704 {
705 #if 0 //TBD-RAJESH fix this
706 if (limIsReassocInProgress( pMac,psessionEntry) && (fc.subType != SIR_MAC_MGMT_DISASSOC) &&
707 (fc.subType != SIR_MAC_MGMT_DEAUTH) && (fc.subType != SIR_MAC_MGMT_REASSOC_RSP))
708 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700709 limLog(pMac, LOGE, FL("Frame with Type - %d, Subtype - %d received in ReAssoc Wait state, dropping..."),
Jeff Johnson295189b2012-06-20 16:38:30 -0700710 fc.type, fc.subType);
711 return;
712 }
713 #endif //HACK to continue scanning
714 // Received Management frame
715 switch (fc.subType)
716 {
717 case SIR_MAC_MGMT_ASSOC_REQ:
718 // Make sure the role supports Association
719 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700720 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700721 )
722 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_ASSOC, psessionEntry);
723
724 else
725 {
726 // Unwanted messages - Log error
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700727 limLog(pMac, LOGE, FL("unexpected message received %X"),limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700728 limPrintMsgName(pMac, LOGE, limMsg->type);
729 }
730 break;
731
732 case SIR_MAC_MGMT_ASSOC_RSP:
733 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_ASSOC,psessionEntry);
734 break;
735
736 case SIR_MAC_MGMT_REASSOC_REQ:
737 // Make sure the role supports Reassociation
738 if ((psessionEntry->limSystemRole == eLIM_BT_AMP_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700739 || (psessionEntry->limSystemRole == eLIM_AP_ROLE)
Jeff Johnson295189b2012-06-20 16:38:30 -0700740 ){
741 limProcessAssocReqFrame(pMac, pRxPacketInfo, LIM_REASSOC, psessionEntry);
742 }
743 else
744 {
745 // Unwanted messages - Log error
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700746 limLog(pMac, LOGE, FL("unexpected message received %X"),limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -0700747 limPrintMsgName(pMac, LOGE, limMsg->type);
748 }
749 break;
750
751 case SIR_MAC_MGMT_REASSOC_RSP:
752 limProcessAssocRspFrame(pMac, pRxPacketInfo, LIM_REASSOC,psessionEntry);
753 break;
754
755 case SIR_MAC_MGMT_PROBE_REQ:
756 limProcessProbeReqFrame_multiple_BSS(pMac, pRxPacketInfo,psessionEntry);
757 break;
758
759 case SIR_MAC_MGMT_PROBE_RSP:
760 if(psessionEntry == NULL)
761 limProcessProbeRspFrameNoSession(pMac, pRxPacketInfo);
762 else
763 limProcessProbeRspFrame(pMac, pRxPacketInfo, psessionEntry);
764 break;
765
766 case SIR_MAC_MGMT_BEACON:
767 __limHandleBeacon(pMac, limMsg,psessionEntry);
768 break;
769
770 case SIR_MAC_MGMT_DISASSOC:
771 limProcessDisassocFrame(pMac, pRxPacketInfo,psessionEntry);
772 break;
773
774 case SIR_MAC_MGMT_AUTH:
775 limProcessAuthFrame(pMac, pRxPacketInfo,psessionEntry);
776 break;
777
778 case SIR_MAC_MGMT_DEAUTH:
779 limProcessDeauthFrame(pMac, pRxPacketInfo,psessionEntry);
780 break;
781
782 case SIR_MAC_MGMT_ACTION:
Jeff Johnson295189b2012-06-20 16:38:30 -0700783 if(psessionEntry == NULL)
784 limProcessActionFrameNoSession(pMac, pRxPacketInfo);
785 else
786 {
Jeff Johnson295189b2012-06-20 16:38:30 -0700787 if (WDA_GET_RX_UNKNOWN_UCAST(pRxPacketInfo))
788 limHandleUnknownA2IndexFrames(pMac, pRxPacketInfo,psessionEntry);
789 else
790 limProcessActionFrame(pMac, pRxPacketInfo,psessionEntry);
Jeff Johnson295189b2012-06-20 16:38:30 -0700791 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700792 break;
793 default:
794 // Received Management frame of 'reserved' subtype
795 break;
796 } // switch (fc.subType)
797
798 }
799 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700800 case SIR_MAC_DATA_FRAME:
801 {
Mohit Khannac0b992f2012-12-04 15:08:18 -0800802#ifdef FEATURE_WLAN_TDLS_INTERNAL
803 /*
804 * if we reach here, following cases are possible.
805 * Possible cases: a) if frame translation is disabled.
806 * b) Some frame with ADRR2 filter enabled may come
807 * here.
808 */
809 tANI_U8 *dataOffset = WDA_GET_RX_MPDU_DATA(pRxPacketInfo);
810 tANI_U8 *rfc1042Hdr = (tANI_U8 *)(dataOffset + RFC1042_HDR_LENGTH) ;
811 tANI_U16 ethType = GET_BE16(rfc1042Hdr) ;
812 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700813 ("TDLS frame with 80211 Header")) ;
Mohit Khannac0b992f2012-12-04 15:08:18 -0800814 if(ETH_TYPE_89_0d == ethType)
815 {
816 tANI_U8 payloadType = (rfc1042Hdr + ETH_TYPE_LEN)[0] ;
817 if(PAYLOAD_TYPE_TDLS == payloadType)
818 {
819 limProcessTdlsFrame(pMac, (tANI_U32*)pRxPacketInfo) ;
820 }
821 }
822#endif
823#ifdef FEATURE_WLAN_CCX
Jeff Johnson295189b2012-06-20 16:38:30 -0700824 /* We accept data frame (IAPP frame) only if Session is
825 * present and ccx connection is established on that
826 * session
827 */
828 if (psessionEntry && psessionEntry->isCCXconnection) {
829 limProcessIappFrame(pMac, pRxPacketInfo, psessionEntry);
830 }
Mohit Khannac0b992f2012-12-04 15:08:18 -0800831#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700832 }
833 break;
Jeff Johnson295189b2012-06-20 16:38:30 -0700834 default:
835 // Received frame of type 'reserved'
836 break;
837
838 } // switch (fc.type)
839
Varun Reddy Yeturu08614702013-04-15 21:58:13 -0700840#ifdef WLAN_FEATURE_ROAM_SCAN_OFFLOAD
841end:
842#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700843 limPktFree(pMac, HAL_TXRX_FRM_802_11_MGMT, pRxPacketInfo, (void *) limMsg->bodyptr) ;
844 return;
845} /*** end limHandle80211Frames() ***/
846
847
848/**
849 * limProcessAbortScanInd()
850 *
851 *FUNCTION:
852 * This function is called from HDD to abort the scan which is presently being run
853 *
854 *
855 *NOTE:
856 *
857 * @param pMac Pointer to Global MAC structure
858 * @param *pMsgBuf A pointer to the SME message buffer
859 * @return None
860 */
861void
862limProcessAbortScanInd(tpAniSirGlobal pMac)
863{
864#ifdef FEATURE_WLAN_DIAG_SUPPORT_LIM //FEATURE_WLAN_DIAG_SUPPORT
865 limDiagEventReport(pMac, WLAN_PE_DIAG_SCAN_ABORT_IND_EVENT, NULL, 0, 0);
866#endif //FEATURE_WLAN_DIAG_SUPPORT
867
868 /* Deactivate the gLimBackgroundScanTimer as part of the abort scan.
869 * SME should send WNI_CFG_BACKGROUND_SCAN_PERIOD indication
870 * to start the background scan again
871 */
Madan Mohan Koyyalamudi8b7f1e62012-10-05 14:56:51 -0700872 PELOG2(limLog(pMac, LOG2, FL("Processing AbortScan Ind"));)
Jeff Johnson295189b2012-06-20 16:38:30 -0700873
874 limAbortBackgroundScan(pMac);
875
876 /* Abort the scan if its running, else just return */
877 if(limIsSystemInScanState(pMac))
878 {
879 if( (eLIM_HAL_INIT_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
880 (eLIM_HAL_START_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
881 (eLIM_HAL_END_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState ) ||
882 (eLIM_HAL_FINISH_SCAN_WAIT_STATE == pMac->lim.gLimHalScanState) )
883 {
884 //Simply signal we need to abort
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700885 limLog( pMac, LOGW, FL(" waiting for HAL, simply signal abort gLimHalScanState = %d"), pMac->lim.gLimHalScanState );
Jeff Johnson295189b2012-06-20 16:38:30 -0700886 pMac->lim.abortScan = 1;
887 }
888 else
889 {
890 //Force abort
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700891 limLog( pMac, LOGW, FL(" Force aborting scan") );
Jeff Johnson295189b2012-06-20 16:38:30 -0700892 pMac->lim.abortScan = 0;
893 limDeactivateAndChangeTimer(pMac, eLIM_MIN_CHANNEL_TIMER);
894 limDeactivateAndChangeTimer(pMac, eLIM_MAX_CHANNEL_TIMER);
895 //Set the resume channel to Any valid channel (invalid).
896 //This will instruct HAL to set it to any previous valid channel.
897 peSetResumeChannel(pMac, 0, 0);
898 limSendHalFinishScanReq(pMac, eLIM_HAL_FINISH_SCAN_WAIT_STATE);
899 }
900 }
901 return;
902}
903
904/**
905 * limMessageProcessor
906 *
907 *FUNCTION:
908 * Wrapper function for limProcessMessages when handling messages received by LIM.
909 * Could either defer messages or process them.
910 * @param pMac Pointer to Global MAC structure
911 * @param limMsg Received LIM message
912 * @return None
913 */
914
915void limMessageProcessor(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
916{
917 if (eLIM_MLM_OFFLINE_STATE == pMac->lim.gLimMlmState)
918 {
919 peFreeMsg(pMac, limMsg);
920 return;
921 }
922
923 if (!defMsgDecision(pMac, limMsg))
924 {
925 limProcessMessages(pMac, limMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700926 // process deferred message queue if allowed
927 {
928 if ( (! (pMac->lim.gLimAddtsSent))
929 &&
930 (! (limIsSystemInScanState(pMac)))
931 )
932 {
933 if (true == GET_LIM_PROCESS_DEFD_MESGS(pMac))
934 limProcessDeferredMessageQueue(pMac);
935 }
936 }
Jeff Johnson295189b2012-06-20 16:38:30 -0700937 }
938}
939
Jeff Johnsone7245742012-09-05 17:12:55 -0700940#ifdef FEATURE_OEM_DATA_SUPPORT
941
942void limOemDataRspHandleResumeLinkRsp(tpAniSirGlobal pMac, eHalStatus status, tANI_U32* mlmOemDataRsp)
943{
944 if(status != eHAL_STATUS_SUCCESS)
945 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700946 limLog(pMac, LOGE, FL("OEM Data Rsp failed to get the response for resume link"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700947 }
948
949 if(NULL != pMac->lim.gpLimMlmOemDataReq)
950 {
951 palFreeMemory(pMac->hHdd, pMac->lim.gpLimMlmOemDataReq);
952 pMac->lim.gpLimMlmOemDataReq = NULL;
953 }
954
955 //"Failure" status doesn't mean that Oem Data Rsp did not happen
956 //and hence we need to respond to upper layers. Only Resume link is failed, but
957 //we got the oem data response already.
958 //Post the meessage to MLM
959 limPostSmeMessage(pMac, LIM_MLM_OEM_DATA_CNF, (tANI_U32*)(mlmOemDataRsp));
960
961 return;
962}
963
964void limProcessOemDataRsp(tpAniSirGlobal pMac, tANI_U32* body)
965{
966 eHalStatus status = eHAL_STATUS_SUCCESS;
967 tpLimMlmOemDataRsp mlmOemDataRsp = NULL;
968 tpStartOemDataRsp oemDataRsp = NULL;
969
970 //Process all the messages for the lim queue
971 SET_LIM_PROCESS_DEFD_MESGS(pMac, true);
972
973 oemDataRsp = (tpStartOemDataRsp)(body);
974
975 status = palAllocateMemory(pMac->hHdd, (void**)(&mlmOemDataRsp), sizeof(tLimMlmOemDataRsp));
976 if(status != eHAL_STATUS_SUCCESS)
977 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -0700978 limLog(pMac, LOGP, FL("could not allocate memory for mlmOemDataRsp"));
Jeff Johnsone7245742012-09-05 17:12:55 -0700979 return;
980 }
981
982 //copy the memory into tLimMlmOemDataRsp and free the tStartOemDataRsp
983 //the structures tStartOemDataRsp and tLimMlmOemDataRsp have the same structure
984 palCopyMemory(pMac->hHdd, (void*)(mlmOemDataRsp), (void*)(oemDataRsp), sizeof(tLimMlmOemDataRsp));
985
986 //Now free the incoming memory
987 palFreeMemory(pMac->hHdd, (void*)(oemDataRsp));
988
989 limResumeLink(pMac, limOemDataRspHandleResumeLinkRsp, (tANI_U32*)mlmOemDataRsp);
990
991 return;
992}
993
994#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700995
996
997/**
998 * limProcessMessages
999 *
1000 *FUNCTION:
1001 * This function is called by limProcessMessageQueue function. This
1002 * function processes messages received by LIM.
1003 *
1004 *LOGIC:
1005 * Depending on the message type, corresponding function will be
1006 * called, for example limProcessSmeMessages() will be called to
1007 * process SME messages received from HDD/Upper layer software module.
1008 *
1009 *ASSUMPTIONS:
1010 * NA
1011 *
1012 *NOTE:
1013 * NA
1014 *
1015 * @param pMac Pointer to Global MAC structure
1016 * @param limMsg Received LIM message
1017 * @return None
1018 */
1019
1020void
1021limProcessMessages(tpAniSirGlobal pMac, tpSirMsgQ limMsg)
1022{
1023 tANI_U8 deferMsg = false;
1024 tLinkStateParams *linkStateParams;
1025#if defined WLAN_FEATURE_VOWIFI_11R
1026 tpPESession pSession;
1027#endif
1028#if defined(ANI_DVT_DEBUG)
1029 tSirMsgQ msgQ;
1030#endif
1031 if(pMac->gDriverType == eDRIVER_TYPE_MFG)
1032 {
Jeff Johnsone7245742012-09-05 17:12:55 -07001033 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1034 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001035 return;
1036 }
1037#ifdef WLAN_DEBUG
1038 pMac->lim.numTot++;
1039#endif
1040
1041
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001042 PELOG3(limLog(pMac, LOG3, FL("rcvd msgType = %s, sme state = %s, mlm state = %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001043 limMsgStr(limMsg->type), limSmeStateStr(pMac->lim.gLimSmeState),
1044 limMlmStateStr(pMac->lim.gLimMlmState));)
1045
Jeff Johnsone7245742012-09-05 17:12:55 -07001046 MTRACE(macTraceMsgRx(pMac, NO_SESSION, LIM_TRACE_MAKE_RXMSG(limMsg->type, LIM_MSG_PROCESSED));)
Jeff Johnson295189b2012-06-20 16:38:30 -07001047
1048 switch (limMsg->type)
1049 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001050
1051 case SIR_LIM_UPDATE_BEACON:
1052 limUpdateBeacon(pMac);
1053 break;
1054
Jeff Johnson295189b2012-06-20 16:38:30 -07001055 case SIR_CFG_PARAM_UPDATE_IND:
1056 /// CFG parameter updated
1057 if (limIsSystemInScanState(pMac))
1058 {
1059 // System is in DFS (Learn) mode
1060 // Defer processsing this message
1061 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1062 {
Leela Venkata Kiran Kumar Reddy Chirala240845a2013-03-22 19:21:10 -07001063 if(!(pMac->lim.deferredMsgCnt & 0xF))
1064 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001065 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 -07001066 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1067 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
Leela Venkata Kiran Kumar Reddy Chirala240845a2013-03-22 19:21:10 -07001068 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001069 limLogSessionStates(pMac);
1070 limPrintMsgName(pMac, LOGE, limMsg->type);
1071 }
1072 }
1073 else
1074 {
1075 limHandleCFGparamUpdate(pMac, limMsg->bodyval);
1076 }
1077
1078 break;
1079
1080 case WDA_INIT_SCAN_RSP:
1081 limProcessInitScanRsp(pMac, limMsg->bodyptr);
1082 break;
1083
1084 case WDA_START_SCAN_RSP:
1085 limProcessStartScanRsp(pMac, limMsg->bodyptr);
1086 break;
1087
1088 case WDA_END_SCAN_RSP:
1089 limProcessEndScanRsp(pMac, limMsg->bodyptr);
1090 break;
1091
1092 case WDA_FINISH_SCAN_RSP:
1093 limProcessFinishScanRsp(pMac, limMsg->bodyptr);
1094 break;
Jeff Johnsone7245742012-09-05 17:12:55 -07001095#ifdef FEATURE_OEM_DATA_SUPPORT
1096 case WDA_START_OEM_DATA_RSP:
1097 limProcessOemDataRsp(pMac, limMsg->bodyptr);
1098 break;
1099#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001100
1101 case WDA_SWITCH_CHANNEL_RSP:
1102 limProcessSwitchChannelRsp(pMac, limMsg->bodyptr);
1103 break;
1104
1105#ifdef ANI_SIR_IBSS_PEER_CACHING
1106 case WDA_IBSS_STA_ADD:
1107 limIbssStaAdd(pMac, limMsg->bodyptr);
1108 break;
1109#endif
1110 case SIR_BB_XPORT_MGMT_MSG:
1111 // These messages are from Peer MAC entity.
1112#ifdef WLAN_DEBUG
1113 pMac->lim.numBbt++;
1114#endif
1115
Jeff Johnson295189b2012-06-20 16:38:30 -07001116 {
1117 v_U16_t pktLen = 0;
1118 vos_pkt_t *pVosPkt;
1119 VOS_STATUS vosStatus;
1120 tSirMsgQ limMsgNew;
Mohit Khannac0b992f2012-12-04 15:08:18 -08001121#ifdef FEATURE_WLAN_TDLS_INTERNAL
1122 tANI_U32 *pBD = NULL ;
1123#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001124
1125 /* The original limMsg which we were deferring have the
1126 * bodyPointer point to 'BD' instead of 'Vos pkt'. If we don't make a copy
1127 * of limMsg, then vos_pkt_peek_data will overwrite the limMsg->bodyPointer.
1128 * and next time when we try to process the msg, we will try to use 'BD' as
1129 * 'Vos Pkt' which will cause a crash
1130 */
1131 palCopyMemory(pMac, (tANI_U8*)&limMsgNew, (tANI_U8*)limMsg, sizeof(tSirMsgQ));
1132 pVosPkt = (vos_pkt_t *)limMsgNew.bodyptr;
1133 vos_pkt_get_packet_length(pVosPkt, &pktLen);
1134
1135 vosStatus = WDA_DS_PeekRxPacketInfo( pVosPkt, (v_PVOID_t *)&limMsgNew.bodyptr, VOS_FALSE );
1136
1137 if( !VOS_IS_STATUS_SUCCESS(vosStatus) )
1138 {
1139 vos_pkt_return_packet(pVosPkt);
1140 break;
1141
1142 }
Mohit Khannac0b992f2012-12-04 15:08:18 -08001143#ifdef FEATURE_WLAN_TDLS_INTERNAL
1144 /*
1145 * TDLS frames comes as translated frames as well as
1146 * MAC 802.11 data frames..
1147 */
1148 limGetBDfromRxPacket(pMac, limMsgNew.bodyptr, &pBD);
1149 if(0 != WDA_GET_RX_FT_DONE(pBD))
1150 {
1151 /*
1152 * TODO: check for scanning state and set deferMesg flag
1153 * accordingly..
1154 */
1155 deferMsg = false ;
1156
1157 limProcessTdlsFrame(pMac, pBD) ;
1158 }
1159 else
1160#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001161 limHandle80211Frames(pMac, &limMsgNew, &deferMsg);
1162
1163 if ( deferMsg == true )
1164 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001165 PELOG1(limLog(pMac, LOG1, FL("Defer message type=%X "), limMsg->type);)
Jeff Johnson295189b2012-06-20 16:38:30 -07001166 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1167 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001168 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 -07001169 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1170 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1171 limLogSessionStates(pMac);
1172 limPrintMsgName(pMac, LOGE, limMsg->type);
1173 vos_pkt_return_packet(pVosPkt);
1174 }
1175 }
1176 else
1177 {
1178 /* PE is not deferring this 802.11 frame so we need to call vos_pkt_return.
1179 * Asumption here is when Rx mgmt frame processing is done,
1180 * voss packet could be freed here.
1181 */
1182 vos_pkt_return_packet(pVosPkt);
1183 }
1184 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001185 break;
1186
1187 case eWNI_SME_SCAN_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001188 case eWNI_SME_REMAIN_ON_CHANNEL_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001189 case eWNI_SME_DISASSOC_REQ:
1190 case eWNI_SME_DEAUTH_REQ:
1191 case eWNI_SME_STA_STAT_REQ:
1192 case eWNI_SME_AGGR_STAT_REQ:
1193 case eWNI_SME_GLOBAL_STAT_REQ:
1194 case eWNI_SME_STAT_SUMM_REQ:
1195 case eWNI_SME_GET_SCANNED_CHANNEL_REQ:
1196 case eWNI_SME_GET_STATISTICS_REQ:
Srinivas Girigowda2471d832013-01-25 13:33:11 -08001197#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
1198 case eWNI_SME_GET_ROAM_RSSI_REQ:
1199#endif
Jeff Johnsone7245742012-09-05 17:12:55 -07001200#ifdef FEATURE_OEM_DATA_SUPPORT
1201 case eWNI_SME_OEM_DATA_REQ:
1202#endif
Mohit Khannac0b992f2012-12-04 15:08:18 -08001203#ifdef FEATURE_WLAN_TDLS
1204 case eWNI_SME_TDLS_SEND_MGMT_REQ:
1205 case eWNI_SME_TDLS_ADD_STA_REQ:
1206 case eWNI_SME_TDLS_DEL_STA_REQ:
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05301207 case eWNI_SME_TDLS_LINK_ESTABLISH_REQ:
Mohit Khannac0b992f2012-12-04 15:08:18 -08001208#endif
1209#ifdef FEATURE_WLAN_TDLS_INTERNAL
1210 case eWNI_SME_TDLS_DISCOVERY_START_REQ:
1211 case eWNI_SME_TDLS_LINK_START_REQ:
1212 case eWNI_SME_TDLS_TEARDOWN_REQ:
1213#endif
Gopichand Nakkala2b248b02013-03-07 17:05:07 +05301214 case eWNI_SME_RESET_AP_CAPS_CHANGED:
Jeff Johnson295189b2012-06-20 16:38:30 -07001215 // These messages are from HDD
1216 limProcessNormalHddMsg(pMac, limMsg, true); //need to response to hdd
1217 break;
1218
1219 case eWNI_SME_SCAN_ABORT_IND:
1220 vos_mem_free((v_VOID_t *)limMsg->bodyptr);
1221 limMsg->bodyptr = NULL;
1222 limProcessAbortScanInd(pMac);
1223 break;
1224
1225 case eWNI_SME_START_REQ:
1226 case eWNI_SME_SYS_READY_IND:
1227#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1228 case eWNI_SME_JOIN_REQ:
1229#endif
1230 case eWNI_SME_AUTH_REQ:
1231 case eWNI_SME_REASSOC_REQ:
1232 case eWNI_SME_START_BSS_REQ:
1233 case eWNI_SME_STOP_BSS_REQ:
1234 case eWNI_SME_SWITCH_CHL_REQ:
1235 case eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ:
1236 case eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ:
1237 case eWNI_SME_SETCONTEXT_REQ:
1238 case eWNI_SME_REMOVEKEY_REQ:
1239#ifndef WNI_ASKEY_NON_SUPPORT_FEATURE
1240 case eWNI_SME_PROMISCUOUS_MODE_REQ:
1241#endif
1242 case eWNI_SME_DISASSOC_CNF:
1243 case eWNI_SME_DEAUTH_CNF:
1244 case eWNI_SME_ASSOC_CNF:
1245 case eWNI_SME_REASSOC_CNF:
1246 case eWNI_SME_ADDTS_REQ:
1247 case eWNI_SME_DELTS_REQ:
1248 case eWNI_SME_DEL_BA_PEER_IND:
1249 case eWNI_SME_SET_TX_POWER_REQ:
1250 case eWNI_SME_GET_TX_POWER_REQ:
1251 case eWNI_SME_GET_NOISE_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001252 case eWNI_SME_GET_ASSOC_STAS_REQ:
1253 case eWNI_SME_TKIP_CNTR_MEAS_REQ:
1254 case eWNI_SME_UPDATE_APWPSIE_REQ:
1255 case eWNI_SME_HIDE_SSID_REQ:
1256 case eWNI_SME_GET_WPSPBC_SESSION_REQ:
1257 case eWNI_SME_SET_APWPARSNIEs_REQ:
Madan Mohan Koyyalamudi167b95e2012-11-27 15:53:38 -08001258 case eWNI_SME_CHNG_MCC_BEACON_INTERVAL:
Jeff Johnson295189b2012-06-20 16:38:30 -07001259#if defined WLAN_FEATURE_VOWIFI
1260 case eWNI_SME_NEIGHBOR_REPORT_REQ_IND:
1261 case eWNI_SME_BEACON_REPORT_RESP_XMIT_IND:
1262#endif
1263#if defined FEATURE_WLAN_CCX
1264 case eWNI_SME_CCX_ADJACENT_AP_REPORT:
1265#endif
1266#ifdef WLAN_FEATURE_VOWIFI_11R
1267 case eWNI_SME_FT_UPDATE_KEY:
1268 case eWNI_SME_FT_PRE_AUTH_REQ:
1269 case eWNI_SME_FT_AGGR_QOS_REQ:
1270#endif
1271 case eWNI_SME_ADD_STA_SELF_REQ:
1272 case eWNI_SME_DEL_STA_SELF_REQ:
Jeff Johnson295189b2012-06-20 16:38:30 -07001273 case eWNI_SME_REGISTER_MGMT_FRAME_REQ:
1274 case eWNI_SME_UPDATE_NOA:
Gopichand Nakkala431db382013-05-30 19:53:39 +05301275 case eWNI_SME_CLEAR_DFS_CHANNEL_LIST:
Jeff Johnson295189b2012-06-20 16:38:30 -07001276 // These messages are from HDD
1277 limProcessNormalHddMsg(pMac, limMsg, false); //no need to response to hdd
1278 break;
1279
1280 //Power Save Messages From HDD
1281 case eWNI_PMC_PWR_SAVE_CFG:
1282 case eWNI_PMC_ENTER_BMPS_REQ:
1283 case eWNI_PMC_EXIT_BMPS_REQ:
1284 case eWNI_PMC_ENTER_IMPS_REQ:
1285 case eWNI_PMC_EXIT_IMPS_REQ:
1286 case eWNI_PMC_ENTER_UAPSD_REQ:
1287 case eWNI_PMC_EXIT_UAPSD_REQ:
1288 case eWNI_PMC_ENTER_WOWL_REQ:
1289 case eWNI_PMC_EXIT_WOWL_REQ:
1290 case eWNI_PMC_WOWL_ADD_BCAST_PTRN:
1291 case eWNI_PMC_WOWL_DEL_BCAST_PTRN:
1292 pmmProcessMessage(pMac, limMsg);
1293 break;
1294
1295 case eWNI_PMC_SMPS_STATE_IND :
1296 {
Jeff Johnson295189b2012-06-20 16:38:30 -07001297 if(limMsg->bodyptr){
1298 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1299 limMsg->bodyptr = NULL;
1300 }
1301 }
1302 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001303 case eWNI_SME_SEND_ACTION_FRAME_IND:
1304 limSendP2PActionFrame(pMac, limMsg);
1305 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1306 limMsg->bodyptr = NULL;
1307 break;
1308 case eWNI_SME_ABORT_REMAIN_ON_CHAN_IND:
1309 limAbortRemainOnChan(pMac);
1310 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1311 limMsg->bodyptr = NULL;
1312 break;
1313
Viral Modi9dc288a2012-12-10 13:09:21 -08001314 case SIR_HAL_P2P_NOA_START_IND:
1315 {
1316 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1317 tANI_U8 i;
Viral Modid871f222013-03-06 02:25:31 -08001318 tANI_U8 p2pGOExists = 0;
Gopichand Nakkala271463a2013-05-13 16:39:49 +05301319
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001320 limLog(pMac, LOG1, "LIM received NOA start %x", limMsg->type);
Viral Modid871f222013-03-06 02:25:31 -08001321
1322 /* Since insert NOA is done and NOA start msg received, we should deactivate the Insert NOA timer */
1323 limDeactivateAndChangeTimer(pMac, eLIM_INSERT_SINGLESHOT_NOA_TIMER);
1324
Viral Modi9dc288a2012-12-10 13:09:21 -08001325 for(i=0; i < pMac->lim.maxBssId; i++)
1326 {
1327 psessionEntry = &pMac->lim.gpSession[i];
1328 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
1329 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1330 { //Save P2P NOA start attributes for P2P Go persona
Viral Modid871f222013-03-06 02:25:31 -08001331 p2pGOExists = 1;
Viral Modi9dc288a2012-12-10 13:09:21 -08001332 palCopyMemory(pMac->hHdd, &psessionEntry->p2pGoPsNoaStartInd, limMsg->bodyptr, sizeof(tSirP2PNoaStart));
Viral Modid871f222013-03-06 02:25:31 -08001333 if (psessionEntry->p2pGoPsNoaStartInd.status != eHAL_STATUS_SUCCESS)
Viral Modi9dc288a2012-12-10 13:09:21 -08001334 {
Viral Modid871f222013-03-06 02:25:31 -08001335 limLog(pMac, LOGW, FL("GO NOA start failure status %d reported by FW."
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001336 " - still go ahead with deferred sme req. This is just info"),
Viral Modid871f222013-03-06 02:25:31 -08001337 psessionEntry->p2pGoPsNoaStartInd.status);
Viral Modi9dc288a2012-12-10 13:09:21 -08001338 }
Viral Modi9dc288a2012-12-10 13:09:21 -08001339 break;
1340 }
1341 }
Viral Modid871f222013-03-06 02:25:31 -08001342
1343 if (p2pGOExists == 0)
1344 {
1345 limLog(pMac, LOGW, FL("By the time, we received NOA start, GO is already removed."
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001346 " - still go ahead with deferred sme req. This is just info"));
Viral Modid871f222013-03-06 02:25:31 -08001347 }
1348
1349 /* We received the NOA start indication. Now we can send down the SME request which requires off-channel operation */
1350 limProcessRegdDefdSmeReqAfterNOAStart(pMac);
Viral Modi9dc288a2012-12-10 13:09:21 -08001351 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1352 limMsg->bodyptr = NULL;
Viral Modid871f222013-03-06 02:25:31 -08001353 }
Viral Modi9dc288a2012-12-10 13:09:21 -08001354 break;
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05301355#ifdef FEATURE_WLAN_TDLS
1356 case SIR_HAL_TDLS_IND:
1357 {
1358 tSirTdlsInd *pTdlsInd = (tpSirTdlsInd)limMsg->bodyptr ;
1359 tpDphHashNode pStaDs = NULL ;
1360 tpPESession psessionEntry = NULL;
1361 tANI_U8 sessionId;
1362 if((psessionEntry = peFindSessionByStaId(pMac,pTdlsInd->staIdx,&sessionId))== NULL)
1363 {
1364 limLog(pMac, LOG1, FL("session does not exist for given bssId\n"));
1365 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1366 limMsg->bodyptr = NULL;
1367 return;
1368 }
1369 if ((pStaDs = dphGetHashEntry(pMac, pTdlsInd->assocId, &psessionEntry->dph.dphHashTable)) == NULL)
1370 {
1371 limLog(pMac, LOG1, FL("pStaDs Does not exist for given staId\n"));
1372 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1373 limMsg->bodyptr = NULL;
1374 return;
1375 }
Viral Modi9dc288a2012-12-10 13:09:21 -08001376
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05301377 if ((STA_ENTRY_TDLS_PEER == pStaDs->staType))
1378 {
1379 limLog(pMac, LOGE,
1380 FL("received TDLS Indication from the Firmware with Reason Code %d "),
1381 pTdlsInd->reasonCode);
1382 limSendSmeTDLSDelStaInd(pMac, pStaDs, psessionEntry,
1383 /*pTdlsInd->reasonCode*/eSIR_MAC_TDLS_TEARDOWN_PEER_UNREACHABLE);
1384 }
1385 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1386 limMsg->bodyptr = NULL;
1387 }
1388 break;
1389#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001390 case SIR_HAL_P2P_NOA_ATTR_IND:
1391 {
1392 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1393 tANI_U8 i;
1394
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001395 limLog(pMac, LOGW, FL("Received message Noa_ATTR %x"), limMsg->type);
Jeff Johnson295189b2012-06-20 16:38:30 -07001396 for(i=0; i < pMac->lim.maxBssId; i++)
1397 {
Viral Modi9dc288a2012-12-10 13:09:21 -08001398 psessionEntry = &pMac->lim.gpSession[i];
1399 if ( (psessionEntry != NULL) && (psessionEntry->valid) &&
Jeff Johnson295189b2012-06-20 16:38:30 -07001400 (psessionEntry->pePersona == VOS_P2P_GO_MODE))
1401 { //Save P2P attributes for P2P Go persona
1402
1403 palCopyMemory(pMac->hHdd,&psessionEntry->p2pGoPsUpdate, limMsg->bodyptr,sizeof(tSirP2PNoaAttr));
1404
1405
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001406 limLog(pMac, LOG2, FL(" &psessionEntry->bssId%02x:%02x:%02x:%02x:%02x:%02x ctWin=%d oppPsFlag=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001407 psessionEntry->bssId[0],
1408 psessionEntry->bssId[1],
1409 psessionEntry->bssId[2],
1410 psessionEntry->bssId[3],
1411 psessionEntry->bssId[4],
1412 psessionEntry->bssId[5],
1413 psessionEntry->p2pGoPsUpdate.ctWin,
1414 psessionEntry->p2pGoPsUpdate.oppPsFlag);
1415
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001416 limLog(pMac, LOG2, FL(" uNoa1IntervalCnt=%d uNoa1Duration=%d uNoa1Interval=%d uNoa1StartTime=%d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001417 psessionEntry->p2pGoPsUpdate.uNoa1IntervalCnt,
1418 psessionEntry->p2pGoPsUpdate.uNoa1Duration,
1419 psessionEntry->p2pGoPsUpdate.uNoa1Interval,
1420 psessionEntry->p2pGoPsUpdate.uNoa1StartTime);
1421
1422
1423 break;
1424 }
1425 }
1426
1427 }
1428 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1429 limMsg->bodyptr = NULL;
1430
1431 break;
1432
1433
Jeff Johnson295189b2012-06-20 16:38:30 -07001434 /* eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER Message comes after the
1435 * device comes out of full power for the full power request sent
1436 * because of channel switch with switch count as 0, so call the same
1437 * function used in timeout case(i.e SIR_LIM_CHANNEL_SWITCH_TIMEOUT)
1438 * for switching the channel*/
1439 case eWNI_SME_PRE_CHANNEL_SWITCH_FULL_POWER:
Jeff Johnsone7245742012-09-05 17:12:55 -07001440 if ( !tx_timer_running(&pMac->lim.limTimers.gLimChannelSwitchTimer) )
1441 {
1442 limProcessChannelSwitchTimeout(pMac);
1443 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001444 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1445 limMsg->bodyptr = NULL;
1446 break;
1447
1448 //Power Save Related Messages From HAL
1449 case WDA_ENTER_BMPS_RSP:
1450 case WDA_EXIT_BMPS_RSP:
1451 case WDA_EXIT_BMPS_IND:
1452 case WDA_ENTER_IMPS_RSP:
1453 case WDA_EXIT_IMPS_RSP:
1454 case WDA_ENTER_UAPSD_RSP:
1455 case WDA_EXIT_UAPSD_RSP:
1456 case WDA_WOWL_ENTER_RSP:
1457 case WDA_WOWL_EXIT_RSP:
1458 pmmProcessMessage(pMac, limMsg);
1459 break;
1460
1461 case WDA_LOW_RSSI_IND:
1462 //limHandleLowRssiInd(pMac);
1463 break;
1464
1465 case WDA_BMPS_STATUS_IND:
1466 limHandleBmpsStatusInd(pMac);
1467 break;
1468
1469 case WDA_MISSED_BEACON_IND:
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001470 limHandleMissedBeaconInd(pMac, limMsg);
1471 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1472 limMsg->bodyptr = NULL;
Jeff Johnson295189b2012-06-20 16:38:30 -07001473 break;
1474 case WDA_MIC_FAILURE_IND:
1475 limMicFailureInd(pMac, limMsg);
1476 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1477 limMsg->bodyptr = NULL;
1478 break;
1479
1480
Jeff Johnson295189b2012-06-20 16:38:30 -07001481
1482 case SIR_LIM_ADDTS_RSP_TIMEOUT:
1483 limProcessSmeReqMessages(pMac,limMsg);
1484 break;
1485#ifdef FEATURE_WLAN_CCX
1486 case SIR_LIM_CCX_TSM_TIMEOUT:
1487 limProcessTsmTimeoutHandler(pMac,limMsg);
1488 break;
1489 case WDA_TSM_STATS_RSP:
1490 limProcessHalCcxTsmRsp(pMac, limMsg);
1491 break;
1492#endif
1493 case WDA_ADD_TS_RSP:
1494 limProcessHalAddTsRsp(pMac, limMsg);
1495 break;
1496
1497 case SIR_LIM_DEL_TS_IND:
1498 limProcessDelTsInd(pMac, limMsg);
Madan Mohan Koyyalamudif244d8f2012-11-29 11:21:05 -08001499 break;
Jeff Johnson295189b2012-06-20 16:38:30 -07001500 case SIR_LIM_ADD_BA_IND:
1501 limProcessAddBaInd(pMac, limMsg);
1502 break;
1503 case SIR_LIM_DEL_BA_ALL_IND:
Kiran Kumar Lokereb3c42b62013-05-29 14:29:43 -07001504 limDelAllBASessions(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001505 break;
1506 case SIR_LIM_DEL_BA_IND:
1507 limProcessMlmHalBADeleteInd( pMac, limMsg );
1508 break;
1509
1510 case SIR_LIM_BEACON_GEN_IND: {
Jeff Johnson295189b2012-06-20 16:38:30 -07001511
Jeff Johnson295189b2012-06-20 16:38:30 -07001512 if( pMac->lim.gLimSystemRole != eLIM_AP_ROLE )
Jeff Johnson295189b2012-06-20 16:38:30 -07001513 schProcessPreBeaconInd(pMac, limMsg);
1514
1515 }
1516 break;
1517
1518 case SIR_LIM_DELETE_STA_CONTEXT_IND:
1519 limDeleteStaContext(pMac, limMsg);
1520 break;
1521
1522 case SIR_LIM_MIN_CHANNEL_TIMEOUT:
1523 case SIR_LIM_MAX_CHANNEL_TIMEOUT:
1524 case SIR_LIM_PERIODIC_PROBE_REQ_TIMEOUT:
1525 case SIR_LIM_JOIN_FAIL_TIMEOUT:
Madan Mohan Koyyalamudi9aff9ff2012-11-29 11:27:25 -08001526 case SIR_LIM_PERIODIC_JOIN_PROBE_REQ_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001527 case SIR_LIM_AUTH_FAIL_TIMEOUT:
1528 case SIR_LIM_AUTH_RSP_TIMEOUT:
1529 case SIR_LIM_ASSOC_FAIL_TIMEOUT:
1530 case SIR_LIM_REASSOC_FAIL_TIMEOUT:
1531#ifdef WLAN_FEATURE_VOWIFI_11R
1532 case SIR_LIM_FT_PREAUTH_RSP_TIMEOUT:
1533#endif
Jeff Johnson295189b2012-06-20 16:38:30 -07001534 case SIR_LIM_REMAIN_CHN_TIMEOUT:
Viral Modi9dc288a2012-12-10 13:09:21 -08001535 case SIR_LIM_INSERT_SINGLESHOT_NOA_TIMEOUT:
Madan Mohan Koyyalamudi521ff192012-11-15 17:13:08 -08001536 case SIR_LIM_DISASSOC_ACK_TIMEOUT:
1537 case SIR_LIM_DEAUTH_ACK_TIMEOUT:
Gopichand Nakkala59a7b432013-05-10 02:50:47 +05301538 case SIR_LIM_CONVERT_ACTIVE_CHANNEL_TO_PASSIVE:
Jeff Johnson295189b2012-06-20 16:38:30 -07001539 // These timeout messages are handled by MLM sub module
1540
1541 limProcessMlmReqMessages(pMac,
1542 limMsg);
1543
1544 break;
1545
1546 case SIR_LIM_HEART_BEAT_TIMEOUT:
1547 /** check if heart beat failed, even if one Beacon
1548 * is rcvd within the Heart Beat interval continue
1549 * normal processing
1550 */
1551
1552 #if 0
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001553 PELOG1(limLog(pMac, LOG1, FL("Heartbeat timeout, SME %d, MLME %d, #bcn %d"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001554 pMac->lim.gLimSmeState, pMac->lim.gLimMlmState,
1555 pMac->lim.gLimRxedBeaconCntDuringHB);)
1556
1557 if(pMac->lim.gLimSystemRole == eLIM_STA_IN_IBSS_ROLE)
1558 limIbssHeartBeatHandle(pMac); //HeartBeat for peers.
1559 else
1560 /**
1561 * Heartbeat failure occurred on STA
1562 * This is handled by LMM sub module.
1563 */
1564 limHandleHeartBeatFailure(pMac);
1565
1566 break;
1567 #endif //TO SUPPORT BT-AMP
Yathishd8713192012-12-10 14:21:35 -08001568 if (limIsSystemInScanState(pMac))
1569 {
1570 // System is in DFS (Learn) mode
1571 // Defer processsing this message
1572 if (limDeferMsg(pMac, limMsg) != TX_SUCCESS)
1573 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001574 PELOGE(limLog(pMac, LOGE, FL("Unable to Defer message(0x%X) limSmeState %d (prev sme state %d) sysRole %d mlm state %d (prev mlm state %d)"),
Yathishd8713192012-12-10 14:21:35 -08001575 limMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
1576 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
1577 limLogSessionStates(pMac);
1578 }
1579 }
1580 else
1581 {
Gopichand Nakkala271463a2013-05-13 16:39:49 +05301582#if defined(FEATURE_WLAN_TDLS) && defined(FEATURE_WLAN_TDLS_OXYGEN_DISAPPEAR_AP)
1583 tpPESession psessionEntry = &pMac->lim.gpSession[0];
1584 for (i=0; i < pMac->lim.maxBssId; i++)
1585 {
1586 psessionEntry = &pMac->lim.gpSession[i];
1587 if ((psessionEntry != NULL) && (psessionEntry->valid) &&
1588 ((psessionEntry->pePersona == VOS_P2P_CLIENT_MODE) ||
1589 (psessionEntry->pePersona == VOS_STA_MODE)))
1590 {
1591 if ((TRUE == pMac->lim.gLimTDLSOxygenSupport) &&
1592 (limGetTDLSPeerCount(pMac, psessionEntry) != 0)) {
1593 if (limMsg->bodyptr) {
1594 palFreeMemory(pMac->hHdd, (tANI_U8 *)limMsg->bodyptr);
1595 limMsg->bodyptr = NULL;
1596 }
1597 return;
1598 }
1599 }
1600 }
1601#endif
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001602 if (NULL == limMsg->bodyptr)
1603 {
1604 limHandleHeartBeatTimeout(pMac);
1605 }
1606 else
1607 {
1608 limHandleHeartBeatTimeoutForSession(pMac, (tpPESession)limMsg->bodyptr);
1609 }
Gopichand Nakkala271463a2013-05-13 16:39:49 +05301610 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001611 break;
Leela Venkata Kiran Kumar Reddy Chirala949300d2013-02-27 19:50:05 -08001612
Jeff Johnson295189b2012-06-20 16:38:30 -07001613 case SIR_LIM_PROBE_HB_FAILURE_TIMEOUT:
1614 limHandleHeartBeatFailureTimeout(pMac);
1615 break;
1616
1617 case SIR_LIM_CHANNEL_SCAN_TIMEOUT:
Jeff Johnson295189b2012-06-20 16:38:30 -07001618 /**
1619 * Background scan timeout occurred on STA.
1620 * This is handled by LMM sub module.
1621 */
1622 limDeactivateAndChangeTimer(pMac, eLIM_BACKGROUND_SCAN_TIMER);
1623
1624 //We will do background scan even in bcnps mode
1625 //if (pMac->sys.gSysEnableScanMode)
1626 pMac->lim.gLimReportBackgroundScanResults = FALSE;
1627 limTriggerBackgroundScan(pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -07001628 break;
1629
Jeff Johnson295189b2012-06-20 16:38:30 -07001630
1631 case SIR_LIM_HASH_MISS_THRES_TIMEOUT:
1632
1633 /*
1634 ** clear the credit to the send disassociate frame bucket
1635 **/
1636
1637 pMac->lim.gLimDisassocFrameCredit = 0;
1638 break;
1639
1640 case SIR_LIM_CNF_WAIT_TIMEOUT:
1641
1642 /*
1643 ** Does not receive CNF or dummy packet
1644 **/
1645 limHandleCnfWaitTimeout(pMac, (tANI_U16) limMsg->bodyval);
1646
1647 break;
1648
1649 case SIR_LIM_KEEPALIVE_TIMEOUT:
1650 limSendKeepAliveToPeer(pMac);
1651
1652 break;
1653
1654 case SIR_LIM_RETRY_INTERRUPT_MSG:
1655 // Message from ISR upon TFP's max retry limit interrupt
1656
1657 break;
1658
1659 case SIR_LIM_INV_KEY_INTERRUPT_MSG:
1660 // Message from ISR upon SP's Invalid session key interrupt
1661
1662 break;
1663
1664 case SIR_LIM_KEY_ID_INTERRUPT_MSG:
1665 // Message from ISR upon SP's Invalid key ID interrupt
1666
1667 break;
1668
1669 case SIR_LIM_REPLAY_THRES_INTERRUPT_MSG:
1670 // Message from ISR upon SP's Replay threshold interrupt
1671
1672 break;
1673
1674 case SIR_LIM_CHANNEL_SWITCH_TIMEOUT:
1675 limProcessChannelSwitchTimeout(pMac);
1676 break;
1677
1678 case SIR_LIM_QUIET_TIMEOUT:
1679 limProcessQuietTimeout(pMac);
1680 break;
1681
1682 case SIR_LIM_QUIET_BSS_TIMEOUT:
1683 limProcessQuietBssTimeout(pMac);
1684 break;
1685
Jeff Johnson295189b2012-06-20 16:38:30 -07001686 case SIR_LIM_UPDATE_OLBC_CACHEL_TIMEOUT:
1687 limHandleUpdateOlbcCache(pMac);
1688 break;
1689#if 0
1690 case SIR_LIM_WPS_OVERLAP_TIMEOUT:
1691 limProcessWPSOverlapTimeout(pMac);
1692 break;
1693#endif
1694
Jeff Johnson295189b2012-06-20 16:38:30 -07001695
Mohit Khannac0b992f2012-12-04 15:08:18 -08001696#ifdef FEATURE_WLAN_TDLS_INTERNAL
1697 /*
1698 * Here discovery timer expires, now we can go ahead and collect all
1699 * the dicovery responses PE has process till now and send this
1700 * responses to SME..
1701 */
1702 case SIR_LIM_TDLS_DISCOVERY_RSP_WAIT:
1703 {
1704 //fetch the sessionEntry based on the sessionId
1705 tpPESession psessionEntry = peFindSessionBySessionId(pMac,
1706 pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId) ;
1707 if(NULL == psessionEntry)
1708 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001709 limLog(pMac, LOGP,FL("Session Does not exist for given sessionID %d"), pMac->lim.limTimers.gLimTdlsDisRspWaitTimer.sessionId);
Mohit Khannac0b992f2012-12-04 15:08:18 -08001710 return;
1711 }
1712
1713 VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001714 ("Discovery Rsp timer expires ")) ;
Mohit Khannac0b992f2012-12-04 15:08:18 -08001715#if 0 // TDLS_hklee: D13 no need to open Addr2 unknown data packet
1716 /* restore RXP filters */
1717 limSetLinkState(pMac, eSIR_LINK_FINISH_TDLS_DISCOVERY_STATE,
1718 psessionEntry->bssId) ;
1719#endif
1720 limSendSmeTdlsDisRsp(pMac, eSIR_SUCCESS,
1721 eWNI_SME_TDLS_DISCOVERY_START_RSP) ;
1722 break ;
1723 }
1724
1725 /*
1726 * we initiated link setup and did not receive TDLS setup rsp
1727 * from TDLS peer STA, send failure RSP to SME.
1728 */
1729 case SIR_LIM_TDLS_LINK_SETUP_RSP_TIMEOUT:
1730 {
1731 tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
1732 tLimTdlsLinkSetupPeer *setupPeer = NULL ;
1733
1734 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001735 ("TDLS setup rsp timer expires ")) ;
Mohit Khannac0b992f2012-12-04 15:08:18 -08001736 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001737 ("TDLS setup rsp timer expires for peer:")) ;
Mohit Khannac0b992f2012-12-04 15:08:18 -08001738 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001739 ("%02X, %02X, %02X,%02X, %02X, %02X"),
Mohit Khannac0b992f2012-12-04 15:08:18 -08001740 peerMac[0],
1741 peerMac[1],
1742 peerMac[2],
1743 peerMac[3],
1744 peerMac[4],
1745 peerMac[5]);
1746
1747 limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
1748 if(NULL != setupPeer)
1749 {
1750 limTdlsDelLinkPeer( pMac, peerMac) ;
1751 }
1752
1753 limSendSmeTdlsLinkStartRsp(pMac, eSIR_FAILURE, peerMac,
1754 eWNI_SME_TDLS_LINK_START_RSP) ;
1755 break ;
1756 }
1757 case SIR_LIM_TDLS_LINK_SETUP_CNF_TIMEOUT:
1758 {
1759 tANI_U8 *peerMac = (tANI_U8 *)limMsg->bodyval ;
1760 tLimTdlsLinkSetupPeer *setupPeer = NULL ;
1761
1762 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_ERROR,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001763 ("TDLS setup CNF timer expires ")) ;
Mohit Khannac0b992f2012-12-04 15:08:18 -08001764 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001765 ("TDLS setup CNF timer expires for peer:")) ;
Mohit Khannac0b992f2012-12-04 15:08:18 -08001766 VOS_TRACE(VOS_MODULE_ID_PE, VOS_TRACE_LEVEL_INFO,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001767 ("%02X, %02X, %02X,%02X, %02X, %02X"),
Mohit Khannac0b992f2012-12-04 15:08:18 -08001768 peerMac[0],
1769 peerMac[1],
1770 peerMac[2],
1771 peerMac[3],
1772 peerMac[4],
1773 peerMac[5]);
1774 limTdlsFindLinkPeer(pMac, peerMac, &setupPeer) ;
1775 if(NULL != setupPeer)
1776 {
1777 limTdlsDelLinkPeer( pMac, peerMac) ;
1778 }
1779 break ;
1780 }
1781#endif /* FEATURE_WLAN_TDLS TIMER */
Jeff Johnson295189b2012-06-20 16:38:30 -07001782 case WDA_ADD_BSS_RSP:
1783 limProcessMlmAddBssRsp( pMac, limMsg );
1784 break;
1785
1786 case WDA_ADD_STA_RSP:
1787
1788 //call a wrapper by paasing bodyptr, their get sessionID and and call proper function from there.
1789 limProcessAddStaRsp(pMac,limMsg);
1790 break;
1791
1792 case WDA_DELETE_STA_RSP:
1793 limProcessMlmDelStaRsp(pMac, limMsg);
1794 break;
1795
1796 case WDA_ADD_STA_SELF_RSP:
1797 limProcessAddStaSelfRsp(pMac, limMsg);
1798 break;
1799 case WDA_DEL_STA_SELF_RSP:
1800 limProcessDelStaSelfRsp(pMac, limMsg);
1801 break;
1802
1803 case WDA_DELETE_BSS_RSP:
1804 limHandleDeleteBssRsp(pMac,limMsg); //wrapper routine to handle delete bss response
1805 break;
1806
1807 case WDA_SET_BSSKEY_RSP:
1808 case WDA_SET_STA_BCASTKEY_RSP:
1809 limProcessMlmSetBssKeyRsp( pMac, limMsg );
1810 break;
1811 case WDA_SET_STAKEY_RSP:
1812 limProcessMlmSetStaKeyRsp( pMac, limMsg );
1813 break;
1814 case WDA_REMOVE_BSSKEY_RSP:
1815 case WDA_REMOVE_STAKEY_RSP:
1816 limProcessMlmRemoveKeyRsp( pMac, limMsg );
1817 break;
1818 case WDA_ADDBA_RSP:
1819 limProcessMlmHalAddBARsp( pMac, limMsg );
1820 break;
1821
1822 case WDA_STA_STAT_RSP:
1823 case WDA_AGGR_STAT_RSP:
1824 case WDA_GLOBAL_STAT_RSP:
1825 case WDA_STAT_SUMM_RSP:
1826 limSendSmeStatsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1827 break;
1828
1829 case WDA_GET_STATISTICS_RSP:
1830 limSendSmePEStatisticsRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1831 break;
Srinivas Girigowda2471d832013-01-25 13:33:11 -08001832#if defined WLAN_FEATURE_VOWIFI_11R || defined FEATURE_WLAN_CCX || defined(FEATURE_WLAN_LFR)
1833 case WDA_GET_ROAM_RSSI_RSP:
1834 limSendSmePEGetRoamRssiRsp ( pMac, limMsg->type, (void *)limMsg->bodyptr);
1835 break;
1836#endif
1837
Jeff Johnson295189b2012-06-20 16:38:30 -07001838
1839 case WDA_SET_MIMOPS_RSP: //limProcessSetMimoRsp(pMac, limMsg);
1840 case WDA_SET_TX_POWER_RSP: //limProcessSetTxPowerRsp(pMac, limMsg);
1841 case WDA_GET_TX_POWER_RSP: //limProcessGetTxPowerRsp(pMac, limMsg);
1842 case WDA_GET_NOISE_RSP:
1843 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
1844 limMsg->bodyptr = NULL;
1845 //limProcessGetNoiseRsp(pMac, limMsg);
1846 break;
1847
1848 case WDA_SET_MAX_TX_POWER_RSP:
1849#if defined WLAN_FEATURE_VOWIFI
1850 rrmSetMaxTxPowerRsp( pMac, limMsg );
1851#endif
1852 if(limMsg->bodyptr != NULL)
1853 {
1854 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
1855 limMsg->bodyptr = NULL;
1856 }
1857 break;
1858
Jeff Johnson295189b2012-06-20 16:38:30 -07001859 case SIR_LIM_ADDR2_MISS_IND:
1860 {
1861 limLog(pMac, LOGE,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001862 FL("Addr2 mismatch interrupt received %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001863 limMsg->type);
1864 /*a message from HAL indicating addr2 mismatch interrupt occurred
1865 limMsg->bodyptr contains only pointer to 48-bit addr2 field*/
1866 //Dinesh fix this. the third parameter should be sessionentry.
1867 //limHandleUnknownA2IndexFrames(pMac, (void *)limMsg->bodyptr);
1868
1869 /*Free message body pointer*/
1870 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
1871 break;
1872 }
Jeff Johnson295189b2012-06-20 16:38:30 -07001873
1874#ifdef WLAN_FEATURE_VOWIFI_11R
1875 case WDA_AGGR_QOS_RSP:
1876 limProcessFTAggrQoSRsp( pMac, limMsg );
1877 break;
1878#endif
1879
1880 case WDA_SET_LINK_STATE_RSP:
1881 linkStateParams = (tLinkStateParams *)limMsg->bodyptr;
1882#if defined WLAN_FEATURE_VOWIFI_11R
1883 pSession = linkStateParams->session;
1884 if(linkStateParams->ft)
1885 {
1886 limSendReassocReqWithFTIEsMgmtFrame(pMac,
1887 pSession->pLimMlmReassocReq,
1888 pSession);
1889 }
1890#endif
1891 if( linkStateParams->callback )
1892 {
1893 linkStateParams->callback( pMac, linkStateParams->callbackArg );
1894 }
1895 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
1896 break;
1897
1898#ifdef WLAN_FEATURE_PACKET_FILTERING
1899 case WDA_PACKET_COALESCING_FILTER_MATCH_COUNT_RSP:
1900 pmmProcessMessage(pMac, limMsg);
1901 break;
1902#endif // WLAN_FEATURE_PACKET_FILTERING
1903
1904#ifdef WLAN_FEATURE_GTK_OFFLOAD
1905 case WDA_GTK_OFFLOAD_GETINFO_RSP:
1906 pmmProcessMessage(pMac, limMsg);
1907 break;
1908#endif // WLAN_FEATURE_GTK_OFFLOAD
Yathishd8713192012-12-10 14:21:35 -08001909 case eWNI_SME_SET_BCN_FILTER_REQ:
1910 {
1911#ifdef WLAN_ACTIVEMODE_OFFLOAD_FEATURE
1912 tpPESession psessionEntry;
1913 tANI_U8 sessionId = (tANI_U8)limMsg->bodyval ;
1914 psessionEntry = &pMac->lim.gpSession[sessionId];
1915 if(psessionEntry != NULL && IS_ACTIVEMODE_OFFLOAD_FEATURE_ENABLE)
1916 {
1917 // sending beacon filtering information down to HAL
1918 if (limSendBeaconFilterInfo(pMac, psessionEntry) != eSIR_SUCCESS)
1919 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001920 limLog(pMac, LOGE, FL("Fail to send Beacon Filter Info "));
Yathishd8713192012-12-10 14:21:35 -08001921 }
1922 }
Dhanashri Atre612af852013-03-29 11:19:05 -07001923 vos_mem_free((v_VOID_t *)(limMsg->bodyptr));
1924 limMsg->bodyptr = NULL;
Yathishd8713192012-12-10 14:21:35 -08001925#endif
1926 }
1927 break;
Gopichand Nakkalaefe3a232013-05-27 17:05:29 +05301928#ifdef FEATURE_WLAN_TDLS
1929 case WDA_SET_TDLS_LINK_ESTABLISH_REQ_RSP:
1930 {
1931 /*TODO Sunil , See how do you enhance this , Reason Code ???*/
1932 limSendSmeTdlsLinkEstablishReqRsp(pMac, 0 , NULL, NULL, eSIR_SUCCESS ) ;
1933 break;
1934 }
1935#endif
Gopichand Nakkalae0078ce2013-06-11 17:49:16 +05301936
1937 case WDA_RX_SCAN_EVENT:
1938 limProcessRxScanEvent(pMac, limMsg->bodyptr);
1939 break;
1940
Jeff Johnson295189b2012-06-20 16:38:30 -07001941 default:
1942 vos_mem_free((v_VOID_t*)limMsg->bodyptr);
1943 limMsg->bodyptr = NULL;
1944 // Unwanted messages
1945 // Log error
1946 limLog(pMac, LOGE,
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001947 FL("Discarding unexpected message received %X"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001948 limMsg->type);
1949 limPrintMsgName(pMac, LOGE, limMsg->type);
1950 break;
1951
1952 } // switch (limMsg->type)
1953
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07001954 PELOG2(limLog(pMac, LOG2, FL("Done Processing msgType = %d, sme state = %s, mlm state = %s"),
Jeff Johnson295189b2012-06-20 16:38:30 -07001955 limMsg->type, limSmeStateStr(pMac->lim.gLimSmeState),
1956 limMlmStateStr(pMac->lim.gLimMlmState));)
1957
1958} /*** end limProcessMessages() ***/
1959
1960
1961
1962/**
1963 * limProcessDeferredMessageQueue
1964 *
1965 *FUNCTION:
1966 * This function is called by LIM while exiting from Learn
1967 * mode. This function fetches messages posted to the LIM
1968 * deferred message queue limDeferredMsgQ.
1969 *
1970 *LOGIC:
1971 *
1972 *ASSUMPTIONS:
1973 * NA
1974 *
1975 *NOTE:
1976 * NA
1977 *
1978 * @param pMac - Pointer to Global MAC structure
1979 * @return None
1980 */
1981
1982void
1983limProcessDeferredMessageQueue(tpAniSirGlobal pMac)
1984{
1985 tSirMsgQ limMsg = { 0, 0, 0 };
1986
Jeff Johnson295189b2012-06-20 16:38:30 -07001987 tSirMsgQ *readMsg;
1988 tANI_U16 size;
1989
1990 /*
1991 ** check any deferred messages need to be processed
1992 **/
1993 size = pMac->lim.gLimDeferredMsgQ.size;
1994 if (size > 0)
1995 {
1996 while ((readMsg = limReadDeferredMsgQ(pMac)) != NULL)
1997 {
1998 palCopyMemory( pMac->hHdd, (tANI_U8*) &limMsg,
1999 (tANI_U8*) readMsg, sizeof(tSirMsgQ));
2000 size--;
2001 limProcessMessages(pMac, &limMsg);
2002
2003 if((limIsSystemInScanState(pMac)) || (true != GET_LIM_PROCESS_DEFD_MESGS(pMac)) ||
2004 (pMac->lim.gLimSystemInScanLearnMode))
2005 break;
2006 }
2007 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002008} /*** end limProcessDeferredMessageQueue() ***/
2009
2010
2011/*
2012 * limProcessNormalHddMsg
2013 * Function: this function checks the current lim state and decide whether the message passed shall be deffered.
2014 * @param pMac - Pointer to Global MAC structure
2015 * pLimMsg -- the message need to be processed
2016 * fRspReqd -- whether return result to hdd
2017 * @return None
2018 */
2019void limProcessNormalHddMsg(tpAniSirGlobal pMac, tSirMsgQ *pLimMsg, tANI_U8 fRspReqd)
2020{
2021 tANI_BOOLEAN fDeferMsg = eANI_BOOLEAN_TRUE;
2022
2023 /* Added For BT-AMP Support */
2024 if ((pMac->lim.gLimSystemRole == eLIM_AP_ROLE) ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_AP_ROLE )
2025 ||(pMac->lim.gLimSystemRole == eLIM_BT_AMP_STA_ROLE)
2026 ||(pMac->lim.gLimSystemRole == eLIM_UNKNOWN_ROLE))
2027 {
2028 /** This check is required only for the AP and in 2 cases.
2029 * 1. If we are in learn mode and we receive any of these messages,
2030 * you have to come out of scan and process the message, hence dont
2031 * defer the message here. In handler, these message could be defered
2032 * till we actually come out of scan mode.
2033 * 2. If radar is detected, you might have to defer all of these
2034 * messages except Stop BSS request/ Switch channel request. This
2035 * decision is also made inside its handler.
2036 *
2037 * Please be careful while using the flag fDeferMsg. Possibly you
2038 * might end up in an infinite loop.
2039 **/
2040 if (((pLimMsg->type == eWNI_SME_START_BSS_REQ) ||
2041 (pLimMsg->type == eWNI_SME_STOP_BSS_REQ) ||
2042 (pLimMsg->type == eWNI_SME_SWITCH_CHL_REQ) ||
2043 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_SECONDARY_REQ) ||
2044 (pLimMsg->type == eWNI_SME_SWITCH_CHL_CB_PRIMARY_REQ)))
2045 {
2046 fDeferMsg = eANI_BOOLEAN_FALSE;
2047 }
2048 }
2049
2050 /* limInsystemInscanState() refers the psessionEntry, how to get session Entry????*/
Jeff Johnsone7245742012-09-05 17:12:55 -07002051 if (((pMac->lim.gLimAddtsSent) || (limIsSystemInScanState(pMac)) /*||
2052 (LIM_IS_RADAR_DETECTED(pMac))*/) && fDeferMsg)
Jeff Johnson295189b2012-06-20 16:38:30 -07002053 {
2054 // System is in DFS (Learn) mode or awaiting addts response
2055 // or if radar is detected, Defer processsing this message
2056 if (limDeferMsg(pMac, pLimMsg) != TX_SUCCESS)
2057 {
2058#ifdef WLAN_DEBUG
2059 pMac->lim.numSme++;
2060#endif
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002061 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 -07002062 pLimMsg->type, pMac->lim.gLimSmeState, pMac->lim.gLimPrevSmeState,
2063 pMac->lim.gLimSystemRole, pMac->lim.gLimMlmState, pMac->lim.gLimPrevMlmState);)
2064 limLogSessionStates(pMac);
2065 limPrintMsgName(pMac, LOGE, pLimMsg->type);
2066 // Release body
2067 palFreeMemory( pMac->hHdd, (tANI_U8 *) pLimMsg->bodyptr);
2068 }
2069 }
2070 else
2071 {
2072 if(fRspReqd)
2073 {
2074 // These messages are from HDD
2075 // Since these requests may also be generated
2076 // internally within LIM module, need to
2077 // distinquish and send response to host
2078 pMac->lim.gLimRspReqd = eANI_BOOLEAN_TRUE;
2079 }
2080#ifdef WLAN_DEBUG
2081 pMac->lim.numSme++;
2082#endif
2083 if(limProcessSmeReqMessages(pMac, pLimMsg))
2084 {
2085 // Release body
2086 // limProcessSmeReqMessage consumed the buffer. We can free it.
2087 palFreeMemory( pMac->hHdd, (tANI_U8 *) pLimMsg->bodyptr);
2088 }
2089 }
2090}
2091
2092void
Jeff Johnsone7245742012-09-05 17:12:55 -07002093handleHTCapabilityandHTInfo(struct sAniSirGlobal *pMac, tpPESession psessionEntry)
Jeff Johnson295189b2012-06-20 16:38:30 -07002094{
2095 tSirMacHTCapabilityInfo macHTCapabilityInfo;
2096 tSirMacHTParametersInfo macHTParametersInfo;
2097 tSirMacHTInfoField1 macHTInfoField1;
2098 tSirMacHTInfoField2 macHTInfoField2;
2099 tSirMacHTInfoField3 macHTInfoField3;
2100 tANI_U32 cfgValue;
2101 tANI_U8 *ptr;
Jeff Johnson295189b2012-06-20 16:38:30 -07002102
Jeff Johnson295189b2012-06-20 16:38:30 -07002103 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_CAP_INFO, &cfgValue) != eSIR_SUCCESS)
2104 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002105 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_CAP_INFO value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002106 return ;
2107 }
2108 ptr = (tANI_U8 *) &macHTCapabilityInfo;
2109 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2110 pMac->lim.gHTLsigTXOPProtection = (tANI_U8)macHTCapabilityInfo.lsigTXOPProtection;
2111 pMac->lim.gHTMIMOPSState = (tSirMacHTMIMOPowerSaveState) macHTCapabilityInfo.mimoPowerSave;
2112 pMac->lim.gHTGreenfield = (tANI_U8)macHTCapabilityInfo.greenField;
2113 pMac->lim.gHTMaxAmsduLength = (tANI_U8)macHTCapabilityInfo.maximalAMSDUsize;
2114 pMac->lim.gHTShortGI20Mhz = (tANI_U8)macHTCapabilityInfo.shortGI20MHz;
2115 pMac->lim.gHTShortGI40Mhz = (tANI_U8)macHTCapabilityInfo.shortGI40MHz;
Jeff Johnson295189b2012-06-20 16:38:30 -07002116 pMac->lim.gHTPSMPSupport = (tANI_U8)macHTCapabilityInfo.psmp;
2117 pMac->lim.gHTDsssCckRate40MHzSupport = (tANI_U8)macHTCapabilityInfo.dsssCckMode40MHz;
2118
2119 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_AMPDU_PARAMS, &cfgValue) != eSIR_SUCCESS)
2120 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002121 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_PARAM_INFO value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002122 return ;
2123 }
2124 ptr = (tANI_U8 *) &macHTParametersInfo;
2125 *ptr = (tANI_U8) (cfgValue & 0xff);
2126 pMac->lim.gHTAMpduDensity = (tANI_U8)macHTParametersInfo.mpduDensity;
2127 pMac->lim.gHTMaxRxAMpduFactor = (tANI_U8)macHTParametersInfo.maxRxAMPDUFactor;
2128
2129 // Get HT IE Info
2130 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD1, &cfgValue) != eSIR_SUCCESS)
2131 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002132 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD1 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002133 return ;
2134 }
2135 ptr = (tANI_U8 *) &macHTInfoField1;
2136 *((tANI_U8 *)ptr) = (tANI_U8) (cfgValue & 0xff);
2137 pMac->lim.gHTServiceIntervalGranularity = (tANI_U8)macHTInfoField1.serviceIntervalGranularity;
2138 pMac->lim.gHTControlledAccessOnly = (tANI_U8)macHTInfoField1.controlledAccessOnly;
2139 pMac->lim.gHTRifsMode = (tANI_U8)macHTInfoField1.rifsMode;
Jeff Johnson295189b2012-06-20 16:38:30 -07002140
2141 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD2, &cfgValue) != eSIR_SUCCESS)
2142 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002143 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD2 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002144 return ;
2145 }
2146 ptr = (tANI_U8 *) &macHTInfoField2;
2147 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2148 pMac->lim.gHTOperMode = (tSirMacHTOperatingMode) macHTInfoField2.opMode;
2149
2150 if (wlan_cfgGetInt(pMac, WNI_CFG_HT_INFO_FIELD3, &cfgValue) != eSIR_SUCCESS)
2151 {
Kiran Kumar Lokere6cd2d782013-04-01 13:24:23 -07002152 limLog(pMac, LOGP, FL("Fail to retrieve WNI_CFG_HT_INFO_FIELD3 value"));
Jeff Johnson295189b2012-06-20 16:38:30 -07002153 return ;
2154 }
2155 ptr = (tANI_U8 *) &macHTInfoField3;
2156 *((tANI_U16 *)ptr) = (tANI_U16) (cfgValue & 0xffff);
2157 pMac->lim.gHTPCOActive = (tANI_U8)macHTInfoField3.pcoActive;
2158 pMac->lim.gHTPCOPhase = (tANI_U8)macHTInfoField3.pcoPhase;
Jeff Johnson295189b2012-06-20 16:38:30 -07002159 pMac->lim.gHTSecondaryBeacon = (tANI_U8)macHTInfoField3.secondaryBeacon;
2160 pMac->lim.gHTDualCTSProtection = (tANI_U8)macHTInfoField3.dualCTSProtection;
2161 pMac->lim.gHTSTBCBasicMCS = (tANI_U8)macHTInfoField3.basicSTBCMCS;
Jeff Johnsone7245742012-09-05 17:12:55 -07002162
2163 /* The lim globals for channelwidth and secondary chnl have been removed and should not be used during no session;
2164 * instead direct cfg is read and used when no session for transmission of mgmt frames (same as old);
2165 * For now, we might come here during init and join with sessionEntry = NULL; in that case just fill the globals which exist
2166 * Sessionized entries values will be filled in join or add bss req. The ones which are missed in join are filled below
2167 */
2168 if (psessionEntry != NULL)
2169 {
2170 psessionEntry->htCapability = IS_DOT11_MODE_HT(psessionEntry->dot11mode);
2171 psessionEntry->beaconParams.fLsigTXOPProtectionFullSupport = (tANI_U8)macHTInfoField3.lsigTXOPProtectionFullSupport;
2172 }
Jeff Johnson295189b2012-06-20 16:38:30 -07002173}
2174
2175void limLogSessionStates(tpAniSirGlobal pMac)
2176{
2177#ifdef WLAN_DEBUG
2178 int i;
2179
2180 for(i = 0; i < pMac->lim.maxBssId; i++)
2181 {
2182 if(pMac->lim.gpSession[i].valid)
2183 {
Madan Mohan Koyyalamudi5695b502012-09-24 14:21:12 -07002184 PELOG1(limLog(pMac, LOG1, FL("Session[%d] sysRole(%d) limSmeState %d (prev sme state %d) mlm state %d (prev mlm state %d)"),
Jeff Johnson295189b2012-06-20 16:38:30 -07002185 i, pMac->lim.gpSession[i].limSystemRole, pMac->lim.gpSession[i].limSmeState,
2186 pMac->lim.gpSession[i].limPrevSmeState, pMac->lim.gpSession[i].limMlmState,
2187 pMac->lim.gpSession[i].limPrevMlmState);)
2188 }
2189 }
2190#endif //ifdef WLAN_DEBUG
2191}