Просмотр исходного кода

qcacmn: Featurize WMI APIs and TLVs that are specific to WIN

In the existing converged component, WMI TLV APIs are implemented in
a generic manner without proper featurization. All the APIs exposed
outside of WMI are implemented in wmi_unified_api.c and all the APIs
forming the CMD or extracting the EVT is implemented in wmi_unified_tlv.c.

Since WIN and MCL have a unified WMI layer in the converged component and
there are features within WIN and MCL that are not common, there exists a
good number of WMI APIs which are specific to WIN but compiled by MCL and
vice-versa. Due to this inadvertent problem, there is a chunk of code and
memory used up by WIN and MCL for features that are not used in their
products.

Featurize WMI APIs and TLVs that are specific to WIN
- Air Time Fareness (ATF)
- Direct Buffer Rx (DBR)
- Smart Antenna (SMART_ANT)
- Generic WIN specific WMI (AP)

Change-Id: I7b27c8993da04c9e9651a9682de370daaa40d187
CRs-Fixed: 2320273
Sathish Kumar 6 лет назад
Родитель
Сommit
637da89a76

+ 233 - 0
wmi_unified_ap_api.h

@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file contains the API definitions for the generic AP WMIs
+ */
+
+#ifndef _WMI_UNIFIED_AP_API_H_
+#define _WMI_UNIFIED_AP_API_H_
+
+#include "wmi_unified_param.h"
+
+QDF_STATUS wmi_unified_beacon_send_cmd(void *wmi_hdl,
+				struct beacon_params *param);
+
+QDF_STATUS wmi_unified_pdev_get_tpc_config_cmd_send(void *wmi_hdl,
+				uint32_t param);
+
+QDF_STATUS wmi_send_pdev_caldata_version_check_cmd(void *wmi_hdl,
+				uint32_t value);
+
+QDF_STATUS wmi_unified_set_ht_ie_cmd_send(void *wmi_hdl,
+				struct ht_ie_params *param);
+
+QDF_STATUS wmi_unified_set_vht_ie_cmd_send(void *wmi_hdl,
+				struct vht_ie_params *param);
+
+QDF_STATUS wmi_unified_set_ctl_table_cmd_send(void *wmi_hdl,
+				struct ctl_table_params *param);
+
+QDF_STATUS wmi_unified_set_mimogain_table_cmd_send(void *wmi_hdl,
+				struct mimogain_table_params *param);
+
+QDF_STATUS wmi_unified_peer_add_wds_entry_cmd_send(void *wmi_hdl,
+				struct peer_add_wds_entry_params *param);
+
+QDF_STATUS wmi_unified_peer_del_wds_entry_cmd_send(void *wmi_hdl,
+				struct peer_del_wds_entry_params *param);
+
+QDF_STATUS wmi_unified_peer_update_wds_entry_cmd_send(void *wmi_hdl,
+				struct peer_update_wds_entry_params *param);
+
+QDF_STATUS wmi_unified_vdev_set_neighbour_rx_cmd_send(void *wmi_hdl,
+				uint8_t macaddr[IEEE80211_ADDR_LEN],
+				struct set_neighbour_rx_params *param);
+
+QDF_STATUS wmi_unified_vdev_config_ratemask_cmd_send(void *wmi_hdl,
+				struct config_ratemask_params *param);
+
+QDF_STATUS wmi_unified_set_quiet_mode_cmd_send(void *wmi_hdl,
+				struct set_quiet_mode_params *param);
+
+QDF_STATUS wmi_unified_nf_dbr_dbm_info_get_cmd_send(void *wmi_hdl,
+						    uint8_t mac_id);
+
+QDF_STATUS wmi_unified_packet_power_info_get_cmd_send(void *wmi_hdl,
+				struct packet_power_info_params *param);
+
+QDF_STATUS wmi_extract_wds_addr_event(void *wmi_hdl,
+		void *evt_buf, uint16_t len, wds_addr_event_t *wds_ev);
+
+QDF_STATUS wmi_extract_dcs_interference_type(void *wmi_hdl,
+		void *evt_buf, struct wmi_host_dcs_interference_param *param);
+
+QDF_STATUS wmi_extract_dcs_cw_int(void *wmi_hdl, void *evt_buf,
+		wmi_host_ath_dcs_cw_int *cw_int);
+
+QDF_STATUS wmi_extract_dcs_im_tgt_stats(void *wmi_hdl, void *evt_buf,
+		wmi_host_dcs_im_tgt_stats_t *wlan_stat);
+
+QDF_STATUS wmi_extract_tbttoffset_update_params(void *wmi_hdl, void *evt_buf,
+		uint8_t idx, struct tbttoffset_params *tbtt_param);
+
+QDF_STATUS wmi_extract_ext_tbttoffset_update_params(void *wmi_hdl,
+		void *evt_buf, uint8_t idx,
+		struct tbttoffset_params *tbtt_param);
+
+QDF_STATUS wmi_extract_tbttoffset_num_vdevs(void *wmi_hdl, void *evt_buf,
+					    uint32_t *num_vdevs);
+
+QDF_STATUS wmi_extract_ext_tbttoffset_num_vdevs(void *wmi_hdl, void *evt_buf,
+						uint32_t *num_vdevs);
+
+QDF_STATUS wmi_extract_pdev_caldata_version_check_ev_param(void *wmi_hdl,
+		void *evt_buf, wmi_host_pdev_check_cal_version_event *param);
+
+QDF_STATUS wmi_extract_pdev_tpc_config_ev_param(void *wmi_hdl, void *evt_buf,
+		wmi_host_pdev_tpc_config_event *param);
+
+QDF_STATUS wmi_extract_nfcal_power_ev_param(void *wmi_hdl, void *evt_buf,
+		wmi_host_pdev_nfcal_power_all_channels_event *param);
+
+QDF_STATUS wmi_extract_pdev_tpc_ev_param(void *wmi_hdl, void *evt_buf,
+		wmi_host_pdev_tpc_event *param);
+
+QDF_STATUS wmi_extract_offchan_data_tx_compl_param(void *wmi_hdl, void *evt_buf,
+		struct wmi_host_offchan_data_tx_compl_event *param);
+
+QDF_STATUS wmi_extract_pdev_csa_switch_count_status(void *wmi_hdl,
+		void *evt_buf,
+		struct pdev_csa_switch_count_status *param);
+
+QDF_STATUS wmi_extract_swba_num_vdevs(void *wmi_hdl, void *evt_buf,
+		uint32_t *num_vdevs);
+
+QDF_STATUS wmi_extract_swba_tim_info(void *wmi_hdl, void *evt_buf,
+		 uint32_t idx, wmi_host_tim_info *tim_info);
+
+QDF_STATUS wmi_extract_swba_noa_info(void *wmi_hdl, void *evt_buf,
+			uint32_t idx, wmi_host_p2p_noa_info *p2p_desc);
+
+QDF_STATUS wmi_extract_peer_sta_ps_statechange_ev(void *wmi_hdl,
+		void *evt_buf, wmi_host_peer_sta_ps_statechange_event *ev);
+
+QDF_STATUS wmi_extract_peer_sta_kickout_ev(void *wmi_hdl, void *evt_buf,
+		wmi_host_peer_sta_kickout_event *ev);
+
+QDF_STATUS wmi_extract_inst_rssi_stats_event(void *wmi_hdl, void *evt_buf,
+			wmi_host_inst_stats_resp *inst_rssi_resp);
+
+QDF_STATUS wmi_unified_send_multiple_vdev_restart_req_cmd(void *wmi_hdl,
+				struct multiple_vdev_restart_params *param);
+
+QDF_STATUS wmi_extract_peer_delete_response_event(void *wmi_hdl,
+		uint8_t *evt_buf,
+		struct wmi_host_peer_delete_response_event *param);
+
+/**
+ * wmi_send_bcn_offload_control_cmd - send beacon ofload control cmd to fw
+ * @wmi_hdl: wmi handle
+ * @bcn_ctrl_param: pointer to bcn_offload_control param
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+QDF_STATUS wmi_send_bcn_offload_control_cmd(void *wmi_hdl,
+			struct bcn_offload_control *bcn_ctrl_param);
+
+#ifdef WLAN_SUPPORT_FILS
+/**
+ * wmi_unified_fils_vdev_config_send_cmd() - send FILS config cmd to fw
+ * @wmi_hdl: wmi handle
+ * @param:   fils config params
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+QDF_STATUS
+wmi_unified_fils_vdev_config_send_cmd(void *wmi_hdl,
+				      struct config_fils_params *param);
+
+/**
+ * wmi_extract_swfda_vdev_id() - api to extract vdev id
+ * @wmi_hdl: wmi handle
+ * @evt_buf: pointer to event buffer
+ * @vdev_id: pointer to vdev id
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+QDF_STATUS wmi_extract_swfda_vdev_id(void *wmi_hdl, void *evt_buf,
+				     uint32_t *vdev_id);
+
+/**
+ * wmi_unified_fils_discovery_send_cmd() - send FILS discovery cmd to fw
+ * @wmi_hdl: wmi handle
+ * @param:   fils discovery params
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+QDF_STATUS wmi_unified_fils_discovery_send_cmd(void *wmi_hdl,
+					       struct fd_params *param);
+#endif /* WLAN_SUPPORT_FILS */
+
+QDF_STATUS wmi_unified_set_qboost_param_cmd_send(void *wmi_hdl,
+				uint8_t macaddr[IEEE80211_ADDR_LEN],
+				struct set_qboost_params *param);
+
+QDF_STATUS wmi_unified_gpio_config_cmd_send(void *wmi_hdl,
+				struct gpio_config_params *param);
+
+QDF_STATUS wmi_unified_gpio_output_cmd_send(void *wmi_hdl,
+				struct gpio_output_params *param);
+
+QDF_STATUS wmi_unified_mcast_group_update_cmd_send(void *wmi_hdl,
+				struct mcast_group_update_params *param);
+
+QDF_STATUS wmi_unified_pdev_qvit_cmd_send(void *wmi_hdl,
+				struct pdev_qvit_params *param);
+
+QDF_STATUS wmi_unified_wmm_update_cmd_send(void *wmi_hdl,
+				struct wmm_update_params *param);
+
+QDF_STATUS wmi_extract_vdev_start_resp(void *wmi_hdl, void *evt_buf,
+		wmi_host_vdev_start_resp *vdev_rsp);
+
+/**
+ * wmi_extract_vdev_delete_resp - api to extract vdev delete
+ * response event params
+ * @wmi_handle: wma handle
+ * @evt_buf: pointer to event buffer
+ * @delele_rsp: pointer to hold delete response from firmware
+ *
+ * Return: QDF_STATUS_SUCCESS for successful event parse
+ *         else QDF_STATUS_E_INVAL or QDF_STATUS_E_FAILURE
+ */
+QDF_STATUS wmi_extract_vdev_delete_resp(void *wmi_hdl, void *evt_buf,
+		struct wmi_host_vdev_delete_resp *delele_rsp);
+
+QDF_STATUS wmi_extract_vdev_stopped_param(void *wmi_hdl, void *evt_buf,
+		uint32_t *vdev_id);
+
+QDF_STATUS wmi_extract_mgmt_tx_compl_param(void *wmi_hdl, void *evt_buf,
+		wmi_host_mgmt_tx_compl_event *param);
+
+QDF_STATUS wmi_extract_chan_info_event(void *wmi_hdl, void *evt_buf,
+			wmi_host_chan_info_event *chan_info);
+
+QDF_STATUS wmi_extract_channel_hopping_event(void *wmi_hdl, void *evt_buf,
+			wmi_host_pdev_channel_hopping_event *ch_hopping);
+#endif /* _WMI_UNIFIED_AP_API_H_ */

