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