Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2005-2011 Atheros Communications Inc. |
| 3 | * Copyright (c) 2011-2014 Qualcomm Atheros, Inc. |
| 4 | * |
| 5 | * Permission to use, copy, modify, and/or distribute this software for any |
| 6 | * purpose with or without fee is hereby granted, provided that the above |
| 7 | * copyright notice and this permission notice appear in all copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | */ |
| 17 | |
| 18 | #ifndef _WMI_OPS_H_ |
| 19 | #define _WMI_OPS_H_ |
| 20 | |
| 21 | struct ath10k; |
| 22 | struct sk_buff; |
| 23 | |
| 24 | struct wmi_ops { |
| 25 | void (*rx)(struct ath10k *ar, struct sk_buff *skb); |
| 26 | void (*map_svc)(const __le32 *in, unsigned long *out, size_t len); |
| 27 | |
| 28 | int (*pull_scan)(struct ath10k *ar, struct sk_buff *skb, |
| 29 | struct wmi_scan_ev_arg *arg); |
| 30 | int (*pull_mgmt_rx)(struct ath10k *ar, struct sk_buff *skb, |
| 31 | struct wmi_mgmt_rx_ev_arg *arg); |
| 32 | int (*pull_ch_info)(struct ath10k *ar, struct sk_buff *skb, |
| 33 | struct wmi_ch_info_ev_arg *arg); |
| 34 | int (*pull_vdev_start)(struct ath10k *ar, struct sk_buff *skb, |
| 35 | struct wmi_vdev_start_ev_arg *arg); |
| 36 | int (*pull_peer_kick)(struct ath10k *ar, struct sk_buff *skb, |
| 37 | struct wmi_peer_kick_ev_arg *arg); |
| 38 | int (*pull_swba)(struct ath10k *ar, struct sk_buff *skb, |
| 39 | struct wmi_swba_ev_arg *arg); |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 40 | int (*pull_phyerr_hdr)(struct ath10k *ar, struct sk_buff *skb, |
| 41 | struct wmi_phyerr_hdr_arg *arg); |
| 42 | int (*pull_phyerr)(struct ath10k *ar, const void *phyerr_buf, |
| 43 | int left_len, struct wmi_phyerr_ev_arg *arg); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 44 | int (*pull_svc_rdy)(struct ath10k *ar, struct sk_buff *skb, |
| 45 | struct wmi_svc_rdy_ev_arg *arg); |
| 46 | int (*pull_rdy)(struct ath10k *ar, struct sk_buff *skb, |
| 47 | struct wmi_rdy_ev_arg *arg); |
| 48 | int (*pull_fw_stats)(struct ath10k *ar, struct sk_buff *skb, |
| 49 | struct ath10k_fw_stats *stats); |
Michal Kazior | c1a4654 | 2015-03-10 16:21:54 +0200 | [diff] [blame] | 50 | int (*pull_roam_ev)(struct ath10k *ar, struct sk_buff *skb, |
| 51 | struct wmi_roam_ev_arg *arg); |
Janusz Dziedzic | f5431e8 | 2015-03-23 17:32:53 +0200 | [diff] [blame] | 52 | int (*pull_wow_event)(struct ath10k *ar, struct sk_buff *skb, |
| 53 | struct wmi_wow_ev_arg *arg); |
Michal Kazior | 84d4911 | 2016-08-19 13:37:42 +0300 | [diff] [blame] | 54 | int (*pull_echo_ev)(struct ath10k *ar, struct sk_buff *skb, |
| 55 | struct wmi_echo_ev_arg *arg); |
Vivek Natarajan | 08e75ea | 2015-08-04 10:45:11 +0530 | [diff] [blame] | 56 | enum wmi_txbf_conf (*get_txbf_conf_scheme)(struct ath10k *ar); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 57 | |
| 58 | struct sk_buff *(*gen_pdev_suspend)(struct ath10k *ar, u32 suspend_opt); |
| 59 | struct sk_buff *(*gen_pdev_resume)(struct ath10k *ar); |
| 60 | struct sk_buff *(*gen_pdev_set_rd)(struct ath10k *ar, u16 rd, u16 rd2g, |
| 61 | u16 rd5g, u16 ctl2g, u16 ctl5g, |
| 62 | enum wmi_dfs_region dfs_reg); |
| 63 | struct sk_buff *(*gen_pdev_set_param)(struct ath10k *ar, u32 id, |
| 64 | u32 value); |
| 65 | struct sk_buff *(*gen_init)(struct ath10k *ar); |
| 66 | struct sk_buff *(*gen_start_scan)(struct ath10k *ar, |
| 67 | const struct wmi_start_scan_arg *arg); |
| 68 | struct sk_buff *(*gen_stop_scan)(struct ath10k *ar, |
| 69 | const struct wmi_stop_scan_arg *arg); |
| 70 | struct sk_buff *(*gen_vdev_create)(struct ath10k *ar, u32 vdev_id, |
| 71 | enum wmi_vdev_type type, |
| 72 | enum wmi_vdev_subtype subtype, |
| 73 | const u8 macaddr[ETH_ALEN]); |
| 74 | struct sk_buff *(*gen_vdev_delete)(struct ath10k *ar, u32 vdev_id); |
| 75 | struct sk_buff *(*gen_vdev_start)(struct ath10k *ar, |
| 76 | const struct wmi_vdev_start_request_arg *arg, |
| 77 | bool restart); |
| 78 | struct sk_buff *(*gen_vdev_stop)(struct ath10k *ar, u32 vdev_id); |
| 79 | struct sk_buff *(*gen_vdev_up)(struct ath10k *ar, u32 vdev_id, u32 aid, |
| 80 | const u8 *bssid); |
| 81 | struct sk_buff *(*gen_vdev_down)(struct ath10k *ar, u32 vdev_id); |
| 82 | struct sk_buff *(*gen_vdev_set_param)(struct ath10k *ar, u32 vdev_id, |
| 83 | u32 param_id, u32 param_value); |
| 84 | struct sk_buff *(*gen_vdev_install_key)(struct ath10k *ar, |
| 85 | const struct wmi_vdev_install_key_arg *arg); |
| 86 | struct sk_buff *(*gen_vdev_spectral_conf)(struct ath10k *ar, |
| 87 | const struct wmi_vdev_spectral_conf_arg *arg); |
| 88 | struct sk_buff *(*gen_vdev_spectral_enable)(struct ath10k *ar, u32 vdev_id, |
| 89 | u32 trigger, u32 enable); |
Michal Kazior | 6d492fe | 2015-01-28 09:57:22 +0200 | [diff] [blame] | 90 | struct sk_buff *(*gen_vdev_wmm_conf)(struct ath10k *ar, u32 vdev_id, |
| 91 | const struct wmi_wmm_params_all_arg *arg); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 92 | struct sk_buff *(*gen_peer_create)(struct ath10k *ar, u32 vdev_id, |
Marek Puzyniak | 7390ed3 | 2015-03-30 09:51:52 +0300 | [diff] [blame] | 93 | const u8 peer_addr[ETH_ALEN], |
| 94 | enum wmi_peer_type peer_type); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 95 | struct sk_buff *(*gen_peer_delete)(struct ath10k *ar, u32 vdev_id, |
| 96 | const u8 peer_addr[ETH_ALEN]); |
| 97 | struct sk_buff *(*gen_peer_flush)(struct ath10k *ar, u32 vdev_id, |
| 98 | const u8 peer_addr[ETH_ALEN], |
| 99 | u32 tid_bitmap); |
| 100 | struct sk_buff *(*gen_peer_set_param)(struct ath10k *ar, u32 vdev_id, |
| 101 | const u8 *peer_addr, |
| 102 | enum wmi_peer_param param_id, |
| 103 | u32 param_value); |
| 104 | struct sk_buff *(*gen_peer_assoc)(struct ath10k *ar, |
| 105 | const struct wmi_peer_assoc_complete_arg *arg); |
| 106 | struct sk_buff *(*gen_set_psmode)(struct ath10k *ar, u32 vdev_id, |
| 107 | enum wmi_sta_ps_mode psmode); |
| 108 | struct sk_buff *(*gen_set_sta_ps)(struct ath10k *ar, u32 vdev_id, |
| 109 | enum wmi_sta_powersave_param param_id, |
| 110 | u32 value); |
| 111 | struct sk_buff *(*gen_set_ap_ps)(struct ath10k *ar, u32 vdev_id, |
| 112 | const u8 *mac, |
| 113 | enum wmi_ap_ps_peer_param param_id, |
| 114 | u32 value); |
| 115 | struct sk_buff *(*gen_scan_chan_list)(struct ath10k *ar, |
| 116 | const struct wmi_scan_chan_list_arg *arg); |
Michal Kazior | 9ad5018 | 2015-01-29 14:29:47 +0200 | [diff] [blame] | 117 | struct sk_buff *(*gen_beacon_dma)(struct ath10k *ar, u32 vdev_id, |
| 118 | const void *bcn, size_t bcn_len, |
| 119 | u32 bcn_paddr, bool dtim_zero, |
| 120 | bool deliver_cab); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 121 | struct sk_buff *(*gen_pdev_set_wmm)(struct ath10k *ar, |
Michal Kazior | 5e752e4 | 2015-01-19 09:53:41 +0100 | [diff] [blame] | 122 | const struct wmi_wmm_params_all_arg *arg); |
Michal Kazior | de23d3e | 2015-02-15 16:50:41 +0200 | [diff] [blame] | 123 | struct sk_buff *(*gen_request_stats)(struct ath10k *ar, u32 stats_mask); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 124 | struct sk_buff *(*gen_force_fw_hang)(struct ath10k *ar, |
| 125 | enum wmi_force_fw_hang_type type, |
| 126 | u32 delay_ms); |
| 127 | struct sk_buff *(*gen_mgmt_tx)(struct ath10k *ar, struct sk_buff *skb); |
Maharaja Kennadyrajan | afcbc82 | 2016-08-23 15:35:36 +0530 | [diff] [blame] | 128 | struct sk_buff *(*gen_dbglog_cfg)(struct ath10k *ar, u64 module_enable, |
SenthilKumar Jegadeesan | 467210a | 2015-01-29 14:36:52 +0530 | [diff] [blame] | 129 | u32 log_level); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 130 | struct sk_buff *(*gen_pktlog_enable)(struct ath10k *ar, u32 filter); |
| 131 | struct sk_buff *(*gen_pktlog_disable)(struct ath10k *ar); |
Rajkumar Manoharan | ffdd738 | 2014-12-17 12:21:40 +0200 | [diff] [blame] | 132 | struct sk_buff *(*gen_pdev_set_quiet_mode)(struct ath10k *ar, |
| 133 | u32 period, u32 duration, |
| 134 | u32 next_offset, |
| 135 | u32 enabled); |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 136 | struct sk_buff *(*gen_pdev_get_temperature)(struct ath10k *ar); |
Rajkumar Manoharan | dc8ab27 | 2015-01-12 14:07:25 +0200 | [diff] [blame] | 137 | struct sk_buff *(*gen_addba_clear_resp)(struct ath10k *ar, u32 vdev_id, |
| 138 | const u8 *mac); |
Rajkumar Manoharan | 65c0893 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 139 | struct sk_buff *(*gen_addba_send)(struct ath10k *ar, u32 vdev_id, |
| 140 | const u8 *mac, u32 tid, u32 buf_size); |
Rajkumar Manoharan | 1159741 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 141 | struct sk_buff *(*gen_addba_set_resp)(struct ath10k *ar, u32 vdev_id, |
| 142 | const u8 *mac, u32 tid, |
| 143 | u32 status); |
Rajkumar Manoharan | 50abef8 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 144 | struct sk_buff *(*gen_delba_send)(struct ath10k *ar, u32 vdev_id, |
| 145 | const u8 *mac, u32 tid, u32 initiator, |
| 146 | u32 reason); |
Michal Kazior | be9ce9d | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 147 | struct sk_buff *(*gen_bcn_tmpl)(struct ath10k *ar, u32 vdev_id, |
| 148 | u32 tim_ie_offset, struct sk_buff *bcn, |
| 149 | u32 prb_caps, u32 prb_erp, |
| 150 | void *prb_ies, size_t prb_ies_len); |
Michal Kazior | 4c4955f | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 151 | struct sk_buff *(*gen_prb_tmpl)(struct ath10k *ar, u32 vdev_id, |
| 152 | struct sk_buff *bcn); |
Michal Kazior | 369242b4e | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 153 | struct sk_buff *(*gen_p2p_go_bcn_ie)(struct ath10k *ar, u32 vdev_id, |
| 154 | const u8 *p2p_ie); |
Janusz Dziedzic | 0c7e477 | 2015-01-24 12:14:52 +0200 | [diff] [blame] | 155 | struct sk_buff *(*gen_vdev_sta_uapsd)(struct ath10k *ar, u32 vdev_id, |
| 156 | const u8 peer_addr[ETH_ALEN], |
| 157 | const struct wmi_sta_uapsd_auto_trig_arg *args, |
| 158 | u32 num_ac); |
Janusz Dziedzic | 6e8b188 | 2015-01-28 09:57:39 +0200 | [diff] [blame] | 159 | struct sk_buff *(*gen_sta_keepalive)(struct ath10k *ar, |
| 160 | const struct wmi_sta_keepalive_arg *arg); |
Janusz Dziedzic | f5431e8 | 2015-03-23 17:32:53 +0200 | [diff] [blame] | 161 | struct sk_buff *(*gen_wow_enable)(struct ath10k *ar); |
| 162 | struct sk_buff *(*gen_wow_add_wakeup_event)(struct ath10k *ar, u32 vdev_id, |
| 163 | enum wmi_wow_wakeup_event event, |
| 164 | u32 enable); |
| 165 | struct sk_buff *(*gen_wow_host_wakeup_ind)(struct ath10k *ar); |
Janusz Dziedzic | d497610 | 2015-03-23 17:32:54 +0200 | [diff] [blame] | 166 | struct sk_buff *(*gen_wow_add_pattern)(struct ath10k *ar, u32 vdev_id, |
| 167 | u32 pattern_id, |
| 168 | const u8 *pattern, |
| 169 | const u8 *mask, |
| 170 | int pattern_len, |
| 171 | int pattern_offset); |
| 172 | struct sk_buff *(*gen_wow_del_pattern)(struct ath10k *ar, u32 vdev_id, |
| 173 | u32 pattern_id); |
Marek Puzyniak | ad45c88 | 2015-03-30 09:51:53 +0300 | [diff] [blame] | 174 | struct sk_buff *(*gen_update_fw_tdls_state)(struct ath10k *ar, |
| 175 | u32 vdev_id, |
| 176 | enum wmi_tdls_state state); |
| 177 | struct sk_buff *(*gen_tdls_peer_update)(struct ath10k *ar, |
| 178 | const struct wmi_tdls_peer_update_cmd_arg *arg, |
| 179 | const struct wmi_tdls_peer_capab_arg *cap, |
| 180 | const struct wmi_channel_arg *chan); |
Michal Kazior | 5b272e3 | 2015-03-31 10:26:22 +0000 | [diff] [blame] | 181 | struct sk_buff *(*gen_adaptive_qcs)(struct ath10k *ar, bool enable); |
Maharaja Kennadyrajan | 2954266 | 2015-10-05 17:56:38 +0300 | [diff] [blame] | 182 | struct sk_buff *(*gen_pdev_get_tpc_config)(struct ath10k *ar, |
| 183 | u32 param); |
Manikanta Pubbisetty | bc6f9ae | 2015-10-16 15:54:52 +0300 | [diff] [blame] | 184 | void (*fw_stats_fill)(struct ath10k *ar, |
| 185 | struct ath10k_fw_stats *fw_stats, |
| 186 | char *buf); |
Maharaja | 62f77f0 | 2015-10-21 11:49:18 +0300 | [diff] [blame] | 187 | struct sk_buff *(*gen_pdev_enable_adaptive_cca)(struct ath10k *ar, |
| 188 | u8 enable, |
| 189 | u32 detect_level, |
| 190 | u32 detect_margin); |
Raja Mani | 4777190 | 2016-03-16 18:13:33 +0530 | [diff] [blame] | 191 | struct sk_buff *(*ext_resource_config)(struct ath10k *ar, |
| 192 | enum wmi_host_platform_type type, |
| 193 | u32 fw_feature_bitmap); |
Peter Oh | 6e4de1a | 2016-01-28 13:54:10 -0800 | [diff] [blame] | 194 | int (*get_vdev_subtype)(struct ath10k *ar, |
| 195 | enum wmi_vdev_subtype subtype); |
Rajkumar Manoharan | 8a0b459 | 2016-04-27 16:23:20 +0530 | [diff] [blame] | 196 | struct sk_buff *(*gen_pdev_bss_chan_info_req) |
| 197 | (struct ath10k *ar, |
| 198 | enum wmi_bss_survey_req_type type); |
Michal Kazior | e25854f | 2016-08-19 13:37:41 +0300 | [diff] [blame] | 199 | struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 200 | }; |
| 201 | |
| 202 | int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); |
| 203 | |
| 204 | static inline int |
| 205 | ath10k_wmi_rx(struct ath10k *ar, struct sk_buff *skb) |
| 206 | { |
| 207 | if (WARN_ON_ONCE(!ar->wmi.ops->rx)) |
| 208 | return -EOPNOTSUPP; |
| 209 | |
| 210 | ar->wmi.ops->rx(ar, skb); |
| 211 | return 0; |
| 212 | } |
| 213 | |
| 214 | static inline int |
| 215 | ath10k_wmi_map_svc(struct ath10k *ar, const __le32 *in, unsigned long *out, |
| 216 | size_t len) |
| 217 | { |
| 218 | if (!ar->wmi.ops->map_svc) |
| 219 | return -EOPNOTSUPP; |
| 220 | |
| 221 | ar->wmi.ops->map_svc(in, out, len); |
| 222 | return 0; |
| 223 | } |
| 224 | |
| 225 | static inline int |
| 226 | ath10k_wmi_pull_scan(struct ath10k *ar, struct sk_buff *skb, |
| 227 | struct wmi_scan_ev_arg *arg) |
| 228 | { |
| 229 | if (!ar->wmi.ops->pull_scan) |
| 230 | return -EOPNOTSUPP; |
| 231 | |
| 232 | return ar->wmi.ops->pull_scan(ar, skb, arg); |
| 233 | } |
| 234 | |
| 235 | static inline int |
| 236 | ath10k_wmi_pull_mgmt_rx(struct ath10k *ar, struct sk_buff *skb, |
| 237 | struct wmi_mgmt_rx_ev_arg *arg) |
| 238 | { |
| 239 | if (!ar->wmi.ops->pull_mgmt_rx) |
| 240 | return -EOPNOTSUPP; |
| 241 | |
| 242 | return ar->wmi.ops->pull_mgmt_rx(ar, skb, arg); |
| 243 | } |
| 244 | |
| 245 | static inline int |
| 246 | ath10k_wmi_pull_ch_info(struct ath10k *ar, struct sk_buff *skb, |
| 247 | struct wmi_ch_info_ev_arg *arg) |
| 248 | { |
| 249 | if (!ar->wmi.ops->pull_ch_info) |
| 250 | return -EOPNOTSUPP; |
| 251 | |
| 252 | return ar->wmi.ops->pull_ch_info(ar, skb, arg); |
| 253 | } |
| 254 | |
| 255 | static inline int |
| 256 | ath10k_wmi_pull_vdev_start(struct ath10k *ar, struct sk_buff *skb, |
| 257 | struct wmi_vdev_start_ev_arg *arg) |
| 258 | { |
| 259 | if (!ar->wmi.ops->pull_vdev_start) |
| 260 | return -EOPNOTSUPP; |
| 261 | |
| 262 | return ar->wmi.ops->pull_vdev_start(ar, skb, arg); |
| 263 | } |
| 264 | |
| 265 | static inline int |
| 266 | ath10k_wmi_pull_peer_kick(struct ath10k *ar, struct sk_buff *skb, |
| 267 | struct wmi_peer_kick_ev_arg *arg) |
| 268 | { |
| 269 | if (!ar->wmi.ops->pull_peer_kick) |
| 270 | return -EOPNOTSUPP; |
| 271 | |
| 272 | return ar->wmi.ops->pull_peer_kick(ar, skb, arg); |
| 273 | } |
| 274 | |
| 275 | static inline int |
| 276 | ath10k_wmi_pull_swba(struct ath10k *ar, struct sk_buff *skb, |
| 277 | struct wmi_swba_ev_arg *arg) |
| 278 | { |
| 279 | if (!ar->wmi.ops->pull_swba) |
| 280 | return -EOPNOTSUPP; |
| 281 | |
| 282 | return ar->wmi.ops->pull_swba(ar, skb, arg); |
| 283 | } |
| 284 | |
| 285 | static inline int |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 286 | ath10k_wmi_pull_phyerr_hdr(struct ath10k *ar, struct sk_buff *skb, |
| 287 | struct wmi_phyerr_hdr_arg *arg) |
| 288 | { |
| 289 | if (!ar->wmi.ops->pull_phyerr_hdr) |
| 290 | return -EOPNOTSUPP; |
| 291 | |
| 292 | return ar->wmi.ops->pull_phyerr_hdr(ar, skb, arg); |
| 293 | } |
| 294 | |
| 295 | static inline int |
| 296 | ath10k_wmi_pull_phyerr(struct ath10k *ar, const void *phyerr_buf, |
| 297 | int left_len, struct wmi_phyerr_ev_arg *arg) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 298 | { |
| 299 | if (!ar->wmi.ops->pull_phyerr) |
| 300 | return -EOPNOTSUPP; |
| 301 | |
Raja Mani | 991adf7 | 2015-08-14 11:13:29 +0300 | [diff] [blame] | 302 | return ar->wmi.ops->pull_phyerr(ar, phyerr_buf, left_len, arg); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 303 | } |
| 304 | |
| 305 | static inline int |
| 306 | ath10k_wmi_pull_svc_rdy(struct ath10k *ar, struct sk_buff *skb, |
| 307 | struct wmi_svc_rdy_ev_arg *arg) |
| 308 | { |
| 309 | if (!ar->wmi.ops->pull_svc_rdy) |
| 310 | return -EOPNOTSUPP; |
| 311 | |
| 312 | return ar->wmi.ops->pull_svc_rdy(ar, skb, arg); |
| 313 | } |
| 314 | |
| 315 | static inline int |
| 316 | ath10k_wmi_pull_rdy(struct ath10k *ar, struct sk_buff *skb, |
| 317 | struct wmi_rdy_ev_arg *arg) |
| 318 | { |
| 319 | if (!ar->wmi.ops->pull_rdy) |
| 320 | return -EOPNOTSUPP; |
| 321 | |
| 322 | return ar->wmi.ops->pull_rdy(ar, skb, arg); |
| 323 | } |
| 324 | |
| 325 | static inline int |
| 326 | ath10k_wmi_pull_fw_stats(struct ath10k *ar, struct sk_buff *skb, |
| 327 | struct ath10k_fw_stats *stats) |
| 328 | { |
| 329 | if (!ar->wmi.ops->pull_fw_stats) |
| 330 | return -EOPNOTSUPP; |
| 331 | |
| 332 | return ar->wmi.ops->pull_fw_stats(ar, skb, stats); |
| 333 | } |
| 334 | |
| 335 | static inline int |
Michal Kazior | c1a4654 | 2015-03-10 16:21:54 +0200 | [diff] [blame] | 336 | ath10k_wmi_pull_roam_ev(struct ath10k *ar, struct sk_buff *skb, |
| 337 | struct wmi_roam_ev_arg *arg) |
| 338 | { |
| 339 | if (!ar->wmi.ops->pull_roam_ev) |
| 340 | return -EOPNOTSUPP; |
| 341 | |
| 342 | return ar->wmi.ops->pull_roam_ev(ar, skb, arg); |
| 343 | } |
| 344 | |
| 345 | static inline int |
Janusz Dziedzic | f5431e8 | 2015-03-23 17:32:53 +0200 | [diff] [blame] | 346 | ath10k_wmi_pull_wow_event(struct ath10k *ar, struct sk_buff *skb, |
| 347 | struct wmi_wow_ev_arg *arg) |
| 348 | { |
| 349 | if (!ar->wmi.ops->pull_wow_event) |
| 350 | return -EOPNOTSUPP; |
| 351 | |
| 352 | return ar->wmi.ops->pull_wow_event(ar, skb, arg); |
| 353 | } |
| 354 | |
Michal Kazior | 84d4911 | 2016-08-19 13:37:42 +0300 | [diff] [blame] | 355 | static inline int |
| 356 | ath10k_wmi_pull_echo_ev(struct ath10k *ar, struct sk_buff *skb, |
| 357 | struct wmi_echo_ev_arg *arg) |
| 358 | { |
| 359 | if (!ar->wmi.ops->pull_echo_ev) |
| 360 | return -EOPNOTSUPP; |
| 361 | |
| 362 | return ar->wmi.ops->pull_echo_ev(ar, skb, arg); |
| 363 | } |
| 364 | |
Vivek Natarajan | 08e75ea | 2015-08-04 10:45:11 +0530 | [diff] [blame] | 365 | static inline enum wmi_txbf_conf |
| 366 | ath10k_wmi_get_txbf_conf_scheme(struct ath10k *ar) |
| 367 | { |
| 368 | if (!ar->wmi.ops->get_txbf_conf_scheme) |
| 369 | return WMI_TXBF_CONF_UNSUPPORTED; |
| 370 | |
| 371 | return ar->wmi.ops->get_txbf_conf_scheme(ar); |
| 372 | } |
| 373 | |
Janusz Dziedzic | f5431e8 | 2015-03-23 17:32:53 +0200 | [diff] [blame] | 374 | static inline int |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 375 | ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *msdu) |
| 376 | { |
| 377 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu); |
| 378 | struct sk_buff *skb; |
| 379 | int ret; |
| 380 | |
| 381 | if (!ar->wmi.ops->gen_mgmt_tx) |
| 382 | return -EOPNOTSUPP; |
| 383 | |
| 384 | skb = ar->wmi.ops->gen_mgmt_tx(ar, msdu); |
| 385 | if (IS_ERR(skb)) |
| 386 | return PTR_ERR(skb); |
| 387 | |
| 388 | ret = ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->mgmt_tx_cmdid); |
| 389 | if (ret) |
| 390 | return ret; |
| 391 | |
| 392 | /* FIXME There's no ACK event for Management Tx. This probably |
| 393 | * shouldn't be called here either. */ |
| 394 | info->flags |= IEEE80211_TX_STAT_ACK; |
| 395 | ieee80211_tx_status_irqsafe(ar->hw, msdu); |
| 396 | |
| 397 | return 0; |
| 398 | } |
| 399 | |
| 400 | static inline int |
| 401 | ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g, u16 rd5g, |
| 402 | u16 ctl2g, u16 ctl5g, |
| 403 | enum wmi_dfs_region dfs_reg) |
| 404 | { |
| 405 | struct sk_buff *skb; |
| 406 | |
| 407 | if (!ar->wmi.ops->gen_pdev_set_rd) |
| 408 | return -EOPNOTSUPP; |
| 409 | |
| 410 | skb = ar->wmi.ops->gen_pdev_set_rd(ar, rd, rd2g, rd5g, ctl2g, ctl5g, |
| 411 | dfs_reg); |
| 412 | if (IS_ERR(skb)) |
| 413 | return PTR_ERR(skb); |
| 414 | |
| 415 | return ath10k_wmi_cmd_send(ar, skb, |
| 416 | ar->wmi.cmd->pdev_set_regdomain_cmdid); |
| 417 | } |
| 418 | |
| 419 | static inline int |
| 420 | ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt) |
| 421 | { |
| 422 | struct sk_buff *skb; |
| 423 | |
| 424 | if (!ar->wmi.ops->gen_pdev_suspend) |
| 425 | return -EOPNOTSUPP; |
| 426 | |
| 427 | skb = ar->wmi.ops->gen_pdev_suspend(ar, suspend_opt); |
| 428 | if (IS_ERR(skb)) |
| 429 | return PTR_ERR(skb); |
| 430 | |
| 431 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_suspend_cmdid); |
| 432 | } |
| 433 | |
| 434 | static inline int |
| 435 | ath10k_wmi_pdev_resume_target(struct ath10k *ar) |
| 436 | { |
| 437 | struct sk_buff *skb; |
| 438 | |
| 439 | if (!ar->wmi.ops->gen_pdev_resume) |
| 440 | return -EOPNOTSUPP; |
| 441 | |
| 442 | skb = ar->wmi.ops->gen_pdev_resume(ar); |
| 443 | if (IS_ERR(skb)) |
| 444 | return PTR_ERR(skb); |
| 445 | |
| 446 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_resume_cmdid); |
| 447 | } |
| 448 | |
| 449 | static inline int |
| 450 | ath10k_wmi_pdev_set_param(struct ath10k *ar, u32 id, u32 value) |
| 451 | { |
| 452 | struct sk_buff *skb; |
| 453 | |
| 454 | if (!ar->wmi.ops->gen_pdev_set_param) |
| 455 | return -EOPNOTSUPP; |
| 456 | |
| 457 | skb = ar->wmi.ops->gen_pdev_set_param(ar, id, value); |
| 458 | if (IS_ERR(skb)) |
| 459 | return PTR_ERR(skb); |
| 460 | |
| 461 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_set_param_cmdid); |
| 462 | } |
| 463 | |
| 464 | static inline int |
| 465 | ath10k_wmi_cmd_init(struct ath10k *ar) |
| 466 | { |
| 467 | struct sk_buff *skb; |
| 468 | |
| 469 | if (!ar->wmi.ops->gen_init) |
| 470 | return -EOPNOTSUPP; |
| 471 | |
| 472 | skb = ar->wmi.ops->gen_init(ar); |
| 473 | if (IS_ERR(skb)) |
| 474 | return PTR_ERR(skb); |
| 475 | |
| 476 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->init_cmdid); |
| 477 | } |
| 478 | |
| 479 | static inline int |
| 480 | ath10k_wmi_start_scan(struct ath10k *ar, |
| 481 | const struct wmi_start_scan_arg *arg) |
| 482 | { |
| 483 | struct sk_buff *skb; |
| 484 | |
| 485 | if (!ar->wmi.ops->gen_start_scan) |
| 486 | return -EOPNOTSUPP; |
| 487 | |
| 488 | skb = ar->wmi.ops->gen_start_scan(ar, arg); |
| 489 | if (IS_ERR(skb)) |
| 490 | return PTR_ERR(skb); |
| 491 | |
| 492 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->start_scan_cmdid); |
| 493 | } |
| 494 | |
| 495 | static inline int |
| 496 | ath10k_wmi_stop_scan(struct ath10k *ar, const struct wmi_stop_scan_arg *arg) |
| 497 | { |
| 498 | struct sk_buff *skb; |
| 499 | |
| 500 | if (!ar->wmi.ops->gen_stop_scan) |
| 501 | return -EOPNOTSUPP; |
| 502 | |
| 503 | skb = ar->wmi.ops->gen_stop_scan(ar, arg); |
| 504 | if (IS_ERR(skb)) |
| 505 | return PTR_ERR(skb); |
| 506 | |
| 507 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->stop_scan_cmdid); |
| 508 | } |
| 509 | |
| 510 | static inline int |
| 511 | ath10k_wmi_vdev_create(struct ath10k *ar, u32 vdev_id, |
| 512 | enum wmi_vdev_type type, |
| 513 | enum wmi_vdev_subtype subtype, |
| 514 | const u8 macaddr[ETH_ALEN]) |
| 515 | { |
| 516 | struct sk_buff *skb; |
| 517 | |
| 518 | if (!ar->wmi.ops->gen_vdev_create) |
| 519 | return -EOPNOTSUPP; |
| 520 | |
| 521 | skb = ar->wmi.ops->gen_vdev_create(ar, vdev_id, type, subtype, macaddr); |
| 522 | if (IS_ERR(skb)) |
| 523 | return PTR_ERR(skb); |
| 524 | |
| 525 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_create_cmdid); |
| 526 | } |
| 527 | |
| 528 | static inline int |
| 529 | ath10k_wmi_vdev_delete(struct ath10k *ar, u32 vdev_id) |
| 530 | { |
| 531 | struct sk_buff *skb; |
| 532 | |
| 533 | if (!ar->wmi.ops->gen_vdev_delete) |
| 534 | return -EOPNOTSUPP; |
| 535 | |
| 536 | skb = ar->wmi.ops->gen_vdev_delete(ar, vdev_id); |
| 537 | if (IS_ERR(skb)) |
| 538 | return PTR_ERR(skb); |
| 539 | |
| 540 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_delete_cmdid); |
| 541 | } |
| 542 | |
| 543 | static inline int |
| 544 | ath10k_wmi_vdev_start(struct ath10k *ar, |
| 545 | const struct wmi_vdev_start_request_arg *arg) |
| 546 | { |
| 547 | struct sk_buff *skb; |
| 548 | |
| 549 | if (!ar->wmi.ops->gen_vdev_start) |
| 550 | return -EOPNOTSUPP; |
| 551 | |
| 552 | skb = ar->wmi.ops->gen_vdev_start(ar, arg, false); |
| 553 | if (IS_ERR(skb)) |
| 554 | return PTR_ERR(skb); |
| 555 | |
| 556 | return ath10k_wmi_cmd_send(ar, skb, |
| 557 | ar->wmi.cmd->vdev_start_request_cmdid); |
| 558 | } |
| 559 | |
| 560 | static inline int |
| 561 | ath10k_wmi_vdev_restart(struct ath10k *ar, |
| 562 | const struct wmi_vdev_start_request_arg *arg) |
| 563 | { |
| 564 | struct sk_buff *skb; |
| 565 | |
| 566 | if (!ar->wmi.ops->gen_vdev_start) |
| 567 | return -EOPNOTSUPP; |
| 568 | |
| 569 | skb = ar->wmi.ops->gen_vdev_start(ar, arg, true); |
| 570 | if (IS_ERR(skb)) |
| 571 | return PTR_ERR(skb); |
| 572 | |
| 573 | return ath10k_wmi_cmd_send(ar, skb, |
| 574 | ar->wmi.cmd->vdev_restart_request_cmdid); |
| 575 | } |
| 576 | |
| 577 | static inline int |
| 578 | ath10k_wmi_vdev_stop(struct ath10k *ar, u32 vdev_id) |
| 579 | { |
| 580 | struct sk_buff *skb; |
| 581 | |
| 582 | if (!ar->wmi.ops->gen_vdev_stop) |
| 583 | return -EOPNOTSUPP; |
| 584 | |
| 585 | skb = ar->wmi.ops->gen_vdev_stop(ar, vdev_id); |
| 586 | if (IS_ERR(skb)) |
| 587 | return PTR_ERR(skb); |
| 588 | |
| 589 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_stop_cmdid); |
| 590 | } |
| 591 | |
| 592 | static inline int |
| 593 | ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, const u8 *bssid) |
| 594 | { |
| 595 | struct sk_buff *skb; |
| 596 | |
| 597 | if (!ar->wmi.ops->gen_vdev_up) |
| 598 | return -EOPNOTSUPP; |
| 599 | |
| 600 | skb = ar->wmi.ops->gen_vdev_up(ar, vdev_id, aid, bssid); |
| 601 | if (IS_ERR(skb)) |
| 602 | return PTR_ERR(skb); |
| 603 | |
| 604 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_up_cmdid); |
| 605 | } |
| 606 | |
| 607 | static inline int |
| 608 | ath10k_wmi_vdev_down(struct ath10k *ar, u32 vdev_id) |
| 609 | { |
| 610 | struct sk_buff *skb; |
| 611 | |
| 612 | if (!ar->wmi.ops->gen_vdev_down) |
| 613 | return -EOPNOTSUPP; |
| 614 | |
| 615 | skb = ar->wmi.ops->gen_vdev_down(ar, vdev_id); |
| 616 | if (IS_ERR(skb)) |
| 617 | return PTR_ERR(skb); |
| 618 | |
| 619 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_down_cmdid); |
| 620 | } |
| 621 | |
| 622 | static inline int |
| 623 | ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id, u32 param_id, |
| 624 | u32 param_value) |
| 625 | { |
| 626 | struct sk_buff *skb; |
| 627 | |
| 628 | if (!ar->wmi.ops->gen_vdev_set_param) |
| 629 | return -EOPNOTSUPP; |
| 630 | |
| 631 | skb = ar->wmi.ops->gen_vdev_set_param(ar, vdev_id, param_id, |
| 632 | param_value); |
| 633 | if (IS_ERR(skb)) |
| 634 | return PTR_ERR(skb); |
| 635 | |
| 636 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_set_param_cmdid); |
| 637 | } |
| 638 | |
| 639 | static inline int |
| 640 | ath10k_wmi_vdev_install_key(struct ath10k *ar, |
| 641 | const struct wmi_vdev_install_key_arg *arg) |
| 642 | { |
| 643 | struct sk_buff *skb; |
| 644 | |
| 645 | if (!ar->wmi.ops->gen_vdev_install_key) |
| 646 | return -EOPNOTSUPP; |
| 647 | |
| 648 | skb = ar->wmi.ops->gen_vdev_install_key(ar, arg); |
| 649 | if (IS_ERR(skb)) |
| 650 | return PTR_ERR(skb); |
| 651 | |
| 652 | return ath10k_wmi_cmd_send(ar, skb, |
| 653 | ar->wmi.cmd->vdev_install_key_cmdid); |
| 654 | } |
| 655 | |
| 656 | static inline int |
| 657 | ath10k_wmi_vdev_spectral_conf(struct ath10k *ar, |
| 658 | const struct wmi_vdev_spectral_conf_arg *arg) |
| 659 | { |
| 660 | struct sk_buff *skb; |
| 661 | u32 cmd_id; |
| 662 | |
Michal Kazior | 18ae68f | 2016-11-14 14:25:23 +0100 | [diff] [blame] | 663 | if (!ar->wmi.ops->gen_vdev_spectral_conf) |
| 664 | return -EOPNOTSUPP; |
| 665 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 666 | skb = ar->wmi.ops->gen_vdev_spectral_conf(ar, arg); |
| 667 | if (IS_ERR(skb)) |
| 668 | return PTR_ERR(skb); |
| 669 | |
| 670 | cmd_id = ar->wmi.cmd->vdev_spectral_scan_configure_cmdid; |
| 671 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); |
| 672 | } |
| 673 | |
| 674 | static inline int |
| 675 | ath10k_wmi_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id, u32 trigger, |
| 676 | u32 enable) |
| 677 | { |
| 678 | struct sk_buff *skb; |
| 679 | u32 cmd_id; |
| 680 | |
Michal Kazior | 18ae68f | 2016-11-14 14:25:23 +0100 | [diff] [blame] | 681 | if (!ar->wmi.ops->gen_vdev_spectral_enable) |
| 682 | return -EOPNOTSUPP; |
| 683 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 684 | skb = ar->wmi.ops->gen_vdev_spectral_enable(ar, vdev_id, trigger, |
| 685 | enable); |
| 686 | if (IS_ERR(skb)) |
| 687 | return PTR_ERR(skb); |
| 688 | |
| 689 | cmd_id = ar->wmi.cmd->vdev_spectral_scan_enable_cmdid; |
| 690 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); |
| 691 | } |
| 692 | |
| 693 | static inline int |
Janusz Dziedzic | 0c7e477 | 2015-01-24 12:14:52 +0200 | [diff] [blame] | 694 | ath10k_wmi_vdev_sta_uapsd(struct ath10k *ar, u32 vdev_id, |
| 695 | const u8 peer_addr[ETH_ALEN], |
| 696 | const struct wmi_sta_uapsd_auto_trig_arg *args, |
| 697 | u32 num_ac) |
| 698 | { |
| 699 | struct sk_buff *skb; |
| 700 | u32 cmd_id; |
| 701 | |
| 702 | if (!ar->wmi.ops->gen_vdev_sta_uapsd) |
| 703 | return -EOPNOTSUPP; |
| 704 | |
| 705 | skb = ar->wmi.ops->gen_vdev_sta_uapsd(ar, vdev_id, peer_addr, args, |
| 706 | num_ac); |
| 707 | if (IS_ERR(skb)) |
| 708 | return PTR_ERR(skb); |
| 709 | |
| 710 | cmd_id = ar->wmi.cmd->sta_uapsd_auto_trig_cmdid; |
| 711 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); |
| 712 | } |
| 713 | |
| 714 | static inline int |
Michal Kazior | 6d492fe | 2015-01-28 09:57:22 +0200 | [diff] [blame] | 715 | ath10k_wmi_vdev_wmm_conf(struct ath10k *ar, u32 vdev_id, |
| 716 | const struct wmi_wmm_params_all_arg *arg) |
| 717 | { |
| 718 | struct sk_buff *skb; |
| 719 | u32 cmd_id; |
| 720 | |
| 721 | skb = ar->wmi.ops->gen_vdev_wmm_conf(ar, vdev_id, arg); |
| 722 | if (IS_ERR(skb)) |
| 723 | return PTR_ERR(skb); |
| 724 | |
| 725 | cmd_id = ar->wmi.cmd->vdev_set_wmm_params_cmdid; |
| 726 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); |
| 727 | } |
| 728 | |
| 729 | static inline int |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 730 | ath10k_wmi_peer_create(struct ath10k *ar, u32 vdev_id, |
Marek Puzyniak | 7390ed3 | 2015-03-30 09:51:52 +0300 | [diff] [blame] | 731 | const u8 peer_addr[ETH_ALEN], |
| 732 | enum wmi_peer_type peer_type) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 733 | { |
| 734 | struct sk_buff *skb; |
| 735 | |
| 736 | if (!ar->wmi.ops->gen_peer_create) |
| 737 | return -EOPNOTSUPP; |
| 738 | |
Marek Puzyniak | 7390ed3 | 2015-03-30 09:51:52 +0300 | [diff] [blame] | 739 | skb = ar->wmi.ops->gen_peer_create(ar, vdev_id, peer_addr, peer_type); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 740 | if (IS_ERR(skb)) |
| 741 | return PTR_ERR(skb); |
| 742 | |
| 743 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_create_cmdid); |
| 744 | } |
| 745 | |
| 746 | static inline int |
| 747 | ath10k_wmi_peer_delete(struct ath10k *ar, u32 vdev_id, |
| 748 | const u8 peer_addr[ETH_ALEN]) |
| 749 | { |
| 750 | struct sk_buff *skb; |
| 751 | |
| 752 | if (!ar->wmi.ops->gen_peer_delete) |
| 753 | return -EOPNOTSUPP; |
| 754 | |
| 755 | skb = ar->wmi.ops->gen_peer_delete(ar, vdev_id, peer_addr); |
| 756 | if (IS_ERR(skb)) |
| 757 | return PTR_ERR(skb); |
| 758 | |
| 759 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_delete_cmdid); |
| 760 | } |
| 761 | |
| 762 | static inline int |
| 763 | ath10k_wmi_peer_flush(struct ath10k *ar, u32 vdev_id, |
| 764 | const u8 peer_addr[ETH_ALEN], u32 tid_bitmap) |
| 765 | { |
| 766 | struct sk_buff *skb; |
| 767 | |
| 768 | if (!ar->wmi.ops->gen_peer_flush) |
| 769 | return -EOPNOTSUPP; |
| 770 | |
| 771 | skb = ar->wmi.ops->gen_peer_flush(ar, vdev_id, peer_addr, tid_bitmap); |
| 772 | if (IS_ERR(skb)) |
| 773 | return PTR_ERR(skb); |
| 774 | |
| 775 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_flush_tids_cmdid); |
| 776 | } |
| 777 | |
| 778 | static inline int |
| 779 | ath10k_wmi_peer_set_param(struct ath10k *ar, u32 vdev_id, const u8 *peer_addr, |
| 780 | enum wmi_peer_param param_id, u32 param_value) |
| 781 | { |
| 782 | struct sk_buff *skb; |
| 783 | |
| 784 | if (!ar->wmi.ops->gen_peer_set_param) |
| 785 | return -EOPNOTSUPP; |
| 786 | |
| 787 | skb = ar->wmi.ops->gen_peer_set_param(ar, vdev_id, peer_addr, param_id, |
| 788 | param_value); |
| 789 | if (IS_ERR(skb)) |
| 790 | return PTR_ERR(skb); |
| 791 | |
| 792 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_set_param_cmdid); |
| 793 | } |
| 794 | |
| 795 | static inline int |
| 796 | ath10k_wmi_set_psmode(struct ath10k *ar, u32 vdev_id, |
| 797 | enum wmi_sta_ps_mode psmode) |
| 798 | { |
| 799 | struct sk_buff *skb; |
| 800 | |
| 801 | if (!ar->wmi.ops->gen_set_psmode) |
| 802 | return -EOPNOTSUPP; |
| 803 | |
| 804 | skb = ar->wmi.ops->gen_set_psmode(ar, vdev_id, psmode); |
| 805 | if (IS_ERR(skb)) |
| 806 | return PTR_ERR(skb); |
| 807 | |
| 808 | return ath10k_wmi_cmd_send(ar, skb, |
| 809 | ar->wmi.cmd->sta_powersave_mode_cmdid); |
| 810 | } |
| 811 | |
| 812 | static inline int |
| 813 | ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 vdev_id, |
| 814 | enum wmi_sta_powersave_param param_id, u32 value) |
| 815 | { |
| 816 | struct sk_buff *skb; |
| 817 | |
| 818 | if (!ar->wmi.ops->gen_set_sta_ps) |
| 819 | return -EOPNOTSUPP; |
| 820 | |
| 821 | skb = ar->wmi.ops->gen_set_sta_ps(ar, vdev_id, param_id, value); |
| 822 | if (IS_ERR(skb)) |
| 823 | return PTR_ERR(skb); |
| 824 | |
| 825 | return ath10k_wmi_cmd_send(ar, skb, |
| 826 | ar->wmi.cmd->sta_powersave_param_cmdid); |
| 827 | } |
| 828 | |
| 829 | static inline int |
| 830 | ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac, |
| 831 | enum wmi_ap_ps_peer_param param_id, u32 value) |
| 832 | { |
| 833 | struct sk_buff *skb; |
| 834 | |
| 835 | if (!ar->wmi.ops->gen_set_ap_ps) |
| 836 | return -EOPNOTSUPP; |
| 837 | |
| 838 | skb = ar->wmi.ops->gen_set_ap_ps(ar, vdev_id, mac, param_id, value); |
| 839 | if (IS_ERR(skb)) |
| 840 | return PTR_ERR(skb); |
| 841 | |
| 842 | return ath10k_wmi_cmd_send(ar, skb, |
| 843 | ar->wmi.cmd->ap_ps_peer_param_cmdid); |
| 844 | } |
| 845 | |
| 846 | static inline int |
| 847 | ath10k_wmi_scan_chan_list(struct ath10k *ar, |
| 848 | const struct wmi_scan_chan_list_arg *arg) |
| 849 | { |
| 850 | struct sk_buff *skb; |
| 851 | |
| 852 | if (!ar->wmi.ops->gen_scan_chan_list) |
| 853 | return -EOPNOTSUPP; |
| 854 | |
| 855 | skb = ar->wmi.ops->gen_scan_chan_list(ar, arg); |
| 856 | if (IS_ERR(skb)) |
| 857 | return PTR_ERR(skb); |
| 858 | |
| 859 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->scan_chan_list_cmdid); |
| 860 | } |
| 861 | |
| 862 | static inline int |
| 863 | ath10k_wmi_peer_assoc(struct ath10k *ar, |
| 864 | const struct wmi_peer_assoc_complete_arg *arg) |
| 865 | { |
| 866 | struct sk_buff *skb; |
| 867 | |
| 868 | if (!ar->wmi.ops->gen_peer_assoc) |
| 869 | return -EOPNOTSUPP; |
| 870 | |
| 871 | skb = ar->wmi.ops->gen_peer_assoc(ar, arg); |
| 872 | if (IS_ERR(skb)) |
| 873 | return PTR_ERR(skb); |
| 874 | |
| 875 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_assoc_cmdid); |
| 876 | } |
| 877 | |
| 878 | static inline int |
Michal Kazior | 9ad5018 | 2015-01-29 14:29:47 +0200 | [diff] [blame] | 879 | ath10k_wmi_beacon_send_ref_nowait(struct ath10k *ar, u32 vdev_id, |
| 880 | const void *bcn, size_t bcn_len, |
| 881 | u32 bcn_paddr, bool dtim_zero, |
| 882 | bool deliver_cab) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 883 | { |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 884 | struct sk_buff *skb; |
| 885 | int ret; |
| 886 | |
| 887 | if (!ar->wmi.ops->gen_beacon_dma) |
| 888 | return -EOPNOTSUPP; |
| 889 | |
Michal Kazior | 9ad5018 | 2015-01-29 14:29:47 +0200 | [diff] [blame] | 890 | skb = ar->wmi.ops->gen_beacon_dma(ar, vdev_id, bcn, bcn_len, bcn_paddr, |
| 891 | dtim_zero, deliver_cab); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 892 | if (IS_ERR(skb)) |
| 893 | return PTR_ERR(skb); |
| 894 | |
| 895 | ret = ath10k_wmi_cmd_send_nowait(ar, skb, |
| 896 | ar->wmi.cmd->pdev_send_bcn_cmdid); |
| 897 | if (ret) { |
| 898 | dev_kfree_skb(skb); |
| 899 | return ret; |
| 900 | } |
| 901 | |
| 902 | return 0; |
| 903 | } |
| 904 | |
| 905 | static inline int |
| 906 | ath10k_wmi_pdev_set_wmm_params(struct ath10k *ar, |
Michal Kazior | 5e752e4 | 2015-01-19 09:53:41 +0100 | [diff] [blame] | 907 | const struct wmi_wmm_params_all_arg *arg) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 908 | { |
| 909 | struct sk_buff *skb; |
| 910 | |
| 911 | if (!ar->wmi.ops->gen_pdev_set_wmm) |
| 912 | return -EOPNOTSUPP; |
| 913 | |
| 914 | skb = ar->wmi.ops->gen_pdev_set_wmm(ar, arg); |
| 915 | if (IS_ERR(skb)) |
| 916 | return PTR_ERR(skb); |
| 917 | |
| 918 | return ath10k_wmi_cmd_send(ar, skb, |
| 919 | ar->wmi.cmd->pdev_set_wmm_params_cmdid); |
| 920 | } |
| 921 | |
| 922 | static inline int |
Michal Kazior | de23d3e | 2015-02-15 16:50:41 +0200 | [diff] [blame] | 923 | ath10k_wmi_request_stats(struct ath10k *ar, u32 stats_mask) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 924 | { |
| 925 | struct sk_buff *skb; |
| 926 | |
| 927 | if (!ar->wmi.ops->gen_request_stats) |
| 928 | return -EOPNOTSUPP; |
| 929 | |
Michal Kazior | de23d3e | 2015-02-15 16:50:41 +0200 | [diff] [blame] | 930 | skb = ar->wmi.ops->gen_request_stats(ar, stats_mask); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 931 | if (IS_ERR(skb)) |
| 932 | return PTR_ERR(skb); |
| 933 | |
| 934 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->request_stats_cmdid); |
| 935 | } |
| 936 | |
| 937 | static inline int |
| 938 | ath10k_wmi_force_fw_hang(struct ath10k *ar, |
| 939 | enum wmi_force_fw_hang_type type, u32 delay_ms) |
| 940 | { |
| 941 | struct sk_buff *skb; |
| 942 | |
| 943 | if (!ar->wmi.ops->gen_force_fw_hang) |
| 944 | return -EOPNOTSUPP; |
| 945 | |
| 946 | skb = ar->wmi.ops->gen_force_fw_hang(ar, type, delay_ms); |
| 947 | if (IS_ERR(skb)) |
| 948 | return PTR_ERR(skb); |
| 949 | |
| 950 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); |
| 951 | } |
| 952 | |
| 953 | static inline int |
Maharaja Kennadyrajan | afcbc82 | 2016-08-23 15:35:36 +0530 | [diff] [blame] | 954 | ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level) |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 955 | { |
| 956 | struct sk_buff *skb; |
| 957 | |
| 958 | if (!ar->wmi.ops->gen_dbglog_cfg) |
| 959 | return -EOPNOTSUPP; |
| 960 | |
SenthilKumar Jegadeesan | 467210a | 2015-01-29 14:36:52 +0530 | [diff] [blame] | 961 | skb = ar->wmi.ops->gen_dbglog_cfg(ar, module_enable, log_level); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 962 | if (IS_ERR(skb)) |
| 963 | return PTR_ERR(skb); |
| 964 | |
| 965 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->dbglog_cfg_cmdid); |
| 966 | } |
| 967 | |
| 968 | static inline int |
| 969 | ath10k_wmi_pdev_pktlog_enable(struct ath10k *ar, u32 filter) |
| 970 | { |
| 971 | struct sk_buff *skb; |
| 972 | |
| 973 | if (!ar->wmi.ops->gen_pktlog_enable) |
| 974 | return -EOPNOTSUPP; |
| 975 | |
| 976 | skb = ar->wmi.ops->gen_pktlog_enable(ar, filter); |
| 977 | if (IS_ERR(skb)) |
| 978 | return PTR_ERR(skb); |
| 979 | |
| 980 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_pktlog_enable_cmdid); |
| 981 | } |
| 982 | |
| 983 | static inline int |
| 984 | ath10k_wmi_pdev_pktlog_disable(struct ath10k *ar) |
| 985 | { |
| 986 | struct sk_buff *skb; |
| 987 | |
| 988 | if (!ar->wmi.ops->gen_pktlog_disable) |
| 989 | return -EOPNOTSUPP; |
| 990 | |
| 991 | skb = ar->wmi.ops->gen_pktlog_disable(ar); |
| 992 | if (IS_ERR(skb)) |
| 993 | return PTR_ERR(skb); |
| 994 | |
| 995 | return ath10k_wmi_cmd_send(ar, skb, |
| 996 | ar->wmi.cmd->pdev_pktlog_disable_cmdid); |
| 997 | } |
| 998 | |
Rajkumar Manoharan | ffdd738 | 2014-12-17 12:21:40 +0200 | [diff] [blame] | 999 | static inline int |
| 1000 | ath10k_wmi_pdev_set_quiet_mode(struct ath10k *ar, u32 period, u32 duration, |
| 1001 | u32 next_offset, u32 enabled) |
| 1002 | { |
| 1003 | struct sk_buff *skb; |
| 1004 | |
| 1005 | if (!ar->wmi.ops->gen_pdev_set_quiet_mode) |
| 1006 | return -EOPNOTSUPP; |
| 1007 | |
| 1008 | skb = ar->wmi.ops->gen_pdev_set_quiet_mode(ar, period, duration, |
| 1009 | next_offset, enabled); |
| 1010 | if (IS_ERR(skb)) |
| 1011 | return PTR_ERR(skb); |
| 1012 | |
| 1013 | return ath10k_wmi_cmd_send(ar, skb, |
| 1014 | ar->wmi.cmd->pdev_set_quiet_mode_cmdid); |
| 1015 | } |
| 1016 | |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 1017 | static inline int |
| 1018 | ath10k_wmi_pdev_get_temperature(struct ath10k *ar) |
| 1019 | { |
| 1020 | struct sk_buff *skb; |
| 1021 | |
| 1022 | if (!ar->wmi.ops->gen_pdev_get_temperature) |
| 1023 | return -EOPNOTSUPP; |
| 1024 | |
| 1025 | skb = ar->wmi.ops->gen_pdev_get_temperature(ar); |
| 1026 | if (IS_ERR(skb)) |
| 1027 | return PTR_ERR(skb); |
| 1028 | |
| 1029 | return ath10k_wmi_cmd_send(ar, skb, |
| 1030 | ar->wmi.cmd->pdev_get_temperature_cmdid); |
| 1031 | } |
| 1032 | |
Rajkumar Manoharan | dc8ab27 | 2015-01-12 14:07:25 +0200 | [diff] [blame] | 1033 | static inline int |
| 1034 | ath10k_wmi_addba_clear_resp(struct ath10k *ar, u32 vdev_id, const u8 *mac) |
| 1035 | { |
| 1036 | struct sk_buff *skb; |
| 1037 | |
| 1038 | if (!ar->wmi.ops->gen_addba_clear_resp) |
| 1039 | return -EOPNOTSUPP; |
| 1040 | |
| 1041 | skb = ar->wmi.ops->gen_addba_clear_resp(ar, vdev_id, mac); |
| 1042 | if (IS_ERR(skb)) |
| 1043 | return PTR_ERR(skb); |
| 1044 | |
| 1045 | return ath10k_wmi_cmd_send(ar, skb, |
| 1046 | ar->wmi.cmd->addba_clear_resp_cmdid); |
| 1047 | } |
| 1048 | |
Rajkumar Manoharan | 65c0893 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 1049 | static inline int |
| 1050 | ath10k_wmi_addba_send(struct ath10k *ar, u32 vdev_id, const u8 *mac, |
| 1051 | u32 tid, u32 buf_size) |
| 1052 | { |
| 1053 | struct sk_buff *skb; |
| 1054 | |
| 1055 | if (!ar->wmi.ops->gen_addba_send) |
| 1056 | return -EOPNOTSUPP; |
| 1057 | |
| 1058 | skb = ar->wmi.ops->gen_addba_send(ar, vdev_id, mac, tid, buf_size); |
| 1059 | if (IS_ERR(skb)) |
| 1060 | return PTR_ERR(skb); |
| 1061 | |
| 1062 | return ath10k_wmi_cmd_send(ar, skb, |
| 1063 | ar->wmi.cmd->addba_send_cmdid); |
| 1064 | } |
| 1065 | |
Rajkumar Manoharan | 1159741 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 1066 | static inline int |
| 1067 | ath10k_wmi_addba_set_resp(struct ath10k *ar, u32 vdev_id, const u8 *mac, |
| 1068 | u32 tid, u32 status) |
| 1069 | { |
| 1070 | struct sk_buff *skb; |
| 1071 | |
| 1072 | if (!ar->wmi.ops->gen_addba_set_resp) |
| 1073 | return -EOPNOTSUPP; |
| 1074 | |
| 1075 | skb = ar->wmi.ops->gen_addba_set_resp(ar, vdev_id, mac, tid, status); |
| 1076 | if (IS_ERR(skb)) |
| 1077 | return PTR_ERR(skb); |
| 1078 | |
| 1079 | return ath10k_wmi_cmd_send(ar, skb, |
| 1080 | ar->wmi.cmd->addba_set_resp_cmdid); |
| 1081 | } |
| 1082 | |
Rajkumar Manoharan | 50abef8 | 2015-01-12 14:07:26 +0200 | [diff] [blame] | 1083 | static inline int |
| 1084 | ath10k_wmi_delba_send(struct ath10k *ar, u32 vdev_id, const u8 *mac, |
| 1085 | u32 tid, u32 initiator, u32 reason) |
| 1086 | { |
| 1087 | struct sk_buff *skb; |
| 1088 | |
| 1089 | if (!ar->wmi.ops->gen_delba_send) |
| 1090 | return -EOPNOTSUPP; |
| 1091 | |
| 1092 | skb = ar->wmi.ops->gen_delba_send(ar, vdev_id, mac, tid, initiator, |
| 1093 | reason); |
| 1094 | if (IS_ERR(skb)) |
| 1095 | return PTR_ERR(skb); |
| 1096 | |
| 1097 | return ath10k_wmi_cmd_send(ar, skb, |
| 1098 | ar->wmi.cmd->delba_send_cmdid); |
| 1099 | } |
| 1100 | |
Michal Kazior | be9ce9d | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 1101 | static inline int |
| 1102 | ath10k_wmi_bcn_tmpl(struct ath10k *ar, u32 vdev_id, u32 tim_ie_offset, |
| 1103 | struct sk_buff *bcn, u32 prb_caps, u32 prb_erp, |
| 1104 | void *prb_ies, size_t prb_ies_len) |
| 1105 | { |
| 1106 | struct sk_buff *skb; |
| 1107 | |
| 1108 | if (!ar->wmi.ops->gen_bcn_tmpl) |
| 1109 | return -EOPNOTSUPP; |
| 1110 | |
| 1111 | skb = ar->wmi.ops->gen_bcn_tmpl(ar, vdev_id, tim_ie_offset, bcn, |
| 1112 | prb_caps, prb_erp, prb_ies, |
| 1113 | prb_ies_len); |
| 1114 | if (IS_ERR(skb)) |
| 1115 | return PTR_ERR(skb); |
| 1116 | |
| 1117 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->bcn_tmpl_cmdid); |
| 1118 | } |
| 1119 | |
Michal Kazior | 4c4955f | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 1120 | static inline int |
| 1121 | ath10k_wmi_prb_tmpl(struct ath10k *ar, u32 vdev_id, struct sk_buff *prb) |
| 1122 | { |
| 1123 | struct sk_buff *skb; |
| 1124 | |
| 1125 | if (!ar->wmi.ops->gen_prb_tmpl) |
| 1126 | return -EOPNOTSUPP; |
| 1127 | |
| 1128 | skb = ar->wmi.ops->gen_prb_tmpl(ar, vdev_id, prb); |
| 1129 | if (IS_ERR(skb)) |
| 1130 | return PTR_ERR(skb); |
| 1131 | |
| 1132 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->prb_tmpl_cmdid); |
| 1133 | } |
| 1134 | |
Michal Kazior | 369242b4e | 2015-01-13 16:30:11 +0200 | [diff] [blame] | 1135 | static inline int |
| 1136 | ath10k_wmi_p2p_go_bcn_ie(struct ath10k *ar, u32 vdev_id, const u8 *p2p_ie) |
| 1137 | { |
| 1138 | struct sk_buff *skb; |
| 1139 | |
| 1140 | if (!ar->wmi.ops->gen_p2p_go_bcn_ie) |
| 1141 | return -EOPNOTSUPP; |
| 1142 | |
| 1143 | skb = ar->wmi.ops->gen_p2p_go_bcn_ie(ar, vdev_id, p2p_ie); |
| 1144 | if (IS_ERR(skb)) |
| 1145 | return PTR_ERR(skb); |
| 1146 | |
| 1147 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->p2p_go_set_beacon_ie); |
| 1148 | } |
| 1149 | |
Janusz Dziedzic | 6e8b188 | 2015-01-28 09:57:39 +0200 | [diff] [blame] | 1150 | static inline int |
| 1151 | ath10k_wmi_sta_keepalive(struct ath10k *ar, |
| 1152 | const struct wmi_sta_keepalive_arg *arg) |
| 1153 | { |
| 1154 | struct sk_buff *skb; |
| 1155 | u32 cmd_id; |
| 1156 | |
| 1157 | if (!ar->wmi.ops->gen_sta_keepalive) |
| 1158 | return -EOPNOTSUPP; |
| 1159 | |
| 1160 | skb = ar->wmi.ops->gen_sta_keepalive(ar, arg); |
| 1161 | if (IS_ERR(skb)) |
| 1162 | return PTR_ERR(skb); |
| 1163 | |
| 1164 | cmd_id = ar->wmi.cmd->sta_keepalive_cmd; |
| 1165 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); |
| 1166 | } |
| 1167 | |
Janusz Dziedzic | f5431e8 | 2015-03-23 17:32:53 +0200 | [diff] [blame] | 1168 | static inline int |
| 1169 | ath10k_wmi_wow_enable(struct ath10k *ar) |
| 1170 | { |
| 1171 | struct sk_buff *skb; |
| 1172 | u32 cmd_id; |
| 1173 | |
| 1174 | if (!ar->wmi.ops->gen_wow_enable) |
| 1175 | return -EOPNOTSUPP; |
| 1176 | |
| 1177 | skb = ar->wmi.ops->gen_wow_enable(ar); |
| 1178 | if (IS_ERR(skb)) |
| 1179 | return PTR_ERR(skb); |
| 1180 | |
| 1181 | cmd_id = ar->wmi.cmd->wow_enable_cmdid; |
| 1182 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); |
| 1183 | } |
| 1184 | |
| 1185 | static inline int |
| 1186 | ath10k_wmi_wow_add_wakeup_event(struct ath10k *ar, u32 vdev_id, |
| 1187 | enum wmi_wow_wakeup_event event, |
| 1188 | u32 enable) |
| 1189 | { |
| 1190 | struct sk_buff *skb; |
| 1191 | u32 cmd_id; |
| 1192 | |
| 1193 | if (!ar->wmi.ops->gen_wow_add_wakeup_event) |
| 1194 | return -EOPNOTSUPP; |
| 1195 | |
| 1196 | skb = ar->wmi.ops->gen_wow_add_wakeup_event(ar, vdev_id, event, enable); |
| 1197 | if (IS_ERR(skb)) |
| 1198 | return PTR_ERR(skb); |
| 1199 | |
| 1200 | cmd_id = ar->wmi.cmd->wow_enable_disable_wake_event_cmdid; |
| 1201 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); |
| 1202 | } |
| 1203 | |
| 1204 | static inline int |
| 1205 | ath10k_wmi_wow_host_wakeup_ind(struct ath10k *ar) |
| 1206 | { |
| 1207 | struct sk_buff *skb; |
| 1208 | u32 cmd_id; |
| 1209 | |
| 1210 | if (!ar->wmi.ops->gen_wow_host_wakeup_ind) |
| 1211 | return -EOPNOTSUPP; |
| 1212 | |
| 1213 | skb = ar->wmi.ops->gen_wow_host_wakeup_ind(ar); |
| 1214 | if (IS_ERR(skb)) |
| 1215 | return PTR_ERR(skb); |
| 1216 | |
| 1217 | cmd_id = ar->wmi.cmd->wow_hostwakeup_from_sleep_cmdid; |
| 1218 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); |
| 1219 | } |
| 1220 | |
Janusz Dziedzic | d497610 | 2015-03-23 17:32:54 +0200 | [diff] [blame] | 1221 | static inline int |
| 1222 | ath10k_wmi_wow_add_pattern(struct ath10k *ar, u32 vdev_id, u32 pattern_id, |
| 1223 | const u8 *pattern, const u8 *mask, |
| 1224 | int pattern_len, int pattern_offset) |
| 1225 | { |
| 1226 | struct sk_buff *skb; |
| 1227 | u32 cmd_id; |
| 1228 | |
| 1229 | if (!ar->wmi.ops->gen_wow_add_pattern) |
| 1230 | return -EOPNOTSUPP; |
| 1231 | |
| 1232 | skb = ar->wmi.ops->gen_wow_add_pattern(ar, vdev_id, pattern_id, |
| 1233 | pattern, mask, pattern_len, |
| 1234 | pattern_offset); |
| 1235 | if (IS_ERR(skb)) |
| 1236 | return PTR_ERR(skb); |
| 1237 | |
| 1238 | cmd_id = ar->wmi.cmd->wow_add_wake_pattern_cmdid; |
| 1239 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); |
| 1240 | } |
| 1241 | |
| 1242 | static inline int |
| 1243 | ath10k_wmi_wow_del_pattern(struct ath10k *ar, u32 vdev_id, u32 pattern_id) |
| 1244 | { |
| 1245 | struct sk_buff *skb; |
| 1246 | u32 cmd_id; |
| 1247 | |
| 1248 | if (!ar->wmi.ops->gen_wow_del_pattern) |
| 1249 | return -EOPNOTSUPP; |
| 1250 | |
| 1251 | skb = ar->wmi.ops->gen_wow_del_pattern(ar, vdev_id, pattern_id); |
| 1252 | if (IS_ERR(skb)) |
| 1253 | return PTR_ERR(skb); |
| 1254 | |
| 1255 | cmd_id = ar->wmi.cmd->wow_del_wake_pattern_cmdid; |
| 1256 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); |
| 1257 | } |
Marek Puzyniak | ad45c88 | 2015-03-30 09:51:53 +0300 | [diff] [blame] | 1258 | |
| 1259 | static inline int |
| 1260 | ath10k_wmi_update_fw_tdls_state(struct ath10k *ar, u32 vdev_id, |
| 1261 | enum wmi_tdls_state state) |
| 1262 | { |
| 1263 | struct sk_buff *skb; |
| 1264 | |
| 1265 | if (!ar->wmi.ops->gen_update_fw_tdls_state) |
| 1266 | return -EOPNOTSUPP; |
| 1267 | |
| 1268 | skb = ar->wmi.ops->gen_update_fw_tdls_state(ar, vdev_id, state); |
| 1269 | if (IS_ERR(skb)) |
| 1270 | return PTR_ERR(skb); |
| 1271 | |
| 1272 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->tdls_set_state_cmdid); |
| 1273 | } |
| 1274 | |
| 1275 | static inline int |
| 1276 | ath10k_wmi_tdls_peer_update(struct ath10k *ar, |
| 1277 | const struct wmi_tdls_peer_update_cmd_arg *arg, |
| 1278 | const struct wmi_tdls_peer_capab_arg *cap, |
| 1279 | const struct wmi_channel_arg *chan) |
| 1280 | { |
| 1281 | struct sk_buff *skb; |
| 1282 | |
| 1283 | if (!ar->wmi.ops->gen_tdls_peer_update) |
| 1284 | return -EOPNOTSUPP; |
| 1285 | |
| 1286 | skb = ar->wmi.ops->gen_tdls_peer_update(ar, arg, cap, chan); |
| 1287 | if (IS_ERR(skb)) |
| 1288 | return PTR_ERR(skb); |
| 1289 | |
| 1290 | return ath10k_wmi_cmd_send(ar, skb, |
| 1291 | ar->wmi.cmd->tdls_peer_update_cmdid); |
| 1292 | } |
| 1293 | |
Michal Kazior | 5b272e3 | 2015-03-31 10:26:22 +0000 | [diff] [blame] | 1294 | static inline int |
| 1295 | ath10k_wmi_adaptive_qcs(struct ath10k *ar, bool enable) |
| 1296 | { |
| 1297 | struct sk_buff *skb; |
| 1298 | |
| 1299 | if (!ar->wmi.ops->gen_adaptive_qcs) |
| 1300 | return -EOPNOTSUPP; |
| 1301 | |
| 1302 | skb = ar->wmi.ops->gen_adaptive_qcs(ar, enable); |
| 1303 | if (IS_ERR(skb)) |
| 1304 | return PTR_ERR(skb); |
| 1305 | |
| 1306 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->adaptive_qcs_cmdid); |
| 1307 | } |
| 1308 | |
Maharaja Kennadyrajan | 2954266 | 2015-10-05 17:56:38 +0300 | [diff] [blame] | 1309 | static inline int |
| 1310 | ath10k_wmi_pdev_get_tpc_config(struct ath10k *ar, u32 param) |
| 1311 | { |
| 1312 | struct sk_buff *skb; |
| 1313 | |
| 1314 | if (!ar->wmi.ops->gen_pdev_get_tpc_config) |
| 1315 | return -EOPNOTSUPP; |
| 1316 | |
| 1317 | skb = ar->wmi.ops->gen_pdev_get_tpc_config(ar, param); |
| 1318 | |
| 1319 | if (IS_ERR(skb)) |
| 1320 | return PTR_ERR(skb); |
| 1321 | |
| 1322 | return ath10k_wmi_cmd_send(ar, skb, |
| 1323 | ar->wmi.cmd->pdev_get_tpc_config_cmdid); |
| 1324 | } |
| 1325 | |
Manikanta Pubbisetty | bc6f9ae | 2015-10-16 15:54:52 +0300 | [diff] [blame] | 1326 | static inline int |
| 1327 | ath10k_wmi_fw_stats_fill(struct ath10k *ar, struct ath10k_fw_stats *fw_stats, |
| 1328 | char *buf) |
| 1329 | { |
| 1330 | if (!ar->wmi.ops->fw_stats_fill) |
| 1331 | return -EOPNOTSUPP; |
| 1332 | |
| 1333 | ar->wmi.ops->fw_stats_fill(ar, fw_stats, buf); |
| 1334 | return 0; |
| 1335 | } |
Maharaja | 62f77f0 | 2015-10-21 11:49:18 +0300 | [diff] [blame] | 1336 | |
| 1337 | static inline int |
| 1338 | ath10k_wmi_pdev_enable_adaptive_cca(struct ath10k *ar, u8 enable, |
| 1339 | u32 detect_level, u32 detect_margin) |
| 1340 | { |
| 1341 | struct sk_buff *skb; |
| 1342 | |
| 1343 | if (!ar->wmi.ops->gen_pdev_enable_adaptive_cca) |
| 1344 | return -EOPNOTSUPP; |
| 1345 | |
| 1346 | skb = ar->wmi.ops->gen_pdev_enable_adaptive_cca(ar, enable, |
| 1347 | detect_level, |
| 1348 | detect_margin); |
| 1349 | |
| 1350 | if (IS_ERR(skb)) |
| 1351 | return PTR_ERR(skb); |
| 1352 | |
| 1353 | return ath10k_wmi_cmd_send(ar, skb, |
| 1354 | ar->wmi.cmd->pdev_enable_adaptive_cca_cmdid); |
| 1355 | } |
| 1356 | |
Peter Oh | 6e4de1a | 2016-01-28 13:54:10 -0800 | [diff] [blame] | 1357 | static inline int |
Raja Mani | 4777190 | 2016-03-16 18:13:33 +0530 | [diff] [blame] | 1358 | ath10k_wmi_ext_resource_config(struct ath10k *ar, |
| 1359 | enum wmi_host_platform_type type, |
| 1360 | u32 fw_feature_bitmap) |
| 1361 | { |
| 1362 | struct sk_buff *skb; |
| 1363 | |
| 1364 | if (!ar->wmi.ops->ext_resource_config) |
| 1365 | return -EOPNOTSUPP; |
| 1366 | |
| 1367 | skb = ar->wmi.ops->ext_resource_config(ar, type, |
| 1368 | fw_feature_bitmap); |
| 1369 | |
| 1370 | if (IS_ERR(skb)) |
| 1371 | return PTR_ERR(skb); |
| 1372 | |
| 1373 | return ath10k_wmi_cmd_send(ar, skb, |
| 1374 | ar->wmi.cmd->ext_resource_cfg_cmdid); |
| 1375 | } |
| 1376 | |
| 1377 | static inline int |
Peter Oh | 6e4de1a | 2016-01-28 13:54:10 -0800 | [diff] [blame] | 1378 | ath10k_wmi_get_vdev_subtype(struct ath10k *ar, enum wmi_vdev_subtype subtype) |
| 1379 | { |
| 1380 | if (!ar->wmi.ops->get_vdev_subtype) |
| 1381 | return -EOPNOTSUPP; |
| 1382 | |
| 1383 | return ar->wmi.ops->get_vdev_subtype(ar, subtype); |
| 1384 | } |
| 1385 | |
Rajkumar Manoharan | 8a0b459 | 2016-04-27 16:23:20 +0530 | [diff] [blame] | 1386 | static inline int |
| 1387 | ath10k_wmi_pdev_bss_chan_info_request(struct ath10k *ar, |
| 1388 | enum wmi_bss_survey_req_type type) |
| 1389 | { |
| 1390 | struct ath10k_wmi *wmi = &ar->wmi; |
| 1391 | struct sk_buff *skb; |
| 1392 | |
| 1393 | if (!wmi->ops->gen_pdev_bss_chan_info_req) |
| 1394 | return -EOPNOTSUPP; |
| 1395 | |
| 1396 | skb = wmi->ops->gen_pdev_bss_chan_info_req(ar, type); |
| 1397 | if (IS_ERR(skb)) |
| 1398 | return PTR_ERR(skb); |
| 1399 | |
| 1400 | return ath10k_wmi_cmd_send(ar, skb, |
| 1401 | wmi->cmd->pdev_bss_chan_info_request_cmdid); |
| 1402 | } |
| 1403 | |
Michal Kazior | e25854f | 2016-08-19 13:37:41 +0300 | [diff] [blame] | 1404 | static inline int |
| 1405 | ath10k_wmi_echo(struct ath10k *ar, u32 value) |
| 1406 | { |
| 1407 | struct ath10k_wmi *wmi = &ar->wmi; |
| 1408 | struct sk_buff *skb; |
| 1409 | |
| 1410 | if (!wmi->ops->gen_echo) |
| 1411 | return -EOPNOTSUPP; |
| 1412 | |
| 1413 | skb = wmi->ops->gen_echo(ar, value); |
| 1414 | if (IS_ERR(skb)) |
| 1415 | return PTR_ERR(skb); |
| 1416 | |
| 1417 | return ath10k_wmi_cmd_send(ar, skb, wmi->cmd->echo_cmdid); |
| 1418 | } |
| 1419 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1420 | #endif |