blob: 321096435e6f090467ab77c97acf6b287cd5c692 [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"
32#include "cds_mq.h"
33#include "ani_global.h"
34#include "a_types.h"
Govind Singh5b486202016-06-09 18:29:42 +053035#include "osapi_linux.h"
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080036#include "wmi_unified.h"
37#ifdef NOT_YET
38#include "htc_api.h"
39#endif
40#include "lim_global.h"
Krunal Soni0193b6f2016-08-15 15:53:43 -070041#include "cds_concurrency.h"
42#include "cds_utils.h"
Krunal Sonid32c6bc2016-10-18 18:00:21 -070043#include "scheduler_api.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 */
57typedef enum {
58 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,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -080065} GEN_PARAM;
66
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
Anurag Chouhanfb54ab02016-02-18 18:00:46 +053099QDF_STATUS wma_mc_process_msg(void *cds_context, cds_msg_t *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
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530103QDF_STATUS wma_start(void *cds_context);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800104
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530105QDF_STATUS wma_stop(void *cds_context, 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
119void wma_setneedshutdown(void *cds_context);
120
121bool wma_needshutdown(void *cds_context);
122
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);
133QDF_STATUS wma_set_reg_domain(void *clientCtxt, v_REGDOMAIN_t regId);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800134
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530135QDF_STATUS wma_get_wcnss_software_version(void *p_cds_gctx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800136 uint8_t *pVersion,
137 uint32_t versionBufferSize);
Dustin Browne70fd972016-11-10 11:17:40 -0800138int wma_runtime_suspend(uint32_t wow_flags);
Houston Hoffmana76591b2015-11-10 16:52:05 -0800139int wma_runtime_resume(void);
Dustin Browne70fd972016-11-10 11:17:40 -0800140int wma_bus_suspend(uint32_t wow_flags);
Rajeev Kumar4c426622016-08-25 14:51:42 -0700141int wma_is_target_wake_up_received(void);
Rajeev Kumar99805a72016-08-29 13:53:52 -0700142int wma_clear_target_wake_up(void);
Govind Singhd76a5b02016-03-08 15:12:14 +0530143QDF_STATUS wma_suspend_target(WMA_HANDLE handle, int disable_target_intr);
Houston Hoffmana769ed32016-04-14 17:02:51 -0700144void wma_target_suspend_acknowledge(void *context, bool wow_nack);
Rajeev Kumar4c426622016-08-25 14:51:42 -0700145void wma_handle_initial_wake_up(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800146int wma_bus_resume(void);
Govind Singhd76a5b02016-03-08 15:12:14 +0530147QDF_STATUS wma_resume_target(WMA_HANDLE handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530148QDF_STATUS wma_disable_wow_in_fw(WMA_HANDLE handle);
149QDF_STATUS wma_disable_d0wow_in_fw(WMA_HANDLE handle);
Houston Hoffmana76591b2015-11-10 16:52:05 -0800150bool wma_is_wow_mode_selected(WMA_HANDLE handle);
Dustin Browne70fd972016-11-10 11:17:40 -0800151QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle, uint32_t wow_flags);
152QDF_STATUS wma_enable_d0wow_in_fw(WMA_HANDLE handle, uint32_t wow_flags);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800153bool wma_check_scan_in_progress(WMA_HANDLE handle);
154void wma_set_peer_authorized_cb(void *wma_ctx, wma_peer_authorized_fp auth_cb);
Govind Singhd76a5b02016-03-08 15:12:14 +0530155QDF_STATUS wma_set_peer_param(void *wma_ctx, uint8_t *peer_addr,
156 uint32_t param_id,
157 uint32_t param_value, uint32_t vdev_id);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800158#ifdef NOT_YET
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530159QDF_STATUS wma_update_channel_list(WMA_HANDLE handle, void *scan_chan_info);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800160#endif
161
162uint8_t *wma_get_vdev_address_by_vdev_id(uint8_t vdev_id);
163struct wma_txrx_node *wma_get_interface_by_vdev_id(uint8_t vdev_id);
164bool wma_is_vdev_up(uint8_t vdev_id);
165
166void *wma_get_beacon_buffer_by_vdev_id(uint8_t vdev_id, uint32_t *buffer_size);
167
168uint8_t wma_get_fw_wlan_feat_caps(uint8_t featEnumValue);
169tSirRetStatus wma_post_ctrl_msg(tpAniSirGlobal pMac, tSirMsgQ *pMsg);
170
171void wma_enable_disable_wakeup_event(WMA_HANDLE handle,
172 uint32_t vdev_id,
173 uint32_t bitmap,
174 bool enable);
175void wma_register_wow_wakeup_events(WMA_HANDLE handle, uint8_t vdev_id,
176 uint8_t vdev_type, uint8_t sub_type);
177void wma_register_wow_default_patterns(WMA_HANDLE handle, uint8_t vdev_id);
Paul Zhange79e7db2017-01-04 16:37:05 +0800178QDF_STATUS wma_register_action_frame_patterns(WMA_HANDLE handle,
179 uint8_t vdev_id);
180
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800181int8_t wma_get_hw_mode_idx_from_dbs_hw_list(enum hw_mode_ss_config mac0_ss,
182 enum hw_mode_bandwidth mac0_bw,
183 enum hw_mode_ss_config mac1_ss,
184 enum hw_mode_bandwidth mac1_bw,
185 enum hw_mode_dbs_capab dbs,
Nitesh Shah5b7bae02016-09-28 18:58:33 +0530186 enum hw_mode_agile_dfs_capab dfs,
187 enum hw_mode_sbs_capab sbs);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530188QDF_STATUS wma_get_hw_mode_from_idx(uint32_t idx,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800189 struct sir_hw_mode_params *hw_mode);
190int8_t wma_get_num_dbs_hw_modes(void);
191bool wma_is_hw_dbs_capable(void);
Aravind Narasimhan5b7c2cd2016-12-08 21:04:26 -0800192bool wma_is_hw_sbs_capable(void);
193bool wma_is_hw_dbs_2x2_capable(void);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800194int8_t wma_get_mac_id_of_vdev(uint32_t vdev_id);
195void wma_update_intf_hw_mode_params(uint32_t vdev_id, uint32_t mac_id,
196 uint32_t cfgd_hw_mode_index);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530197QDF_STATUS wma_get_old_and_new_hw_index(uint32_t *old_hw_mode_index,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800198 uint32_t *new_hw_mode_index);
199void wma_set_dbs_capability_ut(uint32_t dbs);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530200QDF_STATUS wma_get_dbs_hw_modes(bool *one_by_one_dbs, bool *two_by_two_dbs);
201QDF_STATUS wma_get_current_hw_mode(struct sir_hw_mode_params *hw_mode);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800202bool wma_is_dbs_enable(void);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530203QDF_STATUS wma_get_updated_scan_config(uint32_t *scan_config,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800204 bool dbs_scan,
205 bool dbs_plus_agile_scan,
206 bool single_mac_scan_with_dfs);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530207QDF_STATUS wma_get_updated_fw_mode_config(uint32_t *fw_mode_config,
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800208 bool dbs,
209 bool agile_dfs);
210bool wma_get_dbs_scan_config(void);
211bool wma_get_dbs_plus_agile_scan_config(void);
212bool wma_get_single_mac_scan_with_dfs_config(void);
213bool wma_get_dbs_config(void);
214bool wma_get_agile_dfs_config(void);
215bool wma_is_dual_mac_disabled_in_ini(void);
216bool wma_get_prev_dbs_config(void);
217bool wma_get_prev_agile_dfs_config(void);
218bool wma_get_prev_dbs_scan_config(void);
219bool wma_get_prev_dbs_plus_agile_scan_config(void);
220bool wma_get_prev_single_mac_scan_with_dfs_config(void);
Krunal Soni0193b6f2016-08-15 15:53:43 -0700221QDF_STATUS wma_get_caps_for_phyidx_hwmode(struct wma_caps_per_phy *caps_per_phy,
222 enum hw_mode_dbs_capab hw_mode, enum cds_band_type band);
223bool wma_is_rx_ldpc_supported_for_channel(uint32_t channel);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800224
225#define LRO_IPV4_SEED_ARR_SZ 5
226#define LRO_IPV6_SEED_ARR_SZ 11
227
228/**
229 * struct wma_lro_init_cmd_t - set LRO init parameters
230 * @lro_enable: indicates whether lro is enabled
231 * @tcp_flag: If the TCP flags from the packet do not match
232 * the values in this field after masking with TCP flags mask
233 * below, packet is not LRO eligible
234 * @tcp_flag_mask: field for comparing the TCP values provided
235 * above with the TCP flags field in the received packet
236 * @toeplitz_hash_ipv4: contains seed needed to compute the flow id
237 * 5-tuple toeplitz hash for ipv4 packets
238 * @toeplitz_hash_ipv6: contains seed needed to compute the flow id
239 * 5-tuple toeplitz hash for ipv6 packets
240 */
241struct wma_lro_config_cmd_t {
242 uint32_t lro_enable;
243 uint32_t tcp_flag:9,
244 tcp_flag_mask:9;
245 uint32_t toeplitz_hash_ipv4[LRO_IPV4_SEED_ARR_SZ];
246 uint32_t toeplitz_hash_ipv6[LRO_IPV6_SEED_ARR_SZ];
247};
248
249#if defined(FEATURE_LRO)
250int wma_lro_init(struct wma_lro_config_cmd_t *lro_config);
251#endif
252bool wma_is_scan_simultaneous_capable(void);
Ryan Hsu3c8f79f2015-12-02 16:45:09 -0800253
Gupta, Kapil4cb1d7d2016-04-16 18:16:25 -0700254QDF_STATUS wma_remove_beacon_filter(WMA_HANDLE wma,
255 struct beacon_filter_param *filter_params);
256
257QDF_STATUS wma_add_beacon_filter(WMA_HANDLE wma,
258 struct beacon_filter_param *filter_params);
Gupta, Kapil96c7f2f2016-04-25 19:13:41 +0530259QDF_STATUS wma_send_adapt_dwelltime_params(WMA_HANDLE handle,
260 struct adaptive_dwelltime_params *dwelltime_params);
Ryan Hsu3c8f79f2015-12-02 16:45:09 -0800261#ifdef FEATURE_GREEN_AP
262void wma_setup_egap_support(struct wma_tgt_cfg *tgt_cfg, WMA_HANDLE handle);
263void wma_register_egap_event_handle(WMA_HANDLE handle);
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530264QDF_STATUS wma_send_egap_conf_params(WMA_HANDLE handle,
Ryan Hsu3c8f79f2015-12-02 16:45:09 -0800265 struct egap_conf_params *egap_params);
266#else
267static inline void wma_setup_egap_support(struct wma_tgt_cfg *tgt_cfg,
268 WMA_HANDLE handle) {}
269static inline void wma_register_egap_event_handle(WMA_HANDLE handle) {}
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530270static inline QDF_STATUS wma_send_egap_conf_params(WMA_HANDLE handle,
Ryan Hsu3c8f79f2015-12-02 16:45:09 -0800271 struct egap_conf_params *egap_params)
272{
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530273 return QDF_STATUS_E_NOSUPPORT;
Ryan Hsu3c8f79f2015-12-02 16:45:09 -0800274}
275#endif
Anurag Chouhanfb54ab02016-02-18 18:00:46 +0530276QDF_STATUS wma_set_tx_power_scale(uint8_t vdev_id, int value);
277QDF_STATUS wma_set_tx_power_scale_decr_db(uint8_t vdev_id, int value);
Naveen Rawat0fc3f692016-06-22 14:30:54 -0700278
279#ifdef WLAN_FEATURE_NAN_DATAPATH
280QDF_STATUS wma_register_ndp_cb(QDF_STATUS (*pe_ndp_event_handler)
281 (tpAniSirGlobal mac_ctx,
Deepak Dhamdhere0f076bd2016-06-02 11:29:21 -0700282 cds_msg_t *msg));
Naveen Rawat0fc3f692016-06-22 14:30:54 -0700283#else
284static inline QDF_STATUS wma_register_ndp_cb(QDF_STATUS (*pe_ndp_event_handler)
285 (tpAniSirGlobal mac_ctx,
Deepak Dhamdhere0f076bd2016-06-02 11:29:21 -0700286 cds_msg_t *msg))
Naveen Rawat0fc3f692016-06-22 14:30:54 -0700287{
288 return QDF_STATUS_SUCCESS;
289}
290#endif
291
Peng Xu8fdaa492016-06-22 10:20:47 -0700292bool wma_is_p2p_lo_capable(void);
293QDF_STATUS wma_p2p_lo_start(struct sir_p2p_lo_start *params);
294QDF_STATUS wma_p2p_lo_stop(u_int32_t vdev_id);
Padma, Santhosh Kumar5e33beb2016-08-08 19:07:06 +0530295QDF_STATUS wma_get_wakelock_stats(struct sir_wake_lock_stats *wake_lock_stats);
Naveen Rawat8cc23b02016-07-14 12:22:56 -0700296void wma_process_pdev_hw_mode_trans_ind(void *wma,
297 wmi_pdev_hw_mode_transition_event_fixed_param *fixed_param,
298 wmi_pdev_set_hw_mode_response_vdev_mac_entry *vdev_mac_entry,
299 struct sir_hw_mode_trans_ind *hw_mode_trans_ind);
Padma, Santhosh Kumar72e7aec2016-10-12 17:23:44 +0530300
301#ifdef WLAN_FEATURE_DISA
Padma, Santhosh Kumard7cc0792016-06-28 18:54:12 +0530302QDF_STATUS wma_encrypt_decrypt_msg(WMA_HANDLE wma,
303 struct encrypt_decrypt_req_params *encrypt_decrypt_params);
Padma, Santhosh Kumar72e7aec2016-10-12 17:23:44 +0530304#else
305static inline QDF_STATUS wma_encrypt_decrypt_msg(WMA_HANDLE wma,
306 struct encrypt_decrypt_req_params *encrypt_decrypt_params)
307{
308 return 0;
309}
310#endif
Agrawal Ashishb2d1a452016-05-05 12:23:58 +0530311
312/**
313 * wma_set_cts2self_for_p2p_go() - set CTS2SELF command for P2P GO.
314 * @wma_handle: pointer to wma handle.
315 * @cts2self_for_p2p_go: value needs to set to firmware.
316 *
317 * At the time of driver startup, inform about ini parma to FW that
318 * if legacy client connects to P2P GO, stop using NOA for P2P GO.
319 *
320 * Return: QDF_STATUS.
321 */
322QDF_STATUS wma_set_cts2self_for_p2p_go(void *wma_handle,
323 uint32_t cts2self_for_p2p_go);
Padma, Santhosh Kumara7119672016-08-16 16:05:14 +0530324QDF_STATUS wma_set_tx_rx_aggregation_size
325 (struct sir_set_tx_rx_aggregation_size *tx_rx_aggregation_size);
Dustin Brown10a7b712016-10-07 10:31:16 -0700326
327/**
328 * wma_set_qpower_config() - update qpower config in wma
329 * @vdev_id: the Id of the vdev to configure
330 * @qpower: new qpower value
331 *
332 * Return: QDF_STATUS_SUCCESS on success, error number otherwise
333 */
334QDF_STATUS wma_set_qpower_config(uint8_t vdev_id, uint8_t qpower);
Prakash Dhavali7090c5f2015-11-02 17:55:19 -0800335#endif