blob: 46eb6f5836bccea3084ee98c1e8062fc32937b94 [file] [log] [blame]
Prakash Dhavali7090c5f2015-11-02 17:55:19 -08001/*
Paul Zhange79e7db2017-01-04 16:37:05 +08002 * Copyright (c) 2012-2017 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#ifndef WMA_API_H
29#define WMA_API_H
30
31#include "osdep.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080032#include "ani_global.h"
33#include "a_types.h"
Govind Singh5b486202016-06-09 18:29:42 +053034#include "osapi_linux.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080035#include "wmi_unified.h"
36#ifdef NOT_YET
37#include "htc_api.h"
38#endif
39#include "lim_global.h"
Krunal Soni0193b6f2016-08-15 15:53:43 -070040#include "cds_utils.h"
Krunal Sonid32c6bc2016-10-18 18:00:21 -070041#include "scheduler_api.h"
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -080042#include "wlan_policy_mgr_api.h"
Tushnim Bhattacharyya45ed04f2017-03-15 10:15:05 -070043#include <cdp_txrx_ops.h>
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080044
45typedef void *WMA_HANDLE;
46
47/**
48 * enum GEN_PARAM - general parameters
49 * @GEN_VDEV_PARAM_AMPDU: Set ampdu size
50 * @GEN_VDEV_PARAM_AMSDU: Set amsdu size
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080051 * @GEN_PARAM_CRASH_INJECT: inject crash
Rajeev Kumarf4390fa2016-12-22 13:17:33 -080052 * @GEN_PARAM_MODULATED_DTIM: moduled dtim
53 * @GEN_PARAM_CAPTURE_TSF: read tsf
54 * @GEN_PARAM_RESET_TSF_GPIO: reset tsf gpio
55 * @GEN_VDEV_ROAM_SYNCH_DELAY: roam sync delay
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080056 */
Manikandan Mohan1dd8b5d2017-04-18 15:54:09 -070057enum GEN_PARAM {
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080058 GEN_VDEV_PARAM_AMPDU = 0x1,
59 GEN_VDEV_PARAM_AMSDU,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080060 GEN_PARAM_CRASH_INJECT,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080061 GEN_PARAM_MODULATED_DTIM,
Manikandan Mohandcc21ba2016-03-15 14:31:56 -070062 GEN_PARAM_CAPTURE_TSF,
63 GEN_PARAM_RESET_TSF_GPIO,
Varun Reddy Yeturu5ab47462016-05-08 18:08:11 -070064 GEN_VDEV_ROAM_SYNCH_DELAY,
Manikandan Mohan1dd8b5d2017-04-18 15:54:09 -070065};
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080066
Krunal Soni0193b6f2016-08-15 15:53:43 -070067/**
68 * struct wma_caps_per_phy - various caps per phy
69 * @ht_2g: entire HT cap for 2G band in terms of 32 bit flag
70 * @ht_5g: entire HT cap for 5G band in terms of 32 bit flag
71 * @vht_2g: entire VHT cap for 2G band in terms of 32 bit flag
72 * @vht_5g: entire VHT cap for 5G band in terms of 32 bit flag
73 * @he_2g: entire HE cap for 2G band in terms of 32 bit flag
74 * @he_5g: entire HE cap for 5G band in terms of 32 bit flag
75 */
76struct wma_caps_per_phy {
77 uint32_t ht_2g;
78 uint32_t ht_5g;
79 uint32_t vht_2g;
80 uint32_t vht_5g;
81 uint32_t he_2g;
82 uint32_t he_5g;
83};
84
85
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080086#define VDEV_CMD 1
87#define PDEV_CMD 2
88#define GEN_CMD 3
89#define DBG_CMD 4
90#define PPS_CMD 5
91#define QPOWER_CMD 6
92#define GTX_CMD 7
93
94typedef void (*wma_peer_authorized_fp) (uint32_t vdev_id);
95
96
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053097QDF_STATUS wma_pre_start(void *cds_context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080098
Rajeev Kumarb60abe42017-01-21 15:39:31 -080099QDF_STATUS wma_mc_process_msg(void *cds_context, struct scheduler_msg *msg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800100
Krunal Sonid32c6bc2016-10-18 18:00:21 -0700101QDF_STATUS wma_mc_process_handler(struct scheduler_msg *msg);
Krunal Sonid32c6bc2016-10-18 18:00:21 -0700102
Jeff Johnsond4892552017-09-13 08:41:31 -0700103QDF_STATUS wma_start(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800104
Jeff Johnsonacc1cc72017-09-13 08:47:49 -0700105QDF_STATUS wma_stop(uint8_t reason);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800106
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530107QDF_STATUS wma_close(void *cds_context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800108
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530109QDF_STATUS wma_wmi_service_close(void *cds_context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800110
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530111QDF_STATUS wma_wmi_work_close(void *cds_context);
Xun Luoa858a472015-11-10 08:24:45 -0800112
Govind Singhd76a5b02016-03-08 15:12:14 +0530113int wma_rx_ready_event(void *handle, uint8_t *ev, uint32_t len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800114
Govind Singhd76a5b02016-03-08 15:12:14 +0530115int wma_rx_service_ready_event(void *handle, uint8_t *ev, uint32_t len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800116
Govind Singhd76a5b02016-03-08 15:12:14 +0530117int wma_rx_service_ready_ext_event(void *handle, uint8_t *ev, uint32_t len);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800118
Jeff Johnson1f8d0a02017-09-13 08:09:05 -0700119void wma_setneedshutdown(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800120
Jeff Johnson1b5404e2017-09-13 08:04:46 -0700121bool wma_needshutdown(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800122
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530123QDF_STATUS wma_wait_for_ready_event(WMA_HANDLE handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800124
125uint8_t wma_map_channel(uint8_t mapChannel);
126
127int wma_cli_get_command(int vdev_id, int param_id, int vpdev);
128int wma_cli_set_command(int vdev_id, int param_id, int sval, int vpdev);
129int wma_cli_set2_command(int vdev_id, int param_id, int sval1,
130 int sval2, int vpdev);
131
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530132QDF_STATUS wma_set_htconfig(uint8_t vdev_id, uint16_t ht_capab, int value);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800133
Jeff Johnsonabb74042017-08-31 11:44:55 -0700134/**
135 * wma_get_wcnss_software_version() - get wcnss software version
136 * @version: version pointer
137 * @version_buffer_size: buffer size
138 *
139 * Return: QDF_STATUS_SUCCESS for success or error code
140 */
141QDF_STATUS wma_get_wcnss_software_version(uint8_t *version,
142 uint32_t version_buffer_size);
143
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800144void wma_set_peer_authorized_cb(void *wma_ctx, wma_peer_authorized_fp auth_cb);
Govind Singhd76a5b02016-03-08 15:12:14 +0530145QDF_STATUS wma_set_peer_param(void *wma_ctx, uint8_t *peer_addr,
146 uint32_t param_id,
147 uint32_t param_value, uint32_t vdev_id);
Mukul Sharmac3886aa2017-05-04 17:53:22 +0530148QDF_STATUS wma_get_link_speed(WMA_HANDLE handle, tSirLinkSpeedInfo *pLinkSpeed);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800149#ifdef NOT_YET
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530150QDF_STATUS wma_update_channel_list(WMA_HANDLE handle, void *scan_chan_info);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800151#endif
152
153uint8_t *wma_get_vdev_address_by_vdev_id(uint8_t vdev_id);
154struct wma_txrx_node *wma_get_interface_by_vdev_id(uint8_t vdev_id);
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -0800155QDF_STATUS wma_get_connection_info(uint8_t vdev_id,
156 struct policy_mgr_vdev_entry_info *conn_table_entry);
157
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800158bool wma_is_vdev_up(uint8_t vdev_id);
159
160void *wma_get_beacon_buffer_by_vdev_id(uint8_t vdev_id, uint32_t *buffer_size);
161
Krishna Kumaar Natarajand0bbb3c2017-03-13 17:04:58 -0700162bool wma_get_fw_wlan_feat_caps(enum cap_bitmap feature);
163void wma_set_fw_wlan_feat_caps(enum cap_bitmap feature);
Rajeev Kumarfeb96382017-01-22 19:42:09 -0800164tSirRetStatus wma_post_ctrl_msg(tpAniSirGlobal pMac,
165 struct scheduler_msg *pMsg);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800166
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800167void wma_register_wow_wakeup_events(WMA_HANDLE handle, uint8_t vdev_id,
168 uint8_t vdev_type, uint8_t sub_type);
169void wma_register_wow_default_patterns(WMA_HANDLE handle, uint8_t vdev_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800170int8_t wma_get_mac_id_of_vdev(uint32_t vdev_id);
171void wma_update_intf_hw_mode_params(uint32_t vdev_id, uint32_t mac_id,
172 uint32_t cfgd_hw_mode_index);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800173void wma_set_dbs_capability_ut(uint32_t dbs);
Krunal Soni0193b6f2016-08-15 15:53:43 -0700174QDF_STATUS wma_get_caps_for_phyidx_hwmode(struct wma_caps_per_phy *caps_per_phy,
175 enum hw_mode_dbs_capab hw_mode, enum cds_band_type band);
176bool wma_is_rx_ldpc_supported_for_channel(uint32_t channel);
yeshwanth sriram guntuka584c2332017-07-29 12:50:25 +0530177int wma_unified_radio_tx_mem_free(void *handle);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800178
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800179#if defined(FEATURE_LRO)
Dhanashri Atre09828f12016-11-13 10:36:58 -0800180int wma_lro_init(struct cdp_lro_hash_config *lro_config);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800181#endif
Ryan Hsu3c8f79f2015-12-02 16:45:09 -0800182
Gupta, Kapil4cb1d7d2016-04-16 18:16:25 -0700183QDF_STATUS wma_remove_beacon_filter(WMA_HANDLE wma,
184 struct beacon_filter_param *filter_params);
185
186QDF_STATUS wma_add_beacon_filter(WMA_HANDLE wma,
187 struct beacon_filter_param *filter_params);
Gupta, Kapil96c7f2f2016-04-25 19:13:41 +0530188QDF_STATUS wma_send_adapt_dwelltime_params(WMA_HANDLE handle,
189 struct adaptive_dwelltime_params *dwelltime_params);
Nitesh Shahf9a09ff2017-05-22 15:46:25 +0530190
191/**
192 * wma_send_dbs_scan_selection_params() - send DBS scan selection configuration
193 * params to firmware
194 * @handle: wma handler
195 * @dbs_scan_params: pointer to wmi_dbs_scan_sel_params
196 *
197 * Return: QDF_STATUS_SUCCESS on success and QDF failure reason code for failure
198 */
199QDF_STATUS wma_send_dbs_scan_selection_params(WMA_HANDLE handle,
200 struct wmi_dbs_scan_sel_params *dbs_scan_params);
Ryan Hsu3c8f79f2015-12-02 16:45:09 -0800201#ifdef FEATURE_GREEN_AP
202void wma_setup_egap_support(struct wma_tgt_cfg *tgt_cfg, WMA_HANDLE handle);
203void wma_register_egap_event_handle(WMA_HANDLE handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530204QDF_STATUS wma_send_egap_conf_params(WMA_HANDLE handle,
Ryan Hsu3c8f79f2015-12-02 16:45:09 -0800205 struct egap_conf_params *egap_params);
206#else
207static inline void wma_setup_egap_support(struct wma_tgt_cfg *tgt_cfg,
208 WMA_HANDLE handle) {}
209static inline void wma_register_egap_event_handle(WMA_HANDLE handle) {}
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530210static inline QDF_STATUS wma_send_egap_conf_params(WMA_HANDLE handle,
Ryan Hsu3c8f79f2015-12-02 16:45:09 -0800211 struct egap_conf_params *egap_params)
212{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530213 return QDF_STATUS_E_NOSUPPORT;
Ryan Hsu3c8f79f2015-12-02 16:45:09 -0800214}
215#endif
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530216QDF_STATUS wma_set_tx_power_scale(uint8_t vdev_id, int value);
217QDF_STATUS wma_set_tx_power_scale_decr_db(uint8_t vdev_id, int value);
Naveen Rawat0fc3f692016-06-22 14:30:54 -0700218
Naveen Rawatcb5c5402017-03-22 10:12:19 -0700219#if defined(WLAN_FEATURE_NAN_DATAPATH) && !defined(WLAN_FEATURE_NAN_CONVERGENCE)
Naveen Rawat0fc3f692016-06-22 14:30:54 -0700220QDF_STATUS wma_register_ndp_cb(QDF_STATUS (*pe_ndp_event_handler)
221 (tpAniSirGlobal mac_ctx,
Rajeev Kumarb60abe42017-01-21 15:39:31 -0800222 struct scheduler_msg *msg));
Naveen Rawat0fc3f692016-06-22 14:30:54 -0700223#else
224static inline QDF_STATUS wma_register_ndp_cb(QDF_STATUS (*pe_ndp_event_handler)
225 (tpAniSirGlobal mac_ctx,
Rajeev Kumarb60abe42017-01-21 15:39:31 -0800226 struct scheduler_msg *msg))
Naveen Rawat0fc3f692016-06-22 14:30:54 -0700227{
228 return QDF_STATUS_SUCCESS;
229}
Naveen Rawatcb5c5402017-03-22 10:12:19 -0700230#endif /* WLAN_FEATURE_NAN_DATAPATH && !WLAN_FEATURE_NAN_CONVERGENCE */
Naveen Rawat0fc3f692016-06-22 14:30:54 -0700231
Kiran Kumar Lokered0fad462017-06-13 18:23:48 -0700232bool wma_is_csa_offload_enabled(void);
Peng Xu8fdaa492016-06-22 10:20:47 -0700233bool wma_is_p2p_lo_capable(void);
Dustin Brown8d8d9fe2017-07-18 16:01:25 -0700234bool wma_capability_enhanced_mcast_filter(void);
Peng Xu8fdaa492016-06-22 10:20:47 -0700235QDF_STATUS wma_p2p_lo_start(struct sir_p2p_lo_start *params);
236QDF_STATUS wma_p2p_lo_stop(u_int32_t vdev_id);
Padma, Santhosh Kumar5e33beb2016-08-08 19:07:06 +0530237QDF_STATUS wma_get_wakelock_stats(struct sir_wake_lock_stats *wake_lock_stats);
Naveen Rawat8cc23b02016-07-14 12:22:56 -0700238void wma_process_pdev_hw_mode_trans_ind(void *wma,
239 wmi_pdev_hw_mode_transition_event_fixed_param *fixed_param,
240 wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry,
241 struct sir_hw_mode_trans_ind *hw_mode_trans_ind);
Padma, Santhosh Kumar72e7aec2016-10-12 17:23:44 +0530242
243#ifdef WLAN_FEATURE_DISA
Padma, Santhosh Kumard7cc0792016-06-28 18:54:12 +0530244QDF_STATUS wma_encrypt_decrypt_msg(WMA_HANDLE wma,
245 struct encrypt_decrypt_req_params *encrypt_decrypt_params);
Padma, Santhosh Kumar72e7aec2016-10-12 17:23:44 +0530246#else
247static inline QDF_STATUS wma_encrypt_decrypt_msg(WMA_HANDLE wma,
248 struct encrypt_decrypt_req_params *encrypt_decrypt_params)
249{
250 return 0;
251}
252#endif
Agrawal Ashishb2d1a452016-05-05 12:23:58 +0530253
254/**
255 * wma_set_cts2self_for_p2p_go() - set CTS2SELF command for P2P GO.
256 * @wma_handle: pointer to wma handle.
257 * @cts2self_for_p2p_go: value needs to set to firmware.
258 *
259 * At the time of driver startup, inform about ini parma to FW that
260 * if legacy client connects to P2P GO, stop using NOA for P2P GO.
261 *
262 * Return: QDF_STATUS.
263 */
264QDF_STATUS wma_set_cts2self_for_p2p_go(void *wma_handle,
265 uint32_t cts2self_for_p2p_go);
Padma, Santhosh Kumara7119672016-08-16 16:05:14 +0530266QDF_STATUS wma_set_tx_rx_aggregation_size
267 (struct sir_set_tx_rx_aggregation_size *tx_rx_aggregation_size);
Kabilan Kannan3c0a7352016-12-02 18:49:38 -0800268/**
269 * wma_set_sar_limit() - set sar limits in the target
270 * @handle: wma handle
271 * @sar_limit_cmd_params: sar limit cmd params
272 *
273 * This function sends WMI command to set SAR limits.
274 *
275 * Return: QDF_STATUS enumeration
276 */
277QDF_STATUS wma_set_sar_limit(WMA_HANDLE handle,
278 struct sar_limit_cmd_params *sar_limit_params);
Dustin Brown10a7b712016-10-07 10:31:16 -0700279/**
280 * wma_set_qpower_config() - update qpower config in wma
281 * @vdev_id: the Id of the vdev to configure
282 * @qpower: new qpower value
283 *
284 * Return: QDF_STATUS_SUCCESS on success, error number otherwise
285 */
286QDF_STATUS wma_set_qpower_config(uint8_t vdev_id, uint8_t qpower);
Krishna Kumaar Natarajan0103ef82017-02-17 18:15:56 -0800287
Tushnim Bhattacharyya9e81b4c2017-02-15 17:11:14 -0800288bool wma_is_service_enabled(WMI_SERVICE service_type);
Zhang Qiana6e9c102016-12-22 16:47:24 +0800289
290#ifdef WLAN_FEATURE_LINK_LAYER_STATS
291/**
292 * wma_tx_failure_cb() - TX failure callback
293 * @ctx: txrx context
294 * @num_msdu: number of msdu with the same status
295 * @tid: TID number
296 * @status: failure status
297 */
298void wma_tx_failure_cb(void *ctx, uint32_t num_msdu,
299 uint8_t tid, enum htt_tx_status status);
300#else
301static inline void wma_tx_failure_cb(void *ctx, uint32_t num_msdu,
302 uint8_t tid, enum htt_tx_status status)
303{
304}
305#endif
Kiran Kumar Lokerea3de2262017-04-12 12:15:04 -0700306
307/**
308 * wma_store_pdev() - store pdev
309 * @wma_ctx: wma context
310 * @pdev: pdev context
311 *
312 * Return: void
313 */
314void wma_store_pdev(void *wma_ctx, struct wlan_objmgr_pdev *pdev);
315
Krishna Kumaar Natarajanc7e2bb72017-03-10 10:38:46 -0800316/**
317 * wmi_to_sir_peer_type() - convert peer type from WMI to SIR enum
318 * @type: enum wmi_peer_type
319 *
320 * Return: tSirWifiPeerType
321 */
322tSirWifiPeerType wmi_to_sir_peer_type(enum wmi_peer_type type);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800323#endif