Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2011-2015 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 | |
| 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 | |
| 28 | /* |
| 29 | * |
| 30 | * This file lim_api.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 |
| 41 | #include "wni_api.h" |
| 42 | #include "sir_api.h" |
| 43 | #include "ani_global.h" |
| 44 | #include "sir_mac_prot_def.h" |
| 45 | #include "sir_common.h" |
| 46 | #include "sir_debug.h" |
| 47 | #include "sch_global.h" |
| 48 | #include "utils_api.h" |
| 49 | #include "lim_global.h" |
| 50 | #include "wma_if.h" |
| 51 | #include "wma_types.h" |
| 52 | |
| 53 | /* Macro to count heartbeat */ |
| 54 | #define limResetHBPktCount(psessionEntry) (psessionEntry->LimRxedBeaconCntDuringHB = 0) |
| 55 | |
| 56 | /* Useful macros for fetching various states in pMac->lim */ |
| 57 | /* gLimSystemRole */ |
| 58 | #define GET_LIM_SYSTEM_ROLE(psessionEntry) (psessionEntry->limSystemRole) |
| 59 | #define LIM_IS_AP_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_AP_ROLE) |
| 60 | #define LIM_IS_STA_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_STA_ROLE) |
| 61 | #define LIM_IS_IBSS_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) |
| 62 | #define LIM_IS_UNKNOWN_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_UNKNOWN_ROLE) |
| 63 | #define LIM_IS_BT_AMP_AP_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_BT_AMP_AP_ROLE) |
| 64 | #define LIM_IS_BT_AMP_STA_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_BT_AMP_STA_ROLE) |
| 65 | #define LIM_IS_P2P_DEVICE_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_P2P_DEVICE_ROLE) |
| 66 | #define LIM_IS_P2P_DEVICE_GO(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_P2P_DEVICE_GO) |
| 67 | /* gLimSmeState */ |
| 68 | #define GET_LIM_SME_STATE(pMac) (pMac->lim.gLimSmeState) |
| 69 | #define SET_LIM_SME_STATE(pMac, state) (pMac->lim.gLimSmeState = state) |
| 70 | /* gLimMlmState */ |
| 71 | #define GET_LIM_MLM_STATE(pMac) (pMac->lim.gLimMlmState) |
| 72 | #define SET_LIM_MLM_STATE(pMac, state) (pMac->lim.gLimMlmState = state) |
| 73 | /*tpdphHashNode mlmStaContext*/ |
| 74 | #define GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs) (pStaDs->mlmStaContext.mlmState) |
| 75 | #define SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, state) (pStaDs->mlmStaContext.mlmState = state) |
| 76 | /* gLimQuietState */ |
| 77 | #define GET_LIM_QUIET_STATE(pMac) (pMac->lim.gLimSpecMgmt.quietState) |
| 78 | #define SET_LIM_QUIET_STATE(pMac, state) (pMac->lim.gLimSpecMgmt.quietState = state) |
| 79 | #define LIM_IS_CONNECTION_ACTIVE(psessionEntry) (psessionEntry->LimRxedBeaconCntDuringHB) |
| 80 | /*pMac->lim.gLimProcessDefdMsgs*/ |
| 81 | #define GET_LIM_PROCESS_DEFD_MESGS(pMac) (pMac->lim.gLimProcessDefdMsgs) |
| 82 | #define SET_LIM_PROCESS_DEFD_MESGS(pMac, val) (pMac->lim.gLimProcessDefdMsgs = val) |
| 83 | /* LIM exported function templates */ |
| 84 | #define LIM_IS_RADAR_DETECTED(pMac) (pMac->lim.gLimSpecMgmt.fRadarDetCurOperChan) |
| 85 | #define LIM_SET_RADAR_DETECTED(pMac, val) (pMac->lim.gLimSpecMgmt.fRadarDetCurOperChan = val) |
| 86 | #define LIM_MIN_BCN_PR_LENGTH 12 |
| 87 | #define LIM_BCN_PR_CAPABILITY_OFFSET 10 |
| 88 | typedef enum eMgmtFrmDropReason { |
| 89 | eMGMT_DROP_NO_DROP, |
| 90 | eMGMT_DROP_NOT_LAST_IBSS_BCN, |
| 91 | eMGMT_DROP_INFRA_BCN_IN_IBSS, |
| 92 | eMGMT_DROP_SCAN_MODE_FRAME, |
| 93 | eMGMT_DROP_NON_SCAN_MODE_FRAME, |
| 94 | eMGMT_DROP_INVALID_SIZE, |
| 95 | eMGMT_DROP_SPURIOUS_FRAME, |
| 96 | } tMgmtFrmDropReason; |
| 97 | |
| 98 | /** |
| 99 | * Function to initialize LIM state machines. |
| 100 | * This called upon LIM thread creation. |
| 101 | */ |
| 102 | extern tSirRetStatus lim_initialize(tpAniSirGlobal); |
| 103 | tSirRetStatus pe_open(tpAniSirGlobal pMac, tMacOpenParameters *pMacOpenParam); |
| 104 | tSirRetStatus pe_close(tpAniSirGlobal pMac); |
| 105 | void pe_register_tl_handle(tpAniSirGlobal pMac); |
| 106 | tSirRetStatus lim_start(tpAniSirGlobal pMac); |
| 107 | tSirRetStatus pe_start(tpAniSirGlobal pMac); |
| 108 | void pe_stop(tpAniSirGlobal pMac); |
| 109 | tSirRetStatus pe_post_msg_api(tpAniSirGlobal pMac, tSirMsgQ *pMsg); |
| 110 | tSirRetStatus peProcessMsg(tpAniSirGlobal pMac, tSirMsgQ *limMsg); |
| 111 | /** |
| 112 | * Function to cleanup LIM state. |
| 113 | * This called upon reset/persona change etc |
| 114 | */ |
| 115 | extern void lim_cleanup(tpAniSirGlobal); |
| 116 | /* / Function to post messages to LIM thread */ |
| 117 | extern uint32_t lim_post_msg_api(tpAniSirGlobal, tSirMsgQ *); |
| 118 | /** |
| 119 | * Function to process messages posted to LIM thread |
| 120 | * and dispatch to various sub modules within LIM module. |
| 121 | */ |
| 122 | extern void lim_message_processor(tpAniSirGlobal, tpSirMsgQ); |
| 123 | extern void lim_process_messages(tpAniSirGlobal, tpSirMsgQ); /* DT test alt deferred 2 */ |
| 124 | /** |
| 125 | * Function to check the LIM state if system is in Scan/Learn state. |
| 126 | */ |
| 127 | extern uint8_t lim_is_system_in_scan_state(tpAniSirGlobal); |
| 128 | /** |
| 129 | * Function to handle IBSS coalescing. |
| 130 | * Beacon Processing module to call this. |
| 131 | */ |
| 132 | extern tSirRetStatus lim_handle_ibss_coalescing(tpAniSirGlobal, |
| 133 | tpSchBeaconStruct, |
| 134 | uint8_t *, tpPESession); |
| 135 | /* / Function used by other Sirius modules to read global SME state */ |
| 136 | static inline tLimSmeStates lim_get_sme_state(tpAniSirGlobal pMac) |
| 137 | { |
| 138 | return pMac->lim.gLimSmeState; |
| 139 | } |
| 140 | |
| 141 | extern void lim_received_hb_handler(tpAniSirGlobal, uint8_t, tpPESession); |
| 142 | extern void limCheckAndQuietBSS(tpAniSirGlobal); |
| 143 | /* / Function that triggers STA context deletion */ |
| 144 | extern void lim_trigger_sta_deletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 145 | tpPESession psessionEntry); |
| 146 | |
| 147 | #ifdef FEATURE_WLAN_TDLS |
| 148 | /* Function that sends TDLS Del Sta indication to SME */ |
| 149 | extern void lim_send_sme_tdls_del_sta_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 150 | tpPESession psessionEntry, |
| 151 | uint16_t reasonCode); |
| 152 | #endif |
| 153 | |
| 154 | /* / Function that checks for change in AP's capabilties on STA */ |
| 155 | extern void lim_detect_change_in_ap_capabilities(tpAniSirGlobal, |
| 156 | tpSirProbeRespBeacon, tpPESession); |
| 157 | tSirRetStatus lim_update_short_slot(tpAniSirGlobal pMac, |
| 158 | tpSirProbeRespBeacon pBeacon, |
| 159 | tpUpdateBeaconParams pBeaconParams, |
| 160 | tpPESession); |
| 161 | |
| 162 | void lim_ps_offload_handle_missed_beacon_ind(tpAniSirGlobal pMac, tpSirMsgQ pMsg); |
| 163 | void lim_send_heart_beat_timeout_ind(tpAniSirGlobal pMac, tpPESession psessionEntry); |
| 164 | tMgmtFrmDropReason lim_is_pkt_candidate_for_drop(tpAniSirGlobal pMac, |
| 165 | uint8_t *pRxPacketInfo, |
| 166 | uint32_t subType); |
| 167 | bool lim_is_deauth_diassoc_for_drop(tpAniSirGlobal mac, uint8_t *rx_pkt_info); |
| 168 | #ifdef WLAN_FEATURE_11W |
| 169 | bool lim_is_assoc_req_for_drop(tpAniSirGlobal mac, uint8_t *rx_pkt_info); |
| 170 | #endif |
| 171 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
| 172 | void lim_roam_offload_synch_ind(tpAniSirGlobal pMac, tpSirMsgQ pMsg); |
| 173 | #endif |
| 174 | #define limGetQosMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->limQosEnabled) |
| 175 | #define limGetWmeMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->limWmeEnabled) |
| 176 | #define limGetWsmMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->limWsmEnabled) |
| 177 | #define limGet11dMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->lim11dEnabled) |
| 178 | #define limGetAckPolicy(pMac, pVal) (*(pVal) = pMac->lim.ackPolicy) |
| 179 | /* ----------------------------------------------------------------------- */ |
| 180 | static inline void lim_get_phy_mode(tpAniSirGlobal pMac, uint32_t *phyMode, |
| 181 | tpPESession psessionEntry) |
| 182 | { |
| 183 | *phyMode = |
| 184 | psessionEntry ? psessionEntry->gLimPhyMode : pMac->lim.gLimPhyMode; |
| 185 | } |
| 186 | |
| 187 | /* ----------------------------------------------------------------------- */ |
| 188 | static inline void lim_get_rf_band_new(tpAniSirGlobal pMac, tSirRFBand *band, |
| 189 | tpPESession psessionEntry) |
| 190 | { |
| 191 | *band = psessionEntry ? psessionEntry->limRFBand : SIR_BAND_UNKNOWN; |
| 192 | } |
| 193 | |
| 194 | /*-------------------------------------------------------------------------- |
| 195 | |
| 196 | \brief pe_process_messages() - Message Processor for PE |
| 197 | |
| 198 | Voss calls this function to dispatch the message to PE |
| 199 | |
| 200 | \param pMac - Pointer to Global MAC structure |
| 201 | \param pMsg - Pointer to the message structure |
| 202 | |
| 203 | \return uint32_t - TX_SUCCESS for success. |
| 204 | |
| 205 | --------------------------------------------------------------------------*/ |
| 206 | tSirRetStatus pe_process_messages(tpAniSirGlobal pMac, tSirMsgQ *pMsg); |
| 207 | /** ------------------------------------------------------------- |
| 208 | \fn pe_free_msg |
| 209 | \brief Called by CDS scheduler (function cds_sched_flush_mc_mqs) |
| 210 | \ to free a given PE message on the TX and MC thread. |
| 211 | \ This happens when there are messages pending in the PE |
| 212 | \ queue when system is being stopped and reset. |
| 213 | \param tpAniSirGlobal pMac |
| 214 | \param tSirMsgQ pMsg |
| 215 | \return none |
| 216 | -----------------------------------------------------------------*/ |
| 217 | void pe_free_msg(tpAniSirGlobal pMac, tSirMsgQ *pMsg); |
| 218 | |
| 219 | /*-------------------------------------------------------------------------- |
| 220 | |
| 221 | \brief lim_remain_on_chn_rsp() - API for sending remain on channel response. |
| 222 | |
| 223 | LIM calls this api to send the remain on channel response to SME. |
| 224 | |
| 225 | \param pMac - Pointer to Global MAC structure |
| 226 | \param status - status of the response |
| 227 | \param data - pointer to msg |
| 228 | |
| 229 | \return void |
| 230 | |
| 231 | --------------------------------------------------------------------------*/ |
| 232 | void lim_remain_on_chn_rsp(tpAniSirGlobal pMac, CDF_STATUS status, uint32_t *data); |
| 233 | |
| 234 | /*-------------------------------------------------------------------------- |
| 235 | |
| 236 | \brief lim_process_abort_scan_ind() - function for sending abort scan indication. |
| 237 | |
| 238 | LIM calls this function for sending abort scan indication. |
| 239 | |
| 240 | \param pMac - Pointer to Global MAC structure |
| 241 | |
| 242 | \return void |
| 243 | |
| 244 | --------------------------------------------------------------------------*/ |
| 245 | void lim_process_abort_scan_ind(tpAniSirGlobal pMac, uint8_t sessionId, |
| 246 | uint32_t scan_id); |
| 247 | |
| 248 | void __lim_process_sme_assoc_cnf_new(tpAniSirGlobal, uint32_t, uint32_t *); |
| 249 | |
| 250 | /************************************************************/ |
| 251 | #endif /* __LIM_API_H */ |