+ 16 - 309
wmi_unified_api.h

@@ -68,6 +68,22 @@
 #include "wlan_ipa_public_struct.h"
 #endif
 
+#ifdef WMI_SMART_ANT_SUPPORT
+#include "wmi_unified_smart_ant_api.h"
+#endif
+
+#ifdef WMI_DBR_SUPPORT
+#include "wmi_unified_dbr_api.h"
+#endif
+
+#ifdef WMI_ATF_SUPPORT
+#include "wmi_unified_atf_api.h"
+#endif
+
+#ifdef WMI_AP_SUPPORT
+#include "wmi_unified_ap_api.h"
+#endif
+
 typedef qdf_nbuf_t wmi_buf_t;
 #define wmi_buf_data(_buf) qdf_nbuf_data(_buf)
 
@@ -526,9 +542,6 @@ QDF_STATUS wmi_unified_beacon_tmpl_send_cmd(void *wmi_hdl,
 				struct beacon_tmpl_params *param);
 
 
-QDF_STATUS wmi_unified_beacon_send_cmd(void *wmi_hdl,
-				struct beacon_params *param);
-
 QDF_STATUS wmi_unified_peer_assoc_send(void *wmi_hdl,
 				struct peer_assoc_params *param);
 
@@ -956,16 +969,6 @@ QDF_STATUS wmi_unified_oem_dma_ring_cfg(void *wmi_hdl,
 				wmi_oem_dma_ring_cfg_req_fixed_param *cfg);
 #endif
 
-/**
- * wmi_unified_dbr_ring_cfg: Configure direct buffer rx rings
- * @wmi_hdl: WMI handle
- * @cfg: pointer to direct buffer rx config request
- *
- * Return: QDF status of operation
- */
-QDF_STATUS wmi_unified_dbr_ring_cfg(void *wmi_hdl,
-				struct direct_buf_rx_cfg_req *cfg);
-
 QDF_STATUS wmi_unified_start_oem_data_cmd(void *wmi_hdl,
 			  uint32_t data_len,
 			  uint8_t *data);
@@ -1191,12 +1194,6 @@ QDF_STATUS wmi_unified_stats_request_send(void *wmi_hdl,
 				uint8_t macaddr[IEEE80211_ADDR_LEN],
 				struct stats_request_params *param);
 
-QDF_STATUS wmi_unified_pdev_get_tpc_config_cmd_send(void *wmi_hdl,
-				uint32_t param);
-
-QDF_STATUS wmi_unified_set_bwf_cmd_send(void *wmi_hdl,
-				struct set_bwf_params *param);
-
 QDF_STATUS wmi_send_get_user_position_cmd(void *wmi_hdl, uint32_t value);
 
 QDF_STATUS wmi_send_get_peer_mumimo_tx_count_cmd(void *wmi_hdl, uint32_t value);
@@ -1204,9 +1201,6 @@ QDF_STATUS wmi_send_get_peer_mumimo_tx_count_cmd(void *wmi_hdl, uint32_t value);
 QDF_STATUS wmi_send_reset_peer_mumimo_tx_count_cmd(void *wmi_hdl,
 				uint32_t value);
 
-QDF_STATUS wmi_send_pdev_caldata_version_check_cmd(void *wmi_hdl,
-				uint32_t value);
-
 QDF_STATUS wmi_unified_send_btcoex_wlan_priority_cmd(void *wmi_hdl,
 				struct btcoex_cfg_params *param);
 
