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