Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 1 | /* |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 2 | * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved. |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 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" |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame^] | 52 | #include "scheduler_api.h" |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 53 | |
| 54 | /* Macro to count heartbeat */ |
| 55 | #define limResetHBPktCount(psessionEntry) (psessionEntry->LimRxedBeaconCntDuringHB = 0) |
| 56 | |
| 57 | /* Useful macros for fetching various states in pMac->lim */ |
| 58 | /* gLimSystemRole */ |
| 59 | #define GET_LIM_SYSTEM_ROLE(psessionEntry) (psessionEntry->limSystemRole) |
| 60 | #define LIM_IS_AP_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_AP_ROLE) |
| 61 | #define LIM_IS_STA_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_STA_ROLE) |
| 62 | #define LIM_IS_IBSS_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_STA_IN_IBSS_ROLE) |
| 63 | #define LIM_IS_UNKNOWN_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_UNKNOWN_ROLE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 64 | #define LIM_IS_P2P_DEVICE_ROLE(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_P2P_DEVICE_ROLE) |
| 65 | #define LIM_IS_P2P_DEVICE_GO(psessionEntry) (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_P2P_DEVICE_GO) |
Deepak Dhamdhere | c9acc44 | 2016-05-26 02:12:58 -0700 | [diff] [blame] | 66 | #define LIM_IS_NDI_ROLE(psessionEntry) \ |
| 67 | (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_NDI_ROLE) |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 68 | /* gLimSmeState */ |
| 69 | #define GET_LIM_SME_STATE(pMac) (pMac->lim.gLimSmeState) |
| 70 | #define SET_LIM_SME_STATE(pMac, state) (pMac->lim.gLimSmeState = state) |
| 71 | /* gLimMlmState */ |
| 72 | #define GET_LIM_MLM_STATE(pMac) (pMac->lim.gLimMlmState) |
| 73 | #define SET_LIM_MLM_STATE(pMac, state) (pMac->lim.gLimMlmState = state) |
| 74 | /*tpdphHashNode mlmStaContext*/ |
| 75 | #define GET_LIM_STA_CONTEXT_MLM_STATE(pStaDs) (pStaDs->mlmStaContext.mlmState) |
| 76 | #define SET_LIM_STA_CONTEXT_MLM_STATE(pStaDs, state) (pStaDs->mlmStaContext.mlmState = state) |
| 77 | /* gLimQuietState */ |
| 78 | #define GET_LIM_QUIET_STATE(pMac) (pMac->lim.gLimSpecMgmt.quietState) |
| 79 | #define SET_LIM_QUIET_STATE(pMac, state) (pMac->lim.gLimSpecMgmt.quietState = state) |
| 80 | #define LIM_IS_CONNECTION_ACTIVE(psessionEntry) (psessionEntry->LimRxedBeaconCntDuringHB) |
| 81 | /*pMac->lim.gLimProcessDefdMsgs*/ |
| 82 | #define GET_LIM_PROCESS_DEFD_MESGS(pMac) (pMac->lim.gLimProcessDefdMsgs) |
| 83 | #define SET_LIM_PROCESS_DEFD_MESGS(pMac, val) (pMac->lim.gLimProcessDefdMsgs = val) |
| 84 | /* LIM exported function templates */ |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 85 | #define LIM_MIN_BCN_PR_LENGTH 12 |
| 86 | #define LIM_BCN_PR_CAPABILITY_OFFSET 10 |
Kondabattini, Ganesh | e4f18e0 | 2016-09-13 13:01:22 +0530 | [diff] [blame] | 87 | #define LIM_ASSOC_REQ_IE_OFFSET 4 |
| 88 | |
| 89 | /** |
| 90 | * enum lim_vendor_ie_access_policy - vendor ie access policy |
| 91 | * @LIM_ACCESS_POLICY_NONE: access policy not valid |
| 92 | * @LIM_ACCESS_POLICY_RESPOND_IF_IE_IS_PRESENT: respond only if vendor ie |
| 93 | * is present in probe request and assoc request frames |
| 94 | * @LIM_ACCESS_POLICY_DONOT_RESPOND_IF_IE_IS_PRESENT: do not respond if vendor |
| 95 | * ie is present in probe request or assoc request frames |
| 96 | */ |
| 97 | enum lim_vendor_ie_access_policy { |
| 98 | LIM_ACCESS_POLICY_NONE, |
| 99 | LIM_ACCESS_POLICY_RESPOND_IF_IE_IS_PRESENT, |
| 100 | LIM_ACCESS_POLICY_DONOT_RESPOND_IF_IE_IS_PRESENT, |
| 101 | }; |
| 102 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 103 | typedef enum eMgmtFrmDropReason { |
| 104 | eMGMT_DROP_NO_DROP, |
| 105 | eMGMT_DROP_NOT_LAST_IBSS_BCN, |
| 106 | eMGMT_DROP_INFRA_BCN_IN_IBSS, |
| 107 | eMGMT_DROP_SCAN_MODE_FRAME, |
| 108 | eMGMT_DROP_NON_SCAN_MODE_FRAME, |
| 109 | eMGMT_DROP_INVALID_SIZE, |
| 110 | eMGMT_DROP_SPURIOUS_FRAME, |
| 111 | } tMgmtFrmDropReason; |
| 112 | |
| 113 | /** |
| 114 | * Function to initialize LIM state machines. |
| 115 | * This called upon LIM thread creation. |
| 116 | */ |
| 117 | extern tSirRetStatus lim_initialize(tpAniSirGlobal); |
Arun Khandavalli | c811dcc | 2016-06-26 07:37:21 +0530 | [diff] [blame] | 118 | tSirRetStatus pe_open(tpAniSirGlobal pMac, struct cds_config_info *cds_cfg); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 119 | tSirRetStatus pe_close(tpAniSirGlobal pMac); |
| 120 | void pe_register_tl_handle(tpAniSirGlobal pMac); |
| 121 | tSirRetStatus lim_start(tpAniSirGlobal pMac); |
| 122 | tSirRetStatus pe_start(tpAniSirGlobal pMac); |
| 123 | void pe_stop(tpAniSirGlobal pMac); |
| 124 | tSirRetStatus pe_post_msg_api(tpAniSirGlobal pMac, tSirMsgQ *pMsg); |
| 125 | tSirRetStatus peProcessMsg(tpAniSirGlobal pMac, tSirMsgQ *limMsg); |
Jeff Johnson | 82b0c62 | 2016-10-07 07:53:55 -0700 | [diff] [blame] | 126 | |
| 127 | /** |
| 128 | * pe_register_callbacks_with_wma() - register SME and PE callback functions to |
| 129 | * WMA. |
| 130 | * @pMac: mac global ctx |
| 131 | * @ready_req: Ready request parameters, containing callback pointers |
| 132 | * |
| 133 | * Return: None |
| 134 | */ |
| 135 | void pe_register_callbacks_with_wma(tpAniSirGlobal pMac, |
| 136 | tSirSmeReadyReq *ready_req); |
| 137 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 138 | /** |
| 139 | * Function to cleanup LIM state. |
| 140 | * This called upon reset/persona change etc |
| 141 | */ |
| 142 | extern void lim_cleanup(tpAniSirGlobal); |
| 143 | /* / Function to post messages to LIM thread */ |
| 144 | extern uint32_t lim_post_msg_api(tpAniSirGlobal, tSirMsgQ *); |
Padma, Santhosh Kumar | 9509135 | 2016-08-16 15:23:31 +0530 | [diff] [blame] | 145 | uint32_t lim_post_msg_high_priority(tpAniSirGlobal mac, tSirMsgQ *msg); |
| 146 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 147 | /** |
| 148 | * Function to process messages posted to LIM thread |
| 149 | * and dispatch to various sub modules within LIM module. |
| 150 | */ |
| 151 | extern void lim_message_processor(tpAniSirGlobal, tpSirMsgQ); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 152 | /** |
| 153 | * Function to check the LIM state if system is in Scan/Learn state. |
| 154 | */ |
| 155 | extern uint8_t lim_is_system_in_scan_state(tpAniSirGlobal); |
| 156 | /** |
| 157 | * Function to handle IBSS coalescing. |
| 158 | * Beacon Processing module to call this. |
| 159 | */ |
| 160 | extern tSirRetStatus lim_handle_ibss_coalescing(tpAniSirGlobal, |
| 161 | tpSchBeaconStruct, |
| 162 | uint8_t *, tpPESession); |
| 163 | /* / Function used by other Sirius modules to read global SME state */ |
| 164 | static inline tLimSmeStates lim_get_sme_state(tpAniSirGlobal pMac) |
| 165 | { |
| 166 | return pMac->lim.gLimSmeState; |
| 167 | } |
| 168 | |
| 169 | extern void lim_received_hb_handler(tpAniSirGlobal, uint8_t, tpPESession); |
| 170 | extern void limCheckAndQuietBSS(tpAniSirGlobal); |
| 171 | /* / Function that triggers STA context deletion */ |
| 172 | extern void lim_trigger_sta_deletion(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 173 | tpPESession psessionEntry); |
| 174 | |
| 175 | #ifdef FEATURE_WLAN_TDLS |
| 176 | /* Function that sends TDLS Del Sta indication to SME */ |
| 177 | extern void lim_send_sme_tdls_del_sta_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs, |
| 178 | tpPESession psessionEntry, |
| 179 | uint16_t reasonCode); |
Kabilan Kannan | 32eb502 | 2016-10-04 12:24:50 -0700 | [diff] [blame] | 180 | /** |
| 181 | * lim_set_tdls_flags() - update tdls flags based on newer STA connection |
| 182 | * information |
| 183 | * @roam_sync_ind_ptr: pointer to roam offload structure |
| 184 | * @ft_session_ptr: pointer to PE session |
| 185 | * |
| 186 | * Set TDLS flags as per new STA connection capabilities. |
| 187 | * |
| 188 | * Return: None |
| 189 | */ |
| 190 | void lim_set_tdls_flags(roam_offload_synch_ind *roam_sync_ind_ptr, |
| 191 | tpPESession ft_session_ptr); |
| 192 | #else |
| 193 | static inline void lim_set_tdls_flags(roam_offload_synch_ind *roam_sync_ind_ptr, |
| 194 | tpPESession ft_session_ptr) |
| 195 | { |
| 196 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 197 | #endif |
| 198 | |
| 199 | /* / Function that checks for change in AP's capabilties on STA */ |
| 200 | extern void lim_detect_change_in_ap_capabilities(tpAniSirGlobal, |
| 201 | tpSirProbeRespBeacon, tpPESession); |
| 202 | tSirRetStatus lim_update_short_slot(tpAniSirGlobal pMac, |
| 203 | tpSirProbeRespBeacon pBeacon, |
| 204 | tpUpdateBeaconParams pBeaconParams, |
| 205 | tpPESession); |
| 206 | |
| 207 | void lim_ps_offload_handle_missed_beacon_ind(tpAniSirGlobal pMac, tpSirMsgQ pMsg); |
| 208 | void lim_send_heart_beat_timeout_ind(tpAniSirGlobal pMac, tpPESession psessionEntry); |
| 209 | tMgmtFrmDropReason lim_is_pkt_candidate_for_drop(tpAniSirGlobal pMac, |
| 210 | uint8_t *pRxPacketInfo, |
| 211 | uint32_t subType); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 212 | #ifdef WLAN_FEATURE_ROAM_OFFLOAD |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 213 | QDF_STATUS pe_roam_synch_callback(tpAniSirGlobal mac_ctx, |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 214 | struct sSirSmeRoamOffloadSynchInd *roam_sync_ind_ptr, |
| 215 | tpSirBssDescription bss_desc_ptr); |
Varun Reddy Yeturu | bbbbe23 | 2016-02-29 14:01:57 -0800 | [diff] [blame] | 216 | #else |
| 217 | static inline QDF_STATUS pe_roam_synch_callback(tpAniSirGlobal mac_ctx, |
| 218 | struct sSirSmeRoamOffloadSynchInd *roam_sync_ind_ptr, |
| 219 | tpSirBssDescription bss_desc_ptr) |
| 220 | { |
| 221 | return QDF_STATUS_E_NOSUPPORT; |
| 222 | } |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 223 | #endif |
Manjunathappa Prakash | 0e6e6b5 | 2016-04-21 11:48:48 -0700 | [diff] [blame] | 224 | |
| 225 | /** |
Sreelakshmi Konamki | 58c7243 | 2016-11-09 17:06:44 +0530 | [diff] [blame] | 226 | * lim_update_lost_link_info() - update lost link information to SME |
| 227 | * @mac: global MAC handle |
| 228 | * @session: PE session |
| 229 | * @rssi: rssi value from the received frame |
| 230 | * |
| 231 | * Return: None |
| 232 | */ |
| 233 | void lim_update_lost_link_info(tpAniSirGlobal mac, tpPESession session, |
| 234 | int32_t rssi); |
| 235 | |
| 236 | /** |
Manjunathappa Prakash | 0e6e6b5 | 2016-04-21 11:48:48 -0700 | [diff] [blame] | 237 | * lim_mon_init_session() - create PE session for monitor mode operation |
| 238 | * @mac_ptr: mac pointer |
| 239 | * @msg: Pointer to struct sir_create_session type. |
| 240 | * |
| 241 | * Return: NONE |
| 242 | */ |
| 243 | void lim_mon_init_session(tpAniSirGlobal mac_ptr, |
| 244 | struct sir_create_session *msg); |
| 245 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 246 | #define limGetQosMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->limQosEnabled) |
| 247 | #define limGetWmeMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->limWmeEnabled) |
| 248 | #define limGetWsmMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->limWsmEnabled) |
| 249 | #define limGet11dMode(psessionEntry, pVal) (*(pVal) = (psessionEntry)->lim11dEnabled) |
| 250 | #define limGetAckPolicy(pMac, pVal) (*(pVal) = pMac->lim.ackPolicy) |
| 251 | /* ----------------------------------------------------------------------- */ |
| 252 | static inline void lim_get_phy_mode(tpAniSirGlobal pMac, uint32_t *phyMode, |
| 253 | tpPESession psessionEntry) |
| 254 | { |
| 255 | *phyMode = |
| 256 | psessionEntry ? psessionEntry->gLimPhyMode : pMac->lim.gLimPhyMode; |
| 257 | } |
| 258 | |
| 259 | /* ----------------------------------------------------------------------- */ |
| 260 | static inline void lim_get_rf_band_new(tpAniSirGlobal pMac, tSirRFBand *band, |
| 261 | tpPESession psessionEntry) |
| 262 | { |
| 263 | *band = psessionEntry ? psessionEntry->limRFBand : SIR_BAND_UNKNOWN; |
| 264 | } |
| 265 | |
| 266 | /*-------------------------------------------------------------------------- |
| 267 | |
| 268 | \brief pe_process_messages() - Message Processor for PE |
| 269 | |
| 270 | Voss calls this function to dispatch the message to PE |
| 271 | |
| 272 | \param pMac - Pointer to Global MAC structure |
| 273 | \param pMsg - Pointer to the message structure |
| 274 | |
| 275 | \return uint32_t - TX_SUCCESS for success. |
| 276 | |
| 277 | --------------------------------------------------------------------------*/ |
| 278 | tSirRetStatus pe_process_messages(tpAniSirGlobal pMac, tSirMsgQ *pMsg); |
Krunal Soni | d32c6bc | 2016-10-18 18:00:21 -0700 | [diff] [blame^] | 279 | #ifdef NAPIER_CODE |
| 280 | QDF_STATUS pe_mc_process_handler(struct scheduler_msg *msg); |
| 281 | #endif |
| 282 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 283 | /** ------------------------------------------------------------- |
| 284 | \fn pe_free_msg |
| 285 | \brief Called by CDS scheduler (function cds_sched_flush_mc_mqs) |
| 286 | \ to free a given PE message on the TX and MC thread. |
| 287 | \ This happens when there are messages pending in the PE |
| 288 | \ queue when system is being stopped and reset. |
| 289 | \param tpAniSirGlobal pMac |
| 290 | \param tSirMsgQ pMsg |
| 291 | \return none |
| 292 | -----------------------------------------------------------------*/ |
| 293 | void pe_free_msg(tpAniSirGlobal pMac, tSirMsgQ *pMsg); |
| 294 | |
| 295 | /*-------------------------------------------------------------------------- |
| 296 | |
| 297 | \brief lim_remain_on_chn_rsp() - API for sending remain on channel response. |
| 298 | |
| 299 | LIM calls this api to send the remain on channel response to SME. |
| 300 | |
| 301 | \param pMac - Pointer to Global MAC structure |
| 302 | \param status - status of the response |
| 303 | \param data - pointer to msg |
| 304 | |
| 305 | \return void |
| 306 | |
| 307 | --------------------------------------------------------------------------*/ |
Anurag Chouhan | fb54ab0 | 2016-02-18 18:00:46 +0530 | [diff] [blame] | 308 | void lim_remain_on_chn_rsp(tpAniSirGlobal pMac, QDF_STATUS status, uint32_t *data); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 309 | |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 310 | void lim_process_abort_scan_ind(tpAniSirGlobal pMac, uint8_t sessionId, |
Deepak Dhamdhere | d97bfb3 | 2015-10-11 15:16:18 -0700 | [diff] [blame] | 311 | uint32_t scan_id, uint32_t scan_requestor_id); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 312 | |
| 313 | void __lim_process_sme_assoc_cnf_new(tpAniSirGlobal, uint32_t, uint32_t *); |
Varun Reddy Yeturu | d5939f8 | 2015-12-24 18:14:02 -0800 | [diff] [blame] | 314 | #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH |
| 315 | void lim_fill_join_rsp_ht_caps(tpPESession session, tpSirSmeJoinRsp rsp); |
| 316 | #else |
| 317 | static inline void lim_fill_join_rsp_ht_caps(tpPESession session, |
| 318 | tpSirSmeJoinRsp rsp) |
| 319 | {} |
| 320 | #endif |
Selvaraj, Sridhar | 0174182 | 2016-08-30 18:26:19 +0530 | [diff] [blame] | 321 | QDF_STATUS lim_update_ext_cap_ie(tpAniSirGlobal mac_ctx, |
| 322 | uint8_t *ie_data, uint8_t *local_ie_buf, uint16_t *local_ie_len); |
Prakash Dhavali | 7090c5f | 2015-11-02 17:55:19 -0800 | [diff] [blame] | 323 | /************************************************************/ |
| 324 | #endif /* __LIM_API_H */ |