@@ -1231,29 +1225,11 @@ QDF_STATUS wmi_unified_wlan_profile_trigger_cmd_send(void *wmi_hdl,
 QDF_STATUS wmi_unified_set_chan_cmd_send(void *wmi_hdl,
 				struct channel_param *param);
 
-QDF_STATUS wmi_unified_set_ht_ie_cmd_send(void *wmi_hdl,
-				struct ht_ie_params *param);
-
-QDF_STATUS wmi_unified_set_vht_ie_cmd_send(void *wmi_hdl,
-				struct vht_ie_params *param);
-
-QDF_STATUS wmi_unified_wmm_update_cmd_send(void *wmi_hdl,
-				struct wmm_update_params *param);
-
-QDF_STATUS wmi_unified_set_ant_switch_tbl_cmd_send(void *wmi_hdl,
-				struct ant_switch_tbl_params *param);
-
 QDF_STATUS wmi_unified_set_ratepwr_table_cmd_send(void *wmi_hdl,
 				struct ratepwr_table_params *param);
 
 QDF_STATUS wmi_unified_get_ratepwr_table_cmd_send(void *wmi_hdl);
 
-QDF_STATUS wmi_unified_set_ctl_table_cmd_send(void *wmi_hdl,
-				struct ctl_table_params *param);
-
-QDF_STATUS wmi_unified_set_mimogain_table_cmd_send(void *wmi_hdl,
-				struct mimogain_table_params *param);
-
 QDF_STATUS wmi_unified_set_ratepwr_chainmsk_cmd_send(void *wmi_hdl,
 				struct ratepwr_chainmsk_params *param);
 
@@ -1273,18 +1249,6 @@ QDF_STATUS wmi_unified_set_vap_dscp_tid_map_cmd_send(void *wmi_hdl,
 QDF_STATUS wmi_unified_proxy_ast_reserve_cmd_send(void *wmi_hdl,
 				struct proxy_ast_reserve_params *param);
 
-QDF_STATUS wmi_unified_pdev_qvit_cmd_send(void *wmi_hdl,
-				struct pdev_qvit_params *param);
-
-QDF_STATUS wmi_unified_mcast_group_update_cmd_send(void *wmi_hdl,
-				struct mcast_group_update_params *param);
-
-QDF_STATUS wmi_unified_peer_add_wds_entry_cmd_send(void *wmi_hdl,
-				struct peer_add_wds_entry_params *param);
-
-QDF_STATUS wmi_unified_peer_del_wds_entry_cmd_send(void *wmi_hdl,
-				struct peer_del_wds_entry_params *param);
-
 /**
  *  wmi_unified_set_bridge_mac_addr_cmd_send() - WMI set bridge mac addr cmd function
  *  @param wmi_hdl      : handle to WMI.
@@ -1296,33 +1260,12 @@ QDF_STATUS wmi_unified_set_bridge_mac_addr_cmd_send(void *wmi_hdl,
 				struct set_bridge_mac_addr_params *param);
 
 
-QDF_STATUS wmi_unified_peer_update_wds_entry_cmd_send(void *wmi_hdl,
-				struct peer_update_wds_entry_params *param);
-
 QDF_STATUS wmi_unified_phyerr_enable_cmd_send(void *wmi_hdl);
 
 QDF_STATUS wmi_unified_phyerr_enable_cmd_send(void *wmi_hdl);
 
 QDF_STATUS wmi_unified_phyerr_disable_cmd_send(void *wmi_hdl);
 
-QDF_STATUS wmi_unified_smart_ant_enable_cmd_send(void *wmi_hdl,
-				struct smart_ant_enable_params *param);
-
-QDF_STATUS wmi_unified_smart_ant_set_rx_ant_cmd_send(void *wmi_hdl,
-				struct smart_ant_rx_ant_params *param);
-
-QDF_STATUS wmi_unified_smart_ant_set_tx_ant_cmd_send(void *wmi_hdl,
-				uint8_t macaddr[IEEE80211_ADDR_LEN],
-				struct smart_ant_tx_ant_params *param);
-
-QDF_STATUS wmi_unified_smart_ant_set_training_info_cmd_send(void *wmi_hdl,
-				uint8_t macaddr[IEEE80211_ADDR_LEN],
-				struct smart_ant_training_info_params *param);
-
-QDF_STATUS wmi_unified_smart_ant_node_config_cmd_send(void *wmi_hdl,
-				uint8_t macaddr[IEEE80211_ADDR_LEN],
-				struct smart_ant_node_config_params *param);
-
 QDF_STATUS wmi_unified_smart_ant_enable_tx_feedback_cmd_send(void *wmi_hdl,
 			struct smart_ant_enable_tx_feedback_params *param);
 
@@ -1338,16 +1281,9 @@ QDF_STATUS wmi_unified_bss_chan_info_request_cmd_send(void *wmi_hdl,
 QDF_STATUS wmi_unified_thermal_mitigation_param_cmd_send(void *wmi_hdl,
 				struct thermal_mitigation_params *param);
 
-QDF_STATUS wmi_unified_vdev_set_neighbour_rx_cmd_send(void *wmi_hdl,
-				uint8_t macaddr[IEEE80211_ADDR_LEN],
-				struct set_neighbour_rx_params *param);
-
 QDF_STATUS wmi_unified_vdev_set_fwtest_param_cmd_send(void *wmi_hdl,
 				struct set_fwtest_params *param);
 
-QDF_STATUS wmi_unified_vdev_config_ratemask_cmd_send(void *wmi_hdl,
-				struct config_ratemask_params *param);
-
 /**
  *  wmi_unified_vdev_set_custom_aggr_size_cmd_send() - WMI set custom aggr
  *						       size command
@@ -1372,9 +1308,6 @@ QDF_STATUS wmi_unified_vdev_set_qdepth_thresh_cmd_send(void *wmi_hdl,
 QDF_STATUS wmi_unified_pdev_set_regdomain_cmd_send(void *wmi_hdl,
 				struct pdev_set_regdomain_params *param);
 
-QDF_STATUS wmi_unified_set_quiet_mode_cmd_send(void *wmi_hdl,
-				struct set_quiet_mode_params *param);
-
 QDF_STATUS wmi_unified_set_beacon_filter_cmd_send(void *wmi_hdl,
 				struct set_beacon_filter_params *param);
 
@@ -1401,10 +1334,6 @@ QDF_STATUS wmi_unified_singleamsdu_cmd_send(void *wmi_hdl,
 				uint8_t macaddr[IEEE80211_ADDR_LEN],
 				struct singleamsdu_params *param);
 
-QDF_STATUS wmi_unified_set_qboost_param_cmd_send(void *wmi_hdl,
-				uint8_t macaddr[IEEE80211_ADDR_LEN],
-				struct set_qboost_params *param);
-
 QDF_STATUS wmi_unified_mu_scan_cmd_send(void *wmi_hdl,
 				struct mu_scan_params *param);
 
@@ -1485,18 +1414,6 @@ uint8_t *wmi_extract_dbglog_data_len(void *wmi_hdl,
 QDF_STATUS wmi_send_ext_resource_config(void *wmi_hdl,
 				wmi_host_ext_resource_config *ext_cfg);
 
-QDF_STATUS wmi_unified_nf_dbr_dbm_info_get_cmd_send(void *wmi_hdl,
-						    uint8_t mac_id);
-
-QDF_STATUS wmi_unified_packet_power_info_get_cmd_send(void *wmi_hdl,
-				struct packet_power_info_params *param);
-
-QDF_STATUS wmi_unified_gpio_config_cmd_send(void *wmi_hdl,
-				struct gpio_config_params *param);
-
-QDF_STATUS wmi_unified_gpio_output_cmd_send(void *wmi_hdl,
-				struct gpio_output_params *param);
-
 QDF_STATUS wmi_unified_rtt_meas_req_test_cmd_send(void *wmi_hdl,
 				struct rtt_meas_req_test_params *param);
 
@@ -1515,84 +1432,14 @@ QDF_STATUS wmi_unified_lcr_set_cmd_send(void *wmi_hdl,
 QDF_STATUS wmi_unified_send_periodic_chan_stats_config_cmd(void *wmi_hdl,
 			struct periodic_chan_stats_params *param);
 
-#ifdef WLAN_ATF_ENABLE
-QDF_STATUS
-wmi_unified_set_atf_cmd_send(void *wmi_hdl,
-			     struct set_atf_params *param);
-
-QDF_STATUS
-wmi_send_atf_peer_request_cmd(void *wmi_hdl,
-			      struct atf_peer_request_params *param);
-
-QDF_STATUS
-wmi_send_set_atf_grouping_cmd(void *wmi_hdl,
-			      struct atf_grouping_params *param);
-
-QDF_STATUS
-wmi_send_set_atf_group_ac_cmd(void *wmi_hdl,
-			      struct atf_group_ac_params *param);
-
-QDF_STATUS
-wmi_extract_atf_peer_stats_ev(void *wmi_hdl, void *evt_buf,
-			      wmi_host_atf_peer_stats_event *ev);
-
-QDF_STATUS
-wmi_extract_atf_token_info_ev(void *wmi_hdl, void *evt_buf, uint8_t idx,
-			      wmi_host_atf_peer_stats_info *atf_token_info);
-#endif
-
 /* Extract APIs */
 
-QDF_STATUS wmi_extract_wds_addr_event(void *wmi_hdl,
-		void *evt_buf, uint16_t len, wds_addr_event_t *wds_ev);
-
-QDF_STATUS wmi_extract_dcs_interference_type(void *wmi_hdl,
-		void *evt_buf, struct wmi_host_dcs_interference_param *param);
-
-QDF_STATUS wmi_extract_dcs_cw_int(void *wmi_hdl, void *evt_buf,
-		wmi_host_ath_dcs_cw_int *cw_int);
-
-QDF_STATUS wmi_extract_dcs_im_tgt_stats(void *wmi_hdl, void *evt_buf,
-		wmi_host_dcs_im_tgt_stats_t *wlan_stat);
-
 QDF_STATUS wmi_extract_fips_event_data(void *wmi_hdl, void *evt_buf,
 		struct wmi_host_fips_event_param *param);
 
-QDF_STATUS wmi_extract_vdev_start_resp(void *wmi_hdl, void *evt_buf,
-		wmi_host_vdev_start_resp *vdev_rsp);
-
-/**
- * wmi_extract_vdev_delete_resp - api to extract vdev delete
- * response event params
- * @wmi_handle: wma handle
- * @evt_buf: pointer to event buffer
- * @delele_rsp: pointer to hold delete response from firmware
- *
- * Return: QDF_STATUS_SUCCESS for successful event parse
- *         else QDF_STATUS_E_INVAL or QDF_STATUS_E_FAILURE
- */
-QDF_STATUS wmi_extract_vdev_delete_resp(void *wmi_hdl, void *evt_buf,
-		struct wmi_host_vdev_delete_resp *delele_rsp);
-
-QDF_STATUS wmi_extract_tbttoffset_update_params(void *wmi_hdl, void *evt_buf,
-		uint8_t idx, struct tbttoffset_params *tbtt_param);
-
-QDF_STATUS wmi_extract_ext_tbttoffset_update_params(void *wmi_hdl,
-		void *evt_buf, uint8_t idx,
-		struct tbttoffset_params *tbtt_param);
-
-QDF_STATUS wmi_extract_tbttoffset_num_vdevs(void *wmi_hdl, void *evt_buf,
-					    uint32_t *num_vdevs);
-
-QDF_STATUS wmi_extract_ext_tbttoffset_num_vdevs(void *wmi_hdl, void *evt_buf,
-						uint32_t *num_vdevs);
-
 QDF_STATUS wmi_extract_mgmt_rx_params(void *wmi_hdl, void *evt_buf,
 		struct mgmt_rx_event_params *hdr, uint8_t **bufp);
 
-QDF_STATUS wmi_extract_vdev_stopped_param(void *wmi_hdl, void *evt_buf,
-		uint32_t *vdev_id);
-
 QDF_STATUS wmi_extract_vdev_roam_param(void *wmi_hdl, void *evt_buf,
 		wmi_host_roam_event *ev);
 
@@ -1628,47 +1475,16 @@ QDF_STATUS
 wmi_extract_esp_estimate_ev_param(void *wmi_hdl, void *evt_buf,
 				  struct esp_estimation_event *param);
 
-QDF_STATUS wmi_extract_pdev_caldata_version_check_ev_param(void *wmi_hdl,
-		void *evt_buf, wmi_host_pdev_check_cal_version_event *param);
-
-QDF_STATUS wmi_extract_pdev_tpc_config_ev_param(void *wmi_hdl, void *evt_buf,
-		wmi_host_pdev_tpc_config_event *param);
-
 QDF_STATUS wmi_extract_gpio_input_ev_param(void *wmi_hdl,
 		void *evt_buf, uint32_t *gpio_num);
 
 QDF_STATUS wmi_extract_pdev_reserve_ast_ev_param(void *wmi_hdl,
 		void *evt_buf, struct wmi_host_proxy_ast_reserve_param *param);
 
-QDF_STATUS wmi_extract_nfcal_power_ev_param(void *wmi_hdl, void *evt_buf,
-		wmi_host_pdev_nfcal_power_all_channels_event *param);
-
-QDF_STATUS wmi_extract_pdev_tpc_ev_param(void *wmi_hdl, void *evt_buf,
-		wmi_host_pdev_tpc_event *param);
-
 QDF_STATUS wmi_extract_pdev_generic_buffer_ev_param(void *wmi_hdl,
 		void *evt_buf,
 		wmi_host_pdev_generic_buffer_event *param);
 
-QDF_STATUS wmi_extract_mgmt_tx_compl_param(void *wmi_hdl, void *evt_buf,
-		wmi_host_mgmt_tx_compl_event *param);
-
-QDF_STATUS wmi_extract_offchan_data_tx_compl_param(void *wmi_hdl, void *evt_buf,
-		struct wmi_host_offchan_data_tx_compl_event *param);
-
-QDF_STATUS wmi_extract_pdev_csa_switch_count_status(void *wmi_hdl,
-		void *evt_buf,
-		struct pdev_csa_switch_count_status *param);
-
-QDF_STATUS wmi_extract_swba_num_vdevs(void *wmi_hdl, void *evt_buf,
-		uint32_t *num_vdevs);
-
-QDF_STATUS wmi_extract_swba_tim_info(void *wmi_hdl, void *evt_buf,
-		 uint32_t idx, wmi_host_tim_info *tim_info);
-
-QDF_STATUS wmi_extract_swba_noa_info(void *wmi_hdl, void *evt_buf,
-			uint32_t idx, wmi_host_p2p_noa_info *p2p_desc);
-
 #ifdef CONVERGED_P2P_ENABLE
 QDF_STATUS wmi_extract_p2p_lo_stop_ev_param(void *wmi_hdl,
 		void *evt_buf, struct p2p_lo_event *param);
@@ -1677,12 +1493,6 @@ QDF_STATUS wmi_extract_p2p_noa_ev_param(void *wmi_hdl,
 		void *evt_buf, struct p2p_noa_info *param);
 #endif
 
-QDF_STATUS wmi_extract_peer_sta_ps_statechange_ev(void *wmi_hdl,
-		void *evt_buf, wmi_host_peer_sta_ps_statechange_event *ev);
-
-QDF_STATUS wmi_extract_peer_sta_kickout_ev(void *wmi_hdl, void *evt_buf,
-		wmi_host_peer_sta_kickout_event *ev);
-
 QDF_STATUS wmi_extract_peer_ratecode_list_ev(void *wmi_hdl, void *evt_buf,
 		uint8_t *peer_mac, wmi_sa_rate_cap *rate_cap);
 
@@ -1725,12 +1535,6 @@ QDF_STATUS wmi_extract_profile_ctx(void *wmi_hdl, void *evt_buf,
 QDF_STATUS wmi_extract_profile_data(void *wmi_hdl, void *evt_buf, uint8_t idx,
 			wmi_host_wlan_profile_t *profile_data);
 
-QDF_STATUS wmi_extract_chan_info_event(void *wmi_hdl, void *evt_buf,
-			wmi_host_chan_info_event *chan_info);
-
-QDF_STATUS wmi_extract_channel_hopping_event(void *wmi_hdl, void *evt_buf,
-			wmi_host_pdev_channel_hopping_event *ch_hopping);
-
 QDF_STATUS wmi_extract_stats_param(void *wmi_hdl, void *evt_buf,
 					   wmi_host_stats_event *stats_param);
 
@@ -1752,9 +1556,6 @@ QDF_STATUS wmi_extract_peer_extd_stats(void *wmi_hdl, void *evt_buf,
 QDF_STATUS wmi_extract_bss_chan_info_event(void *wmi_hdl, void *evt_buf,
 			wmi_host_pdev_bss_chan_info_event *bss_chan_info);
 
-QDF_STATUS wmi_extract_inst_rssi_stats_event(void *wmi_hdl, void *evt_buf,
-			wmi_host_inst_stats_resp *inst_rssi_resp);
-
 QDF_STATUS wmi_extract_peer_stats(void *wmi_hdl, void *evt_buf,
 		uint32_t index, wmi_host_peer_stats *peer_stats);
 
@@ -1787,9 +1588,6 @@ QDF_STATUS wmi_extract_vdev_nac_rssi_stats(void *wmi_hdl, void *evt_buf,
 QDF_STATUS wmi_unified_send_power_dbg_cmd(void *wmi_hdl,
 				struct wmi_power_dbg_params *param);
 
-QDF_STATUS wmi_unified_send_multiple_vdev_restart_req_cmd(void *wmi_hdl,
-				struct multiple_vdev_restart_params *param);
-
 /**
  * wmi_unified_send_sar_limit_cmd() - send sar limit cmd to fw
  * @wmi_hdl: wmi handle
@@ -1890,50 +1688,6 @@ QDF_STATUS wmi_extract_dbr_ring_cap_service_ready_ext(
 			uint8_t *evt_buf, uint8_t idx,
 			struct wlan_psoc_host_dbr_ring_caps *param);
 
-/**
- * wmi_extract_dbr_buf_release_fixed : Extract direct buffer rx fixed param
- *                                     from buffer release event
- * @wmi_hdl: WMI handle
- * @evt_buf: Event buffer
- * @param: Pointer to direct buffer rx response struct
- *
- * Return: QDF status of operation
- */
-QDF_STATUS wmi_extract_dbr_buf_release_fixed(
-			void *wmi_hdl,
-			uint8_t *evt_buf,
-			struct direct_buf_rx_rsp *param);
-
-/**
- * wmi_extract_dbr_buf_release_entry: Extract direct buffer rx buffer tlv
- *
- * @wmi_hdl: WMI handle
- * @evt_buf: Event buffer
- * @idx: Index of the module for which capability is received
- * @param: Pointer to direct buffer rx entry
- *
- * Return: QDF status of operation
- */
-QDF_STATUS wmi_extract_dbr_buf_release_entry(
-			void *wmi_hdl,
-			uint8_t *evt_buf, uint8_t idx,
-			struct direct_buf_rx_entry *param);
-
-/**
- * wmi_extract_dbr_buf_metadata: Extract direct buffer metadata
- *
- * @wmi_hdl: WMI handle
- * @evt_buf: Event buffer
- * @idx: Index of the module for which capability is received
- * @param: Pointer to direct buffer metadata
- *
- * Return: QDF status of operation
- */
-QDF_STATUS wmi_extract_dbr_buf_metadata(
-			void *wmi_hdl,
-			uint8_t *evt_buf, uint8_t idx,
-			struct direct_buf_rx_metadata *param);
-
 QDF_STATUS wmi_extract_pdev_utf_event(void *wmi_hdl,
 				      uint8_t *evt_buf,
 				      struct wmi_host_pdev_utf_event *param);
@@ -1942,10 +1696,6 @@ QDF_STATUS wmi_extract_pdev_qvit_event(void *wmi_hdl,
 				      uint8_t *evt_buf,
 				      struct wmi_host_pdev_qvit_event *param);
 
-QDF_STATUS wmi_extract_peer_delete_response_event(void *wmi_hdl,
-		uint8_t *evt_buf,
-		struct wmi_host_peer_delete_response_event *param);
-
 QDF_STATUS wmi_extract_chainmask_tables(void *wmi_hdl, uint8_t *evt_buf,
 		struct wlan_psoc_host_chainmask_table *chainmask_table);
 /**
@@ -2062,15 +1812,6 @@ QDF_STATUS wmi_unified_set_arp_stats_req(void *wmi_hdl,
 QDF_STATUS wmi_unified_get_arp_stats_req(void *wmi_hdl,
 					 struct get_arp_stats *req_buf);
 
-/**
- * wmi_send_bcn_offload_control_cmd - send beacon ofload control cmd to fw
- * @wmi_hdl: wmi handle
- * @bcn_ctrl_param: pointer to bcn_offload_control param
- *
- * Return: QDF_STATUS_SUCCESS for success or error code
- */
-QDF_STATUS wmi_send_bcn_offload_control_cmd(void *wmi_hdl,
-			struct bcn_offload_control *bcn_ctrl_param);
 /**
  * wmi_unified_send_wds_entry_list_cmd() - WMI function to get list of
  *  wds entries from FW
@@ -2298,40 +2039,6 @@ QDF_STATUS wmi_extract_green_ap_egap_status_info(
 		struct wlan_green_ap_egap_status_info *egap_status_info_params);
 #endif
 
-#ifdef WLAN_SUPPORT_FILS
-/**
- * wmi_unified_fils_vdev_config_send_cmd() - send FILS config cmd to fw
- * @wmi_hdl: wmi handle
- * @param:   fils config params
- *
- * Return: QDF_STATUS_SUCCESS for success or error code
- */
-QDF_STATUS
-wmi_unified_fils_vdev_config_send_cmd(void *wmi_hdl,
-				      struct config_fils_params *param);
-
-/**
- * wmi_extract_swfda_vdev_id() - api to extract vdev id
- * @wmi_hdl: wmi handle
- * @evt_buf: pointer to event buffer
- * @vdev_id: pointer to vdev id
- *
- * Return: QDF_STATUS_SUCCESS for success or error code
- */
-QDF_STATUS wmi_extract_swfda_vdev_id(void *wmi_hdl, void *evt_buf,
-				     uint32_t *vdev_id);
-
-/**
- * wmi_unified_fils_discovery_send_cmd() - send FILS discovery cmd to fw
- * @wmi_hdl: wmi handle
- * @param:   fils discovery params
- *
- * Return: QDF_STATUS_SUCCESS for success or error code
- */
-QDF_STATUS wmi_unified_fils_discovery_send_cmd(void *wmi_hdl,
-					       struct fd_params *param);
-#endif /* WLAN_SUPPORT_FILS */
-
 /**
  * wmi_unified_send_roam_scan_stats_cmd() - Wrapper to request roam scan stats
  * @wmi_hdl: wmi handle

+ 58 - 0
wmi_unified_atf_api.h

@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file contains the API definitions for ATF
+ */
+
+#ifndef _WMI_UNIFIED_ATF_API_H_
+#define _WMI_UNIFIED_ATF_API_H_
+
+#include "wmi_unified_atf_param.h"
+
+QDF_STATUS wmi_unified_set_bwf_cmd_send(void *wmi_hdl,
+				struct set_bwf_params *param);
+
+#ifdef WLAN_ATF_ENABLE
+QDF_STATUS
+wmi_unified_set_atf_cmd_send(void *wmi_hdl,
+			     struct set_atf_params *param);
+
+QDF_STATUS
+wmi_send_atf_peer_request_cmd(void *wmi_hdl,
+			      struct atf_peer_request_params *param);
+
+QDF_STATUS
+wmi_send_set_atf_grouping_cmd(void *wmi_hdl,
+			      struct atf_grouping_params *param);
+
+QDF_STATUS
+wmi_send_set_atf_group_ac_cmd(void *wmi_hdl,
+			      struct atf_group_ac_params *param);
+
+QDF_STATUS
+wmi_extract_atf_peer_stats_ev(void *wmi_hdl, void *evt_buf,
+			      wmi_host_atf_peer_stats_event *ev);
+
+QDF_STATUS
+wmi_extract_atf_token_info_ev(void *wmi_hdl, void *evt_buf, uint8_t idx,
+			      wmi_host_atf_peer_stats_info *atf_token_info);
+#endif
+
+void wmi_atf_attach_tlv(struct wmi_unified *wmi_handle);
+#endif /* _WMI_UNIFIED_ATF_API_H_ */

+ 220 - 0
wmi_unified_atf_param.h

@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/*
+ * This file contains the API definitions for the Unified Wireless Module
+ * Interface (WMI).
+ */
+
+#ifndef _WMI_UNIFIED_ATF_PARAM_H_
+#define _WMI_UNIFIED_ATF_PARAM_H_
+
+#define ATF_ACTIVED_MAX_CLIENTS   50
+#define ATF_ACTIVED_MAX_ATFGROUPS 16
+
+/**
+ * struct atf_peer_info - ATF peer info params
+ * @peer_macaddr: peer mac addr
+ * @percentage_peer: percentage of air time for this peer
+ * @vdev_id: Associated vdev id
+ * @pdev_id: Associated pdev id
+ */
+typedef struct {
+	struct wmi_macaddr_t peer_macaddr;
+	uint32_t percentage_peer;
+	uint32_t vdev_id;
+	uint32_t pdev_id;
+} atf_peer_info;
+
+/**
+ * struct bwf_peer_info_t - BWF peer info params
+ * @peer_macaddr: peer mac addr
+ * @throughput: Throughput
+ * @max_airtime: Max airtime
+ * @priority: Priority level
+ * @reserved: Reserved array
+ * @vdev_id: Associated vdev id
+ * @pdev_id: Associated pdev id
+ */
+typedef struct {
+	struct wmi_macaddr_t peer_macaddr;
+	uint32_t     throughput;
+	uint32_t     max_airtime;
+	uint32_t     priority;
+	uint32_t     reserved[4];
+	uint32_t     vdev_id;
+	uint32_t     pdev_id;
+} bwf_peer_info;
+
+/**
+ * struct set_bwf_params - BWF params
+ * @num_peers: number of peers
+ * @atf_peer_info: BWF peer info
+ */
+struct set_bwf_params {
+	uint32_t num_peers;
+	bwf_peer_info peer_info[1];
+};
+
+/**
+ * struct atf_peer_ext_info - ATF peer ext info params
+ * @peer_macaddr: peer mac address
+ * @group_index: group index
+ * @atf_index_reserved: ATF index rsvd
+ * @vdev_id: Associated vdev id
+ * @pdev_id: Associated pdev id
+ */
+typedef struct {
+	struct wmi_macaddr_t peer_macaddr;
+	uint32_t group_index;
+	uint32_t atf_index_reserved;
+	uint16_t vdev_id;
+	uint16_t pdev_id;
+} atf_peer_ext_info;
+
+/**
+ * struct set_atf_params - ATF params
+ * @num_peers: number of peers
+ * @atf_peer_info: ATF peer info
+ */
+struct set_atf_params {
+	uint32_t num_peers;
+	atf_peer_info peer_info[ATF_ACTIVED_MAX_CLIENTS];
+};
+
+/**
+ * struct atf_peer_request_params - ATF peer req params
+ * @num_peers: number of peers
+ * @atf_peer_ext_info: ATF peer ext info
+ */
+struct atf_peer_request_params {
+	uint32_t num_peers;
+	atf_peer_ext_info peer_ext_info[ATF_ACTIVED_MAX_CLIENTS];
+};
+
+/**
+ * struct atf_group_info - ATF group info params
+ * @percentage_group: Percentage AT for group
+ * @atf_group_units_reserved: ATF group information
+ * @pdev_id: Associated pdev id
+ */
+typedef struct {
+	uint32_t percentage_group;
+	uint32_t atf_group_units_reserved;
+	uint32_t pdev_id;
+} atf_group_info;
+
+/**
+ * struct atf_grouping_params - ATF grouping params
+ * @num_groups: number of groups
+ * @group_inf: Group informaition
+ */
+struct atf_grouping_params {
+	uint32_t num_groups;
+	atf_group_info group_info[ATF_ACTIVED_MAX_ATFGROUPS];
+};
+
+/**
+ * struct atf_group_wmm_ac_info - ATF group AC info params
+ * @atf_config_ac_be: Relative ATF% for BE traffic
+ * @atf_config_ac_bk: Relative ATF% for BK traffic
+ * @atf_config_ac_vi: Relative ATF% for VI traffic
+ * @atf_config_ac_vo: Relative ATF% for VO traffic
+ * @reserved: Reserved for future use
+ */
+struct atf_group_wmm_ac_info {
+	uint32_t  atf_config_ac_be;
+	uint32_t  atf_config_ac_bk;
+	uint32_t  atf_config_ac_vi;
+	uint32_t  atf_config_ac_vo;
+	uint32_t reserved[2];
+};
+
+/**
+ * struct atf_grp_ac_params - ATF group AC config params
+ * @num_groups: number of groups
+ * @group_inf: Group informaition
+ */
+struct atf_group_ac_params {
+	uint32_t num_groups;
+	struct atf_group_wmm_ac_info group_info[ATF_ACTIVED_MAX_ATFGROUPS];
+};
+
+enum {
+	WMI_HOST_ATF_PEER_STATS_DISABLED = 0,
+	WMI_HOST_ATF_PEER_STATS_ENABLED  = 1,
+};
+
+#define WMI_HOST_ATF_PEER_STATS_GET_PEER_AST_IDX(token_info) \
+	(token_info.field1 & 0xffff)
+
+#define WMI_HOST_ATF_PEER_STATS_GET_USED_TOKENS(token_info) \
+	((token_info.field2 & 0xffff0000) >> 16)
+
+#define WMI_HOST_ATF_PEER_STATS_GET_UNUSED_TOKENS(token_info) \
+	(token_info.field2 & 0xffff)
+
+#define WMI_HOST_ATF_PEER_STATS_SET_PEER_AST_IDX(token_info, peer_ast_idx) \
+	do { \
+		token_info.field1 &= 0xffff0000; \
+		token_info.field1 |= ((peer_ast_idx) & 0xffff); \
+	} while (0)
+
+#define WMI_HOST_ATF_PEER_STATS_SET_USED_TOKENS(token_info, used_token) \
+	do { \
+		token_info.field2 &= 0x0000ffff; \
+		token_info.field2 |= (((used_token) & 0xffff) << 16); \
+	} while (0)
+
+#define WMI_HOST_ATF_PEER_STATS_SET_UNUSED_TOKENS(token_info, unused_token) \
+	do { \
+		token_info.field2 &= 0xffff0000; \
+		token_info.field2 |= ((unused_token) & 0xffff); \
+	} while (0)
+
+/**
+ * struct wmi_host_atf_peer_stats_info
+ * @field1: bits 15:0   peer_ast_index  WMI_ATF_PEER_STATS_GET_PEER_AST_IDX
+ *          bits 31:16  reserved
+ * @field2: bits 15:0   used tokens     WMI_ATF_PEER_STATS_GET_USED_TOKENS
+ *          bits 31:16  unused tokens   WMI_ATF_PEER_STATS_GET_UNUSED_TOKENS
+ * @field3: for future use
+ */
+typedef struct {
+	uint32_t    field1;
+	uint32_t    field2;
+	uint32_t    field3;
+} wmi_host_atf_peer_stats_info;
+
+/**
+ * struct wmi_host_atf_peer_stats_event
+ * @pdev_id: pdev_id
+ * @num_atf_peers: number of peers in token_info_list
+ * @comp_usable_airtime: computed usable airtime in tokens
+ * @reserved[4]: reserved for future use
+ * @wmi_host_atf_peer_stats_info token_info_list: list of num_atf_peers
+ */
+typedef struct {
+	uint32_t pdev_id;
+	uint32_t num_atf_peers;
+	uint32_t comp_usable_airtime;
+	uint32_t reserved[4];
+	wmi_host_atf_peer_stats_info token_info_list[1];
+} wmi_host_atf_peer_stats_event;
+
+#endif /* _WMI_UNIFIED_ATF_PARAM_H_ */

+ 85 - 0
wmi_unified_dbr_api.h

@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: Implement API's specific to DBR component.
+ */
+
+#ifndef _WMI_UNIFIED_DBR_API_H_
+#define _WMI_UNIFIED_DBR_API_H_
+
+#include "wmi_unified_dbr_param.h"
+
+/* Opaque handle of WMI structure */
+struct wmi_unified;
+typedef struct wmi_unified *wmi_unified_t;
+
+/**
+ * wmi_unified_dbr_ring_cfg: Configure direct buffer rx rings
+ * @wmi_hdl: WMI handle
+ * @cfg: pointer to direct buffer rx config request
+ *
+ * Return: QDF status of operation
+ */
+QDF_STATUS wmi_unified_dbr_ring_cfg(void *wmi_hdl,
+				struct direct_buf_rx_cfg_req *cfg);
+
+/**
+ * wmi_extract_dbr_buf_release_fixed : Extract direct buffer rx fixed param
+ *				     from buffer release event
+ * @wmi_hdl: WMI handle
+ * @evt_buf: Event buffer
+ * @param: Pointer to direct buffer rx response struct
+ *
+ * Return: QDF status of operation
+ */
+QDF_STATUS wmi_extract_dbr_buf_release_fixed(
+			void *wmi_hdl,
+			uint8_t *evt_buf,
+			struct direct_buf_rx_rsp *param);
+
+/**
+ * wmi_extract_dbr_buf_release_entry: Extract direct buffer rx buffer tlv
+ *
+ * @wmi_hdl: WMI handle
+ * @evt_buf: Event buffer
+ * @idx: Index of the module for which capability is received
+ * @param: Pointer to direct buffer rx entry
+ *
+ * Return: QDF status of operation
+ */
+QDF_STATUS wmi_extract_dbr_buf_release_entry(
+			void *wmi_hdl,
+			uint8_t *evt_buf, uint8_t idx,
+			struct direct_buf_rx_entry *param);
+
+/**
+ * wmi_extract_dbr_buf_metadata: Extract direct buffer metadata
+ *
+ * @wmi_hdl: WMI handle
+ * @evt_buf: Event buffer
+ * @idx: Index of the module for which capability is received
+ * @param: Pointer to direct buffer metadata
+ *
+ * Return: QDF status of operation
+ */
+QDF_STATUS wmi_extract_dbr_buf_metadata(
+			void *wmi_hdl,
+			uint8_t *evt_buf, uint8_t idx,
+			struct direct_buf_rx_metadata *param);
+
+#endif /* _WMI_UNIFIED_DBR_API_H_ */

+ 131 - 0
wmi_unified_dbr_param.h

@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _WMI_UNIFIED_DBR_PARAM_H_
+#define _WMI_UNIFIED_DBR_PARAM_H_
+
+#define WMI_HOST_DBR_RING_ADDR_LO_S 0
+#define WMI_HOST_DBR_RING_ADDR_LO 0xffffffff
+
+#define WMI_HOST_DBR_RING_ADDR_LO_GET(dword) \
+			WMI_HOST_F_MS(dword, WMI_HOST_DBR_RING_ADDR_LO)
+#define WMI_HOST_DBR_RING_ADDR_LO_SET(dword, val) \
+			WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_RING_ADDR_LO)
+
+#define WMI_HOST_DBR_RING_ADDR_HI_S 0
+#define WMI_HOST_DBR_RING_ADDR_HI 0xf
+
+#define WMI_HOST_DBR_RING_ADDR_HI_GET(dword) \
+			WMI_HOST_F_MS(dword, WMI_HOST_DBR_RING_ADDR_HI)
+#define WMI_HOST_DBR_RING_ADDR_HI_SET(dword, val) \
+			WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_RING_ADDR_HI)
+
+#define WMI_HOST_DBR_DATA_ADDR_LO_S 0
+#define WMI_HOST_DBR_DATA_ADDR_LO 0xffffffff
+
+#define WMI_HOST_DBR_DATA_ADDR_LO_GET(dword) \
+			WMI_HOST_F_MS(dword, WMI_HOST_DBR_DATA_ADDR_LO)
+#define WMI_HOST_DBR_DATA_ADDR_LO_SET(dword, val) \
+			WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_DATA_ADDR_LO)
+
+#define WMI_HOST_DBR_DATA_ADDR_HI_S 0
+#define WMI_HOST_DBR_DATA_ADDR_HI 0xf
+
+#define WMI_HOST_DBR_DATA_ADDR_HI_GET(dword) \
+			WMI_HOST_F_MS(dword, WMI_HOST_DBR_DATA_ADDR_HI)
+#define WMI_HOST_DBR_DATA_ADDR_HI_SET(dword, val) \
+			WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_DATA_ADDR_HI)
+
+#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_S 12
+#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA 0x7fffff
+
+#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_GET(dword) \
+		WMI_HOST_F_MS(dword, WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA)
+#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_SET(dword, val) \
+		WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA)
+
+#define WMI_HOST_MAX_NUM_CHAINS 8
+
+/**
+ * struct direct_buf_rx_rsp: direct buffer rx response structure
+ *
+ * @pdev_id: Index of the pdev for which response is received
+ * @mod_mod: Index of the module for which respone is received
+ * @num_buf_release_entry: Number of buffers released through event
+ * @dbr_entries: Pointer to direct buffer rx entry struct
+ */
+struct direct_buf_rx_rsp {
+	uint32_t pdev_id;
+	uint32_t mod_id;
+	uint32_t num_buf_release_entry;
+	uint32_t num_meta_data_entry;
+	struct direct_buf_rx_entry *dbr_entries;
+};
+
+/**
+ * struct direct_buf_rx_cfg_req: direct buffer rx config request structure
+ *
+ * @pdev_id: Index of the pdev for which response is received
+ * @mod_id: Index of the module for which respone is received
+ * @base_paddr_lo: Lower 32bits of ring base address
+ * @base_paddr_hi: Higher 32bits of ring base address
+ * @head_idx_paddr_lo: Lower 32bits of head idx register address
+ * @head_idx_paddr_hi: Higher 32bits of head idx register address
+ * @tail_idx_paddr_lo: Lower 32bits of tail idx register address
+ * @tail_idx_paddr_hi: Higher 32bits of tail idx register address
+ * @buf_size: Size of the buffer for each pointer in the ring
+ * @num_elems: Number of pointers allocated and part of the source ring
+ */
+struct direct_buf_rx_cfg_req {
+	uint32_t pdev_id;
+	uint32_t mod_id;
+	uint32_t base_paddr_lo;
+	uint32_t base_paddr_hi;
+	uint32_t head_idx_paddr_lo;
+	uint32_t head_idx_paddr_hi;
+	uint32_t tail_idx_paddr_hi;
+	uint32_t tail_idx_paddr_lo;
+	uint32_t buf_size;
+	uint32_t num_elems;
+	uint32_t event_timeout_ms;
+	uint32_t num_resp_per_event;
+};
+
+/**
+ * struct direct_buf_rx_metadata: direct buffer metadata
+ *
+ * @noisefloor: noisefloor
+ */
+struct direct_buf_rx_metadata {
+	int32_t noisefloor[WMI_HOST_MAX_NUM_CHAINS];
+};
+
+/**
+ * struct direct_buf_rx_entry: direct buffer rx release entry structure
+ *
+ * @addr_lo: LSB 32-bits of the buffer
+ * @addr_hi: MSB 32-bits of the buffer
+ * @len: Length of the buffer
+ */
+struct direct_buf_rx_entry {
+	uint32_t paddr_lo;
+	uint32_t paddr_hi;
+	uint32_t len;
+};
+
+#endif /* _WMI_UNIFIED_DBR_PARAM_H_ */

