Commit | Line | Data |
---|---|---|
d7579d12 MK |
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); | |
40 | int (*pull_phyerr)(struct ath10k *ar, struct sk_buff *skb, | |
41 | struct wmi_phyerr_ev_arg *arg); | |
42 | int (*pull_svc_rdy)(struct ath10k *ar, struct sk_buff *skb, | |
43 | struct wmi_svc_rdy_ev_arg *arg); | |
44 | int (*pull_rdy)(struct ath10k *ar, struct sk_buff *skb, | |
45 | struct wmi_rdy_ev_arg *arg); | |
46 | int (*pull_fw_stats)(struct ath10k *ar, struct sk_buff *skb, | |
47 | struct ath10k_fw_stats *stats); | |
c1a4654a MK |
48 | int (*pull_roam_ev)(struct ath10k *ar, struct sk_buff *skb, |
49 | struct wmi_roam_ev_arg *arg); | |
d7579d12 MK |
50 | |
51 | struct sk_buff *(*gen_pdev_suspend)(struct ath10k *ar, u32 suspend_opt); | |
52 | struct sk_buff *(*gen_pdev_resume)(struct ath10k *ar); | |
53 | struct sk_buff *(*gen_pdev_set_rd)(struct ath10k *ar, u16 rd, u16 rd2g, | |
54 | u16 rd5g, u16 ctl2g, u16 ctl5g, | |
55 | enum wmi_dfs_region dfs_reg); | |
56 | struct sk_buff *(*gen_pdev_set_param)(struct ath10k *ar, u32 id, | |
57 | u32 value); | |
58 | struct sk_buff *(*gen_init)(struct ath10k *ar); | |
59 | struct sk_buff *(*gen_start_scan)(struct ath10k *ar, | |
60 | const struct wmi_start_scan_arg *arg); | |
61 | struct sk_buff *(*gen_stop_scan)(struct ath10k *ar, | |
62 | const struct wmi_stop_scan_arg *arg); | |
63 | struct sk_buff *(*gen_vdev_create)(struct ath10k *ar, u32 vdev_id, | |
64 | enum wmi_vdev_type type, | |
65 | enum wmi_vdev_subtype subtype, | |
66 | const u8 macaddr[ETH_ALEN]); | |
67 | struct sk_buff *(*gen_vdev_delete)(struct ath10k *ar, u32 vdev_id); | |
68 | struct sk_buff *(*gen_vdev_start)(struct ath10k *ar, | |
69 | const struct wmi_vdev_start_request_arg *arg, | |
70 | bool restart); | |
71 | struct sk_buff *(*gen_vdev_stop)(struct ath10k *ar, u32 vdev_id); | |
72 | struct sk_buff *(*gen_vdev_up)(struct ath10k *ar, u32 vdev_id, u32 aid, | |
73 | const u8 *bssid); | |
74 | struct sk_buff *(*gen_vdev_down)(struct ath10k *ar, u32 vdev_id); | |
75 | struct sk_buff *(*gen_vdev_set_param)(struct ath10k *ar, u32 vdev_id, | |
76 | u32 param_id, u32 param_value); | |
77 | struct sk_buff *(*gen_vdev_install_key)(struct ath10k *ar, | |
78 | const struct wmi_vdev_install_key_arg *arg); | |
79 | struct sk_buff *(*gen_vdev_spectral_conf)(struct ath10k *ar, | |
80 | const struct wmi_vdev_spectral_conf_arg *arg); | |
81 | struct sk_buff *(*gen_vdev_spectral_enable)(struct ath10k *ar, u32 vdev_id, | |
82 | u32 trigger, u32 enable); | |
6d492fe2 MK |
83 | struct sk_buff *(*gen_vdev_wmm_conf)(struct ath10k *ar, u32 vdev_id, |
84 | const struct wmi_wmm_params_all_arg *arg); | |
d7579d12 MK |
85 | struct sk_buff *(*gen_peer_create)(struct ath10k *ar, u32 vdev_id, |
86 | const u8 peer_addr[ETH_ALEN]); | |
87 | struct sk_buff *(*gen_peer_delete)(struct ath10k *ar, u32 vdev_id, | |
88 | const u8 peer_addr[ETH_ALEN]); | |
89 | struct sk_buff *(*gen_peer_flush)(struct ath10k *ar, u32 vdev_id, | |
90 | const u8 peer_addr[ETH_ALEN], | |
91 | u32 tid_bitmap); | |
92 | struct sk_buff *(*gen_peer_set_param)(struct ath10k *ar, u32 vdev_id, | |
93 | const u8 *peer_addr, | |
94 | enum wmi_peer_param param_id, | |
95 | u32 param_value); | |
96 | struct sk_buff *(*gen_peer_assoc)(struct ath10k *ar, | |
97 | const struct wmi_peer_assoc_complete_arg *arg); | |
98 | struct sk_buff *(*gen_set_psmode)(struct ath10k *ar, u32 vdev_id, | |
99 | enum wmi_sta_ps_mode psmode); | |
100 | struct sk_buff *(*gen_set_sta_ps)(struct ath10k *ar, u32 vdev_id, | |
101 | enum wmi_sta_powersave_param param_id, | |
102 | u32 value); | |
103 | struct sk_buff *(*gen_set_ap_ps)(struct ath10k *ar, u32 vdev_id, | |
104 | const u8 *mac, | |
105 | enum wmi_ap_ps_peer_param param_id, | |
106 | u32 value); | |
107 | struct sk_buff *(*gen_scan_chan_list)(struct ath10k *ar, | |
108 | const struct wmi_scan_chan_list_arg *arg); | |
9ad50182 MK |
109 | struct sk_buff *(*gen_beacon_dma)(struct ath10k *ar, u32 vdev_id, |
110 | const void *bcn, size_t bcn_len, | |
111 | u32 bcn_paddr, bool dtim_zero, | |
112 | bool deliver_cab); | |
d7579d12 | 113 | struct sk_buff *(*gen_pdev_set_wmm)(struct ath10k *ar, |
5e752e42 | 114 | const struct wmi_wmm_params_all_arg *arg); |
de23d3ef | 115 | struct sk_buff *(*gen_request_stats)(struct ath10k *ar, u32 stats_mask); |
d7579d12 MK |
116 | struct sk_buff *(*gen_force_fw_hang)(struct ath10k *ar, |
117 | enum wmi_force_fw_hang_type type, | |
118 | u32 delay_ms); | |
119 | struct sk_buff *(*gen_mgmt_tx)(struct ath10k *ar, struct sk_buff *skb); | |
467210a6 SJ |
120 | struct sk_buff *(*gen_dbglog_cfg)(struct ath10k *ar, u32 module_enable, |
121 | u32 log_level); | |
d7579d12 MK |
122 | struct sk_buff *(*gen_pktlog_enable)(struct ath10k *ar, u32 filter); |
123 | struct sk_buff *(*gen_pktlog_disable)(struct ath10k *ar); | |
ffdd738d RM |
124 | struct sk_buff *(*gen_pdev_set_quiet_mode)(struct ath10k *ar, |
125 | u32 period, u32 duration, | |
126 | u32 next_offset, | |
127 | u32 enabled); | |
a57a6a27 | 128 | struct sk_buff *(*gen_pdev_get_temperature)(struct ath10k *ar); |
dc8ab278 RM |
129 | struct sk_buff *(*gen_addba_clear_resp)(struct ath10k *ar, u32 vdev_id, |
130 | const u8 *mac); | |
65c0893d RM |
131 | struct sk_buff *(*gen_addba_send)(struct ath10k *ar, u32 vdev_id, |
132 | const u8 *mac, u32 tid, u32 buf_size); | |
11597413 RM |
133 | struct sk_buff *(*gen_addba_set_resp)(struct ath10k *ar, u32 vdev_id, |
134 | const u8 *mac, u32 tid, | |
135 | u32 status); | |
50abef85 RM |
136 | struct sk_buff *(*gen_delba_send)(struct ath10k *ar, u32 vdev_id, |
137 | const u8 *mac, u32 tid, u32 initiator, | |
138 | u32 reason); | |
be9ce9d8 MK |
139 | struct sk_buff *(*gen_bcn_tmpl)(struct ath10k *ar, u32 vdev_id, |
140 | u32 tim_ie_offset, struct sk_buff *bcn, | |
141 | u32 prb_caps, u32 prb_erp, | |
142 | void *prb_ies, size_t prb_ies_len); | |
4c4955fe MK |
143 | struct sk_buff *(*gen_prb_tmpl)(struct ath10k *ar, u32 vdev_id, |
144 | struct sk_buff *bcn); | |
369242b4 MK |
145 | struct sk_buff *(*gen_p2p_go_bcn_ie)(struct ath10k *ar, u32 vdev_id, |
146 | const u8 *p2p_ie); | |
0c7e477c JD |
147 | struct sk_buff *(*gen_vdev_sta_uapsd)(struct ath10k *ar, u32 vdev_id, |
148 | const u8 peer_addr[ETH_ALEN], | |
149 | const struct wmi_sta_uapsd_auto_trig_arg *args, | |
150 | u32 num_ac); | |
6e8b188b JD |
151 | struct sk_buff *(*gen_sta_keepalive)(struct ath10k *ar, |
152 | const struct wmi_sta_keepalive_arg *arg); | |
d7579d12 MK |
153 | }; |
154 | ||
155 | int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); | |
156 | ||
157 | static inline int | |
158 | ath10k_wmi_rx(struct ath10k *ar, struct sk_buff *skb) | |
159 | { | |
160 | if (WARN_ON_ONCE(!ar->wmi.ops->rx)) | |
161 | return -EOPNOTSUPP; | |
162 | ||
163 | ar->wmi.ops->rx(ar, skb); | |
164 | return 0; | |
165 | } | |
166 | ||
167 | static inline int | |
168 | ath10k_wmi_map_svc(struct ath10k *ar, const __le32 *in, unsigned long *out, | |
169 | size_t len) | |
170 | { | |
171 | if (!ar->wmi.ops->map_svc) | |
172 | return -EOPNOTSUPP; | |
173 | ||
174 | ar->wmi.ops->map_svc(in, out, len); | |
175 | return 0; | |
176 | } | |
177 | ||
178 | static inline int | |
179 | ath10k_wmi_pull_scan(struct ath10k *ar, struct sk_buff *skb, | |
180 | struct wmi_scan_ev_arg *arg) | |
181 | { | |
182 | if (!ar->wmi.ops->pull_scan) | |
183 | return -EOPNOTSUPP; | |
184 | ||
185 | return ar->wmi.ops->pull_scan(ar, skb, arg); | |
186 | } | |
187 | ||
188 | static inline int | |
189 | ath10k_wmi_pull_mgmt_rx(struct ath10k *ar, struct sk_buff *skb, | |
190 | struct wmi_mgmt_rx_ev_arg *arg) | |
191 | { | |
192 | if (!ar->wmi.ops->pull_mgmt_rx) | |
193 | return -EOPNOTSUPP; | |
194 | ||
195 | return ar->wmi.ops->pull_mgmt_rx(ar, skb, arg); | |
196 | } | |
197 | ||
198 | static inline int | |
199 | ath10k_wmi_pull_ch_info(struct ath10k *ar, struct sk_buff *skb, | |
200 | struct wmi_ch_info_ev_arg *arg) | |
201 | { | |
202 | if (!ar->wmi.ops->pull_ch_info) | |
203 | return -EOPNOTSUPP; | |
204 | ||
205 | return ar->wmi.ops->pull_ch_info(ar, skb, arg); | |
206 | } | |
207 | ||
208 | static inline int | |
209 | ath10k_wmi_pull_vdev_start(struct ath10k *ar, struct sk_buff *skb, | |
210 | struct wmi_vdev_start_ev_arg *arg) | |
211 | { | |
212 | if (!ar->wmi.ops->pull_vdev_start) | |
213 | return -EOPNOTSUPP; | |
214 | ||
215 | return ar->wmi.ops->pull_vdev_start(ar, skb, arg); | |
216 | } | |
217 | ||
218 | static inline int | |
219 | ath10k_wmi_pull_peer_kick(struct ath10k *ar, struct sk_buff *skb, | |
220 | struct wmi_peer_kick_ev_arg *arg) | |
221 | { | |
222 | if (!ar->wmi.ops->pull_peer_kick) | |
223 | return -EOPNOTSUPP; | |
224 | ||
225 | return ar->wmi.ops->pull_peer_kick(ar, skb, arg); | |
226 | } | |
227 | ||
228 | static inline int | |
229 | ath10k_wmi_pull_swba(struct ath10k *ar, struct sk_buff *skb, | |
230 | struct wmi_swba_ev_arg *arg) | |
231 | { | |
232 | if (!ar->wmi.ops->pull_swba) | |
233 | return -EOPNOTSUPP; | |
234 | ||
235 | return ar->wmi.ops->pull_swba(ar, skb, arg); | |
236 | } | |
237 | ||
238 | static inline int | |
239 | ath10k_wmi_pull_phyerr(struct ath10k *ar, struct sk_buff *skb, | |
240 | struct wmi_phyerr_ev_arg *arg) | |
241 | { | |
242 | if (!ar->wmi.ops->pull_phyerr) | |
243 | return -EOPNOTSUPP; | |
244 | ||
245 | return ar->wmi.ops->pull_phyerr(ar, skb, arg); | |
246 | } | |
247 | ||
248 | static inline int | |
249 | ath10k_wmi_pull_svc_rdy(struct ath10k *ar, struct sk_buff *skb, | |
250 | struct wmi_svc_rdy_ev_arg *arg) | |
251 | { | |
252 | if (!ar->wmi.ops->pull_svc_rdy) | |
253 | return -EOPNOTSUPP; | |
254 | ||
255 | return ar->wmi.ops->pull_svc_rdy(ar, skb, arg); | |
256 | } | |
257 | ||
258 | static inline int | |
259 | ath10k_wmi_pull_rdy(struct ath10k *ar, struct sk_buff *skb, | |
260 | struct wmi_rdy_ev_arg *arg) | |
261 | { | |
262 | if (!ar->wmi.ops->pull_rdy) | |
263 | return -EOPNOTSUPP; | |
264 | ||
265 | return ar->wmi.ops->pull_rdy(ar, skb, arg); | |
266 | } | |
267 | ||
268 | static inline int | |
269 | ath10k_wmi_pull_fw_stats(struct ath10k *ar, struct sk_buff *skb, | |
270 | struct ath10k_fw_stats *stats) | |
271 | { | |
272 | if (!ar->wmi.ops->pull_fw_stats) | |
273 | return -EOPNOTSUPP; | |
274 | ||
275 | return ar->wmi.ops->pull_fw_stats(ar, skb, stats); | |
276 | } | |
277 | ||
c1a4654a MK |
278 | static inline int |
279 | ath10k_wmi_pull_roam_ev(struct ath10k *ar, struct sk_buff *skb, | |
280 | struct wmi_roam_ev_arg *arg) | |
281 | { | |
282 | if (!ar->wmi.ops->pull_roam_ev) | |
283 | return -EOPNOTSUPP; | |
284 | ||
285 | return ar->wmi.ops->pull_roam_ev(ar, skb, arg); | |
286 | } | |
287 | ||
d7579d12 MK |
288 | static inline int |
289 | ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *msdu) | |
290 | { | |
291 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu); | |
292 | struct sk_buff *skb; | |
293 | int ret; | |
294 | ||
295 | if (!ar->wmi.ops->gen_mgmt_tx) | |
296 | return -EOPNOTSUPP; | |
297 | ||
298 | skb = ar->wmi.ops->gen_mgmt_tx(ar, msdu); | |
299 | if (IS_ERR(skb)) | |
300 | return PTR_ERR(skb); | |
301 | ||
302 | ret = ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->mgmt_tx_cmdid); | |
303 | if (ret) | |
304 | return ret; | |
305 | ||
306 | /* FIXME There's no ACK event for Management Tx. This probably | |
307 | * shouldn't be called here either. */ | |
308 | info->flags |= IEEE80211_TX_STAT_ACK; | |
309 | ieee80211_tx_status_irqsafe(ar->hw, msdu); | |
310 | ||
311 | return 0; | |
312 | } | |
313 | ||
314 | static inline int | |
315 | ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g, u16 rd5g, | |
316 | u16 ctl2g, u16 ctl5g, | |
317 | enum wmi_dfs_region dfs_reg) | |
318 | { | |
319 | struct sk_buff *skb; | |
320 | ||
321 | if (!ar->wmi.ops->gen_pdev_set_rd) | |
322 | return -EOPNOTSUPP; | |
323 | ||
324 | skb = ar->wmi.ops->gen_pdev_set_rd(ar, rd, rd2g, rd5g, ctl2g, ctl5g, | |
325 | dfs_reg); | |
326 | if (IS_ERR(skb)) | |
327 | return PTR_ERR(skb); | |
328 | ||
329 | return ath10k_wmi_cmd_send(ar, skb, | |
330 | ar->wmi.cmd->pdev_set_regdomain_cmdid); | |
331 | } | |
332 | ||
333 | static inline int | |
334 | ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt) | |
335 | { | |
336 | struct sk_buff *skb; | |
337 | ||
338 | if (!ar->wmi.ops->gen_pdev_suspend) | |
339 | return -EOPNOTSUPP; | |
340 | ||
341 | skb = ar->wmi.ops->gen_pdev_suspend(ar, suspend_opt); | |
342 | if (IS_ERR(skb)) | |
343 | return PTR_ERR(skb); | |
344 | ||
345 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_suspend_cmdid); | |
346 | } | |
347 | ||
348 | static inline int | |
349 | ath10k_wmi_pdev_resume_target(struct ath10k *ar) | |
350 | { | |
351 | struct sk_buff *skb; | |
352 | ||
353 | if (!ar->wmi.ops->gen_pdev_resume) | |
354 | return -EOPNOTSUPP; | |
355 | ||
356 | skb = ar->wmi.ops->gen_pdev_resume(ar); | |
357 | if (IS_ERR(skb)) | |
358 | return PTR_ERR(skb); | |
359 | ||
360 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_resume_cmdid); | |
361 | } | |
362 | ||
363 | static inline int | |
364 | ath10k_wmi_pdev_set_param(struct ath10k *ar, u32 id, u32 value) | |
365 | { | |
366 | struct sk_buff *skb; | |
367 | ||
368 | if (!ar->wmi.ops->gen_pdev_set_param) | |
369 | return -EOPNOTSUPP; | |
370 | ||
371 | skb = ar->wmi.ops->gen_pdev_set_param(ar, id, value); | |
372 | if (IS_ERR(skb)) | |
373 | return PTR_ERR(skb); | |
374 | ||
375 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_set_param_cmdid); | |
376 | } | |
377 | ||
378 | static inline int | |
379 | ath10k_wmi_cmd_init(struct ath10k *ar) | |
380 | { | |
381 | struct sk_buff *skb; | |
382 | ||
383 | if (!ar->wmi.ops->gen_init) | |
384 | return -EOPNOTSUPP; | |
385 | ||
386 | skb = ar->wmi.ops->gen_init(ar); | |
387 | if (IS_ERR(skb)) | |
388 | return PTR_ERR(skb); | |
389 | ||
390 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->init_cmdid); | |
391 | } | |
392 | ||
393 | static inline int | |
394 | ath10k_wmi_start_scan(struct ath10k *ar, | |
395 | const struct wmi_start_scan_arg *arg) | |
396 | { | |
397 | struct sk_buff *skb; | |
398 | ||
399 | if (!ar->wmi.ops->gen_start_scan) | |
400 | return -EOPNOTSUPP; | |
401 | ||
402 | skb = ar->wmi.ops->gen_start_scan(ar, arg); | |
403 | if (IS_ERR(skb)) | |
404 | return PTR_ERR(skb); | |
405 | ||
406 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->start_scan_cmdid); | |
407 | } | |
408 | ||
409 | static inline int | |
410 | ath10k_wmi_stop_scan(struct ath10k *ar, const struct wmi_stop_scan_arg *arg) | |
411 | { | |
412 | struct sk_buff *skb; | |
413 | ||
414 | if (!ar->wmi.ops->gen_stop_scan) | |
415 | return -EOPNOTSUPP; | |
416 | ||
417 | skb = ar->wmi.ops->gen_stop_scan(ar, arg); | |
418 | if (IS_ERR(skb)) | |
419 | return PTR_ERR(skb); | |
420 | ||
421 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->stop_scan_cmdid); | |
422 | } | |
423 | ||
424 | static inline int | |
425 | ath10k_wmi_vdev_create(struct ath10k *ar, u32 vdev_id, | |
426 | enum wmi_vdev_type type, | |
427 | enum wmi_vdev_subtype subtype, | |
428 | const u8 macaddr[ETH_ALEN]) | |
429 | { | |
430 | struct sk_buff *skb; | |
431 | ||
432 | if (!ar->wmi.ops->gen_vdev_create) | |
433 | return -EOPNOTSUPP; | |
434 | ||
435 | skb = ar->wmi.ops->gen_vdev_create(ar, vdev_id, type, subtype, macaddr); | |
436 | if (IS_ERR(skb)) | |
437 | return PTR_ERR(skb); | |
438 | ||
439 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_create_cmdid); | |
440 | } | |
441 | ||
442 | static inline int | |
443 | ath10k_wmi_vdev_delete(struct ath10k *ar, u32 vdev_id) | |
444 | { | |
445 | struct sk_buff *skb; | |
446 | ||
447 | if (!ar->wmi.ops->gen_vdev_delete) | |
448 | return -EOPNOTSUPP; | |
449 | ||
450 | skb = ar->wmi.ops->gen_vdev_delete(ar, vdev_id); | |
451 | if (IS_ERR(skb)) | |
452 | return PTR_ERR(skb); | |
453 | ||
454 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_delete_cmdid); | |
455 | } | |
456 | ||
457 | static inline int | |
458 | ath10k_wmi_vdev_start(struct ath10k *ar, | |
459 | const struct wmi_vdev_start_request_arg *arg) | |
460 | { | |
461 | struct sk_buff *skb; | |
462 | ||
463 | if (!ar->wmi.ops->gen_vdev_start) | |
464 | return -EOPNOTSUPP; | |
465 | ||
466 | skb = ar->wmi.ops->gen_vdev_start(ar, arg, false); | |
467 | if (IS_ERR(skb)) | |
468 | return PTR_ERR(skb); | |
469 | ||
470 | return ath10k_wmi_cmd_send(ar, skb, | |
471 | ar->wmi.cmd->vdev_start_request_cmdid); | |
472 | } | |
473 | ||
474 | static inline int | |
475 | ath10k_wmi_vdev_restart(struct ath10k *ar, | |
476 | const struct wmi_vdev_start_request_arg *arg) | |
477 | { | |
478 | struct sk_buff *skb; | |
479 | ||
480 | if (!ar->wmi.ops->gen_vdev_start) | |
481 | return -EOPNOTSUPP; | |
482 | ||
483 | skb = ar->wmi.ops->gen_vdev_start(ar, arg, true); | |
484 | if (IS_ERR(skb)) | |
485 | return PTR_ERR(skb); | |
486 | ||
487 | return ath10k_wmi_cmd_send(ar, skb, | |
488 | ar->wmi.cmd->vdev_restart_request_cmdid); | |
489 | } | |
490 | ||
491 | static inline int | |
492 | ath10k_wmi_vdev_stop(struct ath10k *ar, u32 vdev_id) | |
493 | { | |
494 | struct sk_buff *skb; | |
495 | ||
496 | if (!ar->wmi.ops->gen_vdev_stop) | |
497 | return -EOPNOTSUPP; | |
498 | ||
499 | skb = ar->wmi.ops->gen_vdev_stop(ar, vdev_id); | |
500 | if (IS_ERR(skb)) | |
501 | return PTR_ERR(skb); | |
502 | ||
503 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_stop_cmdid); | |
504 | } | |
505 | ||
506 | static inline int | |
507 | ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, const u8 *bssid) | |
508 | { | |
509 | struct sk_buff *skb; | |
510 | ||
511 | if (!ar->wmi.ops->gen_vdev_up) | |
512 | return -EOPNOTSUPP; | |
513 | ||
514 | skb = ar->wmi.ops->gen_vdev_up(ar, vdev_id, aid, bssid); | |
515 | if (IS_ERR(skb)) | |
516 | return PTR_ERR(skb); | |
517 | ||
518 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_up_cmdid); | |
519 | } | |
520 | ||
521 | static inline int | |
522 | ath10k_wmi_vdev_down(struct ath10k *ar, u32 vdev_id) | |
523 | { | |
524 | struct sk_buff *skb; | |
525 | ||
526 | if (!ar->wmi.ops->gen_vdev_down) | |
527 | return -EOPNOTSUPP; | |
528 | ||
529 | skb = ar->wmi.ops->gen_vdev_down(ar, vdev_id); | |
530 | if (IS_ERR(skb)) | |
531 | return PTR_ERR(skb); | |
532 | ||
533 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_down_cmdid); | |
534 | } | |
535 | ||
536 | static inline int | |
537 | ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id, u32 param_id, | |
538 | u32 param_value) | |
539 | { | |
540 | struct sk_buff *skb; | |
541 | ||
542 | if (!ar->wmi.ops->gen_vdev_set_param) | |
543 | return -EOPNOTSUPP; | |
544 | ||
545 | skb = ar->wmi.ops->gen_vdev_set_param(ar, vdev_id, param_id, | |
546 | param_value); | |
547 | if (IS_ERR(skb)) | |
548 | return PTR_ERR(skb); | |
549 | ||
550 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_set_param_cmdid); | |
551 | } | |
552 | ||
553 | static inline int | |
554 | ath10k_wmi_vdev_install_key(struct ath10k *ar, | |
555 | const struct wmi_vdev_install_key_arg *arg) | |
556 | { | |
557 | struct sk_buff *skb; | |
558 | ||
559 | if (!ar->wmi.ops->gen_vdev_install_key) | |
560 | return -EOPNOTSUPP; | |
561 | ||
562 | skb = ar->wmi.ops->gen_vdev_install_key(ar, arg); | |
563 | if (IS_ERR(skb)) | |
564 | return PTR_ERR(skb); | |
565 | ||
566 | return ath10k_wmi_cmd_send(ar, skb, | |
567 | ar->wmi.cmd->vdev_install_key_cmdid); | |
568 | } | |
569 | ||
570 | static inline int | |
571 | ath10k_wmi_vdev_spectral_conf(struct ath10k *ar, | |
572 | const struct wmi_vdev_spectral_conf_arg *arg) | |
573 | { | |
574 | struct sk_buff *skb; | |
575 | u32 cmd_id; | |
576 | ||
577 | skb = ar->wmi.ops->gen_vdev_spectral_conf(ar, arg); | |
578 | if (IS_ERR(skb)) | |
579 | return PTR_ERR(skb); | |
580 | ||
581 | cmd_id = ar->wmi.cmd->vdev_spectral_scan_configure_cmdid; | |
582 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); | |
583 | } | |
584 | ||
585 | static inline int | |
586 | ath10k_wmi_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id, u32 trigger, | |
587 | u32 enable) | |
588 | { | |
589 | struct sk_buff *skb; | |
590 | u32 cmd_id; | |
591 | ||
592 | skb = ar->wmi.ops->gen_vdev_spectral_enable(ar, vdev_id, trigger, | |
593 | enable); | |
594 | if (IS_ERR(skb)) | |
595 | return PTR_ERR(skb); | |
596 | ||
597 | cmd_id = ar->wmi.cmd->vdev_spectral_scan_enable_cmdid; | |
598 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); | |
599 | } | |
600 | ||
0c7e477c JD |
601 | static inline int |
602 | ath10k_wmi_vdev_sta_uapsd(struct ath10k *ar, u32 vdev_id, | |
603 | const u8 peer_addr[ETH_ALEN], | |
604 | const struct wmi_sta_uapsd_auto_trig_arg *args, | |
605 | u32 num_ac) | |
606 | { | |
607 | struct sk_buff *skb; | |
608 | u32 cmd_id; | |
609 | ||
610 | if (!ar->wmi.ops->gen_vdev_sta_uapsd) | |
611 | return -EOPNOTSUPP; | |
612 | ||
613 | skb = ar->wmi.ops->gen_vdev_sta_uapsd(ar, vdev_id, peer_addr, args, | |
614 | num_ac); | |
615 | if (IS_ERR(skb)) | |
616 | return PTR_ERR(skb); | |
617 | ||
618 | cmd_id = ar->wmi.cmd->sta_uapsd_auto_trig_cmdid; | |
619 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); | |
620 | } | |
621 | ||
6d492fe2 MK |
622 | static inline int |
623 | ath10k_wmi_vdev_wmm_conf(struct ath10k *ar, u32 vdev_id, | |
624 | const struct wmi_wmm_params_all_arg *arg) | |
625 | { | |
626 | struct sk_buff *skb; | |
627 | u32 cmd_id; | |
628 | ||
629 | skb = ar->wmi.ops->gen_vdev_wmm_conf(ar, vdev_id, arg); | |
630 | if (IS_ERR(skb)) | |
631 | return PTR_ERR(skb); | |
632 | ||
633 | cmd_id = ar->wmi.cmd->vdev_set_wmm_params_cmdid; | |
634 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); | |
635 | } | |
636 | ||
d7579d12 MK |
637 | static inline int |
638 | ath10k_wmi_peer_create(struct ath10k *ar, u32 vdev_id, | |
639 | const u8 peer_addr[ETH_ALEN]) | |
640 | { | |
641 | struct sk_buff *skb; | |
642 | ||
643 | if (!ar->wmi.ops->gen_peer_create) | |
644 | return -EOPNOTSUPP; | |
645 | ||
646 | skb = ar->wmi.ops->gen_peer_create(ar, vdev_id, peer_addr); | |
647 | if (IS_ERR(skb)) | |
648 | return PTR_ERR(skb); | |
649 | ||
650 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_create_cmdid); | |
651 | } | |
652 | ||
653 | static inline int | |
654 | ath10k_wmi_peer_delete(struct ath10k *ar, u32 vdev_id, | |
655 | const u8 peer_addr[ETH_ALEN]) | |
656 | { | |
657 | struct sk_buff *skb; | |
658 | ||
659 | if (!ar->wmi.ops->gen_peer_delete) | |
660 | return -EOPNOTSUPP; | |
661 | ||
662 | skb = ar->wmi.ops->gen_peer_delete(ar, vdev_id, peer_addr); | |
663 | if (IS_ERR(skb)) | |
664 | return PTR_ERR(skb); | |
665 | ||
666 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_delete_cmdid); | |
667 | } | |
668 | ||
669 | static inline int | |
670 | ath10k_wmi_peer_flush(struct ath10k *ar, u32 vdev_id, | |
671 | const u8 peer_addr[ETH_ALEN], u32 tid_bitmap) | |
672 | { | |
673 | struct sk_buff *skb; | |
674 | ||
675 | if (!ar->wmi.ops->gen_peer_flush) | |
676 | return -EOPNOTSUPP; | |
677 | ||
678 | skb = ar->wmi.ops->gen_peer_flush(ar, vdev_id, peer_addr, tid_bitmap); | |
679 | if (IS_ERR(skb)) | |
680 | return PTR_ERR(skb); | |
681 | ||
682 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_flush_tids_cmdid); | |
683 | } | |
684 | ||
685 | static inline int | |
686 | ath10k_wmi_peer_set_param(struct ath10k *ar, u32 vdev_id, const u8 *peer_addr, | |
687 | enum wmi_peer_param param_id, u32 param_value) | |
688 | { | |
689 | struct sk_buff *skb; | |
690 | ||
691 | if (!ar->wmi.ops->gen_peer_set_param) | |
692 | return -EOPNOTSUPP; | |
693 | ||
694 | skb = ar->wmi.ops->gen_peer_set_param(ar, vdev_id, peer_addr, param_id, | |
695 | param_value); | |
696 | if (IS_ERR(skb)) | |
697 | return PTR_ERR(skb); | |
698 | ||
699 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_set_param_cmdid); | |
700 | } | |
701 | ||
702 | static inline int | |
703 | ath10k_wmi_set_psmode(struct ath10k *ar, u32 vdev_id, | |
704 | enum wmi_sta_ps_mode psmode) | |
705 | { | |
706 | struct sk_buff *skb; | |
707 | ||
708 | if (!ar->wmi.ops->gen_set_psmode) | |
709 | return -EOPNOTSUPP; | |
710 | ||
711 | skb = ar->wmi.ops->gen_set_psmode(ar, vdev_id, psmode); | |
712 | if (IS_ERR(skb)) | |
713 | return PTR_ERR(skb); | |
714 | ||
715 | return ath10k_wmi_cmd_send(ar, skb, | |
716 | ar->wmi.cmd->sta_powersave_mode_cmdid); | |
717 | } | |
718 | ||
719 | static inline int | |
720 | ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 vdev_id, | |
721 | enum wmi_sta_powersave_param param_id, u32 value) | |
722 | { | |
723 | struct sk_buff *skb; | |
724 | ||
725 | if (!ar->wmi.ops->gen_set_sta_ps) | |
726 | return -EOPNOTSUPP; | |
727 | ||
728 | skb = ar->wmi.ops->gen_set_sta_ps(ar, vdev_id, param_id, value); | |
729 | if (IS_ERR(skb)) | |
730 | return PTR_ERR(skb); | |
731 | ||
732 | return ath10k_wmi_cmd_send(ar, skb, | |
733 | ar->wmi.cmd->sta_powersave_param_cmdid); | |
734 | } | |
735 | ||
736 | static inline int | |
737 | ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac, | |
738 | enum wmi_ap_ps_peer_param param_id, u32 value) | |
739 | { | |
740 | struct sk_buff *skb; | |
741 | ||
742 | if (!ar->wmi.ops->gen_set_ap_ps) | |
743 | return -EOPNOTSUPP; | |
744 | ||
745 | skb = ar->wmi.ops->gen_set_ap_ps(ar, vdev_id, mac, param_id, value); | |
746 | if (IS_ERR(skb)) | |
747 | return PTR_ERR(skb); | |
748 | ||
749 | return ath10k_wmi_cmd_send(ar, skb, | |
750 | ar->wmi.cmd->ap_ps_peer_param_cmdid); | |
751 | } | |
752 | ||
753 | static inline int | |
754 | ath10k_wmi_scan_chan_list(struct ath10k *ar, | |
755 | const struct wmi_scan_chan_list_arg *arg) | |
756 | { | |
757 | struct sk_buff *skb; | |
758 | ||
759 | if (!ar->wmi.ops->gen_scan_chan_list) | |
760 | return -EOPNOTSUPP; | |
761 | ||
762 | skb = ar->wmi.ops->gen_scan_chan_list(ar, arg); | |
763 | if (IS_ERR(skb)) | |
764 | return PTR_ERR(skb); | |
765 | ||
766 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->scan_chan_list_cmdid); | |
767 | } | |
768 | ||
769 | static inline int | |
770 | ath10k_wmi_peer_assoc(struct ath10k *ar, | |
771 | const struct wmi_peer_assoc_complete_arg *arg) | |
772 | { | |
773 | struct sk_buff *skb; | |
774 | ||
775 | if (!ar->wmi.ops->gen_peer_assoc) | |
776 | return -EOPNOTSUPP; | |
777 | ||
778 | skb = ar->wmi.ops->gen_peer_assoc(ar, arg); | |
779 | if (IS_ERR(skb)) | |
780 | return PTR_ERR(skb); | |
781 | ||
782 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_assoc_cmdid); | |
783 | } | |
784 | ||
785 | static inline int | |
9ad50182 MK |
786 | ath10k_wmi_beacon_send_ref_nowait(struct ath10k *ar, u32 vdev_id, |
787 | const void *bcn, size_t bcn_len, | |
788 | u32 bcn_paddr, bool dtim_zero, | |
789 | bool deliver_cab) | |
d7579d12 | 790 | { |
d7579d12 MK |
791 | struct sk_buff *skb; |
792 | int ret; | |
793 | ||
794 | if (!ar->wmi.ops->gen_beacon_dma) | |
795 | return -EOPNOTSUPP; | |
796 | ||
9ad50182 MK |
797 | skb = ar->wmi.ops->gen_beacon_dma(ar, vdev_id, bcn, bcn_len, bcn_paddr, |
798 | dtim_zero, deliver_cab); | |
d7579d12 MK |
799 | if (IS_ERR(skb)) |
800 | return PTR_ERR(skb); | |
801 | ||
802 | ret = ath10k_wmi_cmd_send_nowait(ar, skb, | |
803 | ar->wmi.cmd->pdev_send_bcn_cmdid); | |
804 | if (ret) { | |
805 | dev_kfree_skb(skb); | |
806 | return ret; | |
807 | } | |
808 | ||
809 | return 0; | |
810 | } | |
811 | ||
812 | static inline int | |
813 | ath10k_wmi_pdev_set_wmm_params(struct ath10k *ar, | |
5e752e42 | 814 | const struct wmi_wmm_params_all_arg *arg) |
d7579d12 MK |
815 | { |
816 | struct sk_buff *skb; | |
817 | ||
818 | if (!ar->wmi.ops->gen_pdev_set_wmm) | |
819 | return -EOPNOTSUPP; | |
820 | ||
821 | skb = ar->wmi.ops->gen_pdev_set_wmm(ar, arg); | |
822 | if (IS_ERR(skb)) | |
823 | return PTR_ERR(skb); | |
824 | ||
825 | return ath10k_wmi_cmd_send(ar, skb, | |
826 | ar->wmi.cmd->pdev_set_wmm_params_cmdid); | |
827 | } | |
828 | ||
829 | static inline int | |
de23d3ef | 830 | ath10k_wmi_request_stats(struct ath10k *ar, u32 stats_mask) |
d7579d12 MK |
831 | { |
832 | struct sk_buff *skb; | |
833 | ||
834 | if (!ar->wmi.ops->gen_request_stats) | |
835 | return -EOPNOTSUPP; | |
836 | ||
de23d3ef | 837 | skb = ar->wmi.ops->gen_request_stats(ar, stats_mask); |
d7579d12 MK |
838 | if (IS_ERR(skb)) |
839 | return PTR_ERR(skb); | |
840 | ||
841 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->request_stats_cmdid); | |
842 | } | |
843 | ||
844 | static inline int | |
845 | ath10k_wmi_force_fw_hang(struct ath10k *ar, | |
846 | enum wmi_force_fw_hang_type type, u32 delay_ms) | |
847 | { | |
848 | struct sk_buff *skb; | |
849 | ||
850 | if (!ar->wmi.ops->gen_force_fw_hang) | |
851 | return -EOPNOTSUPP; | |
852 | ||
853 | skb = ar->wmi.ops->gen_force_fw_hang(ar, type, delay_ms); | |
854 | if (IS_ERR(skb)) | |
855 | return PTR_ERR(skb); | |
856 | ||
857 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); | |
858 | } | |
859 | ||
860 | static inline int | |
467210a6 | 861 | ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable, u32 log_level) |
d7579d12 MK |
862 | { |
863 | struct sk_buff *skb; | |
864 | ||
865 | if (!ar->wmi.ops->gen_dbglog_cfg) | |
866 | return -EOPNOTSUPP; | |
867 | ||
467210a6 | 868 | skb = ar->wmi.ops->gen_dbglog_cfg(ar, module_enable, log_level); |
d7579d12 MK |
869 | if (IS_ERR(skb)) |
870 | return PTR_ERR(skb); | |
871 | ||
872 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->dbglog_cfg_cmdid); | |
873 | } | |
874 | ||
875 | static inline int | |
876 | ath10k_wmi_pdev_pktlog_enable(struct ath10k *ar, u32 filter) | |
877 | { | |
878 | struct sk_buff *skb; | |
879 | ||
880 | if (!ar->wmi.ops->gen_pktlog_enable) | |
881 | return -EOPNOTSUPP; | |
882 | ||
883 | skb = ar->wmi.ops->gen_pktlog_enable(ar, filter); | |
884 | if (IS_ERR(skb)) | |
885 | return PTR_ERR(skb); | |
886 | ||
887 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_pktlog_enable_cmdid); | |
888 | } | |
889 | ||
890 | static inline int | |
891 | ath10k_wmi_pdev_pktlog_disable(struct ath10k *ar) | |
892 | { | |
893 | struct sk_buff *skb; | |
894 | ||
895 | if (!ar->wmi.ops->gen_pktlog_disable) | |
896 | return -EOPNOTSUPP; | |
897 | ||
898 | skb = ar->wmi.ops->gen_pktlog_disable(ar); | |
899 | if (IS_ERR(skb)) | |
900 | return PTR_ERR(skb); | |
901 | ||
902 | return ath10k_wmi_cmd_send(ar, skb, | |
903 | ar->wmi.cmd->pdev_pktlog_disable_cmdid); | |
904 | } | |
905 | ||
ffdd738d RM |
906 | static inline int |
907 | ath10k_wmi_pdev_set_quiet_mode(struct ath10k *ar, u32 period, u32 duration, | |
908 | u32 next_offset, u32 enabled) | |
909 | { | |
910 | struct sk_buff *skb; | |
911 | ||
912 | if (!ar->wmi.ops->gen_pdev_set_quiet_mode) | |
913 | return -EOPNOTSUPP; | |
914 | ||
915 | skb = ar->wmi.ops->gen_pdev_set_quiet_mode(ar, period, duration, | |
916 | next_offset, enabled); | |
917 | if (IS_ERR(skb)) | |
918 | return PTR_ERR(skb); | |
919 | ||
920 | return ath10k_wmi_cmd_send(ar, skb, | |
921 | ar->wmi.cmd->pdev_set_quiet_mode_cmdid); | |
922 | } | |
923 | ||
a57a6a27 RM |
924 | static inline int |
925 | ath10k_wmi_pdev_get_temperature(struct ath10k *ar) | |
926 | { | |
927 | struct sk_buff *skb; | |
928 | ||
929 | if (!ar->wmi.ops->gen_pdev_get_temperature) | |
930 | return -EOPNOTSUPP; | |
931 | ||
932 | skb = ar->wmi.ops->gen_pdev_get_temperature(ar); | |
933 | if (IS_ERR(skb)) | |
934 | return PTR_ERR(skb); | |
935 | ||
936 | return ath10k_wmi_cmd_send(ar, skb, | |
937 | ar->wmi.cmd->pdev_get_temperature_cmdid); | |
938 | } | |
939 | ||
dc8ab278 RM |
940 | static inline int |
941 | ath10k_wmi_addba_clear_resp(struct ath10k *ar, u32 vdev_id, const u8 *mac) | |
942 | { | |
943 | struct sk_buff *skb; | |
944 | ||
945 | if (!ar->wmi.ops->gen_addba_clear_resp) | |
946 | return -EOPNOTSUPP; | |
947 | ||
948 | skb = ar->wmi.ops->gen_addba_clear_resp(ar, vdev_id, mac); | |
949 | if (IS_ERR(skb)) | |
950 | return PTR_ERR(skb); | |
951 | ||
952 | return ath10k_wmi_cmd_send(ar, skb, | |
953 | ar->wmi.cmd->addba_clear_resp_cmdid); | |
954 | } | |
955 | ||
65c0893d RM |
956 | static inline int |
957 | ath10k_wmi_addba_send(struct ath10k *ar, u32 vdev_id, const u8 *mac, | |
958 | u32 tid, u32 buf_size) | |
959 | { | |
960 | struct sk_buff *skb; | |
961 | ||
962 | if (!ar->wmi.ops->gen_addba_send) | |
963 | return -EOPNOTSUPP; | |
964 | ||
965 | skb = ar->wmi.ops->gen_addba_send(ar, vdev_id, mac, tid, buf_size); | |
966 | if (IS_ERR(skb)) | |
967 | return PTR_ERR(skb); | |
968 | ||
969 | return ath10k_wmi_cmd_send(ar, skb, | |
970 | ar->wmi.cmd->addba_send_cmdid); | |
971 | } | |
972 | ||
11597413 RM |
973 | static inline int |
974 | ath10k_wmi_addba_set_resp(struct ath10k *ar, u32 vdev_id, const u8 *mac, | |
975 | u32 tid, u32 status) | |
976 | { | |
977 | struct sk_buff *skb; | |
978 | ||
979 | if (!ar->wmi.ops->gen_addba_set_resp) | |
980 | return -EOPNOTSUPP; | |
981 | ||
982 | skb = ar->wmi.ops->gen_addba_set_resp(ar, vdev_id, mac, tid, status); | |
983 | if (IS_ERR(skb)) | |
984 | return PTR_ERR(skb); | |
985 | ||
986 | return ath10k_wmi_cmd_send(ar, skb, | |
987 | ar->wmi.cmd->addba_set_resp_cmdid); | |
988 | } | |
989 | ||
50abef85 RM |
990 | static inline int |
991 | ath10k_wmi_delba_send(struct ath10k *ar, u32 vdev_id, const u8 *mac, | |
992 | u32 tid, u32 initiator, u32 reason) | |
993 | { | |
994 | struct sk_buff *skb; | |
995 | ||
996 | if (!ar->wmi.ops->gen_delba_send) | |
997 | return -EOPNOTSUPP; | |
998 | ||
999 | skb = ar->wmi.ops->gen_delba_send(ar, vdev_id, mac, tid, initiator, | |
1000 | reason); | |
1001 | if (IS_ERR(skb)) | |
1002 | return PTR_ERR(skb); | |
1003 | ||
1004 | return ath10k_wmi_cmd_send(ar, skb, | |
1005 | ar->wmi.cmd->delba_send_cmdid); | |
1006 | } | |
1007 | ||
be9ce9d8 MK |
1008 | static inline int |
1009 | ath10k_wmi_bcn_tmpl(struct ath10k *ar, u32 vdev_id, u32 tim_ie_offset, | |
1010 | struct sk_buff *bcn, u32 prb_caps, u32 prb_erp, | |
1011 | void *prb_ies, size_t prb_ies_len) | |
1012 | { | |
1013 | struct sk_buff *skb; | |
1014 | ||
1015 | if (!ar->wmi.ops->gen_bcn_tmpl) | |
1016 | return -EOPNOTSUPP; | |
1017 | ||
1018 | skb = ar->wmi.ops->gen_bcn_tmpl(ar, vdev_id, tim_ie_offset, bcn, | |
1019 | prb_caps, prb_erp, prb_ies, | |
1020 | prb_ies_len); | |
1021 | if (IS_ERR(skb)) | |
1022 | return PTR_ERR(skb); | |
1023 | ||
1024 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->bcn_tmpl_cmdid); | |
1025 | } | |
1026 | ||
4c4955fe MK |
1027 | static inline int |
1028 | ath10k_wmi_prb_tmpl(struct ath10k *ar, u32 vdev_id, struct sk_buff *prb) | |
1029 | { | |
1030 | struct sk_buff *skb; | |
1031 | ||
1032 | if (!ar->wmi.ops->gen_prb_tmpl) | |
1033 | return -EOPNOTSUPP; | |
1034 | ||
1035 | skb = ar->wmi.ops->gen_prb_tmpl(ar, vdev_id, prb); | |
1036 | if (IS_ERR(skb)) | |
1037 | return PTR_ERR(skb); | |
1038 | ||
1039 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->prb_tmpl_cmdid); | |
1040 | } | |
1041 | ||
369242b4 MK |
1042 | static inline int |
1043 | ath10k_wmi_p2p_go_bcn_ie(struct ath10k *ar, u32 vdev_id, const u8 *p2p_ie) | |
1044 | { | |
1045 | struct sk_buff *skb; | |
1046 | ||
1047 | if (!ar->wmi.ops->gen_p2p_go_bcn_ie) | |
1048 | return -EOPNOTSUPP; | |
1049 | ||
1050 | skb = ar->wmi.ops->gen_p2p_go_bcn_ie(ar, vdev_id, p2p_ie); | |
1051 | if (IS_ERR(skb)) | |
1052 | return PTR_ERR(skb); | |
1053 | ||
1054 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->p2p_go_set_beacon_ie); | |
1055 | } | |
1056 | ||
6e8b188b JD |
1057 | static inline int |
1058 | ath10k_wmi_sta_keepalive(struct ath10k *ar, | |
1059 | const struct wmi_sta_keepalive_arg *arg) | |
1060 | { | |
1061 | struct sk_buff *skb; | |
1062 | u32 cmd_id; | |
1063 | ||
1064 | if (!ar->wmi.ops->gen_sta_keepalive) | |
1065 | return -EOPNOTSUPP; | |
1066 | ||
1067 | skb = ar->wmi.ops->gen_sta_keepalive(ar, arg); | |
1068 | if (IS_ERR(skb)) | |
1069 | return PTR_ERR(skb); | |
1070 | ||
1071 | cmd_id = ar->wmi.cmd->sta_keepalive_cmd; | |
1072 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); | |
1073 | } | |
1074 | ||
d7579d12 | 1075 | #endif |