blob: 88bca93e8def57999269e098daeaf9bf8b445859 [file] [log] [blame]
Jeff Johnson295189b2012-06-20 16:38:30 -07001/*
Kapil Gupta7a3d9b12016-12-20 20:36:38 +05302 * Copyright (c) 2011-2013, 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.
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080020 */
Kiet Lam842dad02014-02-18 18:44:02 -080021
22/*
23 * This file was originally distributed by Qualcomm Atheros, Inc.
24 * under proprietary terms before Copyright ownership was assigned
25 * to the Linux Foundation.
26 */
27
Gopichand Nakkala92f07d82013-01-08 21:16:34 -080028/*
Jeff Johnson295189b2012-06-20 16:38:30 -070029 *
Jeff Johnson295189b2012-06-20 16:38:30 -070030 * This file limApi.h contains the definitions exported by
31 * LIM module.
32 * Author: Chandra Modumudi
33 * Date: 02/11/02
34 * History:-
35 * Date Modified by Modification Information
36 * --------------------------------------------------------------------
37 *
38 */
39#ifndef __LIM_API_H
40#define __LIM_API_H
Jeff Johnson295189b2012-06-20 16:38:30 -070041#include "wniApi.h"
42#include "sirApi.h"
43#include "aniGlobal.h"
44#include "sirMacProtDef.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070045#include "sirCommon.h"
46#include "sirDebug.h"
47#include "schGlobal.h"
48#include "utilsApi.h"
49#include "limGlobal.h"
50#include "halMsgApi.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070051#include "wlan_qct_wdi_ds.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070052#include "wlan_qct_wda.h"
Jeff Johnson295189b2012-06-20 16:38:30 -070053#define LIM_POL_SYS_SCAN_MODE 0
54#define LIM_POL_SYS_LEARN_MODE 1
55
Jeff Johnson295189b2012-06-20 16:38:30 -070056/* Macro to count heartbeat */
Jeff Johnson295189b2012-06-20 16:38:30 -070057#define limResetHBPktCount(psessionEntry) (psessionEntry->LimRxedBeaconCntDuringHB = 0)
58
Jeff Johnson295189b2012-06-20 16:38:30 -070059/* Useful macros for fetching various states in pMac->lim */
60/* gLimSystemRole */
61#define GET_LIM_SYSTEM_ROLE(psessionEntry) (psessionEntry->limSystemRole)
62#define LIM_IS_AP_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_AP_ROLE)
63#define LIM_IS_STA_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_STA_ROLE)
64#define LIM_IS_IBSS_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_STA_IN_IBSS_ROLE)
65/* gLimSmeState */
66#define GET_LIM_SME_STATE(pMac) (pMac->lim.gLimSmeState)
67#define SET_LIM_SME_STATE(pMac, state) (pMac->lim.gLimSmeState = state)
68/* gLimMlmState */
69#define GET_LIM_MLM_STATE(pMac) (pMac->lim.gLimMlmState)
70#define SET_LIM_MLM_STATE(pMac, state) (pMac->lim.gLimMlmState = state)
71/*tpdphHashNode mlmStaContext*/
72#define GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs) (pStaDs->mlmStaContext.mlmState)
73#define SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, state) (pStaDs->mlmStaContext.mlmState = state)
74/* gLimQuietState */
75#define GET_LIM_QUIET_STATE(pMac) (pMac->lim.gLimSpecMgmt.quietState)
76#define SET_LIM_QUIET_STATE(pMac, state) (pMac->lim.gLimSpecMgmt.quietState = state)
Jeff Johnson295189b2012-06-20 16:38:30 -070077#define LIM_IS_CONNECTION_ACTIVE(psessionEntry) (psessionEntry->LimRxedBeaconCntDuringHB)
Jeff Johnson295189b2012-06-20 16:38:30 -070078/*pMac->lim.gLimProcessDefdMsgs*/
79#define GET_LIM_PROCESS_DEFD_MESGS(pMac) (pMac->lim.gLimProcessDefdMsgs)
80#define SET_LIM_PROCESS_DEFD_MESGS(pMac, val) (pMac->lim.gLimProcessDefdMsgs = val)
81// LIM exported function templates
82//inline tANI_U16
83//limGetNumAniPeersInBss(tpAniSirGlobal pMac)
84//{ return pMac->lim.gLimNumOfAniSTAs; }
85#define LIM_IS_RADAR_DETECTED(pMac) (pMac->lim.gLimSpecMgmt.fRadarDetCurOperChan)
86#define LIM_SET_RADAR_DETECTED(pMac, val) (pMac->lim.gLimSpecMgmt.fRadarDetCurOperChan = val)
87#define LIM_MIN_BCN_PR_LENGTH 12
88#define LIM_BCN_PR_CAPABILITY_OFFSET 10
Ganesh Kondabattini8f6e3b32014-08-25 16:07:54 +053089#define DEFAULT_MIN_CHAN_TIME_DURING_MIRACAST 20
90#define DEFAULT_MAX_CHAN_TIME_DURING_MIRACAST 20
91
Jeff Johnson295189b2012-06-20 16:38:30 -070092typedef enum eMgmtFrmDropReason
93{
94 eMGMT_DROP_NO_DROP,
95 eMGMT_DROP_NOT_LAST_IBSS_BCN,
96 eMGMT_DROP_INFRA_BCN_IN_IBSS,
97 eMGMT_DROP_SCAN_MODE_FRAME,
98 eMGMT_DROP_NON_SCAN_MODE_FRAME,
99 eMGMT_DROP_INVALID_SIZE,
Sushant Kaushik1f5f54b2015-07-28 14:32:22 +0530100 eMGMT_DROP_SPURIOUS_FRAME,
Jeff Johnson295189b2012-06-20 16:38:30 -0700101}tMgmtFrmDropReason;
102
103
Jeff Johnson295189b2012-06-20 16:38:30 -0700104/// During TD ring clean up at HDD in RTAI, will call this call back
105extern void limPostTdDummyPktCallbak(void* pMacGlobals, unsigned int* pBd);
Jeff Johnson295189b2012-06-20 16:38:30 -0700106/**
107 * Function to initialize LIM state machines.
108 * This called upon LIM thread creation.
109 */
110extern tSirRetStatus limInitialize(tpAniSirGlobal);
111tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam);
112tSirRetStatus peClose(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700113tSirRetStatus limStart(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700114/**
115 * Function to Initialize radar interrupts.
116 */
117void limRadarInit(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700118tSirRetStatus peStart(tpAniSirGlobal pMac);
119void peStop(tpAniSirGlobal pMac);
120tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
121tSirRetStatus peProcessMsg(tpAniSirGlobal pMac, tSirMsgQ* limMsg);
122void limDumpInit(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700123/**
124 * Function to cleanup LIM state.
125 * This called upon reset/persona change etc
126 */
127extern void limCleanup(tpAniSirGlobal);
Jeff Johnson295189b2012-06-20 16:38:30 -0700128/// Function to post messages to LIM thread
129extern tANI_U32 limPostMsgApi(tpAniSirGlobal, tSirMsgQ *);
Padma, Santhosh Kumarb036fc72015-11-13 16:22:23 +0530130tANI_U32 limPostMsgApiHighPri(tpAniSirGlobal, tSirMsgQ *);
131
Jeff Johnson295189b2012-06-20 16:38:30 -0700132/**
Jeff Johnson295189b2012-06-20 16:38:30 -0700133 * Function to process messages posted to LIM thread
134 * and dispatch to various sub modules within LIM module.
135 */
136extern void limMessageProcessor(tpAniSirGlobal, tpSirMsgQ);
137extern void limProcessMessages(tpAniSirGlobal, tpSirMsgQ); // DT test alt deferred 2
Jeff Johnson295189b2012-06-20 16:38:30 -0700138/**
139 * Function to check the LIM state if system is in Scan/Learn state.
140 */
141extern tANI_U8 limIsSystemInScanState(tpAniSirGlobal);
Jeff Johnson295189b2012-06-20 16:38:30 -0700142/**
143 * Function to handle IBSS coalescing.
144 * Beacon Processing module to call this.
145 */
146extern tSirRetStatus limHandleIBSScoalescing(tpAniSirGlobal,
147 tpSchBeaconStruct,
148 tANI_U8 *,tpPESession);
Jeff Johnson295189b2012-06-20 16:38:30 -0700149/// Function used by other Sirius modules to read global SME state
150 static inline tLimSmeStates
151limGetSmeState(tpAniSirGlobal pMac) { return pMac->lim.gLimSmeState; }
Jeff Johnson295189b2012-06-20 16:38:30 -0700152/// Function used by other Sirius modules to read global system role
153 static inline tLimSystemRole
154limGetSystemRole(tpPESession psessionEntry) { return psessionEntry->limSystemRole; }
Jeff Johnson295189b2012-06-20 16:38:30 -0700155//limGetAID(tpPESession psessionEntry) { return psessionEntry->limAID; }
Jeff Johnson295189b2012-06-20 16:38:30 -0700156extern void limReceivedHBHandler(tpAniSirGlobal, tANI_U8, tpPESession);
157//extern void limResetHBPktCount(tpPESession);
Jeff Johnson295189b2012-06-20 16:38:30 -0700158extern void limCheckAndQuietBSS(tpAniSirGlobal);
Jeff Johnson295189b2012-06-20 16:38:30 -0700159/// Function to send WDS info to WSM if needed
160extern void limProcessWdsInfo(tpAniSirGlobal, tSirPropIEStruct);
Jeff Johnson295189b2012-06-20 16:38:30 -0700161/// Function to initialize WDS info params
162extern void limInitWdsInfoParams(tpAniSirGlobal);
Jeff Johnson295189b2012-06-20 16:38:30 -0700163/// Function that triggers STA context deletion
164extern void limTriggerSTAdeletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry);
165
Hoonki Leee6bfe942013-02-05 15:01:19 -0800166#ifdef FEATURE_WLAN_TDLS
167// Function that sends TDLS Del Sta indication to SME
168extern void limSendSmeTDLSDelStaInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry, tANI_U16 reasonCode);
169#endif
170
Jeff Johnson295189b2012-06-20 16:38:30 -0700171/// Function that checks for change in AP's capabilties on STA
172extern void limDetectChangeInApCapabilities(tpAniSirGlobal,
173 tpSirProbeRespBeacon,tpPESession);
174tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac,
175 tpSirProbeRespBeacon pBeacon,
176 tpUpdateBeaconParams pBeaconParams,tpPESession);
177
Jeff Johnson295189b2012-06-20 16:38:30 -0700178/// creates an addts request action frame and sends it out to staid
179extern void limSendAddtsReq (tpAniSirGlobal pMac, tANI_U16 staid, tANI_U8 tsid, tANI_U8 userPrio, tANI_U8 wme);
180/// creates a delts request action frame and sends it out to staid
181extern void limSendDeltsReq (tpAniSirGlobal pMac, tANI_U16 staid, tANI_U8 tsid, tANI_U8 userPrio, tANI_U8 wme);
182/// creates a SM Power State Mode update request action frame and sends it out to staid
183extern void limPostStartLearnModeMsgToSch(tpAniSirGlobal pMac);
Jeff Johnsone7245742012-09-05 17:12:55 -0700184#ifdef WLAN_FEATURE_11AC
Madan Mohan Koyyalamudic6226de2012-09-18 16:33:31 -0700185extern ePhyChanBondState limGet11ACPhyCBState(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 htSecondaryChannelOffset, tANI_U8 CenterChan,tpPESession );
Jeff Johnsone7245742012-09-05 17:12:55 -0700186#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700187tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac);
Jeff Johnson295189b2012-06-20 16:38:30 -0700188#if 0 /* Currently, this function is not used but keep it around for when we do need it */
189tSirRetStatus limUpdateGlobalChannelBonding(tpAniSirGlobal pMac, tHalBitVal cbBit);
190#endif /* 0 */
191
Jeff Johnson295189b2012-06-20 16:38:30 -0700192void limHandleLowRssiInd(tpAniSirGlobal pMac);
193void limHandleBmpsStatusInd(tpAniSirGlobal pMac);
Kapil Gupta7a3d9b12016-12-20 20:36:38 +0530194#ifdef WLAN_FEATURE_APFIND
195void limHandleAPFindInd(tpAniSirGlobal pMac);
196#endif
Leela Venkata Kiran Kumar Reddy Chirala3ca17902013-02-27 19:50:05 -0800197void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700198tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType);
Sushant Kaushikefe08fa2015-07-06 14:54:09 +0530199boolean limIsDeauthDiassocForDrop(tpAniSirGlobal pMac,
200 tANI_U8 *pRxPacketInfo);
Sushant Kaushik1f5f54b2015-07-28 14:32:22 +0530201#ifdef WLAN_FEATURE_11W
202bool lim_is_assoc_req_for_drop(tpAniSirGlobal mac, uint8_t *rx_pkt_info);
203#endif
Jeff Johnson295189b2012-06-20 16:38:30 -0700204void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
Sachin Ahuja3d47fcd2015-08-28 16:02:06 +0530205
206void limProcessLostLinkParamsInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
207void limUpdateLostLinkParams(tpAniSirGlobal pMac,
208 tpPESession psessionEntry, tANI_U8 *pRxPacketInfo);
209
210
Jeff Johnson295189b2012-06-20 16:38:30 -0700211/* ----------------------------------------------------------------------- */
212// These used to be in DPH
213extern void limSetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId);
214extern void limGetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId);
215extern void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac);
216extern tSirRetStatus limCheckRxSeqNumber(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo);
Madan Mohan Koyyalamudia53c4dc2012-11-13 10:35:42 -0800217#define limGetQosMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->limQosEnabled)
218#define limGetWmeMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->limWmeEnabled)
219#define limGetWsmMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->limWsmEnabled)
220#define limGet11dMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->lim11dEnabled)
221#define limGetAckPolicy(pMac, pVal) (*(pVal) = pMac->lim.ackPolicy)
Jeff Johnson295189b2012-06-20 16:38:30 -0700222/* ----------------------------------------------------------------------- */
223static inline void limGetPhyMode(tpAniSirGlobal pMac, tANI_U32 *phyMode, tpPESession psessionEntry)
224{
225 *phyMode = psessionEntry ? psessionEntry->gLimPhyMode : pMac->lim.gLimPhyMode;
226}
227
228/* ----------------------------------------------------------------------- */
229static inline void limGetRfBand(tpAniSirGlobal pMac, tSirRFBand *band, tpPESession psessionEntry)
230{
231 *band = psessionEntry ? psessionEntry->limRFBand : SIR_BAND_UNKNOWN;
232}
233
234/*--------------------------------------------------------------------------
235
236 \brief peProcessMessages() - Message Processor for PE
237
238 Voss calls this function to dispatch the message to PE
239
240 \param pMac - Pointer to Global MAC structure
241 \param pMsg - Pointer to the message structure
242
243 \return tANI_U32 - TX_SUCCESS for success.
244
245 --------------------------------------------------------------------------*/
Jeff Johnson295189b2012-06-20 16:38:30 -0700246tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700247/** -------------------------------------------------------------
248\fn peFreeMsg
249\brief Called by VOS scheduler (function vos_sched_flush_mc_mqs)
250\ to free a given PE message on the TX and MC thread.
251\ This happens when there are messages pending in the PE
252\ queue when system is being stopped and reset.
253\param tpAniSirGlobal pMac
254\param tSirMsgQ pMsg
255\return none
256-----------------------------------------------------------------*/
257v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg);
Jeff Johnson295189b2012-06-20 16:38:30 -0700258/************************************************************/
259#endif /* __LIM_API_H */