+ 0 - 371
wmi_unified_param.h

@@ -3914,68 +3914,6 @@ struct thermal_mitigation_params {
 	tt_level_config levelconf[THERMAL_LEVELS];
 };
 
-/**
- * struct smart_ant_enable_params - Smart antenna params
- * @enable: Enable/Disable
- * @mode: SA mode
- * @rx_antenna: RX antenna config
- * @gpio_pin : GPIO pin config
- * @gpio_func : GPIO function config
- */
-struct smart_ant_enable_params {
-	uint32_t enable;
-	uint32_t mode;
-	uint32_t rx_antenna;
-	uint32_t gpio_pin[WMI_HAL_MAX_SANTENNA];
-	uint32_t gpio_func[WMI_HAL_MAX_SANTENNA];
-	uint32_t pdev_id;
-};
-
-/**
- * struct smart_ant_rx_ant_params - RX antenna params
- * @antenna: RX antenna
- */
-struct smart_ant_rx_ant_params {
-	uint32_t antenna;
-	uint32_t pdev_id;
-};
-
-/**
- * struct smart_ant_tx_ant_params - TX antenna param
- * @antenna_array: Antenna arry
- * @vdev_id: VDEV id
- */
-struct smart_ant_tx_ant_params {
-	uint32_t *antenna_array;
-	uint8_t vdev_id;
-};
-
-/**
- * struct smart_ant_training_info_params - SA training params
- * @vdev_id: VDEV id
- * @rate_array: Rates array
- * @antenna_array: Antenna array
- * @numpkts: num packets for training
- */
-struct smart_ant_training_info_params {
-	uint8_t vdev_id;
-	uint32_t *rate_array;
-	uint32_t *antenna_array;
-	uint32_t numpkts;
-};
-
-/**
- * struct smart_ant_node_config_params - SA node config params
- * @vdev_id: VDEV id
- * @cmd_id: Command id
- * @args_count: Arguments count
- */
-struct smart_ant_node_config_params {
-	uint8_t vdev_id;
-	uint32_t cmd_id;
-	uint16_t args_count;
-	uint32_t *args_arr;
-};
 /**
  * struct smart_ant_enable_tx_feedback_params - SA tx feeback params
  * @enable: Enable TX feedback for SA
@@ -4226,134 +4164,6 @@ struct wmi_macaddr_t {
 	uint32_t mac_addr47to32;
 };
 
-/**
- * struct atf_peer_info - ATF peer info params
- * @peer_macaddr: peer mac addr
- * @percentage_peer: percentage of air time for this peer
- * @vdev_id: Associated vdev id
- * @pdev_id: Associated pdev id
- */
-typedef struct {
-	struct wmi_macaddr_t peer_macaddr;
-	uint32_t percentage_peer;
-	uint32_t vdev_id;
-	uint32_t pdev_id;
-} atf_peer_info;
-
-/**
- * struct bwf_peer_info_t - BWF peer info params
- * @peer_macaddr: peer mac addr
- * @throughput: Throughput
- * @max_airtime: Max airtime
- * @priority: Priority level
- * @reserved: Reserved array
- * @vdev_id: Associated vdev id
- * @pdev_id: Associated pdev id
- */
-typedef struct {
-	struct wmi_macaddr_t peer_macaddr;
-	uint32_t     throughput;
-	uint32_t     max_airtime;
-	uint32_t     priority;
-	uint32_t     reserved[4];
-	uint32_t     vdev_id;
-	uint32_t     pdev_id;
-} bwf_peer_info;
-
-/**
- * struct set_bwf_params - BWF params
- * @num_peers: number of peers
- * @atf_peer_info: BWF peer info
- */
-struct set_bwf_params {
-	uint32_t num_peers;
-	bwf_peer_info peer_info[1];
-};
-
-/**
- * struct atf_peer_ext_info - ATF peer ext info params
- * @peer_macaddr: peer mac address
- * @group_index: group index
- * @atf_index_reserved: ATF index rsvd
- * @vdev_id: Associated vdev id
- * @pdev_id: Associated pdev id
- */
-typedef struct {
-	struct wmi_macaddr_t peer_macaddr;
-	uint32_t group_index;
-	uint32_t atf_index_reserved;
-	uint16_t vdev_id;
-	uint16_t pdev_id;
-} atf_peer_ext_info;
-
-/**
- * struct set_atf_params - ATF params
- * @num_peers: number of peers
- * @atf_peer_info: ATF peer info
- */
-struct set_atf_params {
-	uint32_t num_peers;
-	atf_peer_info peer_info[ATF_ACTIVED_MAX_CLIENTS];
-};
-
-/**
- * struct atf_peer_request_params - ATF peer req params
- * @num_peers: number of peers
- * @atf_peer_ext_info: ATF peer ext info
- */
-struct atf_peer_request_params {
-	uint32_t num_peers;
-	atf_peer_ext_info peer_ext_info[ATF_ACTIVED_MAX_CLIENTS];
-};
-
-/**
- * struct atf_group_info - ATF group info params
- * @percentage_group: Percentage AT for group
- * @atf_group_units_reserved: ATF group information
- * @pdev_id: Associated pdev id
- */
-typedef struct {
-	uint32_t percentage_group;
-	uint32_t atf_group_units_reserved;
-	uint32_t pdev_id;
-} atf_group_info;
-
-/**
- * struct atf_grouping_params - ATF grouping params
- * @num_groups: number of groups
- * @group_inf: Group informaition
- */
-struct atf_grouping_params {
-	uint32_t num_groups;
-	atf_group_info group_info[ATF_ACTIVED_MAX_ATFGROUPS];
-};
-
-/**
- * struct atf_group_wmm_ac_info - ATF group AC info params
- * @atf_config_ac_be: Relative ATF% for BE traffic
- * @atf_config_ac_bk: Relative ATF% for BK traffic
- * @atf_config_ac_vi: Relative ATF% for VI traffic
- * @atf_config_ac_vo: Relative ATF% for VO traffic
- * @reserved: Reserved for future use
- */
-struct atf_group_wmm_ac_info {
-	uint32_t  atf_config_ac_be;
-	uint32_t  atf_config_ac_bk;
-	uint32_t  atf_config_ac_vi;
-	uint32_t  atf_config_ac_vo;
-	uint32_t reserved[2];
-};
-
-/**
- * struct atf_grp_ac_params - ATF group AC config params
- * @num_groups: number of groups
- * @group_inf: Group informaition
- */
-struct atf_group_ac_params {
-	uint32_t num_groups;
-	struct atf_group_wmm_ac_info group_info[ATF_ACTIVED_MAX_ATFGROUPS];
-};
-
 /**
  * struct wlan_profile_params - WLAN profile params
  * @param_id: param id
@@ -4439,18 +4249,6 @@ struct wmi_host_wme_vparams {
 	u_int32_t	noackpolicy;
 };
 
-/**
- * struct ant_switch_tbl_params - Antenna switch table params
- * @ant_ctrl_common1: ANtenna control common param 1
- * @ant_ctrl_common2: Antenna control commn param 2
- */
-struct ant_switch_tbl_params {
-	uint32_t ant_ctrl_common1;
-	uint32_t ant_ctrl_common2;
-	uint32_t pdev_id;
-	uint32_t antCtrlChain;
-};
-
 /**
  * struct ratepwr_table_params - Rate power table params
  * @ratepwr_tbl: pointer to rate power table
@@ -7558,68 +7356,6 @@ typedef struct {
 	uint32_t wmm_ac;
 } wmi_host_tx_data_traffic_ctrl_event;
 
-enum {
-	WMI_HOST_ATF_PEER_STATS_DISABLED = 0,
-	WMI_HOST_ATF_PEER_STATS_ENABLED  = 1,
-};
-
-#define WMI_HOST_ATF_PEER_STATS_GET_PEER_AST_IDX(token_info) \
-	(token_info.field1 & 0xffff)
-
-#define WMI_HOST_ATF_PEER_STATS_GET_USED_TOKENS(token_info) \
-	((token_info.field2 & 0xffff0000) >> 16)
-
-#define WMI_HOST_ATF_PEER_STATS_GET_UNUSED_TOKENS(token_info) \
-	(token_info.field2 & 0xffff)
-
-#define WMI_HOST_ATF_PEER_STATS_SET_PEER_AST_IDX(token_info, peer_ast_idx) \
-	do { \
-		token_info.field1 &= 0xffff0000; \
-		token_info.field1 |= ((peer_ast_idx) & 0xffff); \
-	} while (0)
-
-#define WMI_HOST_ATF_PEER_STATS_SET_USED_TOKENS(token_info, used_token) \
-	do { \
-		token_info.field2 &= 0x0000ffff; \
-		token_info.field2 |= (((used_token) & 0xffff) << 16); \
-	} while (0)
-
-#define WMI_HOST_ATF_PEER_STATS_SET_UNUSED_TOKENS(token_info, unused_token) \
-	do { \
-		token_info.field2 &= 0xffff0000; \
-		token_info.field2 |= ((unused_token) & 0xffff); \
-	} while (0)
-
-/**
- * struct wmi_host_atf_peer_stats_info
- * @field1: bits 15:0   peer_ast_index  WMI_ATF_PEER_STATS_GET_PEER_AST_IDX
- *          bits 31:16  reserved
- * @field2: bits 15:0   used tokens     WMI_ATF_PEER_STATS_GET_USED_TOKENS
- *          bits 31:16  unused tokens   WMI_ATF_PEER_STATS_GET_UNUSED_TOKENS
- * @field3: for future use
- */
-typedef struct {
-	uint32_t    field1;
-	uint32_t    field2;
-	uint32_t    field3;
-} wmi_host_atf_peer_stats_info;
-
-/**
- * struct wmi_host_atf_peer_stats_event
- * @pdev_id: pdev_id
- * @num_atf_peers: number of peers in token_info_list
- * @comp_usable_airtime: computed usable airtime in tokens
- * @reserved[4]: reserved for future use
- * @wmi_host_atf_peer_stats_info token_info_list: list of num_atf_peers
- */
-typedef struct {
-	uint32_t pdev_id;
-	uint32_t num_atf_peers;
-	uint32_t comp_usable_airtime;
-	uint32_t reserved[4];
-	wmi_host_atf_peer_stats_info token_info_list[1];
-} wmi_host_atf_peer_stats_event;
-
 /**
  * struct wmi_host_ath_dcs_cw_int
  * @channel: either number or freq in mhz
@@ -8449,113 +8185,6 @@ struct wdsentry {
 	uint32_t flags;
 };
 
-#define WMI_HOST_DBR_RING_ADDR_LO_S 0
-#define WMI_HOST_DBR_RING_ADDR_LO 0xffffffff
-
-#define WMI_HOST_DBR_RING_ADDR_LO_GET(dword) \
-			WMI_HOST_F_MS(dword, WMI_HOST_DBR_RING_ADDR_LO)
-#define WMI_HOST_DBR_RING_ADDR_LO_SET(dword, val) \
-			WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_RING_ADDR_LO)
-
-#define WMI_HOST_DBR_RING_ADDR_HI_S 0
-#define WMI_HOST_DBR_RING_ADDR_HI 0xf
-
-#define WMI_HOST_DBR_RING_ADDR_HI_GET(dword) \
-			WMI_HOST_F_MS(dword, WMI_HOST_DBR_RING_ADDR_HI)
-#define WMI_HOST_DBR_RING_ADDR_HI_SET(dword, val) \
-			WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_RING_ADDR_HI)
-
-#define WMI_HOST_DBR_DATA_ADDR_LO_S 0
-#define WMI_HOST_DBR_DATA_ADDR_LO 0xffffffff
-
-#define WMI_HOST_DBR_DATA_ADDR_LO_GET(dword) \
-			WMI_HOST_F_MS(dword, WMI_HOST_DBR_DATA_ADDR_LO)
-#define WMI_HOST_DBR_DATA_ADDR_LO_SET(dword, val) \
-			WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_DATA_ADDR_LO)
-
-#define WMI_HOST_DBR_DATA_ADDR_HI_S 0
-#define WMI_HOST_DBR_DATA_ADDR_HI 0xf
-
-#define WMI_HOST_DBR_DATA_ADDR_HI_GET(dword) \
-			WMI_HOST_F_MS(dword, WMI_HOST_DBR_DATA_ADDR_HI)
-#define WMI_HOST_DBR_DATA_ADDR_HI_SET(dword, val) \
-			WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_DATA_ADDR_HI)
-
-#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_S 12
-#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA 0x7fffff
-
-#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_GET(dword) \
-		WMI_HOST_F_MS(dword, WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA)
-#define WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA_SET(dword, val) \
-		WMI_HOST_F_RMW(dword, val, WMI_HOST_DBR_DATA_ADDR_HI_HOST_DATA)
-
-/**
- * struct direct_buf_rx_metadata: direct buffer metadata
- *
- * @noisefloor: noisefloor
- */
-struct direct_buf_rx_metadata {
-	int32_t noisefloor[WMI_HOST_MAX_NUM_CHAINS];
-};
-
-/**
- * struct direct_buf_rx_entry: direct buffer rx release entry structure
- *
- * @addr_lo: LSB 32-bits of the buffer
- * @addr_hi: MSB 32-bits of the buffer
- * @len: Length of the buffer
- */
-struct direct_buf_rx_entry {
-	uint32_t paddr_lo;
-	uint32_t paddr_hi;
-	uint32_t len;
-};
-
-/**
- * struct direct_buf_rx_rsp: direct buffer rx response structure
- *
- * @pdev_id: Index of the pdev for which response is received
- * @mod_mod: Index of the module for which respone is received
- * @num_buf_release_entry: Number of buffers released through event
- * @dbr_entries: Pointer to direct buffer rx entry struct
- */
-struct direct_buf_rx_rsp {
-	uint32_t pdev_id;
-	uint32_t mod_id;
-	uint32_t num_buf_release_entry;
-	uint32_t num_meta_data_entry;
-	struct direct_buf_rx_entry *dbr_entries;
-};
-
-/**
- * struct direct_buf_rx_cfg_req: direct buffer rx config request structure
- *
- * @pdev_id: Index of the pdev for which response is received
- * @mod_id: Index of the module for which respone is received
- * @base_paddr_lo: Lower 32bits of ring base address
- * @base_paddr_hi: Higher 32bits of ring base address
- * @head_idx_paddr_lo: Lower 32bits of head idx register address
- * @head_idx_paddr_hi: Higher 32bits of head idx register address
- * @tail_idx_paddr_lo: Lower 32bits of tail idx register address
- * @tail_idx_paddr_hi: Higher 32bits of tail idx register address
- * @buf_size: Size of the buffer for each pointer in the ring
- * @num_elems: Number of pointers allocated and part of the source ring
- */
-struct direct_buf_rx_cfg_req {
-	uint32_t pdev_id;
-	uint32_t mod_id;
-	uint32_t base_paddr_lo;
-	uint32_t base_paddr_hi;
-	uint32_t head_idx_paddr_lo;
-	uint32_t head_idx_paddr_hi;
-	uint32_t tail_idx_paddr_hi;
-	uint32_t tail_idx_paddr_lo;
-	uint32_t buf_size;
-	uint32_t num_elems;
-	uint32_t event_timeout_ms;
-	uint32_t num_resp_per_event;
-};
-
 /**
  * struct wmi_obss_detection_cfg_param - obss detection cfg
  * @vdev_id: vdev id

+ 56 - 6
wmi_unified_priv.h

@@ -52,6 +52,18 @@
 #include "wmi_unified_twt_param.h"
 #endif
 
+#ifdef WMI_SMART_ANT_SUPPORT
+#include "wmi_unified_smart_ant_param.h"
+#endif
+
+#ifdef WMI_DBR_SUPPORT
+#include "wmi_unified_dbr_param.h"
+#endif
+
+#ifdef WMI_ATF_SUPPORT
+#include "wmi_unified_atf_param.h"
+#endif
+
 #define WMI_UNIFIED_MAX_EVENT 0x100
 
 #ifdef WMI_EXT_DBG
@@ -728,9 +740,6 @@ QDF_STATUS (*send_oem_dma_cfg_cmd)(wmi_unified_t wmi_handle,
 				   wmi_oem_dma_ring_cfg_req_fixed_param *cfg);
 #endif
 
-QDF_STATUS (*send_dbr_cfg_cmd)(wmi_unified_t wmi_handle,
-				   struct direct_buf_rx_cfg_req *cfg);
-
 QDF_STATUS (*send_start_oem_data_cmd)(wmi_unified_t wmi_handle,
 			  uint32_t data_len,
 			  uint8_t *data);
@@ -896,8 +905,10 @@ QDF_STATUS (*extract_apf_read_memory_resp_event)(wmi_unified_t wmi_handle,
 QDF_STATUS (*send_pdev_get_tpc_config_cmd)(wmi_unified_t wmi_handle,
 		uint32_t param);
 
+#ifdef WMI_ATF_SUPPORT
 QDF_STATUS (*send_set_bwf_cmd)(wmi_unified_t wmi_handle,
 		struct set_bwf_params *param);
+#endif
 
 QDF_STATUS (*send_pdev_fips_cmd)(wmi_unified_t wmi_handle,
 		struct fips_params *param);
@@ -924,9 +935,6 @@ QDF_STATUS (*send_process_update_edca_param_cmd)(wmi_unified_t wmi_handle,
 		uint8_t vdev_id, bool mu_edca_param,
 		struct wmi_host_wme_vparams wmm_vparams[WMI_MAX_NUM_AC]);
 
-QDF_STATUS (*send_set_ant_switch_tbl_cmd)(wmi_unified_t wmi_handle,
-		struct ant_switch_tbl_params *param);
-
 QDF_STATUS (*send_set_ratepwr_table_cmd)(wmi_unified_t wmi_handle,
 		struct ratepwr_table_params *param);
 
@@ -979,6 +987,10 @@ QDF_STATUS (*send_phyerr_enable_cmd)(wmi_unified_t wmi_handle);
 
 QDF_STATUS (*send_phyerr_disable_cmd)(wmi_unified_t wmi_handle);
 
+#ifdef WMI_SMART_ANT_SUPPORT
+QDF_STATUS (*send_set_ant_switch_tbl_cmd)(wmi_unified_t wmi_handle,
+		struct ant_switch_tbl_params *param);
+
 QDF_STATUS (*send_smart_ant_enable_cmd)(wmi_unified_t wmi_handle,
 		struct smart_ant_enable_params *param);
 
@@ -996,6 +1008,7 @@ QDF_STATUS (*send_smart_ant_set_training_info_cmd)(wmi_unified_t wmi_handle,
 QDF_STATUS (*send_smart_ant_set_node_config_cmd)(wmi_unified_t wmi_handle,
 		uint8_t macaddr[IEEE80211_ADDR_LEN],
 		struct smart_ant_node_config_params *param);
+#endif
 
 QDF_STATUS (*send_smart_ant_enable_tx_feedback_cmd)(wmi_unified_t wmi_handle,
 		struct smart_ant_enable_tx_feedback_params *param);
@@ -1530,6 +1543,10 @@ QDF_STATUS (*extract_sar_cap_service_ready_ext)(
 		uint8_t *evt_buf,
 		struct wlan_psoc_host_service_ext_param *ext_param);
 
+#ifdef WMI_DBR_SUPPORT
+QDF_STATUS (*send_dbr_cfg_cmd)(wmi_unified_t wmi_handle,
+				   struct direct_buf_rx_cfg_req *cfg);
+
 QDF_STATUS (*extract_dbr_buf_release_fixed)(
 			wmi_unified_t wmi_handle,
 			uint8_t *evt_buf,
@@ -1544,6 +1561,7 @@ QDF_STATUS (*extract_dbr_buf_metadata)(
 			wmi_unified_t wmi_handle,
 			uint8_t *evt_buf, uint8_t idx,
 			struct direct_buf_rx_metadata *param);
+#endif
 
 QDF_STATUS (*extract_pdev_utf_event)(wmi_unified_t wmi_hdl,
 				     uint8_t *evt_buf,
@@ -1926,6 +1944,38 @@ static inline void wmi_extscan_attach_tlv(struct wmi_unified *wmi_handle)
 }
 #endif
 
+#ifdef WMI_SMART_ANT_SUPPORT
+void wmi_smart_ant_attach_tlv(struct wmi_unified *wmi_handle);
+#else
+static inline void wmi_smart_ant_attach_tlv(struct wmi_unified *wmi_handle)
+{
+}
+#endif
+
+#ifdef WMI_DBR_SUPPORT
+void wmi_dbr_attach_tlv(struct wmi_unified *wmi_handle);
+#else
+static inline void wmi_dbr_attach_tlv(struct wmi_unified *wmi_handle)
+{
+}
+#endif
+
+#ifdef WMI_ATF_SUPPORT
+void wmi_atf_attach_tlv(struct wmi_unified *wmi_handle);
+#else
+static inline void wmi_atf_attach_tlv(struct wmi_unified *wmi_handle)
+{
+}
+#endif
+
+#ifdef WMI_AP_SUPPORT
+void wmi_ap_attach_tlv(struct wmi_unified *wmi_handle);
+#else
+static inline void wmi_ap_attach_tlv(struct wmi_unified *wmi_handle)
+{
+}
+#endif
+
 /**
  * wmi_align() - provides word aligned parameter
  * @param: parameter to be aligned

+ 48 - 0
wmi_unified_smart_ant_api.h

@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+/**
+ * DOC: Implement API's specific to Smart Antenna component.
+ */
+
+#ifndef _WMI_UNIFIED_SMART_ANT_API_H_
+#define _WMI_UNIFIED_SMART_ANT_API_H_
+
+#include "wmi_unified_smart_ant_param.h"
+
+QDF_STATUS wmi_unified_smart_ant_enable_cmd_send(void *wmi_hdl,
+				struct smart_ant_enable_params *param);
+
+QDF_STATUS wmi_unified_smart_ant_set_rx_ant_cmd_send(void *wmi_hdl,
+				struct smart_ant_rx_ant_params *param);
+
+QDF_STATUS wmi_unified_smart_ant_set_tx_ant_cmd_send(void *wmi_hdl,
+				uint8_t macaddr[IEEE80211_ADDR_LEN],
+				struct smart_ant_tx_ant_params *param);
+
+QDF_STATUS wmi_unified_smart_ant_set_training_info_cmd_send(void *wmi_hdl,
+				uint8_t macaddr[IEEE80211_ADDR_LEN],
+				struct smart_ant_training_info_params *param);
+
+QDF_STATUS wmi_unified_smart_ant_node_config_cmd_send(void *wmi_hdl,
+				uint8_t macaddr[IEEE80211_ADDR_LEN],
+				struct smart_ant_node_config_params *param);
+
+QDF_STATUS wmi_unified_set_ant_switch_tbl_cmd_send(void *wmi_hdl,
+				struct ant_switch_tbl_params *param);
+
+#endif /* _WMI_UNIFIED_SMART_ANT_API_H_ */

