wmi-ops.h 34 KB

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