blob: 3a4b31fbd36edb422dbeab448a7d3bd578f6257c [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Varun Reddy Yeturud5939f82015-12-24 18:14:02 -08002 * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
Prakash Dhavali7090c5f2015-11-02 17:55:19 -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.
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 Sonid32c6bc2016-10-18 18:00:21 -070052#include "scheduler_api.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080053
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 Dhavali7090c5f2015-11-02 17:55:19 -080064#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 Dhamdherec9acc442016-05-26 02:12:58 -070066#define LIM_IS_NDI_ROLE(psessionEntry) \
67 (GET_LIM_SYSTEM_ROLE(psessionEntry) == eLIM_NDI_ROLE)
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080068/* 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 Dhavali7090c5f2015-11-02 17:55:19 -080085#define LIM_MIN_BCN_PR_LENGTH 12
86#define LIM_BCN_PR_CAPABILITY_OFFSET 10
Kondabattini, Ganeshe4f18e02016-09-13 13:01:22 +053087#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 */
97enum 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 Dhavali7090c5f2015-11-02 17:55:19 -0800103typedef 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 */
117extern tSirRetStatus lim_initialize(tpAniSirGlobal);
Arun Khandavallic811dcc2016-06-26 07:37:21 +0530118tSirRetStatus pe_open(tpAniSirGlobal pMac, struct cds_config_info *cds_cfg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800119tSirRetStatus pe_close(tpAniSirGlobal pMac);
120void pe_register_tl_handle(tpAniSirGlobal pMac);
121tSirRetStatus lim_start(tpAniSirGlobal pMac);
122tSirRetStatus pe_start(tpAniSirGlobal pMac);
123void pe_stop(tpAniSirGlobal pMac);
124tSirRetStatus pe_post_msg_api(tpAniSirGlobal pMac, tSirMsgQ *pMsg);
125tSirRetStatus peProcessMsg(tpAniSirGlobal pMac, tSirMsgQ *limMsg);
Jeff Johnson82b0c622016-10-07 07:53:55 -0700126
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 */
135void pe_register_callbacks_with_wma(tpAniSirGlobal pMac,
136 tSirSmeReadyReq *ready_req);
137
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800138/**
139 * Function to cleanup LIM state.
140 * This called upon reset/persona change etc
141 */
142extern void lim_cleanup(tpAniSirGlobal);
143/* / Function to post messages to LIM thread */
144extern uint32_t lim_post_msg_api(tpAniSirGlobal, tSirMsgQ *);
Padma, Santhosh Kumar95091352016-08-16 15:23:31 +0530145uint32_t lim_post_msg_high_priority(tpAniSirGlobal mac, tSirMsgQ *msg);
146
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800147/**
148 * Function to process messages posted to LIM thread
149 * and dispatch to various sub modules within LIM module.
150 */
151extern void lim_message_processor(tpAniSirGlobal, tpSirMsgQ);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800152/**
153 * Function to check the LIM state if system is in Scan/Learn state.
154 */
155extern uint8_t lim_is_system_in_scan_state(tpAniSirGlobal);
156/**
157 * Function to handle IBSS coalescing.
158 * Beacon Processing module to call this.
159 */
160extern tSirRetStatus lim_handle_ibss_coalescing(tpAniSirGlobal,
161 tpSchBeaconStruct,
162 uint8_t *, tpPESession);
163/* / Function used by other Sirius modules to read global SME state */
164static inline tLimSmeStates lim_get_sme_state(tpAniSirGlobal pMac)
165{
166 return pMac->lim.gLimSmeState;
167}
168
169extern void lim_received_hb_handler(tpAniSirGlobal, uint8_t, tpPESession);
170extern void limCheckAndQuietBSS(tpAniSirGlobal);
171/* / Function that triggers STA context deletion */
172extern 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 */
177extern void lim_send_sme_tdls_del_sta_ind(tpAniSirGlobal pMac, tpDphHashNode pStaDs,
178 tpPESession psessionEntry,
179 uint16_t reasonCode);
Kabilan Kannan32eb5022016-10-04 12:24:50 -0700180/**
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 */
190void lim_set_tdls_flags(roam_offload_synch_ind *roam_sync_ind_ptr,
191 tpPESession ft_session_ptr);
192#else
193static inline void lim_set_tdls_flags(roam_offload_synch_ind *roam_sync_ind_ptr,
194 tpPESession ft_session_ptr)
195{
196}
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800197#endif
198
199/* / Function that checks for change in AP's capabilties on STA */
200extern void lim_detect_change_in_ap_capabilities(tpAniSirGlobal,
201 tpSirProbeRespBeacon, tpPESession);
202tSirRetStatus lim_update_short_slot(tpAniSirGlobal pMac,
203 tpSirProbeRespBeacon pBeacon,
204 tpUpdateBeaconParams pBeaconParams,
205 tpPESession);
206
207void lim_ps_offload_handle_missed_beacon_ind(tpAniSirGlobal pMac, tpSirMsgQ pMsg);
208void lim_send_heart_beat_timeout_ind(tpAniSirGlobal pMac, tpPESession psessionEntry);
209tMgmtFrmDropReason lim_is_pkt_candidate_for_drop(tpAniSirGlobal pMac,
210 uint8_t *pRxPacketInfo,
211 uint32_t subType);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800212#ifdef WLAN_FEATURE_ROAM_OFFLOAD
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530213QDF_STATUS pe_roam_synch_callback(tpAniSirGlobal mac_ctx,
Varun Reddy Yeturud5939f82015-12-24 18:14:02 -0800214 struct sSirSmeRoamOffloadSynchInd *roam_sync_ind_ptr,
215 tpSirBssDescription bss_desc_ptr);
Varun Reddy Yeturubbbbe232016-02-29 14:01:57 -0800216#else
217static 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 Dhavali7090c5f2015-11-02 17:55:19 -0800223#endif
Manjunathappa Prakash0e6e6b52016-04-21 11:48:48 -0700224
225/**
Sreelakshmi Konamki58c72432016-11-09 17:06:44 +0530226 * 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 */
233void lim_update_lost_link_info(tpAniSirGlobal mac, tpPESession session,
234 int32_t rssi);
235
236/**
Manjunathappa Prakash0e6e6b52016-04-21 11:48:48 -0700237 * 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 */
243void lim_mon_init_session(tpAniSirGlobal mac_ptr,
244 struct sir_create_session *msg);
245
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800246#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/* ----------------------------------------------------------------------- */
252static 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/* ----------------------------------------------------------------------- */
260static 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 --------------------------------------------------------------------------*/
278tSirRetStatus pe_process_messages(tpAniSirGlobal pMac, tSirMsgQ *pMsg);
Krunal Sonid32c6bc2016-10-18 18:00:21 -0700279#ifdef NAPIER_CODE
280QDF_STATUS pe_mc_process_handler(struct scheduler_msg *msg);
281#endif
282
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800283/** -------------------------------------------------------------
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 -----------------------------------------------------------------*/
293void 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 Chouhanfb54ab02016-02-18 18:00:46 +0530308void lim_remain_on_chn_rsp(tpAniSirGlobal pMac, QDF_STATUS status, uint32_t *data);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800309
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800310void lim_process_abort_scan_ind(tpAniSirGlobal pMac, uint8_t sessionId,
Deepak Dhamdhered97bfb32015-10-11 15:16:18 -0700311 uint32_t scan_id, uint32_t scan_requestor_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800312
313void __lim_process_sme_assoc_cnf_new(tpAniSirGlobal, uint32_t, uint32_t *);
Varun Reddy Yeturud5939f82015-12-24 18:14:02 -0800314#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
315void lim_fill_join_rsp_ht_caps(tpPESession session, tpSirSmeJoinRsp rsp);
316#else
317static inline void lim_fill_join_rsp_ht_caps(tpPESession session,
318 tpSirSmeJoinRsp rsp)
319{}
320#endif
Selvaraj, Sridhar01741822016-08-30 18:26:19 +0530321QDF_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 Dhavali7090c5f2015-11-02 17:55:19 -0800323/************************************************************/
324#endif /* __LIM_API_H */