+ 97 - 0
wmi_unified_smart_ant_param.h

@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
+ *
+ * Permission to use, copy, modify, and/or distribute this software for
+ * any purpose with or without fee is hereby granted, provided that the
+ * above copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifndef _WMI_UNIFIED_SMART_ANT_PARAM_H_
+#define _WMI_UNIFIED_SMART_ANT_PARAM_H_
+
+/**
+ * struct ant_switch_tbl_params - Antenna switch table params
+ * @ant_ctrl_common1: ANtenna control common param 1
+ * @ant_ctrl_common2: Antenna control commn param 2
+ */
+struct ant_switch_tbl_params {
+	uint32_t ant_ctrl_common1;
+	uint32_t ant_ctrl_common2;
+	uint32_t pdev_id;
+	uint32_t antCtrlChain;
+};
+
+/**
+ * struct smart_ant_enable_params - Smart antenna params
+ * @enable: Enable/Disable
+ * @mode: SA mode
+ * @rx_antenna: RX antenna config
+ * @gpio_pin : GPIO pin config
+ * @gpio_func : GPIO function config
+ */
+struct smart_ant_enable_params {
+	uint32_t enable;
+	uint32_t mode;
+	uint32_t rx_antenna;
+	uint32_t gpio_pin[WMI_HAL_MAX_SANTENNA];
+	uint32_t gpio_func[WMI_HAL_MAX_SANTENNA];
+	uint32_t pdev_id;
+};
+
+/**
+ * struct smart_ant_rx_ant_params - RX antenna params
+ * @antenna: RX antenna
+ */
+struct smart_ant_rx_ant_params {
+	uint32_t antenna;
+	uint32_t pdev_id;
+};
+
+/**
+ * struct smart_ant_tx_ant_params - TX antenna param
+ * @antenna_array: Antenna arry
+ * @vdev_id: VDEV id
+ */
+struct smart_ant_tx_ant_params {
+	uint32_t *antenna_array;
+	uint8_t vdev_id;
+};
+
+/**
+ * struct smart_ant_training_info_params - SA training params
+ * @vdev_id: VDEV id
+ * @rate_array: Rates array
+ * @antenna_array: Antenna array
+ * @numpkts: num packets for training
+ */
+struct smart_ant_training_info_params {
+	uint8_t vdev_id;
+	uint32_t *rate_array;
+	uint32_t *antenna_array;
+	uint32_t numpkts;
+};
+
+/**
+ * struct smart_ant_node_config_params - SA node config params
+ * @vdev_id: VDEV id
+ * @cmd_id: Command id
+ * @args_count: Arguments count
+ */
+struct smart_ant_node_config_params {
+	uint8_t vdev_id;
+	uint32_t cmd_id;
+	uint16_t args_count;
+	uint32_t *args_arr;
+};
+
+#endif /* _WMI_UNIFIED_SMART_ANT_PARAM_H_ */