Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2005-2011 Atheros Communications Inc. |
| 3 | * Copyright (c) 2011-2014 Qualcomm Atheros, Inc. |
| 4 | * |
| 5 | * Permission to use, copy, modify, and/or distribute this software for any |
| 6 | * purpose with or without fee is hereby granted, provided that the above |
| 7 | * copyright notice and this permission notice appear in all copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | */ |
| 17 | |
| 18 | #ifndef _WMI_OPS_H_ |
| 19 | #define _WMI_OPS_H_ |
| 20 | |
| 21 | struct ath10k; |
| 22 | struct sk_buff; |
| 23 | |
| 24 | struct wmi_ops { |
| 25 | void (*rx)(struct ath10k *ar, struct sk_buff *skb); |
| 26 | void (*map_svc)(const __le32 *in, unsigned long *out, size_t len); |
| 27 | |
| 28 | int (*pull_scan)(struct ath10k *ar, struct sk_buff *skb, |
| 29 | struct wmi_scan_ev_arg *arg); |
| 30 | int (*pull_mgmt_rx)(struct ath10k *ar, struct sk_buff *skb, |
| 31 | struct wmi_mgmt_rx_ev_arg *arg); |
| 32 | int (*pull_ch_info)(struct ath10k *ar, struct sk_buff *skb, |
| 33 | struct wmi_ch_info_ev_arg *arg); |
| 34 | int (*pull_vdev_start)(struct ath10k *ar, struct sk_buff *skb, |
| 35 | struct wmi_vdev_start_ev_arg *arg); |
| 36 | int (*pull_peer_kick)(struct ath10k *ar, struct sk_buff *skb, |
| 37 | struct wmi_peer_kick_ev_arg *arg); |
| 38 | int (*pull_swba)(struct ath10k *ar, struct sk_buff *skb, |
| 39 | struct wmi_swba_ev_arg *arg); |
| 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_pdev_set_wmm_params_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); |
Rajkumar Manoharan | ffdd738 | 2014-12-17 12:21:40 +0200 | [diff] [blame] | 117 | struct sk_buff *(*gen_pdev_set_quiet_mode)(struct ath10k *ar, |
| 118 | u32 period, u32 duration, |
| 119 | u32 next_offset, |
| 120 | u32 enabled); |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 121 | struct sk_buff *(*gen_pdev_get_temperature)(struct ath10k *ar); |
Rajkumar Manoharan | dc8ab27 | 2015-01-12 14:07:25 +0200 | [diff] [blame] | 122 | struct sk_buff *(*gen_addba_clear_resp)(struct ath10k *ar, u32 vdev_id, |
| 123 | const u8 *mac); |
Rajkumar Manoharan | 65c0893 | 2015-01-12 14:07:26 +0200 | [diff] [blame^] | 124 | struct sk_buff *(*gen_addba_send)(struct ath10k *ar, u32 vdev_id, |
| 125 | const u8 *mac, u32 tid, u32 buf_size); |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 126 | }; |
| 127 | |
| 128 | int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id); |
| 129 | |
| 130 | static inline int |
| 131 | ath10k_wmi_rx(struct ath10k *ar, struct sk_buff *skb) |
| 132 | { |
| 133 | if (WARN_ON_ONCE(!ar->wmi.ops->rx)) |
| 134 | return -EOPNOTSUPP; |
| 135 | |
| 136 | ar->wmi.ops->rx(ar, skb); |
| 137 | return 0; |
| 138 | } |
| 139 | |
| 140 | static inline int |
| 141 | ath10k_wmi_map_svc(struct ath10k *ar, const __le32 *in, unsigned long *out, |
| 142 | size_t len) |
| 143 | { |
| 144 | if (!ar->wmi.ops->map_svc) |
| 145 | return -EOPNOTSUPP; |
| 146 | |
| 147 | ar->wmi.ops->map_svc(in, out, len); |
| 148 | return 0; |
| 149 | } |
| 150 | |
| 151 | static inline int |
| 152 | ath10k_wmi_pull_scan(struct ath10k *ar, struct sk_buff *skb, |
| 153 | struct wmi_scan_ev_arg *arg) |
| 154 | { |
| 155 | if (!ar->wmi.ops->pull_scan) |
| 156 | return -EOPNOTSUPP; |
| 157 | |
| 158 | return ar->wmi.ops->pull_scan(ar, skb, arg); |
| 159 | } |
| 160 | |
| 161 | static inline int |
| 162 | ath10k_wmi_pull_mgmt_rx(struct ath10k *ar, struct sk_buff *skb, |
| 163 | struct wmi_mgmt_rx_ev_arg *arg) |
| 164 | { |
| 165 | if (!ar->wmi.ops->pull_mgmt_rx) |
| 166 | return -EOPNOTSUPP; |
| 167 | |
| 168 | return ar->wmi.ops->pull_mgmt_rx(ar, skb, arg); |
| 169 | } |
| 170 | |
| 171 | static inline int |
| 172 | ath10k_wmi_pull_ch_info(struct ath10k *ar, struct sk_buff *skb, |
| 173 | struct wmi_ch_info_ev_arg *arg) |
| 174 | { |
| 175 | if (!ar->wmi.ops->pull_ch_info) |
| 176 | return -EOPNOTSUPP; |
| 177 | |
| 178 | return ar->wmi.ops->pull_ch_info(ar, skb, arg); |
| 179 | } |
| 180 | |
| 181 | static inline int |
| 182 | ath10k_wmi_pull_vdev_start(struct ath10k *ar, struct sk_buff *skb, |
| 183 | struct wmi_vdev_start_ev_arg *arg) |
| 184 | { |
| 185 | if (!ar->wmi.ops->pull_vdev_start) |
| 186 | return -EOPNOTSUPP; |
| 187 | |
| 188 | return ar->wmi.ops->pull_vdev_start(ar, skb, arg); |
| 189 | } |
| 190 | |
| 191 | static inline int |
| 192 | ath10k_wmi_pull_peer_kick(struct ath10k *ar, struct sk_buff *skb, |
| 193 | struct wmi_peer_kick_ev_arg *arg) |
| 194 | { |
| 195 | if (!ar->wmi.ops->pull_peer_kick) |
| 196 | return -EOPNOTSUPP; |
| 197 | |
| 198 | return ar->wmi.ops->pull_peer_kick(ar, skb, arg); |
| 199 | } |
| 200 | |
| 201 | static inline int |
| 202 | ath10k_wmi_pull_swba(struct ath10k *ar, struct sk_buff *skb, |
| 203 | struct wmi_swba_ev_arg *arg) |
| 204 | { |
| 205 | if (!ar->wmi.ops->pull_swba) |
| 206 | return -EOPNOTSUPP; |
| 207 | |
| 208 | return ar->wmi.ops->pull_swba(ar, skb, arg); |
| 209 | } |
| 210 | |
| 211 | static inline int |
| 212 | ath10k_wmi_pull_phyerr(struct ath10k *ar, struct sk_buff *skb, |
| 213 | struct wmi_phyerr_ev_arg *arg) |
| 214 | { |
| 215 | if (!ar->wmi.ops->pull_phyerr) |
| 216 | return -EOPNOTSUPP; |
| 217 | |
| 218 | return ar->wmi.ops->pull_phyerr(ar, skb, arg); |
| 219 | } |
| 220 | |
| 221 | static inline int |
| 222 | ath10k_wmi_pull_svc_rdy(struct ath10k *ar, struct sk_buff *skb, |
| 223 | struct wmi_svc_rdy_ev_arg *arg) |
| 224 | { |
| 225 | if (!ar->wmi.ops->pull_svc_rdy) |
| 226 | return -EOPNOTSUPP; |
| 227 | |
| 228 | return ar->wmi.ops->pull_svc_rdy(ar, skb, arg); |
| 229 | } |
| 230 | |
| 231 | static inline int |
| 232 | ath10k_wmi_pull_rdy(struct ath10k *ar, struct sk_buff *skb, |
| 233 | struct wmi_rdy_ev_arg *arg) |
| 234 | { |
| 235 | if (!ar->wmi.ops->pull_rdy) |
| 236 | return -EOPNOTSUPP; |
| 237 | |
| 238 | return ar->wmi.ops->pull_rdy(ar, skb, arg); |
| 239 | } |
| 240 | |
| 241 | static inline int |
| 242 | ath10k_wmi_pull_fw_stats(struct ath10k *ar, struct sk_buff *skb, |
| 243 | struct ath10k_fw_stats *stats) |
| 244 | { |
| 245 | if (!ar->wmi.ops->pull_fw_stats) |
| 246 | return -EOPNOTSUPP; |
| 247 | |
| 248 | return ar->wmi.ops->pull_fw_stats(ar, skb, stats); |
| 249 | } |
| 250 | |
| 251 | static inline int |
| 252 | ath10k_wmi_mgmt_tx(struct ath10k *ar, struct sk_buff *msdu) |
| 253 | { |
| 254 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(msdu); |
| 255 | struct sk_buff *skb; |
| 256 | int ret; |
| 257 | |
| 258 | if (!ar->wmi.ops->gen_mgmt_tx) |
| 259 | return -EOPNOTSUPP; |
| 260 | |
| 261 | skb = ar->wmi.ops->gen_mgmt_tx(ar, msdu); |
| 262 | if (IS_ERR(skb)) |
| 263 | return PTR_ERR(skb); |
| 264 | |
| 265 | ret = ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->mgmt_tx_cmdid); |
| 266 | if (ret) |
| 267 | return ret; |
| 268 | |
| 269 | /* FIXME There's no ACK event for Management Tx. This probably |
| 270 | * shouldn't be called here either. */ |
| 271 | info->flags |= IEEE80211_TX_STAT_ACK; |
| 272 | ieee80211_tx_status_irqsafe(ar->hw, msdu); |
| 273 | |
| 274 | return 0; |
| 275 | } |
| 276 | |
| 277 | static inline int |
| 278 | ath10k_wmi_pdev_set_regdomain(struct ath10k *ar, u16 rd, u16 rd2g, u16 rd5g, |
| 279 | u16 ctl2g, u16 ctl5g, |
| 280 | enum wmi_dfs_region dfs_reg) |
| 281 | { |
| 282 | struct sk_buff *skb; |
| 283 | |
| 284 | if (!ar->wmi.ops->gen_pdev_set_rd) |
| 285 | return -EOPNOTSUPP; |
| 286 | |
| 287 | skb = ar->wmi.ops->gen_pdev_set_rd(ar, rd, rd2g, rd5g, ctl2g, ctl5g, |
| 288 | dfs_reg); |
| 289 | if (IS_ERR(skb)) |
| 290 | return PTR_ERR(skb); |
| 291 | |
| 292 | return ath10k_wmi_cmd_send(ar, skb, |
| 293 | ar->wmi.cmd->pdev_set_regdomain_cmdid); |
| 294 | } |
| 295 | |
| 296 | static inline int |
| 297 | ath10k_wmi_pdev_suspend_target(struct ath10k *ar, u32 suspend_opt) |
| 298 | { |
| 299 | struct sk_buff *skb; |
| 300 | |
| 301 | if (!ar->wmi.ops->gen_pdev_suspend) |
| 302 | return -EOPNOTSUPP; |
| 303 | |
| 304 | skb = ar->wmi.ops->gen_pdev_suspend(ar, suspend_opt); |
| 305 | if (IS_ERR(skb)) |
| 306 | return PTR_ERR(skb); |
| 307 | |
| 308 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_suspend_cmdid); |
| 309 | } |
| 310 | |
| 311 | static inline int |
| 312 | ath10k_wmi_pdev_resume_target(struct ath10k *ar) |
| 313 | { |
| 314 | struct sk_buff *skb; |
| 315 | |
| 316 | if (!ar->wmi.ops->gen_pdev_resume) |
| 317 | return -EOPNOTSUPP; |
| 318 | |
| 319 | skb = ar->wmi.ops->gen_pdev_resume(ar); |
| 320 | if (IS_ERR(skb)) |
| 321 | return PTR_ERR(skb); |
| 322 | |
| 323 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_resume_cmdid); |
| 324 | } |
| 325 | |
| 326 | static inline int |
| 327 | ath10k_wmi_pdev_set_param(struct ath10k *ar, u32 id, u32 value) |
| 328 | { |
| 329 | struct sk_buff *skb; |
| 330 | |
| 331 | if (!ar->wmi.ops->gen_pdev_set_param) |
| 332 | return -EOPNOTSUPP; |
| 333 | |
| 334 | skb = ar->wmi.ops->gen_pdev_set_param(ar, id, value); |
| 335 | if (IS_ERR(skb)) |
| 336 | return PTR_ERR(skb); |
| 337 | |
| 338 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_set_param_cmdid); |
| 339 | } |
| 340 | |
| 341 | static inline int |
| 342 | ath10k_wmi_cmd_init(struct ath10k *ar) |
| 343 | { |
| 344 | struct sk_buff *skb; |
| 345 | |
| 346 | if (!ar->wmi.ops->gen_init) |
| 347 | return -EOPNOTSUPP; |
| 348 | |
| 349 | skb = ar->wmi.ops->gen_init(ar); |
| 350 | if (IS_ERR(skb)) |
| 351 | return PTR_ERR(skb); |
| 352 | |
| 353 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->init_cmdid); |
| 354 | } |
| 355 | |
| 356 | static inline int |
| 357 | ath10k_wmi_start_scan(struct ath10k *ar, |
| 358 | const struct wmi_start_scan_arg *arg) |
| 359 | { |
| 360 | struct sk_buff *skb; |
| 361 | |
| 362 | if (!ar->wmi.ops->gen_start_scan) |
| 363 | return -EOPNOTSUPP; |
| 364 | |
| 365 | skb = ar->wmi.ops->gen_start_scan(ar, arg); |
| 366 | if (IS_ERR(skb)) |
| 367 | return PTR_ERR(skb); |
| 368 | |
| 369 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->start_scan_cmdid); |
| 370 | } |
| 371 | |
| 372 | static inline int |
| 373 | ath10k_wmi_stop_scan(struct ath10k *ar, const struct wmi_stop_scan_arg *arg) |
| 374 | { |
| 375 | struct sk_buff *skb; |
| 376 | |
| 377 | if (!ar->wmi.ops->gen_stop_scan) |
| 378 | return -EOPNOTSUPP; |
| 379 | |
| 380 | skb = ar->wmi.ops->gen_stop_scan(ar, arg); |
| 381 | if (IS_ERR(skb)) |
| 382 | return PTR_ERR(skb); |
| 383 | |
| 384 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->stop_scan_cmdid); |
| 385 | } |
| 386 | |
| 387 | static inline int |
| 388 | ath10k_wmi_vdev_create(struct ath10k *ar, u32 vdev_id, |
| 389 | enum wmi_vdev_type type, |
| 390 | enum wmi_vdev_subtype subtype, |
| 391 | const u8 macaddr[ETH_ALEN]) |
| 392 | { |
| 393 | struct sk_buff *skb; |
| 394 | |
| 395 | if (!ar->wmi.ops->gen_vdev_create) |
| 396 | return -EOPNOTSUPP; |
| 397 | |
| 398 | skb = ar->wmi.ops->gen_vdev_create(ar, vdev_id, type, subtype, macaddr); |
| 399 | if (IS_ERR(skb)) |
| 400 | return PTR_ERR(skb); |
| 401 | |
| 402 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_create_cmdid); |
| 403 | } |
| 404 | |
| 405 | static inline int |
| 406 | ath10k_wmi_vdev_delete(struct ath10k *ar, u32 vdev_id) |
| 407 | { |
| 408 | struct sk_buff *skb; |
| 409 | |
| 410 | if (!ar->wmi.ops->gen_vdev_delete) |
| 411 | return -EOPNOTSUPP; |
| 412 | |
| 413 | skb = ar->wmi.ops->gen_vdev_delete(ar, vdev_id); |
| 414 | if (IS_ERR(skb)) |
| 415 | return PTR_ERR(skb); |
| 416 | |
| 417 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_delete_cmdid); |
| 418 | } |
| 419 | |
| 420 | static inline int |
| 421 | ath10k_wmi_vdev_start(struct ath10k *ar, |
| 422 | const struct wmi_vdev_start_request_arg *arg) |
| 423 | { |
| 424 | struct sk_buff *skb; |
| 425 | |
| 426 | if (!ar->wmi.ops->gen_vdev_start) |
| 427 | return -EOPNOTSUPP; |
| 428 | |
| 429 | skb = ar->wmi.ops->gen_vdev_start(ar, arg, false); |
| 430 | if (IS_ERR(skb)) |
| 431 | return PTR_ERR(skb); |
| 432 | |
| 433 | return ath10k_wmi_cmd_send(ar, skb, |
| 434 | ar->wmi.cmd->vdev_start_request_cmdid); |
| 435 | } |
| 436 | |
| 437 | static inline int |
| 438 | ath10k_wmi_vdev_restart(struct ath10k *ar, |
| 439 | const struct wmi_vdev_start_request_arg *arg) |
| 440 | { |
| 441 | struct sk_buff *skb; |
| 442 | |
| 443 | if (!ar->wmi.ops->gen_vdev_start) |
| 444 | return -EOPNOTSUPP; |
| 445 | |
| 446 | skb = ar->wmi.ops->gen_vdev_start(ar, arg, true); |
| 447 | if (IS_ERR(skb)) |
| 448 | return PTR_ERR(skb); |
| 449 | |
| 450 | return ath10k_wmi_cmd_send(ar, skb, |
| 451 | ar->wmi.cmd->vdev_restart_request_cmdid); |
| 452 | } |
| 453 | |
| 454 | static inline int |
| 455 | ath10k_wmi_vdev_stop(struct ath10k *ar, u32 vdev_id) |
| 456 | { |
| 457 | struct sk_buff *skb; |
| 458 | |
| 459 | if (!ar->wmi.ops->gen_vdev_stop) |
| 460 | return -EOPNOTSUPP; |
| 461 | |
| 462 | skb = ar->wmi.ops->gen_vdev_stop(ar, vdev_id); |
| 463 | if (IS_ERR(skb)) |
| 464 | return PTR_ERR(skb); |
| 465 | |
| 466 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_stop_cmdid); |
| 467 | } |
| 468 | |
| 469 | static inline int |
| 470 | ath10k_wmi_vdev_up(struct ath10k *ar, u32 vdev_id, u32 aid, const u8 *bssid) |
| 471 | { |
| 472 | struct sk_buff *skb; |
| 473 | |
| 474 | if (!ar->wmi.ops->gen_vdev_up) |
| 475 | return -EOPNOTSUPP; |
| 476 | |
| 477 | skb = ar->wmi.ops->gen_vdev_up(ar, vdev_id, aid, bssid); |
| 478 | if (IS_ERR(skb)) |
| 479 | return PTR_ERR(skb); |
| 480 | |
| 481 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_up_cmdid); |
| 482 | } |
| 483 | |
| 484 | static inline int |
| 485 | ath10k_wmi_vdev_down(struct ath10k *ar, u32 vdev_id) |
| 486 | { |
| 487 | struct sk_buff *skb; |
| 488 | |
| 489 | if (!ar->wmi.ops->gen_vdev_down) |
| 490 | return -EOPNOTSUPP; |
| 491 | |
| 492 | skb = ar->wmi.ops->gen_vdev_down(ar, vdev_id); |
| 493 | if (IS_ERR(skb)) |
| 494 | return PTR_ERR(skb); |
| 495 | |
| 496 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_down_cmdid); |
| 497 | } |
| 498 | |
| 499 | static inline int |
| 500 | ath10k_wmi_vdev_set_param(struct ath10k *ar, u32 vdev_id, u32 param_id, |
| 501 | u32 param_value) |
| 502 | { |
| 503 | struct sk_buff *skb; |
| 504 | |
| 505 | if (!ar->wmi.ops->gen_vdev_set_param) |
| 506 | return -EOPNOTSUPP; |
| 507 | |
| 508 | skb = ar->wmi.ops->gen_vdev_set_param(ar, vdev_id, param_id, |
| 509 | param_value); |
| 510 | if (IS_ERR(skb)) |
| 511 | return PTR_ERR(skb); |
| 512 | |
| 513 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->vdev_set_param_cmdid); |
| 514 | } |
| 515 | |
| 516 | static inline int |
| 517 | ath10k_wmi_vdev_install_key(struct ath10k *ar, |
| 518 | const struct wmi_vdev_install_key_arg *arg) |
| 519 | { |
| 520 | struct sk_buff *skb; |
| 521 | |
| 522 | if (!ar->wmi.ops->gen_vdev_install_key) |
| 523 | return -EOPNOTSUPP; |
| 524 | |
| 525 | skb = ar->wmi.ops->gen_vdev_install_key(ar, arg); |
| 526 | if (IS_ERR(skb)) |
| 527 | return PTR_ERR(skb); |
| 528 | |
| 529 | return ath10k_wmi_cmd_send(ar, skb, |
| 530 | ar->wmi.cmd->vdev_install_key_cmdid); |
| 531 | } |
| 532 | |
| 533 | static inline int |
| 534 | ath10k_wmi_vdev_spectral_conf(struct ath10k *ar, |
| 535 | const struct wmi_vdev_spectral_conf_arg *arg) |
| 536 | { |
| 537 | struct sk_buff *skb; |
| 538 | u32 cmd_id; |
| 539 | |
| 540 | skb = ar->wmi.ops->gen_vdev_spectral_conf(ar, arg); |
| 541 | if (IS_ERR(skb)) |
| 542 | return PTR_ERR(skb); |
| 543 | |
| 544 | cmd_id = ar->wmi.cmd->vdev_spectral_scan_configure_cmdid; |
| 545 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); |
| 546 | } |
| 547 | |
| 548 | static inline int |
| 549 | ath10k_wmi_vdev_spectral_enable(struct ath10k *ar, u32 vdev_id, u32 trigger, |
| 550 | u32 enable) |
| 551 | { |
| 552 | struct sk_buff *skb; |
| 553 | u32 cmd_id; |
| 554 | |
| 555 | skb = ar->wmi.ops->gen_vdev_spectral_enable(ar, vdev_id, trigger, |
| 556 | enable); |
| 557 | if (IS_ERR(skb)) |
| 558 | return PTR_ERR(skb); |
| 559 | |
| 560 | cmd_id = ar->wmi.cmd->vdev_spectral_scan_enable_cmdid; |
| 561 | return ath10k_wmi_cmd_send(ar, skb, cmd_id); |
| 562 | } |
| 563 | |
| 564 | static inline int |
| 565 | ath10k_wmi_peer_create(struct ath10k *ar, u32 vdev_id, |
| 566 | const u8 peer_addr[ETH_ALEN]) |
| 567 | { |
| 568 | struct sk_buff *skb; |
| 569 | |
| 570 | if (!ar->wmi.ops->gen_peer_create) |
| 571 | return -EOPNOTSUPP; |
| 572 | |
| 573 | skb = ar->wmi.ops->gen_peer_create(ar, vdev_id, peer_addr); |
| 574 | if (IS_ERR(skb)) |
| 575 | return PTR_ERR(skb); |
| 576 | |
| 577 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_create_cmdid); |
| 578 | } |
| 579 | |
| 580 | static inline int |
| 581 | ath10k_wmi_peer_delete(struct ath10k *ar, u32 vdev_id, |
| 582 | const u8 peer_addr[ETH_ALEN]) |
| 583 | { |
| 584 | struct sk_buff *skb; |
| 585 | |
| 586 | if (!ar->wmi.ops->gen_peer_delete) |
| 587 | return -EOPNOTSUPP; |
| 588 | |
| 589 | skb = ar->wmi.ops->gen_peer_delete(ar, vdev_id, peer_addr); |
| 590 | if (IS_ERR(skb)) |
| 591 | return PTR_ERR(skb); |
| 592 | |
| 593 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_delete_cmdid); |
| 594 | } |
| 595 | |
| 596 | static inline int |
| 597 | ath10k_wmi_peer_flush(struct ath10k *ar, u32 vdev_id, |
| 598 | const u8 peer_addr[ETH_ALEN], u32 tid_bitmap) |
| 599 | { |
| 600 | struct sk_buff *skb; |
| 601 | |
| 602 | if (!ar->wmi.ops->gen_peer_flush) |
| 603 | return -EOPNOTSUPP; |
| 604 | |
| 605 | skb = ar->wmi.ops->gen_peer_flush(ar, vdev_id, peer_addr, tid_bitmap); |
| 606 | if (IS_ERR(skb)) |
| 607 | return PTR_ERR(skb); |
| 608 | |
| 609 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_flush_tids_cmdid); |
| 610 | } |
| 611 | |
| 612 | static inline int |
| 613 | ath10k_wmi_peer_set_param(struct ath10k *ar, u32 vdev_id, const u8 *peer_addr, |
| 614 | enum wmi_peer_param param_id, u32 param_value) |
| 615 | { |
| 616 | struct sk_buff *skb; |
| 617 | |
| 618 | if (!ar->wmi.ops->gen_peer_set_param) |
| 619 | return -EOPNOTSUPP; |
| 620 | |
| 621 | skb = ar->wmi.ops->gen_peer_set_param(ar, vdev_id, peer_addr, param_id, |
| 622 | param_value); |
| 623 | if (IS_ERR(skb)) |
| 624 | return PTR_ERR(skb); |
| 625 | |
| 626 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_set_param_cmdid); |
| 627 | } |
| 628 | |
| 629 | static inline int |
| 630 | ath10k_wmi_set_psmode(struct ath10k *ar, u32 vdev_id, |
| 631 | enum wmi_sta_ps_mode psmode) |
| 632 | { |
| 633 | struct sk_buff *skb; |
| 634 | |
| 635 | if (!ar->wmi.ops->gen_set_psmode) |
| 636 | return -EOPNOTSUPP; |
| 637 | |
| 638 | skb = ar->wmi.ops->gen_set_psmode(ar, vdev_id, psmode); |
| 639 | if (IS_ERR(skb)) |
| 640 | return PTR_ERR(skb); |
| 641 | |
| 642 | return ath10k_wmi_cmd_send(ar, skb, |
| 643 | ar->wmi.cmd->sta_powersave_mode_cmdid); |
| 644 | } |
| 645 | |
| 646 | static inline int |
| 647 | ath10k_wmi_set_sta_ps_param(struct ath10k *ar, u32 vdev_id, |
| 648 | enum wmi_sta_powersave_param param_id, u32 value) |
| 649 | { |
| 650 | struct sk_buff *skb; |
| 651 | |
| 652 | if (!ar->wmi.ops->gen_set_sta_ps) |
| 653 | return -EOPNOTSUPP; |
| 654 | |
| 655 | skb = ar->wmi.ops->gen_set_sta_ps(ar, vdev_id, param_id, value); |
| 656 | if (IS_ERR(skb)) |
| 657 | return PTR_ERR(skb); |
| 658 | |
| 659 | return ath10k_wmi_cmd_send(ar, skb, |
| 660 | ar->wmi.cmd->sta_powersave_param_cmdid); |
| 661 | } |
| 662 | |
| 663 | static inline int |
| 664 | ath10k_wmi_set_ap_ps_param(struct ath10k *ar, u32 vdev_id, const u8 *mac, |
| 665 | enum wmi_ap_ps_peer_param param_id, u32 value) |
| 666 | { |
| 667 | struct sk_buff *skb; |
| 668 | |
| 669 | if (!ar->wmi.ops->gen_set_ap_ps) |
| 670 | return -EOPNOTSUPP; |
| 671 | |
| 672 | skb = ar->wmi.ops->gen_set_ap_ps(ar, vdev_id, mac, param_id, value); |
| 673 | if (IS_ERR(skb)) |
| 674 | return PTR_ERR(skb); |
| 675 | |
| 676 | return ath10k_wmi_cmd_send(ar, skb, |
| 677 | ar->wmi.cmd->ap_ps_peer_param_cmdid); |
| 678 | } |
| 679 | |
| 680 | static inline int |
| 681 | ath10k_wmi_scan_chan_list(struct ath10k *ar, |
| 682 | const struct wmi_scan_chan_list_arg *arg) |
| 683 | { |
| 684 | struct sk_buff *skb; |
| 685 | |
| 686 | if (!ar->wmi.ops->gen_scan_chan_list) |
| 687 | return -EOPNOTSUPP; |
| 688 | |
| 689 | skb = ar->wmi.ops->gen_scan_chan_list(ar, arg); |
| 690 | if (IS_ERR(skb)) |
| 691 | return PTR_ERR(skb); |
| 692 | |
| 693 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->scan_chan_list_cmdid); |
| 694 | } |
| 695 | |
| 696 | static inline int |
| 697 | ath10k_wmi_peer_assoc(struct ath10k *ar, |
| 698 | const struct wmi_peer_assoc_complete_arg *arg) |
| 699 | { |
| 700 | struct sk_buff *skb; |
| 701 | |
| 702 | if (!ar->wmi.ops->gen_peer_assoc) |
| 703 | return -EOPNOTSUPP; |
| 704 | |
| 705 | skb = ar->wmi.ops->gen_peer_assoc(ar, arg); |
| 706 | if (IS_ERR(skb)) |
| 707 | return PTR_ERR(skb); |
| 708 | |
| 709 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->peer_assoc_cmdid); |
| 710 | } |
| 711 | |
| 712 | static inline int |
| 713 | ath10k_wmi_beacon_send_ref_nowait(struct ath10k_vif *arvif) |
| 714 | { |
| 715 | struct ath10k *ar = arvif->ar; |
| 716 | struct sk_buff *skb; |
| 717 | int ret; |
| 718 | |
| 719 | if (!ar->wmi.ops->gen_beacon_dma) |
| 720 | return -EOPNOTSUPP; |
| 721 | |
| 722 | skb = ar->wmi.ops->gen_beacon_dma(arvif); |
| 723 | if (IS_ERR(skb)) |
| 724 | return PTR_ERR(skb); |
| 725 | |
| 726 | ret = ath10k_wmi_cmd_send_nowait(ar, skb, |
| 727 | ar->wmi.cmd->pdev_send_bcn_cmdid); |
| 728 | if (ret) { |
| 729 | dev_kfree_skb(skb); |
| 730 | return ret; |
| 731 | } |
| 732 | |
| 733 | return 0; |
| 734 | } |
| 735 | |
| 736 | static inline int |
| 737 | ath10k_wmi_pdev_set_wmm_params(struct ath10k *ar, |
| 738 | const struct wmi_pdev_set_wmm_params_arg *arg) |
| 739 | { |
| 740 | struct sk_buff *skb; |
| 741 | |
| 742 | if (!ar->wmi.ops->gen_pdev_set_wmm) |
| 743 | return -EOPNOTSUPP; |
| 744 | |
| 745 | skb = ar->wmi.ops->gen_pdev_set_wmm(ar, arg); |
| 746 | if (IS_ERR(skb)) |
| 747 | return PTR_ERR(skb); |
| 748 | |
| 749 | return ath10k_wmi_cmd_send(ar, skb, |
| 750 | ar->wmi.cmd->pdev_set_wmm_params_cmdid); |
| 751 | } |
| 752 | |
| 753 | static inline int |
| 754 | ath10k_wmi_request_stats(struct ath10k *ar, enum wmi_stats_id stats_id) |
| 755 | { |
| 756 | struct sk_buff *skb; |
| 757 | |
| 758 | if (!ar->wmi.ops->gen_request_stats) |
| 759 | return -EOPNOTSUPP; |
| 760 | |
| 761 | skb = ar->wmi.ops->gen_request_stats(ar, stats_id); |
| 762 | if (IS_ERR(skb)) |
| 763 | return PTR_ERR(skb); |
| 764 | |
| 765 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->request_stats_cmdid); |
| 766 | } |
| 767 | |
| 768 | static inline int |
| 769 | ath10k_wmi_force_fw_hang(struct ath10k *ar, |
| 770 | enum wmi_force_fw_hang_type type, u32 delay_ms) |
| 771 | { |
| 772 | struct sk_buff *skb; |
| 773 | |
| 774 | if (!ar->wmi.ops->gen_force_fw_hang) |
| 775 | return -EOPNOTSUPP; |
| 776 | |
| 777 | skb = ar->wmi.ops->gen_force_fw_hang(ar, type, delay_ms); |
| 778 | if (IS_ERR(skb)) |
| 779 | return PTR_ERR(skb); |
| 780 | |
| 781 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid); |
| 782 | } |
| 783 | |
| 784 | static inline int |
| 785 | ath10k_wmi_dbglog_cfg(struct ath10k *ar, u32 module_enable) |
| 786 | { |
| 787 | struct sk_buff *skb; |
| 788 | |
| 789 | if (!ar->wmi.ops->gen_dbglog_cfg) |
| 790 | return -EOPNOTSUPP; |
| 791 | |
| 792 | skb = ar->wmi.ops->gen_dbglog_cfg(ar, module_enable); |
| 793 | if (IS_ERR(skb)) |
| 794 | return PTR_ERR(skb); |
| 795 | |
| 796 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->dbglog_cfg_cmdid); |
| 797 | } |
| 798 | |
| 799 | static inline int |
| 800 | ath10k_wmi_pdev_pktlog_enable(struct ath10k *ar, u32 filter) |
| 801 | { |
| 802 | struct sk_buff *skb; |
| 803 | |
| 804 | if (!ar->wmi.ops->gen_pktlog_enable) |
| 805 | return -EOPNOTSUPP; |
| 806 | |
| 807 | skb = ar->wmi.ops->gen_pktlog_enable(ar, filter); |
| 808 | if (IS_ERR(skb)) |
| 809 | return PTR_ERR(skb); |
| 810 | |
| 811 | return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->pdev_pktlog_enable_cmdid); |
| 812 | } |
| 813 | |
| 814 | static inline int |
| 815 | ath10k_wmi_pdev_pktlog_disable(struct ath10k *ar) |
| 816 | { |
| 817 | struct sk_buff *skb; |
| 818 | |
| 819 | if (!ar->wmi.ops->gen_pktlog_disable) |
| 820 | return -EOPNOTSUPP; |
| 821 | |
| 822 | skb = ar->wmi.ops->gen_pktlog_disable(ar); |
| 823 | if (IS_ERR(skb)) |
| 824 | return PTR_ERR(skb); |
| 825 | |
| 826 | return ath10k_wmi_cmd_send(ar, skb, |
| 827 | ar->wmi.cmd->pdev_pktlog_disable_cmdid); |
| 828 | } |
| 829 | |
Rajkumar Manoharan | ffdd738 | 2014-12-17 12:21:40 +0200 | [diff] [blame] | 830 | static inline int |
| 831 | ath10k_wmi_pdev_set_quiet_mode(struct ath10k *ar, u32 period, u32 duration, |
| 832 | u32 next_offset, u32 enabled) |
| 833 | { |
| 834 | struct sk_buff *skb; |
| 835 | |
| 836 | if (!ar->wmi.ops->gen_pdev_set_quiet_mode) |
| 837 | return -EOPNOTSUPP; |
| 838 | |
| 839 | skb = ar->wmi.ops->gen_pdev_set_quiet_mode(ar, period, duration, |
| 840 | next_offset, enabled); |
| 841 | if (IS_ERR(skb)) |
| 842 | return PTR_ERR(skb); |
| 843 | |
| 844 | return ath10k_wmi_cmd_send(ar, skb, |
| 845 | ar->wmi.cmd->pdev_set_quiet_mode_cmdid); |
| 846 | } |
| 847 | |
Rajkumar Manoharan | a57a6a2 | 2014-12-17 12:22:17 +0200 | [diff] [blame] | 848 | static inline int |
| 849 | ath10k_wmi_pdev_get_temperature(struct ath10k *ar) |
| 850 | { |
| 851 | struct sk_buff *skb; |
| 852 | |
| 853 | if (!ar->wmi.ops->gen_pdev_get_temperature) |
| 854 | return -EOPNOTSUPP; |
| 855 | |
| 856 | skb = ar->wmi.ops->gen_pdev_get_temperature(ar); |
| 857 | if (IS_ERR(skb)) |
| 858 | return PTR_ERR(skb); |
| 859 | |
| 860 | return ath10k_wmi_cmd_send(ar, skb, |
| 861 | ar->wmi.cmd->pdev_get_temperature_cmdid); |
| 862 | } |
| 863 | |
Rajkumar Manoharan | dc8ab27 | 2015-01-12 14:07:25 +0200 | [diff] [blame] | 864 | static inline int |
| 865 | ath10k_wmi_addba_clear_resp(struct ath10k *ar, u32 vdev_id, const u8 *mac) |
| 866 | { |
| 867 | struct sk_buff *skb; |
| 868 | |
| 869 | if (!ar->wmi.ops->gen_addba_clear_resp) |
| 870 | return -EOPNOTSUPP; |
| 871 | |
| 872 | skb = ar->wmi.ops->gen_addba_clear_resp(ar, vdev_id, mac); |
| 873 | if (IS_ERR(skb)) |
| 874 | return PTR_ERR(skb); |
| 875 | |
| 876 | return ath10k_wmi_cmd_send(ar, skb, |
| 877 | ar->wmi.cmd->addba_clear_resp_cmdid); |
| 878 | } |
| 879 | |
Rajkumar Manoharan | 65c0893 | 2015-01-12 14:07:26 +0200 | [diff] [blame^] | 880 | static inline int |
| 881 | ath10k_wmi_addba_send(struct ath10k *ar, u32 vdev_id, const u8 *mac, |
| 882 | u32 tid, u32 buf_size) |
| 883 | { |
| 884 | struct sk_buff *skb; |
| 885 | |
| 886 | if (!ar->wmi.ops->gen_addba_send) |
| 887 | return -EOPNOTSUPP; |
| 888 | |
| 889 | skb = ar->wmi.ops->gen_addba_send(ar, vdev_id, mac, tid, buf_size); |
| 890 | if (IS_ERR(skb)) |
| 891 | return PTR_ERR(skb); |
| 892 | |
| 893 | return ath10k_wmi_cmd_send(ar, skb, |
| 894 | ar->wmi.cmd->addba_send_cmdid); |
| 895 | } |
| 896 | |
Michal Kazior | d7579d1 | 2014-12-03 10:10:54 +0200 | [diff] [blame] | 897 | #endif |