Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 1 | /* |
Gopichand Nakkala | 92f07d8 | 2013-01-08 21:16:34 -0800 | [diff] [blame] | 2 | * 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 Johnson | 32d95a3 | 2012-09-10 13:15:23 -0700 | [diff] [blame] | 22 | * Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 23 | * |
| 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 | */ |
| 41 | |
| 42 | /* |
| 43 | * |
| 44 | * Airgo Networks, Inc proprietary. All rights reserved. |
| 45 | * This file limApi.h contains the definitions exported by |
| 46 | * LIM module. |
| 47 | * Author: Chandra Modumudi |
| 48 | * Date: 02/11/02 |
| 49 | * History:- |
| 50 | * Date Modified by Modification Information |
| 51 | * -------------------------------------------------------------------- |
| 52 | * |
| 53 | */ |
| 54 | #ifndef __LIM_API_H |
| 55 | #define __LIM_API_H |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 56 | #include "wniApi.h" |
| 57 | #include "sirApi.h" |
| 58 | #include "aniGlobal.h" |
| 59 | #include "sirMacProtDef.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 60 | #include "sirCommon.h" |
| 61 | #include "sirDebug.h" |
| 62 | #include "schGlobal.h" |
| 63 | #include "utilsApi.h" |
| 64 | #include "limGlobal.h" |
| 65 | #include "halMsgApi.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 66 | #include "wlan_qct_wdi_ds.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 67 | #include "wlan_qct_wda.h" |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 68 | #define LIM_POL_SYS_SCAN_MODE 0 |
| 69 | #define LIM_POL_SYS_LEARN_MODE 1 |
| 70 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 71 | /* Macro to count heartbeat */ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 72 | #define limResetHBPktCount(psessionEntry) (psessionEntry->LimRxedBeaconCntDuringHB = 0) |
| 73 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 74 | /* Useful macros for fetching various states in pMac->lim */ |
| 75 | /* gLimSystemRole */ |
| 76 | #define GET_LIM_SYSTEM_ROLE(psessionEntry) (psessionEntry->limSystemRole) |
| 77 | #define LIM_IS_AP_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_AP_ROLE) |
| 78 | #define LIM_IS_STA_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_STA_ROLE) |
| 79 | #define LIM_IS_IBSS_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) |
| 80 | /* gLimSmeState */ |
| 81 | #define GET_LIM_SME_STATE(pMac) (pMac->lim.gLimSmeState) |
| 82 | #define SET_LIM_SME_STATE(pMac, state) (pMac->lim.gLimSmeState = state) |
| 83 | /* gLimMlmState */ |
| 84 | #define GET_LIM_MLM_STATE(pMac) (pMac->lim.gLimMlmState) |
| 85 | #define SET_LIM_MLM_STATE(pMac, state) (pMac->lim.gLimMlmState = state) |
| 86 | /*tpdphHashNode mlmStaContext*/ |
| 87 | #define GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs) (pStaDs->mlmStaContext.mlmState) |
| 88 | #define SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, state) (pStaDs->mlmStaContext.mlmState = state) |
| 89 | /* gLimQuietState */ |
| 90 | #define GET_LIM_QUIET_STATE(pMac) (pMac->lim.gLimSpecMgmt.quietState) |
| 91 | #define SET_LIM_QUIET_STATE(pMac, state) (pMac->lim.gLimSpecMgmt.quietState = state) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 92 | #define LIM_IS_CONNECTION_ACTIVE(psessionEntry) (psessionEntry->LimRxedBeaconCntDuringHB) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 93 | /*pMac->lim.gLimProcessDefdMsgs*/ |
| 94 | #define GET_LIM_PROCESS_DEFD_MESGS(pMac) (pMac->lim.gLimProcessDefdMsgs) |
| 95 | #define SET_LIM_PROCESS_DEFD_MESGS(pMac, val) (pMac->lim.gLimProcessDefdMsgs = val) |
| 96 | // LIM exported function templates |
| 97 | //inline tANI_U16 |
| 98 | //limGetNumAniPeersInBss(tpAniSirGlobal pMac) |
| 99 | //{ return pMac->lim.gLimNumOfAniSTAs; } |
| 100 | #define LIM_IS_RADAR_DETECTED(pMac) (pMac->lim.gLimSpecMgmt.fRadarDetCurOperChan) |
| 101 | #define LIM_SET_RADAR_DETECTED(pMac, val) (pMac->lim.gLimSpecMgmt.fRadarDetCurOperChan = val) |
| 102 | #define LIM_MIN_BCN_PR_LENGTH 12 |
| 103 | #define LIM_BCN_PR_CAPABILITY_OFFSET 10 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 104 | typedef enum eMgmtFrmDropReason |
| 105 | { |
| 106 | eMGMT_DROP_NO_DROP, |
| 107 | eMGMT_DROP_NOT_LAST_IBSS_BCN, |
| 108 | eMGMT_DROP_INFRA_BCN_IN_IBSS, |
| 109 | eMGMT_DROP_SCAN_MODE_FRAME, |
| 110 | eMGMT_DROP_NON_SCAN_MODE_FRAME, |
| 111 | eMGMT_DROP_INVALID_SIZE, |
| 112 | }tMgmtFrmDropReason; |
| 113 | |
| 114 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 115 | /// During TD ring clean up at HDD in RTAI, will call this call back |
| 116 | extern void limPostTdDummyPktCallbak(void* pMacGlobals, unsigned int* pBd); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 117 | /** |
| 118 | * Function to initialize LIM state machines. |
| 119 | * This called upon LIM thread creation. |
| 120 | */ |
| 121 | extern tSirRetStatus limInitialize(tpAniSirGlobal); |
| 122 | tSirRetStatus peOpen(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam); |
| 123 | tSirRetStatus peClose(tpAniSirGlobal pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 124 | tSirRetStatus limStart(tpAniSirGlobal pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 125 | /** |
| 126 | * Function to Initialize radar interrupts. |
| 127 | */ |
| 128 | void limRadarInit(tpAniSirGlobal pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 129 | tSirRetStatus peStart(tpAniSirGlobal pMac); |
| 130 | void peStop(tpAniSirGlobal pMac); |
| 131 | tSirRetStatus pePostMsgApi(tpAniSirGlobal pMac, tSirMsgQ* pMsg); |
| 132 | tSirRetStatus peProcessMsg(tpAniSirGlobal pMac, tSirMsgQ* limMsg); |
| 133 | void limDumpInit(tpAniSirGlobal pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 134 | /** |
| 135 | * Function to cleanup LIM state. |
| 136 | * This called upon reset/persona change etc |
| 137 | */ |
| 138 | extern void limCleanup(tpAniSirGlobal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 139 | /// Function to post messages to LIM thread |
| 140 | extern tANI_U32 limPostMsgApi(tpAniSirGlobal, tSirMsgQ *); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 141 | /** |
| 142 | * Function to fetch messages posted LIM thread |
| 143 | */ |
| 144 | extern void limProcessMessageQueue(tpAniSirGlobal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 145 | /** |
| 146 | * Function to process messages posted to LIM thread |
| 147 | * and dispatch to various sub modules within LIM module. |
| 148 | */ |
| 149 | extern void limMessageProcessor(tpAniSirGlobal, tpSirMsgQ); |
| 150 | extern void limProcessMessages(tpAniSirGlobal, tpSirMsgQ); // DT test alt deferred 2 |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 151 | /** |
| 152 | * Function to check the LIM state if system is in Scan/Learn state. |
| 153 | */ |
| 154 | extern tANI_U8 limIsSystemInScanState(tpAniSirGlobal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 155 | /** |
| 156 | * Function to handle IBSS coalescing. |
| 157 | * Beacon Processing module to call this. |
| 158 | */ |
| 159 | extern tSirRetStatus limHandleIBSScoalescing(tpAniSirGlobal, |
| 160 | tpSchBeaconStruct, |
| 161 | tANI_U8 *,tpPESession); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 162 | /// Function used by other Sirius modules to read global SME state |
| 163 | static inline tLimSmeStates |
| 164 | limGetSmeState(tpAniSirGlobal pMac) { return pMac->lim.gLimSmeState; } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 165 | /// Function used by other Sirius modules to read global system role |
| 166 | static inline tLimSystemRole |
| 167 | limGetSystemRole(tpPESession psessionEntry) { return psessionEntry->limSystemRole; } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 168 | //limGetAID(tpPESession psessionEntry) { return psessionEntry->limAID; } |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 169 | extern void limReceivedHBHandler(tpAniSirGlobal, tANI_U8, tpPESession); |
| 170 | //extern void limResetHBPktCount(tpPESession); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 171 | extern void limCheckAndQuietBSS(tpAniSirGlobal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 172 | /// Function to send WDS info to WSM if needed |
| 173 | extern void limProcessWdsInfo(tpAniSirGlobal, tSirPropIEStruct); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 174 | /// Function to initialize WDS info params |
| 175 | extern void limInitWdsInfoParams(tpAniSirGlobal); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 176 | /// Function that triggers STA context deletion |
| 177 | extern void limTriggerSTAdeletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry); |
| 178 | |
Hoonki Lee | e6bfe94 | 2013-02-05 15:01:19 -0800 | [diff] [blame] | 179 | #ifdef FEATURE_WLAN_TDLS |
| 180 | // Function that sends TDLS Del Sta indication to SME |
| 181 | extern void limSendSmeTDLSDelStaInd(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpPESession psessionEntry, tANI_U16 reasonCode); |
| 182 | #endif |
| 183 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 184 | /// Function that checks for change in AP's capabilties on STA |
| 185 | extern void limDetectChangeInApCapabilities(tpAniSirGlobal, |
| 186 | tpSirProbeRespBeacon,tpPESession); |
| 187 | tSirRetStatus limUpdateShortSlot(tpAniSirGlobal pMac, |
| 188 | tpSirProbeRespBeacon pBeacon, |
| 189 | tpUpdateBeaconParams pBeaconParams,tpPESession); |
| 190 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 191 | /// creates an addts request action frame and sends it out to staid |
| 192 | extern void limSendAddtsReq (tpAniSirGlobal pMac, tANI_U16 staid, tANI_U8 tsid, tANI_U8 userPrio, tANI_U8 wme); |
| 193 | /// creates a delts request action frame and sends it out to staid |
| 194 | extern void limSendDeltsReq (tpAniSirGlobal pMac, tANI_U16 staid, tANI_U8 tsid, tANI_U8 userPrio, tANI_U8 wme); |
| 195 | /// creates a SM Power State Mode update request action frame and sends it out to staid |
| 196 | extern void limPostStartLearnModeMsgToSch(tpAniSirGlobal pMac); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 197 | #ifdef WLAN_FEATURE_11AC |
Madan Mohan Koyyalamudi | c6226de | 2012-09-18 16:33:31 -0700 | [diff] [blame] | 198 | extern ePhyChanBondState limGet11ACPhyCBState(tpAniSirGlobal pMac, tANI_U8 channel, tANI_U8 htSecondaryChannelOffset, tANI_U8 CenterChan,tpPESession ); |
Jeff Johnson | e724574 | 2012-09-05 17:12:55 -0700 | [diff] [blame] | 199 | #endif |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 200 | tANI_U8 limIsSystemInActiveState(tpAniSirGlobal pMac); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 201 | #if 0 /* Currently, this function is not used but keep it around for when we do need it */ |
| 202 | tSirRetStatus limUpdateGlobalChannelBonding(tpAniSirGlobal pMac, tHalBitVal cbBit); |
| 203 | #endif /* 0 */ |
| 204 | |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 205 | void limHandleLowRssiInd(tpAniSirGlobal pMac); |
| 206 | void limHandleBmpsStatusInd(tpAniSirGlobal pMac); |
Leela Venkata Kiran Kumar Reddy Chirala | 3ca1790 | 2013-02-27 19:50:05 -0800 | [diff] [blame^] | 207 | void limHandleMissedBeaconInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 208 | tMgmtFrmDropReason limIsPktCandidateForDrop(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo, tANI_U32 subType); |
| 209 | void limMicFailureInd(tpAniSirGlobal pMac, tpSirMsgQ pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 210 | /* ----------------------------------------------------------------------- */ |
| 211 | // These used to be in DPH |
| 212 | extern void limSetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId); |
| 213 | extern void limGetBssid(tpAniSirGlobal pMac, tANI_U8 *bssId); |
| 214 | extern void limGetMyMacAddr(tpAniSirGlobal pMac, tANI_U8 *mac); |
| 215 | extern tSirRetStatus limCheckRxSeqNumber(tpAniSirGlobal pMac, tANI_U8 *pRxPacketInfo); |
Madan Mohan Koyyalamudi | a53c4dc | 2012-11-13 10:35:42 -0800 | [diff] [blame] | 216 | #define limGetQosMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->limQosEnabled) |
| 217 | #define limGetWmeMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->limWmeEnabled) |
| 218 | #define limGetWsmMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->limWsmEnabled) |
| 219 | #define limGet11dMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->lim11dEnabled) |
| 220 | #define limGetAckPolicy(pMac, pVal) (*(pVal) = pMac->lim.ackPolicy) |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 221 | /* ----------------------------------------------------------------------- */ |
| 222 | static inline void limGetPhyMode(tpAniSirGlobal pMac, tANI_U32 *phyMode, tpPESession psessionEntry) |
| 223 | { |
| 224 | *phyMode = psessionEntry ? psessionEntry->gLimPhyMode : pMac->lim.gLimPhyMode; |
| 225 | } |
| 226 | |
| 227 | /* ----------------------------------------------------------------------- */ |
| 228 | static inline void limGetRfBand(tpAniSirGlobal pMac, tSirRFBand *band, tpPESession psessionEntry) |
| 229 | { |
| 230 | *band = psessionEntry ? psessionEntry->limRFBand : SIR_BAND_UNKNOWN; |
| 231 | } |
| 232 | |
| 233 | /*-------------------------------------------------------------------------- |
| 234 | |
| 235 | \brief peProcessMessages() - Message Processor for PE |
| 236 | |
| 237 | Voss calls this function to dispatch the message to PE |
| 238 | |
| 239 | \param pMac - Pointer to Global MAC structure |
| 240 | \param pMsg - Pointer to the message structure |
| 241 | |
| 242 | \return tANI_U32 - TX_SUCCESS for success. |
| 243 | |
| 244 | --------------------------------------------------------------------------*/ |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 245 | tSirRetStatus peProcessMessages(tpAniSirGlobal pMac, tSirMsgQ* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 246 | /** ------------------------------------------------------------- |
| 247 | \fn peFreeMsg |
| 248 | \brief Called by VOS scheduler (function vos_sched_flush_mc_mqs) |
| 249 | \ to free a given PE message on the TX and MC thread. |
| 250 | \ This happens when there are messages pending in the PE |
| 251 | \ queue when system is being stopped and reset. |
| 252 | \param tpAniSirGlobal pMac |
| 253 | \param tSirMsgQ pMsg |
| 254 | \return none |
| 255 | -----------------------------------------------------------------*/ |
| 256 | v_VOID_t peFreeMsg( tpAniSirGlobal pMac, tSirMsgQ* pMsg); |
Jeff Johnson | 295189b | 2012-06-20 16:38:30 -0700 | [diff] [blame] | 257 | /************************************************************/ |
| 258 | #endif /* __LIM_API_H */ |