Linux Audio

Check our new training course

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