Pārlūkot izejas kodu

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 gadi atpakaļ
vecāks
revīzija
a8dcd50683

+ 1 - 0
target_if/direct_buf_rx/inc/target_if_direct_buf_rx_api.h

@@ -21,6 +21,7 @@
 
 #include "qdf_nbuf.h"
 #include "qdf_atomic.h"
+#include "wmi_unified_api.h"
 
 #define direct_buf_rx_alert(params...) \
 	QDF_TRACE_FATAL(QDF_MODULE_ID_DIRECT_BUF_RX, params)

+ 0 - 1
target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c

@@ -17,7 +17,6 @@
  */
 
 #include <qdf_status.h>
-#include <wmi_unified_api.h>
 #include <target_if_direct_buf_rx_api.h>
 #include <wlan_objmgr_cmn.h>
 #include <wlan_objmgr_global_obj.h>

+ 0 - 1
target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c

@@ -17,7 +17,6 @@
  */
 
 #include "target_if.h"
-#include "wmi_unified_api.h"
 #include "wlan_lmac_if_def.h"
 #include "target_if_direct_buf_rx_main.h"
 #include <target_if_direct_buf_rx_api.h>

+ 2 - 0
target_if/spectral/target_if_spectral_phyerr.c

@@ -31,7 +31,9 @@
 #include <osif_rawmode_sim.h>
 #endif /*CONFIG_WIN*/
 #include <reg_services_public_struct.h>
+#ifdef DIRECT_BUF_RX_ENABLE
 #include <target_if_direct_buf_rx_api.h>
+#endif
 extern int spectral_debug_level;
 
 #ifdef WLAN_CONV_SPECTRAL_ENABLE

+ 233 - 0
wmi/inc/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/inc/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/inc/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/inc/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/inc/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/inc/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/inc/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/inc/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/inc/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/inc/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_ */

+ 1063 - 0
wmi/src/wmi_unified_ap_api.c

@@ -0,0 +1,1063 @@
+/*
+ * 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.
+ */
+
+#include "wmi_unified_priv.h"
+#include "wmi_unified_param.h"
+#include "wmi_unified_ap_api.h"
+#include "qdf_module.h"
+
+/**
+ *  wmi_unified_peer_add_wds_entry_cmd_send() - WMI add wds entry cmd function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold wds entry param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_peer_add_wds_entry_cmd_send(void *wmi_hdl,
+				struct peer_add_wds_entry_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_peer_add_wds_entry_cmd)
+		return wmi_handle->ops->send_peer_add_wds_entry_cmd(wmi_handle,
+				param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_peer_del_wds_entry_cmd_send() - WMI del wds entry cmd function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold wds entry param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_peer_del_wds_entry_cmd_send(void *wmi_hdl,
+				struct peer_del_wds_entry_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_peer_del_wds_entry_cmd)
+		return wmi_handle->ops->send_peer_del_wds_entry_cmd(wmi_handle,
+				param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_peer_update_wds_entry_cmd_send() - WMI update wds entry cmd function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold wds entry param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_peer_update_wds_entry_cmd_send(void *wmi_hdl,
+				struct peer_update_wds_entry_params *param)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->send_peer_update_wds_entry_cmd)
+		return wmi->ops->send_peer_update_wds_entry_cmd(wmi, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_pdev_get_tpc_config_cmd_send() - WMI get tpc config function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : tpc config param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_pdev_get_tpc_config_cmd_send(void *wmi_hdl,
+				uint32_t param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_pdev_get_tpc_config_cmd)
+		return wmi_handle->ops->send_pdev_get_tpc_config_cmd(wmi_handle,
+				param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_beacon_send_cmd() - WMI beacon send function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param macaddr	: MAC address
+ *  @param param    : pointer to hold beacon send cmd parameter
+ *
+ *  Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_beacon_send_cmd(void *wmi_hdl,
+				struct beacon_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_beacon_send_cmd)
+		return wmi_handle->ops->send_beacon_send_cmd(wmi_handle,
+				  param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_set_ctl_table_cmd_send() - WMI ctl table cmd function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold ctl table param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_set_ctl_table_cmd_send(void *wmi_hdl,
+				struct ctl_table_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_set_ctl_table_cmd)
+		return wmi_handle->ops->send_set_ctl_table_cmd(wmi_handle,
+				param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_set_mimogain_table_cmd_send() - WMI set mimogain cmd function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold mimogain param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_set_mimogain_table_cmd_send(void *wmi_hdl,
+				struct mimogain_table_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_set_mimogain_table_cmd)
+		return wmi_handle->ops->send_set_mimogain_table_cmd(wmi_handle,
+				param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_packet_power_info_get_cmd_send() - WMI get packet power info function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold packet power info param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_packet_power_info_get_cmd_send(void *wmi_hdl,
+				struct packet_power_info_params *param)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->send_packet_power_info_get_cmd)
+		return wmi->ops->send_packet_power_info_get_cmd(wmi, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_vdev_config_ratemask_cmd_send() - WMI config ratemask function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold config ratemask param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_vdev_config_ratemask_cmd_send(void *wmi_hdl,
+				struct config_ratemask_params *param)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->send_vdev_config_ratemask_cmd)
+		return wmi->ops->send_vdev_config_ratemask_cmd(wmi, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_vdev_set_neighbour_rx_cmd_send() - WMI set neighbour rx function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param macaddr	: MAC address
+ *  @param param    : pointer to hold neighbour rx parameter
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+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)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->send_vdev_set_neighbour_rx_cmd)
+		return wmi->ops->send_vdev_set_neighbour_rx_cmd(wmi,
+				  macaddr, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_nf_dbr_dbm_info_get_cmd_send() - WMI request nf info function
+ *  @param wmi_handle	  : handle to WMI.
+ *  @mac_id: mac_id
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_nf_dbr_dbm_info_get_cmd_send(void *wmi_hdl,
+						    uint8_t mac_id)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->send_nf_dbr_dbm_info_get_cmd)
+		return wmi->ops->send_nf_dbr_dbm_info_get_cmd(wmi, mac_id);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_set_ht_ie_cmd_send() - WMI set channel cmd function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold channel param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_set_ht_ie_cmd_send(void *wmi_hdl,
+				struct ht_ie_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_set_ht_ie_cmd)
+		return wmi_handle->ops->send_set_ht_ie_cmd(wmi_handle, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_set_vht_ie_cmd_send() - WMI set channel cmd function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold channel param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_set_vht_ie_cmd_send(void *wmi_hdl,
+				struct vht_ie_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_set_vht_ie_cmd)
+		return wmi_handle->ops->send_set_vht_ie_cmd(wmi_handle, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_set_quiet_mode_cmd_send() - WMI set quiet mode function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold quiet mode param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_set_quiet_mode_cmd_send(void *wmi_hdl,
+				struct set_quiet_mode_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_set_quiet_mode_cmd)
+		return wmi_handle->ops->send_set_quiet_mode_cmd(wmi_handle,
+				param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * 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_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_bcn_offload_control_cmd)
+		return wmi_handle->ops->send_bcn_offload_control_cmd(wmi_handle,
+				bcn_ctrl_param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_tbttoffset_num_vdevs() - extract tbtt offset num vdev
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param vdev_map: Pointer to hold num vdev
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_tbttoffset_num_vdevs(void *wmi_hdl, void *evt_buf,
+					    uint32_t *num_vdevs)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->extract_tbttoffset_num_vdevs)
+		return wmi->ops->extract_tbttoffset_num_vdevs(wmi,
+			evt_buf, num_vdevs);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_ext_tbttoffset_num_vdevs() - extract ext tbtt offset num vdev
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param vdev_map: Pointer to hold num vdev
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_ext_tbttoffset_num_vdevs(void *wmi_hdl, void *evt_buf,
+					    uint32_t *num_vdevs)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->extract_ext_tbttoffset_num_vdevs)
+		return wmi->ops->extract_ext_tbttoffset_num_vdevs(wmi,
+			evt_buf, num_vdevs);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_tbttoffset_update_params() - extract tbtt offset update param
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param idx: Index referring to a vdev
+ * @param tbtt_param: Pointer to tbttoffset event param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_tbttoffset_update_params(void *wmi_hdl, void *evt_buf,
+	uint8_t idx, struct tbttoffset_params *tbtt_param)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->extract_tbttoffset_update_params)
+		return wmi->ops->extract_tbttoffset_update_params(wmi,
+			evt_buf, idx, tbtt_param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_ext_tbttoffset_update_params() - extract tbtt offset update param
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param idx: Index referring to a vdev
+ * @param tbtt_param: Pointer to tbttoffset event param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_ext_tbttoffset_update_params(void *wmi_hdl,
+	void *evt_buf, uint8_t idx, struct tbttoffset_params *tbtt_param)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->extract_ext_tbttoffset_update_params)
+		return wmi->ops->extract_ext_tbttoffset_update_params(wmi,
+			evt_buf, idx, tbtt_param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_offchan_data_tx_compl_param() -
+ *	    extract offchan data tx completion param from event
+ * @wmi_hdl: wmi handle
+ * @evt_buf: pointer to event buffer
+ * @param: Pointer to offchan data tx completion param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_offchan_data_tx_compl_param(void *wmi_hdl, void *evt_buf,
+	struct wmi_host_offchan_data_tx_compl_event *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_offchan_data_tx_compl_param)
+		return wmi_handle->ops->extract_offchan_data_tx_compl_param(
+				wmi_handle, evt_buf, param);
+
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_pdev_csa_switch_count_status() - extract CSA switch count status
+ * from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to CSA switch count status param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_pdev_csa_switch_count_status(void *wmi_hdl,
+	void *evt_buf,
+	struct pdev_csa_switch_count_status *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_pdev_csa_switch_count_status)
+		return wmi_handle->ops->extract_pdev_csa_switch_count_status(
+				wmi_handle,
+				evt_buf,
+				param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+
+/**
+ * wmi_extract_swba_num_vdevs() - extract swba num vdevs from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param num_vdevs: Pointer to hold num vdevs
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_swba_num_vdevs(void *wmi_hdl, void *evt_buf,
+		uint32_t *num_vdevs)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_swba_num_vdevs)
+		return wmi_handle->ops->extract_swba_num_vdevs(wmi_handle,
+					evt_buf, num_vdevs);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_swba_tim_info() - extract swba tim info from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param idx: Index to bcn info
+ * @param tim_info: Pointer to hold tim info
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_swba_tim_info(void *wmi_hdl, void *evt_buf,
+	    uint32_t idx, wmi_host_tim_info *tim_info)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_swba_tim_info)
+		return wmi_handle->ops->extract_swba_tim_info(wmi_handle,
+			evt_buf, idx, tim_info);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_swba_noa_info() - extract swba NoA information from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param idx: Index to bcn info
+ * @param p2p_desc: Pointer to hold p2p NoA info
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_swba_noa_info(void *wmi_hdl, void *evt_buf,
+	    uint32_t idx, wmi_host_p2p_noa_info *p2p_desc)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_swba_noa_info)
+		return wmi_handle->ops->extract_swba_noa_info(wmi_handle,
+			evt_buf, idx, p2p_desc);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_peer_sta_kickout_ev() - extract peer sta kickout event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param ev: Pointer to hold peer param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_peer_sta_kickout_ev(void *wmi_hdl, void *evt_buf,
+	wmi_host_peer_sta_kickout_event *ev)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_peer_sta_kickout_ev)
+		return wmi_handle->ops->extract_peer_sta_kickout_ev(wmi_handle,
+			evt_buf, ev);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_unified_send_multiple_vdev_restart_req_cmd() - send multiple vdev restart
+ * @wmi_handle: wmi handle
+ * @param: multiple vdev restart parameter
+ *
+ * Send WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID parameters to fw.
+ *
+ * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
+ */
+QDF_STATUS wmi_unified_send_multiple_vdev_restart_req_cmd(void *wmi_hdl,
+				struct multiple_vdev_restart_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_multiple_vdev_restart_req_cmd)
+		return wmi_handle->ops->send_multiple_vdev_restart_req_cmd(
+					wmi_handle,
+					param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_extract_wds_addr_event - Extract WDS addr WMI event
+ *
+ *  @param wmi_handle      : handle to WMI.
+ *  @param evt_buf    : pointer to event buffer
+ *  @param len : length of the event buffer
+ *  @param wds_ev: pointer to strct to extract
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_wds_addr_event(void *wmi_hdl, void *evt_buf,
+	uint16_t len, wds_addr_event_t *wds_ev)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_wds_addr_event) {
+		return wmi_handle->ops->extract_wds_addr_event(wmi_handle,
+			evt_buf, len, wds_ev);
+	}
+	return QDF_STATUS_E_FAILURE;
+}
+qdf_export_symbol(wmi_extract_wds_addr_event);
+
+/**
+ * wmi_extract_dcs_interference_type() - extract dcs interference type
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold dcs interference param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_dcs_interference_type(void *wmi_hdl,
+	void *evt_buf, struct wmi_host_dcs_interference_param *param)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->extract_dcs_interference_type) {
+		return wmi->ops->extract_dcs_interference_type(wmi,
+			evt_buf, param);
+	}
+	return QDF_STATUS_E_FAILURE;
+}
+
+/*
+ * wmi_extract_dcs_cw_int() - extract dcs cw interference from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param cw_int: Pointer to hold cw interference
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_dcs_cw_int(void *wmi_hdl, void *evt_buf,
+	wmi_host_ath_dcs_cw_int *cw_int)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_dcs_cw_int) {
+		return wmi_handle->ops->extract_dcs_cw_int(wmi_handle,
+			evt_buf, cw_int);
+	}
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_dcs_im_tgt_stats() - extract dcs im target stats from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param wlan_stat: Pointer to hold wlan stats
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_dcs_im_tgt_stats(void *wmi_hdl, void *evt_buf,
+	wmi_host_dcs_im_tgt_stats_t *wlan_stat)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_dcs_im_tgt_stats) {
+		return wmi_handle->ops->extract_dcs_im_tgt_stats(wmi_handle,
+			evt_buf, wlan_stat);
+	}
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_peer_delete_response_event() -
+ *       extract vdev id and peer mac addresse from peer delete response event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold evt buf
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+QDF_STATUS wmi_extract_peer_delete_response_event(
+			void *wmi_hdl,
+			uint8_t *evt_buf,
+			struct wmi_host_peer_delete_response_event *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_peer_delete_response_event)
+		return wmi_handle->ops->extract_peer_delete_response_event(
+				wmi_handle,
+				evt_buf, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_pdev_tpc_ev_param() - extract tpc param from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold tpc param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_pdev_tpc_ev_param(void *wmi_hdl, void *evt_buf,
+	wmi_host_pdev_tpc_event *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_pdev_tpc_ev_param)
+		return wmi_handle->ops->extract_pdev_tpc_ev_param(wmi_handle,
+				evt_buf, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_pdev_tpc_config_ev_param() - extract pdev tpc configuration
+ * param from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold tpc configuration
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_pdev_tpc_config_ev_param(void *wmi_hdl, void *evt_buf,
+	wmi_host_pdev_tpc_config_event *param)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->extract_pdev_tpc_config_ev_param)
+		return wmi->ops->extract_pdev_tpc_config_ev_param(wmi,
+			evt_buf, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_nfcal_power_ev_param() - extract noise floor calibration
+ * power param from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold nf cal power param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_nfcal_power_ev_param(void *wmi_hdl, void *evt_buf,
+	wmi_host_pdev_nfcal_power_all_channels_event *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_nfcal_power_ev_param)
+		return wmi_handle->ops->extract_nfcal_power_ev_param(wmi_handle,
+				evt_buf, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_peer_sta_ps_statechange_ev() - extract peer sta ps state
+ * from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param ev: Pointer to hold peer param and ps state
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_peer_sta_ps_statechange_ev(void *wmi_hdl, void *evt_buf,
+	wmi_host_peer_sta_ps_statechange_event *ev)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->extract_peer_sta_ps_statechange_ev)
+		return wmi->ops->extract_peer_sta_ps_statechange_ev(wmi,
+			evt_buf, ev);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_inst_rssi_stats_event() - extract inst rssi stats from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param inst_rssi_resp: Pointer to hold inst rssi response
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_inst_rssi_stats_event(void *wmi_hdl, void *evt_buf,
+			   wmi_host_inst_stats_resp *inst_rssi_resp)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->extract_inst_rssi_stats_event)
+		return wmi->ops->extract_inst_rssi_stats_event(wmi,
+			evt_buf, inst_rssi_resp);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+
+/**
+ * wmi_send_pdev_caldata_version_check_cmd() - send reset peer mumimo
+ *                                             tx count to fw
+ * @wmi_handle: wmi handle
+ * @value: value
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS
+wmi_send_pdev_caldata_version_check_cmd(void *wmi_hdl, uint32_t value)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->send_pdev_caldata_version_check_cmd)
+		return wmi->ops->send_pdev_caldata_version_check_cmd(wmi,
+								value);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_pdev_caldata_version_check_ev_param() - extract caldata
+ *                                                     from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold caldata version data
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_pdev_caldata_version_check_ev_param(void *wmi_hdl,
+	void *evt_buf,
+	wmi_host_pdev_check_cal_version_event *param)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->extract_pdev_caldata_version_check_ev_param)
+		return wmi->ops->extract_pdev_caldata_version_check_ev_param(
+			wmi, evt_buf, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+#ifdef WLAN_SUPPORT_FILS
+QDF_STATUS
+wmi_unified_fils_discovery_send_cmd(void *wmi_hdl, struct fd_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
+
+	if (wmi_handle->ops->send_fils_discovery_send_cmd)
+		return wmi_handle->ops->send_fils_discovery_send_cmd(wmi_handle,
+								     param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS
+wmi_unified_fils_vdev_config_send_cmd(void *wmi_hdl,
+				      struct config_fils_params *param)
+{
+	wmi_unified_t wmi = (wmi_unified_t)wmi_hdl;
+
+	if (wmi->ops->send_vdev_fils_enable_cmd)
+		return wmi->ops->send_vdev_fils_enable_cmd(wmi, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS
+wmi_extract_swfda_vdev_id(void *wmi_hdl, void *evt_buf,
+			  uint32_t *vdev_id)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
+
+	if (wmi_handle->ops->extract_swfda_vdev_id)
+		return wmi_handle->ops->extract_swfda_vdev_id(wmi_handle,
+							      evt_buf, vdev_id);
+
+	return QDF_STATUS_E_FAILURE;
+}
+#endif /* WLAN_SUPPORT_FILS */
+
+/**
+ *  wmi_unified_set_qboost_param_cmd_send() - WMI set_qboost function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param macaddr        : MAC address
+ *  @param param    : pointer to hold set_qboost parameter
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_set_qboost_param_cmd_send(void *wmi_hdl,
+				uint8_t macaddr[IEEE80211_ADDR_LEN],
+				struct set_qboost_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_set_qboost_param_cmd)
+		return wmi_handle->ops->send_set_qboost_param_cmd(wmi_handle,
+				  macaddr, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_gpio_config_cmd_send() - WMI gpio config function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold gpio config param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_gpio_config_cmd_send(void *wmi_hdl,
+				struct gpio_config_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_gpio_config_cmd)
+		return wmi_handle->ops->send_gpio_config_cmd(wmi_handle, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_gpio_output_cmd_send() - WMI gpio config function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold gpio config param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_gpio_output_cmd_send(void *wmi_hdl,
+				struct gpio_output_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_gpio_output_cmd)
+		return wmi_handle->ops->send_gpio_output_cmd(wmi_handle, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_mcast_group_update_cmd_send() - WMI mcast grp update cmd function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold mcast grp param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_mcast_group_update_cmd_send(void *wmi_hdl,
+				struct mcast_group_update_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_mcast_group_update_cmd)
+		return wmi_handle->ops->send_mcast_group_update_cmd(wmi_handle,
+				param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_pdev_qvit_cmd_send() - WMI pdev qvit cmd function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold qvit param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_pdev_qvit_cmd_send(void *wmi_hdl,
+				struct pdev_qvit_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_pdev_qvit_cmd)
+		return wmi_handle->ops->send_pdev_qvit_cmd(wmi_handle, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_wmm_update_cmd_send() - WMI wmm update cmd function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold wmm param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_wmm_update_cmd_send(void *wmi_hdl,
+				struct wmm_update_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_wmm_update_cmd)
+		return wmi_handle->ops->send_wmm_update_cmd(wmi_handle, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_vdev_start_resp() - extract vdev start response
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param vdev_rsp: Pointer to hold vdev response
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_vdev_start_resp(void *wmi_hdl, void *evt_buf,
+	wmi_host_vdev_start_resp *vdev_rsp)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_vdev_start_resp)
+		return wmi_handle->ops->extract_vdev_start_resp(wmi_handle,
+				evt_buf, vdev_rsp);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_vdev_delete_resp() - extract vdev delete response
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param delete_rsp: Pointer to hold vdev delete response
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_vdev_delete_resp(void *wmi_hdl, void *evt_buf,
+	struct wmi_host_vdev_delete_resp *delete_rsp)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_vdev_delete_resp)
+		return wmi_handle->ops->extract_vdev_delete_resp(wmi_handle,
+				evt_buf, delete_rsp);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_vdev_stopped_param() - extract vdev stop param from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param vdev_id: Pointer to hold vdev identifier
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_vdev_stopped_param(void *wmi_hdl, void *evt_buf,
+	uint32_t *vdev_id)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_vdev_stopped_param)
+		return wmi_handle->ops->extract_vdev_stopped_param(wmi_handle,
+				evt_buf, vdev_id);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_mgmt_tx_compl_param() - extract mgmt tx completion param
+ * from event
+ * @wmi_hdl: wmi handle
+ * @evt_buf: pointer to event buffer
+ * @param: Pointer to mgmt tx completion param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_mgmt_tx_compl_param(void *wmi_hdl, void *evt_buf,
+	wmi_host_mgmt_tx_compl_event *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_mgmt_tx_compl_param)
+		return wmi_handle->ops->extract_mgmt_tx_compl_param(wmi_handle,
+				evt_buf, param);
+
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_chan_info_event() - extract chan information from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param chan_info: Pointer to hold chan information
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_chan_info_event(void *wmi_hdl, void *evt_buf,
+			       wmi_host_chan_info_event *chan_info)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_chan_info_event)
+		return wmi_handle->ops->extract_chan_info_event(wmi_handle,
+			evt_buf, chan_info);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_channel_hopping_event() - extract channel hopping param
+ * from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param ch_hopping: Pointer to hold channel hopping param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_extract_channel_hopping_event(void *wmi_hdl, void *evt_buf,
+	     wmi_host_pdev_channel_hopping_event *ch_hopping)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->extract_channel_hopping_event)
+		return wmi->ops->extract_channel_hopping_event(wmi,
+			evt_buf, ch_hopping);
+
+	return QDF_STATUS_E_FAILURE;
+}

+ 2544 - 0
wmi/src/wmi_unified_ap_tlv.c

@@ -0,0 +1,2544 @@
+/*
+ * 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.
+ */
+
+#include <osdep.h>
+#include "wmi.h"
+#include "wmi_unified_priv.h"
+#include "wmi_unified_ap_api.h"
+#include <wlan_utility.h>
+
+/**
+ * send_peer_add_wds_entry_cmd_tlv() - send peer add command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer holding peer details
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS send_peer_add_wds_entry_cmd_tlv(wmi_unified_t wmi_handle,
+					struct peer_add_wds_entry_params *param)
+{
+	wmi_peer_add_wds_entry_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	int len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		qdf_print("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+	cmd = (wmi_peer_add_wds_entry_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_peer_add_wds_entry_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN
+		       (wmi_peer_add_wds_entry_cmd_fixed_param));
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr);
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_addr, &cmd->peer_macaddr);
+	cmd->flags = (param->flags & WMI_HOST_WDS_FLAG_STATIC) ?
+		      WMI_WDS_FLAG_STATIC : 0;
+	cmd->vdev_id = param->vdev_id;
+
+	wmi_mtrace(WMI_PEER_ADD_WDS_ENTRY_CMDID, cmd->vdev_id, 0);
+	return wmi_unified_cmd_send(wmi_handle, buf, len,
+			WMI_PEER_ADD_WDS_ENTRY_CMDID);
+}
+
+/**
+ * send_peer_del_wds_entry_cmd_tlv() - send peer delete command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer holding peer details
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS send_peer_del_wds_entry_cmd_tlv(wmi_unified_t wmi_handle,
+					struct peer_del_wds_entry_params *param)
+{
+	wmi_peer_remove_wds_entry_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	int len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		qdf_print("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+	cmd = (wmi_peer_remove_wds_entry_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_peer_remove_wds_entry_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN
+		(wmi_peer_remove_wds_entry_cmd_fixed_param));
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(param->dest_addr, &cmd->wds_macaddr);
+	cmd->vdev_id = param->vdev_id;
+	wmi_mtrace(WMI_PEER_REMOVE_WDS_ENTRY_CMDID, cmd->vdev_id, 0);
+	return wmi_unified_cmd_send(wmi_handle, buf, len,
+			WMI_PEER_REMOVE_WDS_ENTRY_CMDID);
+}
+
+/**
+ * send_peer_update_wds_entry_cmd_tlv() - send peer update command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer holding peer details
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS send_peer_update_wds_entry_cmd_tlv(wmi_unified_t wmi_handle,
+				struct peer_update_wds_entry_params *param)
+{
+	wmi_peer_update_wds_entry_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	int len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		qdf_print("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	/* wmi_buf_alloc returns zeroed command buffer */
+	cmd = (wmi_peer_update_wds_entry_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+			WMITLV_TAG_STRUC_wmi_peer_update_wds_entry_cmd_fixed_param,
+			WMITLV_GET_STRUCT_TLVLEN
+				(wmi_peer_update_wds_entry_cmd_fixed_param));
+	cmd->flags = (param->flags & WMI_HOST_WDS_FLAG_STATIC) ? WMI_WDS_FLAG_STATIC : 0;
+	cmd->vdev_id = param->vdev_id;
+	if (param->wds_macaddr)
+		WMI_CHAR_ARRAY_TO_MAC_ADDR(param->wds_macaddr,
+				&cmd->wds_macaddr);
+	if (param->peer_macaddr)
+		WMI_CHAR_ARRAY_TO_MAC_ADDR(param->peer_macaddr,
+				&cmd->peer_macaddr);
+	wmi_mtrace(WMI_PEER_UPDATE_WDS_ENTRY_CMDID, cmd->vdev_id, 0);
+	return wmi_unified_cmd_send(wmi_handle, buf, len,
+			WMI_PEER_UPDATE_WDS_ENTRY_CMDID);
+}
+
+/**
+ * send_pdev_get_tpc_config_cmd_tlv() - send get tpc config command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to get tpc config params
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+send_pdev_get_tpc_config_cmd_tlv(wmi_unified_t wmi_handle,
+				uint32_t param)
+{
+	wmi_pdev_get_tpc_config_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	int32_t len = sizeof(wmi_pdev_get_tpc_config_cmd_fixed_param);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+	cmd = (wmi_pdev_get_tpc_config_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_pdev_get_tpc_config_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN
+		(wmi_pdev_get_tpc_config_cmd_fixed_param));
+
+	cmd->param = param;
+	wmi_mtrace(WMI_PDEV_GET_TPC_CONFIG_CMDID, NO_SESSION, 0);
+	if (wmi_unified_cmd_send(wmi_handle, buf, len,
+				 WMI_PDEV_GET_TPC_CONFIG_CMDID)) {
+		WMI_LOGE("Send pdev get tpc config cmd failed");
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+
+	}
+	WMI_LOGD("%s:send success", __func__);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle,
+				struct beacon_params *param)
+{
+	QDF_STATUS ret;
+	wmi_bcn_send_from_host_cmd_fixed_param *cmd;
+	wmi_buf_t wmi_buf;
+	qdf_dma_addr_t dma_addr;
+	uint32_t dtim_flag = 0;
+
+	wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
+	if (!wmi_buf) {
+		WMI_LOGE("%s : wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+	if (param->is_dtim_count_zero) {
+		dtim_flag |= WMI_BCN_SEND_DTIM_ZERO;
+		if (param->is_bitctl_reqd) {
+			/* deliver CAB traffic in next DTIM beacon */
+			dtim_flag |= WMI_BCN_SEND_DTIM_BITCTL_SET;
+		}
+	}
+	cmd = (wmi_bcn_send_from_host_cmd_fixed_param *)wmi_buf_data(wmi_buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_bcn_send_from_host_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN
+				(wmi_bcn_send_from_host_cmd_fixed_param));
+	cmd->vdev_id = param->vdev_id;
+	cmd->data_len = qdf_nbuf_len(param->wbuf);
+	cmd->frame_ctrl = param->frame_ctrl;
+	cmd->dtim_flag = dtim_flag;
+	dma_addr = qdf_nbuf_get_frag_paddr(param->wbuf, 0);
+	cmd->frag_ptr_lo = qdf_get_lower_32_bits(dma_addr);
+#if defined(HTT_PADDR64)
+	cmd->frag_ptr_hi = qdf_get_upper_32_bits(dma_addr) & 0x1F;
+#endif
+	cmd->bcn_antenna = param->bcn_txant;
+
+	wmi_mtrace(WMI_PDEV_SEND_BCN_CMDID, cmd->vdev_id, 0);
+	ret = wmi_unified_cmd_send(wmi_handle,
+			wmi_buf, sizeof(*cmd), WMI_PDEV_SEND_BCN_CMDID);
+	if (ret != QDF_STATUS_SUCCESS) {
+		WMI_LOGE("%s: Failed to send bcn: %d", __func__, ret);
+		wmi_buf_free(wmi_buf);
+	}
+
+	return ret;
+}
+
+/**
+ * send_set_ctl_table_cmd_tlv() - send ctl table cmd to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to hold ctl table param
+ *
+ *  @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS
+send_set_ctl_table_cmd_tlv(wmi_unified_t wmi_handle,
+			   struct ctl_table_params *param)
+{
+	uint16_t len, ctl_tlv_len;
+	uint8_t *buf_ptr;
+	wmi_buf_t buf;
+	wmi_pdev_set_ctl_table_cmd_fixed_param *cmd;
+	uint32_t *ctl_array;
+
+	if (!param->ctl_array)
+		return QDF_STATUS_E_FAILURE;
+
+	ctl_tlv_len = WMI_TLV_HDR_SIZE +
+		roundup(param->ctl_cmd_len, sizeof(uint32_t));
+	len = sizeof(*cmd) + ctl_tlv_len;
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	buf_ptr = wmi_buf_data(buf);
+	qdf_mem_zero(buf_ptr, len);
+
+	cmd = (wmi_pdev_set_ctl_table_cmd_fixed_param *)buf_ptr;
+
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_pdev_set_ctl_table_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				wmi_pdev_set_ctl_table_cmd_fixed_param));
+	cmd->ctl_len = param->ctl_cmd_len;
+	cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
+								param->pdev_id);
+
+	buf_ptr += sizeof(*cmd);
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32,
+		       (cmd->ctl_len));
+	buf_ptr += WMI_TLV_HDR_SIZE;
+	ctl_array = (uint32_t *)buf_ptr;
+
+	WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[0], &param->ctl_band,
+					sizeof(param->ctl_band));
+	WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&ctl_array[1], param->ctl_array,
+					param->ctl_cmd_len -
+					sizeof(param->ctl_band));
+
+	wmi_mtrace(WMI_PDEV_SET_CTL_TABLE_CMDID, NO_SESSION, 0);
+	if (wmi_unified_cmd_send(wmi_handle, buf, len,
+				 WMI_PDEV_SET_CTL_TABLE_CMDID)) {
+		WMI_LOGE("%s:Failed to send command", __func__);
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * send_set_mimogain_table_cmd_tlv() - send mimogain table cmd to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to hold mimogain table param
+ *
+ *  @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS
+send_set_mimogain_table_cmd_tlv(wmi_unified_t wmi_handle,
+				struct mimogain_table_params *param)
+{
+	uint16_t len, table_tlv_len;
+	wmi_buf_t buf;
+	uint8_t *buf_ptr;
+	wmi_pdev_set_mimogain_table_cmd_fixed_param *cmd;
+	uint32_t *gain_table;
+
+	if (!param->array_gain)
+		return QDF_STATUS_E_FAILURE;
+
+	/* len must be multiple of a single array gain table */
+	if (param->tbl_len %
+	    ((WMI_HOST_TX_NUM_CHAIN-1) * WMI_HOST_TPC_REGINDEX_MAX *
+	     WMI_HOST_ARRAY_GAIN_NUM_STREAMS) != 0) {
+		WMI_LOGE("Array gain table len not correct");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	table_tlv_len = WMI_TLV_HDR_SIZE +
+		roundup(param->tbl_len, sizeof(uint32_t));
+	len = sizeof(*cmd) + table_tlv_len;
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	buf_ptr = wmi_buf_data(buf);
+	qdf_mem_zero(buf_ptr, len);
+
+	cmd = (wmi_pdev_set_mimogain_table_cmd_fixed_param *)buf_ptr;
+
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_pdev_set_mimogain_table_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(
+		       wmi_pdev_set_mimogain_table_cmd_fixed_param));
+
+	cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
+								param->pdev_id);
+	WMI_MIMOGAIN_ARRAY_GAIN_LEN_SET(cmd->mimogain_info, param->tbl_len);
+	WMI_MIMOGAIN_MULTI_CHAIN_BYPASS_SET(cmd->mimogain_info,
+					    param->multichain_gain_bypass);
+
+	buf_ptr += sizeof(*cmd);
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32,
+		       (param->tbl_len));
+	buf_ptr += WMI_TLV_HDR_SIZE;
+	gain_table = (uint32_t *)buf_ptr;
+
+	WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(gain_table,
+					param->array_gain,
+					param->tbl_len);
+
+	wmi_mtrace(WMI_PDEV_SET_MIMOGAIN_TABLE_CMDID, NO_SESSION, 0);
+	if (wmi_unified_cmd_send(wmi_handle, buf, len,
+				 WMI_PDEV_SET_MIMOGAIN_TABLE_CMDID)) {
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * enum packet_power_tlv_flags: target defined
+ * packet power rate flags for TLV
+ * @WMI_TLV_FLAG_ONE_CHAIN: one chain
+ * @WMI_TLV_FLAG_TWO_CHAIN: two chain
+ * @WMI_TLV_FLAG_THREE_CHAIN: three chain
+ * @WMI_TLV_FLAG_FOUR_CHAIN: four chain
+ * @WMI_TLV_FLAG_FIVE_CHAIN: five chain
+ * @WMI_TLV_FLAG_SIX_CHAIN: six chain
+ * @WMI_TLV_FLAG_SEVEN_CHAIN: seven chain
+ * @WMI_TLV_FLAG_EIGHT_CHAIN:eight chain
+ * @WMI_TLV_FLAG_STBC: STBC is set
+ * @WMI_TLV_FLAG_40MHZ: 40MHz chan width
+ * @WMI_TLV_FLAG_80MHZ: 80MHz chan width
+ * @WMI_TLV_FLAG_160MHZ: 160MHz chan width
+ * @WMI_TLV_FLAG_TXBF: Tx Bf enabled
+ * @WMI_TLV_FLAG_RTSENA: RTS enabled
+ * @WMI_TLV_FLAG_CTSENA: CTS enabled
+ * @WMI_TLV_FLAG_LDPC: LDPC is set
+ * @WMI_TLV_FLAG_SGI: Short gaurd interval
+ * @WMI_TLV_FLAG_SU: SU Data
+ * @WMI_TLV_FLAG_DL_MU_MIMO_AC: DL AC MU data
+ * @WMI_TLV_FLAG_DL_MU_MIMO_AX: DL AX MU data
+ * @WMI_TLV_FLAG_DL_OFDMA: DL OFDMA data
+ * @WMI_TLV_FLAG_UL_OFDMA: UL OFDMA data
+ * @WMI_TLV_FLAG_UL_MU_MIMO: UL MU data
+ *
+ * @WMI_TLV_FLAG_BW_MASK: bandwidth mask
+ * @WMI_TLV_FLAG_BW_SHIFT: bandwidth shift
+ * @WMI_TLV_FLAG_SU_MU_OFDMA_MASK: su/mu/ofdma mask
+ * @WMI_TLV_FLAG_SU_MU_OFDMA_shift: su/mu/ofdma shift
+ */
+enum packet_power_tlv_flags {
+	WMI_TLV_FLAG_ONE_CHAIN	 = 0x00000001,
+	WMI_TLV_FLAG_TWO_CHAIN	 = 0x00000003,
+	WMI_TLV_FLAG_THREE_CHAIN       = 0x00000007,
+	WMI_TLV_FLAG_FOUR_CHAIN	= 0x0000000F,
+	WMI_TLV_FLAG_FIVE_CHAIN	= 0x0000001F,
+	WMI_TLV_FLAG_SIX_CHAIN	 = 0x0000003F,
+	WMI_TLV_FLAG_SEVEN_CHAIN       = 0x0000007F,
+	WMI_TLV_FLAG_EIGHT_CHAIN       = 0x0000008F,
+	WMI_TLV_FLAG_STBC	      = 0x00000100,
+	WMI_TLV_FLAG_40MHZ	     = 0x00000200,
+	WMI_TLV_FLAG_80MHZ	     = 0x00000300,
+	WMI_TLV_FLAG_160MHZ	    = 0x00000400,
+	WMI_TLV_FLAG_TXBF	      = 0x00000800,
+	WMI_TLV_FLAG_RTSENA	    = 0x00001000,
+	WMI_TLV_FLAG_CTSENA	    = 0x00002000,
+	WMI_TLV_FLAG_LDPC	      = 0x00004000,
+	WMI_TLV_FLAG_SGI	       = 0x00008000,
+	WMI_TLV_FLAG_SU		= 0x00100000,
+	WMI_TLV_FLAG_DL_MU_MIMO_AC     = 0x00200000,
+	WMI_TLV_FLAG_DL_MU_MIMO_AX     = 0x00300000,
+	WMI_TLV_FLAG_DL_OFDMA	  = 0x00400000,
+	WMI_TLV_FLAG_UL_OFDMA	  = 0x00500000,
+	WMI_TLV_FLAG_UL_MU_MIMO	= 0x00600000,
+
+	WMI_TLV_FLAG_CHAIN_MASK	= 0xff,
+	WMI_TLV_FLAG_BW_MASK	   = 0x3,
+	WMI_TLV_FLAG_BW_SHIFT	  = 9,
+	WMI_TLV_FLAG_SU_MU_OFDMA_MASK  = 0x7,
+	WMI_TLV_FLAG_SU_MU_OFDMA_SHIFT = 20,
+};
+
+/**
+ * convert_to_power_info_rate_flags() - convert packet_power_info_params
+ * to FW understandable format
+ * @param: pointer to hold packet power info param
+ *
+ * @return FW understandable 32 bit rate flags
+ */
+static uint32_t
+convert_to_power_info_rate_flags(struct packet_power_info_params *param)
+{
+	uint32_t rateflags = 0;
+
+	if (param->chainmask)
+		rateflags |=
+			(param->chainmask & WMI_TLV_FLAG_CHAIN_MASK);
+	if (param->chan_width)
+		rateflags |=
+			((param->chan_width & WMI_TLV_FLAG_BW_MASK)
+			 << WMI_TLV_FLAG_BW_SHIFT);
+	if (param->su_mu_ofdma)
+		rateflags |=
+			((param->su_mu_ofdma & WMI_TLV_FLAG_SU_MU_OFDMA_MASK)
+			 << WMI_TLV_FLAG_SU_MU_OFDMA_SHIFT);
+	if (param->rate_flags & WMI_HOST_FLAG_STBC)
+		rateflags |= WMI_TLV_FLAG_STBC;
+	if (param->rate_flags & WMI_HOST_FLAG_LDPC)
+		rateflags |= WMI_TLV_FLAG_LDPC;
+	if (param->rate_flags & WMI_HOST_FLAG_TXBF)
+		rateflags |= WMI_TLV_FLAG_TXBF;
+	if (param->rate_flags & WMI_HOST_FLAG_RTSENA)
+		rateflags |= WMI_TLV_FLAG_RTSENA;
+	if (param->rate_flags & WMI_HOST_FLAG_CTSENA)
+		rateflags |= WMI_TLV_FLAG_CTSENA;
+	if (param->rate_flags & WMI_HOST_FLAG_SGI)
+		rateflags |= WMI_TLV_FLAG_SGI;
+
+	return rateflags;
+}
+
+/**
+ * send_packet_power_info_get_cmd_tlv() - send request to get packet power
+ * info to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to hold packet power info param
+ *
+ * @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS
+send_packet_power_info_get_cmd_tlv(wmi_unified_t wmi_handle,
+				   struct packet_power_info_params *param)
+{
+	wmi_pdev_get_tpc_cmd_fixed_param *cmd;
+	wmi_buf_t wmibuf;
+	uint8_t *buf_ptr;
+	u_int32_t len = sizeof(wmi_pdev_get_tpc_cmd_fixed_param);
+
+	wmibuf = wmi_buf_alloc(wmi_handle, len);
+	if (wmibuf == NULL)
+		return QDF_STATUS_E_NOMEM;
+
+	buf_ptr = (uint8_t *)wmi_buf_data(wmibuf);
+
+	cmd = (wmi_pdev_get_tpc_cmd_fixed_param *)buf_ptr;
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_pdev_get_tpc_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				wmi_pdev_get_tpc_cmd_fixed_param));
+	cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
+								param->pdev_id);
+	cmd->rate_flags = convert_to_power_info_rate_flags(param);
+	cmd->nss = param->nss;
+	cmd->preamble = param->preamble;
+	cmd->hw_rate = param->hw_rate;
+
+	WMI_LOGI("%s[%d] commandID %d, wmi_pdev_get_tpc_cmd=0x%x,"
+		"rate_flags: 0x%x, nss: %d, preamble: %d, hw_rate: %d",
+		__func__, __LINE__, WMI_PDEV_GET_TPC_CMDID, *((u_int32_t *)cmd),
+		cmd->rate_flags, cmd->nss, cmd->preamble, cmd->hw_rate);
+
+	wmi_mtrace(WMI_PDEV_GET_TPC_CMDID, NO_SESSION, 0);
+	if (wmi_unified_cmd_send(wmi_handle, wmibuf, len,
+				 WMI_PDEV_GET_TPC_CMDID)) {
+			WMI_LOGE(FL("Failed to get tpc command"));
+			wmi_buf_free(wmibuf);
+			return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * send_vdev_config_ratemask_cmd_tlv() - config ratemask param in fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to hold config ratemask params
+ *
+ *  @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS send_vdev_config_ratemask_cmd_tlv(wmi_unified_t wmi_handle,
+					struct config_ratemask_params *param)
+{
+	wmi_vdev_config_ratemask_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	int32_t len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+	cmd = (wmi_vdev_config_ratemask_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_vdev_config_ratemask_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				wmi_vdev_config_ratemask_cmd_fixed_param));
+	cmd->vdev_id = param->vdev_id;
+	cmd->type = param->type;
+	cmd->mask_lower32 = param->lower32;
+	cmd->mask_higher32 = param->higher32;
+	cmd->mask_lower32_2 = param->lower32_2;
+	WMI_LOGI("Setting vdev ratemask vdev id = 0x%X, type = 0x%X"
+		"mask_l32 = 0x%X mask_h32 = 0x%X mask_l32_2 = 0x%X",
+		param->vdev_id, param->type, param->lower32,
+		param->higher32, param->lower32_2);
+
+	wmi_mtrace(WMI_VDEV_RATEMASK_CMDID, cmd->vdev_id, 0);
+	if (wmi_unified_cmd_send(wmi_handle, buf, len,
+				 WMI_VDEV_RATEMASK_CMDID)) {
+			WMI_LOGE("Seting vdev ratemask failed");
+			wmi_buf_free(buf);
+			return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * send_vdev_set_neighbour_rx_cmd_tlv() - set neighbour rx param in fw
+ * @wmi_handle: wmi handle
+ * @macaddr: vdev mac address
+ * @param: pointer to hold neigbour rx param
+ *
+ *  @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS send_vdev_set_neighbour_rx_cmd_tlv(wmi_unified_t wmi_handle,
+					uint8_t macaddr[IEEE80211_ADDR_LEN],
+					struct set_neighbour_rx_params *param)
+{
+	wmi_vdev_filter_nrp_config_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	int32_t len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+	cmd = (wmi_vdev_filter_nrp_config_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_vdev_filter_nrp_config_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(
+			wmi_vdev_filter_nrp_config_cmd_fixed_param));
+	cmd->vdev_id = param->vdev_id;
+	cmd->bssid_idx = param->idx;
+	cmd->action = param->action;
+	cmd->type = param->type;
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->addr);
+	cmd->flag = 0;
+
+	wmi_mtrace(WMI_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID, cmd->vdev_id, 0);
+	if (wmi_unified_cmd_send(wmi_handle, buf, len,
+				 WMI_VDEV_FILTER_NEIGHBOR_RX_PACKETS_CMDID)) {
+			WMI_LOGE("Failed to set neighbour rx param");
+			wmi_buf_free(buf);
+			return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * send_nf_dbr_dbm_info_get_cmd_tlv() - send request to get nf to fw
+ * @wmi_handle: wmi handle
+ * @mac_id: radio context
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+send_nf_dbr_dbm_info_get_cmd_tlv(wmi_unified_t wmi_handle, uint8_t mac_id)
+{
+	wmi_buf_t buf;
+	QDF_STATUS ret;
+	wmi_pdev_get_nfcal_power_fixed_param *cmd;
+	int32_t len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (buf == NULL)
+		return QDF_STATUS_E_NOMEM;
+
+	cmd = (wmi_pdev_get_nfcal_power_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_pdev_get_nfcal_power_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN
+				(wmi_pdev_get_nfcal_power_fixed_param));
+	cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(mac_id);
+
+	wmi_mtrace(WMI_PDEV_GET_NFCAL_POWER_CMDID, NO_SESSION, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
+				   WMI_PDEV_GET_NFCAL_POWER_CMDID);
+	if (ret != 0) {
+		WMI_LOGE("Sending get nfcal power cmd failed");
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ * send_set_ht_ie_cmd_tlv() - send ht ie command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to ht ie param
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+send_set_ht_ie_cmd_tlv(wmi_unified_t wmi_handle,
+		       struct ht_ie_params *param)
+{
+	wmi_pdev_set_ht_ie_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	QDF_STATUS ret;
+	int32_t len;
+	uint8_t *buf_ptr;
+
+	len = sizeof(*cmd)  + WMI_TLV_HDR_SIZE +
+	      roundup(param->ie_len, sizeof(uint32_t));
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	buf_ptr = (uint8_t *)wmi_buf_data(buf);
+	cmd = (wmi_pdev_set_ht_ie_cmd_fixed_param *)buf_ptr;
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_pdev_set_ht_ie_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				wmi_pdev_set_ht_ie_cmd_fixed_param));
+	cmd->reserved0 = 0;
+	cmd->ie_len = param->ie_len;
+	cmd->tx_streams = param->tx_streams;
+	cmd->rx_streams = param->rx_streams;
+
+	buf_ptr += sizeof(*cmd);
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len);
+	buf_ptr += WMI_TLV_HDR_SIZE;
+	if (param->ie_len)
+		WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data,
+						cmd->ie_len);
+
+	wmi_mtrace(WMI_PDEV_SET_HT_CAP_IE_CMDID, NO_SESSION, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
+				   WMI_PDEV_SET_HT_CAP_IE_CMDID);
+
+	if (ret != 0) {
+		WMI_LOGE("Sending set ht ie cmd failed");
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ * send_set_vht_ie_cmd_tlv() - send vht ie command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to vht ie param
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+send_set_vht_ie_cmd_tlv(wmi_unified_t wmi_handle,
+			struct vht_ie_params *param)
+{
+	wmi_pdev_set_vht_ie_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	QDF_STATUS ret;
+	int32_t len;
+	uint8_t *buf_ptr;
+
+	len = sizeof(*cmd)  + WMI_TLV_HDR_SIZE +
+	      roundup(param->ie_len, sizeof(uint32_t));
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	buf_ptr = (uint8_t *)wmi_buf_data(buf);
+	cmd = (wmi_pdev_set_vht_ie_cmd_fixed_param *)buf_ptr;
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_pdev_set_vht_ie_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				wmi_pdev_set_vht_ie_cmd_fixed_param));
+	cmd->reserved0 = 0;
+	cmd->ie_len = param->ie_len;
+	cmd->tx_streams = param->tx_streams;
+	cmd->rx_streams = param->rx_streams;
+
+	buf_ptr += sizeof(*cmd);
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE, cmd->ie_len);
+	buf_ptr += WMI_TLV_HDR_SIZE;
+	if (param->ie_len)
+		WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(buf_ptr, param->ie_data,
+						cmd->ie_len);
+
+	wmi_mtrace(WMI_PDEV_SET_VHT_CAP_IE_CMDID, NO_SESSION, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
+				   WMI_PDEV_SET_VHT_CAP_IE_CMDID);
+
+	if (ret != 0) {
+		WMI_LOGE("Sending set vht ie cmd failed");
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ * send_set_quiet_mode_cmd_tlv() - send set quiet mode command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to quiet mode params
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+send_set_quiet_mode_cmd_tlv(wmi_unified_t wmi_handle,
+			    struct set_quiet_mode_params *param)
+{
+	wmi_pdev_set_quiet_cmd_fixed_param *quiet_cmd;
+	wmi_buf_t buf;
+	QDF_STATUS ret;
+	int32_t len;
+
+	len = sizeof(*quiet_cmd);
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&quiet_cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_pdev_set_quiet_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				wmi_pdev_set_quiet_cmd_fixed_param));
+	quiet_cmd = (wmi_pdev_set_quiet_cmd_fixed_param *)wmi_buf_data(buf);
+	quiet_cmd->enabled = param->enabled;
+	quiet_cmd->period = (param->period)*(param->intval);
+	quiet_cmd->duration = param->duration;
+	quiet_cmd->next_start = param->offset;
+	quiet_cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
+							WMI_HOST_PDEV_ID_SOC);
+
+	wmi_mtrace(WMI_PDEV_SET_QUIET_MODE_CMDID, NO_SESSION, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
+				   WMI_PDEV_SET_QUIET_MODE_CMDID);
+
+	if (ret != 0) {
+		WMI_LOGE("Sending set quiet cmd failed");
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ * send_bcn_offload_control_cmd_tlv - send beacon ofload control cmd to fw
+ * @wmi_handle: wmi handle
+ * @bcn_ctrl_param: pointer to bcn_offload_control param
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static
+QDF_STATUS send_bcn_offload_control_cmd_tlv(wmi_unified_t wmi_handle,
+			struct bcn_offload_control *bcn_ctrl_param)
+{
+	wmi_buf_t buf;
+	wmi_bcn_offload_ctrl_cmd_fixed_param *cmd;
+	QDF_STATUS ret;
+	uint32_t len;
+
+	len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		qdf_print("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cmd = (wmi_bcn_offload_ctrl_cmd_fixed_param *) wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+			WMITLV_TAG_STRUC_wmi_bcn_offload_ctrl_cmd_fixed_param,
+			WMITLV_GET_STRUCT_TLVLEN
+			(wmi_bcn_offload_ctrl_cmd_fixed_param));
+	cmd->vdev_id = bcn_ctrl_param->vdev_id;
+	switch (bcn_ctrl_param->bcn_ctrl_op) {
+	case BCN_OFFLD_CTRL_TX_DISABLE:
+		cmd->bcn_ctrl_op = WMI_BEACON_CTRL_TX_DISABLE;
+		break;
+	case BCN_OFFLD_CTRL_TX_ENABLE:
+		cmd->bcn_ctrl_op = WMI_BEACON_CTRL_TX_ENABLE;
+		break;
+	case BCN_OFFLD_CTRL_SWBA_DISABLE:
+		cmd->bcn_ctrl_op = WMI_BEACON_CTRL_SWBA_EVENT_DISABLE;
+		break;
+	case BCN_OFFLD_CTRL_SWBA_ENABLE:
+		cmd->bcn_ctrl_op = WMI_BEACON_CTRL_SWBA_EVENT_ENABLE;
+		break;
+	default:
+		WMI_LOGE("WMI_BCN_OFFLOAD_CTRL_CMDID unknown CTRL Operation %d",
+			bcn_ctrl_param->bcn_ctrl_op);
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+		break;
+	}
+	wmi_mtrace(WMI_BCN_OFFLOAD_CTRL_CMDID, cmd->vdev_id, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
+			WMI_BCN_OFFLOAD_CTRL_CMDID);
+
+	if (QDF_IS_STATUS_ERROR(ret)) {
+		WMI_LOGE("WMI_BCN_OFFLOAD_CTRL_CMDID send returned Error %d",
+				ret);
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ * extract_tbttoffset_num_vdevs_tlv() - extract tbtt offset num vdev
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param num_vdevs: Pointer to hold num vdev
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_tbttoffset_num_vdevs_tlv(void *wmi_hdl,
+	void *evt_buf, uint32_t *num_vdevs)
+{
+	WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf;
+	wmi_tbtt_offset_event_fixed_param *tbtt_offset_event;
+	uint32_t vdev_map;
+
+	param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *)evt_buf;
+	if (!param_buf) {
+		qdf_print("Invalid tbtt update ext event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+	tbtt_offset_event = param_buf->fixed_param;
+	vdev_map = tbtt_offset_event->vdev_map;
+	*num_vdevs = wmi_vdev_map_to_num_vdevs(vdev_map);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_ext_tbttoffset_num_vdevs_tlv() - extract ext tbtt offset num vdev
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param num_vdevs: Pointer to hold num vdev
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_ext_tbttoffset_num_vdevs_tlv(void *wmi_hdl,
+	void *evt_buf, uint32_t *num_vdevs)
+{
+	WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *param_buf;
+	wmi_tbtt_offset_ext_event_fixed_param *tbtt_offset_ext_event;
+
+	param_buf = (WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *)evt_buf;
+	if (!param_buf) {
+		qdf_print("Invalid tbtt update ext event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+	tbtt_offset_ext_event = param_buf->fixed_param;
+
+	*num_vdevs = tbtt_offset_ext_event->num_vdevs;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_tbttoffset_update_params_tlv() - extract tbtt offset param
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param idx: Index referring to a vdev
+ * @param tbtt_param: Pointer to tbttoffset event param
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_tbttoffset_update_params_tlv(void *wmi_hdl,
+	void *evt_buf, uint8_t idx,
+	struct tbttoffset_params *tbtt_param)
+{
+	WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *param_buf;
+	wmi_tbtt_offset_event_fixed_param *tbtt_offset_event;
+	uint32_t vdev_map;
+
+	param_buf = (WMI_TBTTOFFSET_UPDATE_EVENTID_param_tlvs *) evt_buf;
+	if (!param_buf) {
+		qdf_print("Invalid tbtt update event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	tbtt_offset_event = param_buf->fixed_param;
+	vdev_map = tbtt_offset_event->vdev_map;
+	tbtt_param->vdev_id = wmi_vdev_map_to_vdev_id(vdev_map, idx);
+	if (tbtt_param->vdev_id == WLAN_INVALID_VDEV_ID)
+		return QDF_STATUS_E_INVAL;
+	tbtt_param->tbttoffset =
+		param_buf->tbttoffset_list[tbtt_param->vdev_id];
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_ext_tbttoffset_update_params_tlv() - extract ext tbtt offset param
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param idx: Index referring to a vdev
+ * @param tbtt_param: Pointer to tbttoffset event param
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_ext_tbttoffset_update_params_tlv(void *wmi_hdl,
+	void *evt_buf, uint8_t idx,
+	struct tbttoffset_params *tbtt_param)
+{
+	WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *param_buf;
+	wmi_tbtt_offset_info *tbtt_offset_info;
+
+	param_buf = (WMI_TBTTOFFSET_EXT_UPDATE_EVENTID_param_tlvs *)evt_buf;
+	if (!param_buf) {
+		qdf_print("Invalid tbtt update event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+	tbtt_offset_info = &param_buf->tbtt_offset_info[idx];
+
+	tbtt_param->vdev_id = tbtt_offset_info->vdev_id;
+	tbtt_param->tbttoffset = tbtt_offset_info->tbttoffset;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_swba_num_vdevs_tlv() - extract swba num vdevs from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param num_vdevs: Pointer to hold num vdevs
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_swba_num_vdevs_tlv(wmi_unified_t wmi_handle,
+	void *evt_buf, uint32_t *num_vdevs)
+{
+	WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf;
+	wmi_host_swba_event_fixed_param *swba_event;
+	uint32_t vdev_map;
+
+	param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf;
+	if (!param_buf) {
+		WMI_LOGE("Invalid swba event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	swba_event = param_buf->fixed_param;
+	*num_vdevs = swba_event->num_vdevs;
+	if (!(*num_vdevs)) {
+		vdev_map = swba_event->vdev_map;
+		*num_vdevs = wmi_vdev_map_to_num_vdevs(vdev_map);
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_swba_tim_info_tlv() - extract swba tim info from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param idx: Index to bcn info
+ * @param tim_info: Pointer to hold tim info
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_swba_tim_info_tlv(wmi_unified_t wmi_handle,
+	void *evt_buf, uint32_t idx, wmi_host_tim_info *tim_info)
+{
+	WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf;
+	wmi_tim_info *tim_info_ev;
+
+	param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf;
+	if (!param_buf) {
+		WMI_LOGE("Invalid swba event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	tim_info_ev = &param_buf->tim_info[idx];
+
+	tim_info->tim_len = tim_info_ev->tim_len;
+	tim_info->tim_mcast = tim_info_ev->tim_mcast;
+	qdf_mem_copy(tim_info->tim_bitmap, tim_info_ev->tim_bitmap,
+			(sizeof(uint32_t) * WMI_TIM_BITMAP_ARRAY_SIZE));
+	tim_info->tim_changed = tim_info_ev->tim_changed;
+	tim_info->tim_num_ps_pending = tim_info_ev->tim_num_ps_pending;
+	tim_info->vdev_id = tim_info_ev->vdev_id;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_swba_noa_info_tlv() - extract swba NoA information from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param idx: Index to bcn info
+ * @param p2p_desc: Pointer to hold p2p NoA info
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_swba_noa_info_tlv(wmi_unified_t wmi_handle,
+	void *evt_buf, uint32_t idx, wmi_host_p2p_noa_info *p2p_desc)
+{
+	WMI_HOST_SWBA_EVENTID_param_tlvs *param_buf;
+	wmi_p2p_noa_info *p2p_noa_info;
+	uint8_t i = 0;
+
+	param_buf = (WMI_HOST_SWBA_EVENTID_param_tlvs *) evt_buf;
+	if (!param_buf) {
+		WMI_LOGE("Invalid swba event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	p2p_noa_info = &param_buf->p2p_noa_info[idx];
+
+	p2p_desc->modified = false;
+	p2p_desc->num_descriptors = 0;
+	if (WMI_UNIFIED_NOA_ATTR_IS_MODIFIED(p2p_noa_info)) {
+		p2p_desc->modified = true;
+		p2p_desc->index =
+			(uint8_t) WMI_UNIFIED_NOA_ATTR_INDEX_GET(p2p_noa_info);
+		p2p_desc->oppPS =
+			(uint8_t) WMI_UNIFIED_NOA_ATTR_OPP_PS_GET(p2p_noa_info);
+		p2p_desc->ctwindow =
+			(uint8_t) WMI_UNIFIED_NOA_ATTR_CTWIN_GET(p2p_noa_info);
+		p2p_desc->num_descriptors =
+			(uint8_t) WMI_UNIFIED_NOA_ATTR_NUM_DESC_GET
+							(p2p_noa_info);
+		for (i = 0; i < p2p_desc->num_descriptors; i++) {
+			p2p_desc->noa_descriptors[i].type_count =
+				(uint8_t) p2p_noa_info->noa_descriptors[i].
+				type_count;
+			p2p_desc->noa_descriptors[i].duration =
+				p2p_noa_info->noa_descriptors[i].duration;
+			p2p_desc->noa_descriptors[i].interval =
+				p2p_noa_info->noa_descriptors[i].interval;
+			p2p_desc->noa_descriptors[i].start_time =
+				p2p_noa_info->noa_descriptors[i].start_time;
+		}
+		p2p_desc->vdev_id = p2p_noa_info->vdev_id;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_offchan_data_tx_compl_param_tlv() -
+ *	    extract Offchan data tx completion event params
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold offchan data TX completion params
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_offchan_data_tx_compl_param_tlv(
+		wmi_unified_t wmi_handle, void *evt_buf,
+		struct wmi_host_offchan_data_tx_compl_event *param)
+{
+	WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *param_buf;
+	wmi_offchan_data_tx_compl_event_fixed_param *cmpl_params;
+
+	param_buf = (WMI_OFFCHAN_DATA_TX_COMPLETION_EVENTID_param_tlvs *)
+		evt_buf;
+	if (!param_buf) {
+		WMI_LOGE("%s: Invalid offchan data Tx compl event", __func__);
+		return QDF_STATUS_E_INVAL;
+	}
+	cmpl_params = param_buf->fixed_param;
+
+	param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host(
+							cmpl_params->pdev_id);
+	param->desc_id = cmpl_params->desc_id;
+	param->status = cmpl_params->status;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_pdev_csa_switch_count_status_tlv() - extract pdev csa switch count
+ *					      status tlv
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold csa switch count status event param
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_pdev_csa_switch_count_status_tlv(
+				wmi_unified_t wmi_handle,
+				void *evt_buf,
+				struct pdev_csa_switch_count_status *param)
+{
+	WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *param_buf;
+	wmi_pdev_csa_switch_count_status_event_fixed_param *csa_status;
+
+	param_buf = (WMI_PDEV_CSA_SWITCH_COUNT_STATUS_EVENTID_param_tlvs *)
+		     evt_buf;
+	if (!param_buf) {
+		WMI_LOGE("%s: Invalid CSA status event", __func__);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	csa_status = param_buf->fixed_param;
+
+	param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host(
+							csa_status->pdev_id);
+	param->current_switch_count = csa_status->current_switch_count;
+	param->num_vdevs = csa_status->num_vdevs;
+	param->vdev_ids = param_buf->vdev_ids;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_pdev_tpc_config_ev_param_tlv() - extract pdev tpc configuration
+ * param from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold tpc configuration
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS extract_pdev_tpc_config_ev_param_tlv(wmi_unified_t wmi_handle,
+		void *evt_buf,
+		wmi_host_pdev_tpc_config_event *param)
+{
+	wmi_pdev_tpc_config_event_fixed_param *event =
+		(wmi_pdev_tpc_config_event_fixed_param *)evt_buf;
+
+	if (!event) {
+		WMI_LOGE("Invalid event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	param->pdev_id = event->pdev_id;
+	param->regDomain = event->regDomain;
+	param->chanFreq = event->chanFreq;
+	param->phyMode = event->phyMode;
+	param->twiceAntennaReduction = event->twiceAntennaReduction;
+	param->twiceAntennaGain = event->twiceAntennaGain;
+	param->twiceMaxRDPower = event->twiceMaxRDPower;
+	param->powerLimit = event->powerLimit;
+	param->rateMax = event->rateMax;
+	param->numTxChain = event->numTxChain;
+	param->ctl = event->ctl;
+	param->flags = event->flags;
+
+	qdf_mem_copy(param->maxRegAllowedPower, event->maxRegAllowedPower,
+		sizeof(param->maxRegAllowedPower));
+	qdf_mem_copy(param->maxRegAllowedPowerAGCDD,
+		event->maxRegAllowedPowerAGCDD,
+		sizeof(param->maxRegAllowedPowerAGCDD));
+	qdf_mem_copy(param->maxRegAllowedPowerAGSTBC,
+		event->maxRegAllowedPowerAGSTBC,
+		sizeof(param->maxRegAllowedPowerAGSTBC));
+	qdf_mem_copy(param->maxRegAllowedPowerAGTXBF,
+		event->maxRegAllowedPowerAGTXBF,
+		sizeof(param->maxRegAllowedPowerAGTXBF));
+	WMI_LOGD("%s:extract success", __func__);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_peer_sta_kickout_ev_tlv() - extract peer sta kickout event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param ev: Pointer to hold peer param
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_peer_sta_kickout_ev_tlv(wmi_unified_t wmi_handle,
+	void *evt_buf, wmi_host_peer_sta_kickout_event *ev)
+{
+	WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *param_buf = NULL;
+	wmi_peer_sta_kickout_event_fixed_param *kickout_event = NULL;
+
+	param_buf = (WMI_PEER_STA_KICKOUT_EVENTID_param_tlvs *) evt_buf;
+	kickout_event = param_buf->fixed_param;
+
+	WMI_MAC_ADDR_TO_CHAR_ARRAY(&kickout_event->peer_macaddr,
+							ev->peer_macaddr);
+
+	ev->reason = kickout_event->reason;
+	ev->rssi = kickout_event->rssi;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * send_multiple_vdev_restart_req_cmd_tlv() - send multiple vdev restart req
+ * @wmi_handle: wmi handle
+ * @param: wmi multiple vdev restart req param
+ *
+ * Send WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID parameters to fw.
+ *
+ * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
+ */
+static QDF_STATUS send_multiple_vdev_restart_req_cmd_tlv(
+				wmi_unified_t wmi_handle,
+				struct multiple_vdev_restart_params *param)
+{
+	wmi_buf_t buf;
+	QDF_STATUS qdf_status;
+	wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *cmd;
+	int i;
+	uint8_t *buf_ptr;
+	uint32_t *vdev_ids;
+	wmi_channel *chan_info;
+	struct channel_param *tchan_info;
+	uint16_t len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
+
+	len += sizeof(wmi_channel);
+	if (param->num_vdevs)
+		len += sizeof(uint32_t) * param->num_vdevs;
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("Failed to allocate memory");
+		qdf_status = QDF_STATUS_E_NOMEM;
+		goto end;
+	}
+
+	buf_ptr = (uint8_t *)wmi_buf_data(buf);
+	cmd = (wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param *)
+	       buf_ptr;
+
+	WMITLV_SET_HDR(&cmd->tlv_header,
+	WMITLV_TAG_STRUC_wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param,
+	WMITLV_GET_STRUCT_TLVLEN
+		(wmi_pdev_multiple_vdev_restart_request_cmd_fixed_param));
+	cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
+								param->pdev_id);
+	cmd->requestor_id = param->requestor_id;
+	cmd->disable_hw_ack = param->disable_hw_ack;
+	cmd->cac_duration_ms = param->cac_duration_ms;
+	cmd->num_vdevs = param->num_vdevs;
+
+	WMI_LOGI("%s:cmd->pdev_id: %d ,cmd->requestor_id: %d ,"
+		"cmd->disable_hw_ack: %d , cmd->cac_duration_ms:%d ,"
+		" cmd->num_vdevs: %d ",
+		__func__, cmd->pdev_id, cmd->requestor_id,
+		cmd->disable_hw_ack, cmd->cac_duration_ms, cmd->num_vdevs);
+	buf_ptr += sizeof(*cmd);
+
+	WMITLV_SET_HDR(buf_ptr,
+		       WMITLV_TAG_ARRAY_UINT32,
+		       sizeof(uint32_t) * param->num_vdevs);
+	vdev_ids = (uint32_t *)(buf_ptr + WMI_TLV_HDR_SIZE);
+	for (i = 0; i < param->num_vdevs; i++)
+		vdev_ids[i] = param->vdev_ids[i];
+
+	buf_ptr += (sizeof(uint32_t) * param->num_vdevs) + WMI_TLV_HDR_SIZE;
+
+	WMITLV_SET_HDR(buf_ptr,
+		       WMITLV_TAG_STRUC_wmi_channel,
+		       WMITLV_GET_STRUCT_TLVLEN(wmi_channel));
+	chan_info = (wmi_channel *)buf_ptr;
+	tchan_info = &(param->ch_param);
+	chan_info->mhz = tchan_info->mhz;
+	chan_info->band_center_freq1 = tchan_info->cfreq1;
+	chan_info->band_center_freq2 = tchan_info->cfreq2;
+	if (tchan_info->is_chan_passive)
+		WMI_SET_CHANNEL_FLAG(chan_info,
+				     WMI_CHAN_FLAG_PASSIVE);
+	if (tchan_info->dfs_set)
+		WMI_SET_CHANNEL_FLAG(chan_info, WMI_CHAN_FLAG_DFS);
+
+	if (tchan_info->allow_vht)
+		WMI_SET_CHANNEL_FLAG(chan_info,
+				     WMI_CHAN_FLAG_ALLOW_VHT);
+	else  if (tchan_info->allow_ht)
+		WMI_SET_CHANNEL_FLAG(chan_info,
+				     WMI_CHAN_FLAG_ALLOW_HT);
+	WMI_SET_CHANNEL_MODE(chan_info, tchan_info->phy_mode);
+	WMI_SET_CHANNEL_MIN_POWER(chan_info, tchan_info->minpower);
+	WMI_SET_CHANNEL_MAX_POWER(chan_info, tchan_info->maxpower);
+	WMI_SET_CHANNEL_REG_POWER(chan_info, tchan_info->maxregpower);
+	WMI_SET_CHANNEL_ANTENNA_MAX(chan_info, tchan_info->antennamax);
+	WMI_SET_CHANNEL_REG_CLASSID(chan_info, tchan_info->reg_class_id);
+	WMI_SET_CHANNEL_MAX_TX_POWER(chan_info, tchan_info->maxregpower);
+
+	WMI_LOGI("%s:tchan_info->is_chan_passive: %d ,"
+		"tchan_info->dfs_set : %d ,tchan_info->allow_vht:%d ,"
+		"tchan_info->allow_ht: %d ,tchan_info->antennamax: %d ,"
+		"tchan_info->phy_mode: %d ,tchan_info->minpower: %d,"
+		"tchan_info->maxpower: %d ,tchan_info->maxregpower: %d ,"
+		"tchan_info->reg_class_id: %d ,"
+		"tchan_info->maxregpower : %d ", __func__,
+		tchan_info->is_chan_passive, tchan_info->dfs_set,
+		tchan_info->allow_vht, tchan_info->allow_ht,
+		tchan_info->antennamax, tchan_info->phy_mode,
+		tchan_info->minpower, tchan_info->maxpower,
+		tchan_info->maxregpower, tchan_info->reg_class_id,
+		tchan_info->maxregpower);
+
+	wmi_mtrace(WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID, NO_SESSION, 0);
+	qdf_status = wmi_unified_cmd_send(wmi_handle, buf, len,
+				WMI_PDEV_MULTIPLE_VDEV_RESTART_REQUEST_CMDID);
+
+	if (QDF_IS_STATUS_ERROR(qdf_status)) {
+		WMI_LOGE("%s: Failed to send", __func__);
+		wmi_buf_free(buf);
+	}
+
+end:
+	return qdf_status;
+}
+
+/**
+ * extract_dcs_interference_type_tlv() - extract dcs interference type
+ * from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold dcs interference param
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS extract_dcs_interference_type_tlv(
+		wmi_unified_t wmi_handle,
+		void *evt_buf, struct wmi_host_dcs_interference_param *param)
+{
+	WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf;
+
+	param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf;
+	if (!param_buf)
+		return QDF_STATUS_E_INVAL;
+
+	param->interference_type = param_buf->fixed_param->interference_type;
+	param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host(
+					param_buf->fixed_param->pdev_id);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/*
+ * extract_dcs_cw_int_tlv() - extract dcs cw interference from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param cw_int: Pointer to hold cw interference
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS extract_dcs_cw_int_tlv(wmi_unified_t wmi_handle,
+		void *evt_buf,
+		wmi_host_ath_dcs_cw_int *cw_int)
+{
+	WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf;
+	wlan_dcs_cw_int *ev;
+
+	param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf;
+	if (!param_buf)
+		return QDF_STATUS_E_INVAL;
+
+	ev = param_buf->cw_int;
+
+	cw_int->channel = ev->channel;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_dcs_im_tgt_stats_tlv() - extract dcs im target stats from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param wlan_stat: Pointer to hold wlan stats
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS extract_dcs_im_tgt_stats_tlv(wmi_unified_t wmi_handle,
+		void *evt_buf,
+		wmi_host_dcs_im_tgt_stats_t *wlan_stat)
+{
+	WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *param_buf;
+	wlan_dcs_im_tgt_stats_t *ev;
+
+	param_buf = (WMI_DCS_INTERFERENCE_EVENTID_param_tlvs *) evt_buf;
+	if (!param_buf)
+		return QDF_STATUS_E_INVAL;
+
+	ev = param_buf->wlan_stat;
+	wlan_stat->reg_tsf32 = ev->reg_tsf32;
+	wlan_stat->last_ack_rssi = ev->last_ack_rssi;
+	wlan_stat->tx_waste_time = ev->tx_waste_time;
+	wlan_stat->rx_time = ev->rx_time;
+	wlan_stat->phyerr_cnt = ev->phyerr_cnt;
+	wlan_stat->mib_stats.listen_time = ev->listen_time;
+	wlan_stat->mib_stats.reg_tx_frame_cnt = ev->reg_tx_frame_cnt;
+	wlan_stat->mib_stats.reg_rx_frame_cnt = ev->reg_rx_frame_cnt;
+	wlan_stat->mib_stats.reg_rxclr_cnt = ev->reg_rxclr_cnt;
+	wlan_stat->mib_stats.reg_cycle_cnt = ev->reg_cycle_cnt;
+	wlan_stat->mib_stats.reg_rxclr_ext_cnt = ev->reg_rxclr_ext_cnt;
+	wlan_stat->mib_stats.reg_ofdm_phyerr_cnt = ev->reg_ofdm_phyerr_cnt;
+	wlan_stat->mib_stats.reg_cck_phyerr_cnt = ev->reg_cck_phyerr_cnt;
+	wlan_stat->chan_nf = ev->chan_nf;
+	wlan_stat->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/*
+ * extract_peer_delete_response_event_tlv() - extract peer delete response event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param vdev_id: Pointer to hold vdev_id
+ * @param mac_addr: Pointer to hold peer mac address
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_peer_delete_response_event_tlv(wmi_unified_t wmi_hdl,
+	void *evt_buf, struct wmi_host_peer_delete_response_event *param)
+{
+	WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *param_buf;
+	wmi_peer_delete_resp_event_fixed_param *ev;
+
+	param_buf = (WMI_PEER_DELETE_RESP_EVENTID_param_tlvs *)evt_buf;
+
+	ev = (wmi_peer_delete_resp_event_fixed_param *) param_buf->fixed_param;
+	if (!ev) {
+		WMI_LOGE("%s: Invalid peer_delete response", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	param->vdev_id = ev->vdev_id;
+	WMI_MAC_ADDR_TO_CHAR_ARRAY(&ev->peer_macaddr,
+			&param->mac_address.bytes[0]);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_pdev_tpc_ev_param_tlv() - extract tpc param from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold tpc param
+ *
+ * @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS extract_pdev_tpc_ev_param_tlv(wmi_unified_t wmi_handle,
+		void *evt_buf,
+		wmi_host_pdev_tpc_event *param)
+{
+	WMI_PDEV_TPC_EVENTID_param_tlvs *param_buf;
+	wmi_pdev_tpc_event_fixed_param *event;
+
+	param_buf = (WMI_PDEV_TPC_EVENTID_param_tlvs *)evt_buf;
+	event = (wmi_pdev_tpc_event_fixed_param *)param_buf->fixed_param;
+
+	param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host(
+								event->pdev_id);
+	qdf_mem_copy(param->tpc, param_buf->tpc, sizeof(param->tpc));
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_nfcal_power_ev_param_tlv() - extract noise floor calibration
+ * power param from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold nf cal power param
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+extract_nfcal_power_ev_param_tlv(wmi_unified_t wmi_handle,
+			void *evt_buf,
+			wmi_host_pdev_nfcal_power_all_channels_event *param)
+{
+	WMI_PDEV_NFCAL_POWER_ALL_CHANNELS_EVENTID_param_tlvs *param_buf;
+	wmi_pdev_nfcal_power_all_channels_event_fixed_param *event;
+	wmi_pdev_nfcal_power_all_channels_nfdBr *ch_nfdbr;
+	wmi_pdev_nfcal_power_all_channels_nfdBm *ch_nfdbm;
+	wmi_pdev_nfcal_power_all_channels_freqNum *ch_freqnum;
+	uint32_t i;
+
+	param_buf =
+		(WMI_PDEV_NFCAL_POWER_ALL_CHANNELS_EVENTID_param_tlvs *)evt_buf;
+	event = param_buf->fixed_param;
+	ch_nfdbr = param_buf->nfdbr;
+	ch_nfdbm = param_buf->nfdbm;
+	ch_freqnum = param_buf->freqnum;
+
+	WMI_LOGD("pdev_id[%x], num_nfdbr[%d], num_nfdbm[%d] num_freqnum[%d]",
+		 event->pdev_id, param_buf->num_nfdbr,
+		 param_buf->num_nfdbm, param_buf->num_freqnum);
+
+	if (param_buf->num_nfdbr >
+	    WMI_HOST_RXG_CAL_CHAN_MAX * WMI_HOST_MAX_NUM_CHAINS) {
+		WMI_LOGE("invalid number of nfdBr");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (param_buf->num_nfdbm >
+	    WMI_HOST_RXG_CAL_CHAN_MAX * WMI_HOST_MAX_NUM_CHAINS) {
+		WMI_LOGE("invalid number of nfdBm");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (param_buf->num_freqnum > WMI_HOST_RXG_CAL_CHAN_MAX) {
+		WMI_LOGE("invalid number of freqNum");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	for (i = 0; i < param_buf->num_nfdbr; i++) {
+		param->nfdbr[i] = (int8_t)ch_nfdbr->nfdBr;
+		param->nfdbm[i] = (int8_t)ch_nfdbm->nfdBm;
+		ch_nfdbr++;
+		ch_nfdbm++;
+	}
+
+	for (i = 0; i < param_buf->num_freqnum; i++) {
+		param->freqnum[i] = ch_freqnum->freqNum;
+		ch_freqnum++;
+	}
+
+	param->pdev_id = wmi_handle->ops->
+		convert_pdev_id_target_to_host(event->pdev_id);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+#ifdef BIG_ENDIAN_HOST
+/**
+ * wds_addr_ev_conv_data_be() - LE to BE conversion of wds addr event
+ * @param data_len - data length
+ * @param data - pointer to data
+ *
+ * Return: QDF_STATUS - success or error status
+ */
+static QDF_STATUS wds_addr_ev_conv_data_be(uint16_t data_len, uint8_t *ev)
+{
+	uint8_t *datap = (uint8_t *)ev;
+	int i;
+	/* Skip swapping the first word */
+	datap += sizeof(uint32_t);
+	for (i = 0; i < ((data_len / sizeof(uint32_t))-1);
+			i++, datap += sizeof(uint32_t)) {
+		*(uint32_t *)datap = qdf_le32_to_cpu(*(uint32_t *)datap);
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+#else
+/**
+ * wds_addr_ev_conv_data_be() - Dummy operation for LE platforms
+ * @param data_len - data length
+ * @param data - pointer to data
+ *
+ * Return: QDF_STATUS - success or error status
+ */
+static QDF_STATUS wds_addr_ev_conv_data_be(uint32_t data_len, uint8_t *ev)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
+/**
+ * extract_wds_addr_event_tlv() - extract wds address from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param wds_ev: Pointer to hold wds address
+ *
+ * @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS extract_wds_addr_event_tlv(wmi_unified_t wmi_handle,
+		void *evt_buf,
+		uint16_t len, wds_addr_event_t *wds_ev)
+{
+	WMI_WDS_PEER_EVENTID_param_tlvs *param_buf;
+	wmi_wds_addr_event_fixed_param *ev;
+	int i;
+
+	param_buf = (WMI_WDS_PEER_EVENTID_param_tlvs *)evt_buf;
+	ev = (wmi_wds_addr_event_fixed_param *)param_buf->fixed_param;
+
+	if (wds_addr_ev_conv_data_be(len, (uint8_t *)ev) != QDF_STATUS_SUCCESS)
+		return QDF_STATUS_E_FAILURE;
+
+	qdf_mem_copy(wds_ev->event_type, ev->event_type,
+		     sizeof(wds_ev->event_type));
+	for (i = 0; i < 4; i++) {
+		wds_ev->peer_mac[i] =
+			((u_int8_t *)&(ev->peer_mac.mac_addr31to0))[i];
+		wds_ev->dest_mac[i] =
+			((u_int8_t *)&(ev->dest_mac.mac_addr31to0))[i];
+	}
+	for (i = 0; i < 2; i++) {
+		wds_ev->peer_mac[4+i] =
+			((u_int8_t *)&(ev->peer_mac.mac_addr47to32))[i];
+		wds_ev->dest_mac[4+i] =
+			((u_int8_t *)&(ev->dest_mac.mac_addr47to32))[i];
+	}
+	wds_ev->vdev_id = ev->vdev_id;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_peer_sta_ps_statechange_ev_tlv() - extract peer sta ps state
+ * from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param ev: Pointer to hold peer param and ps state
+ *
+ * @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS extract_peer_sta_ps_statechange_ev_tlv(wmi_unified_t wmi_handle,
+		void *evt_buf, wmi_host_peer_sta_ps_statechange_event *ev)
+{
+	WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *param_buf;
+	wmi_peer_sta_ps_statechange_event_fixed_param *event;
+
+	param_buf = (WMI_PEER_STA_PS_STATECHG_EVENTID_param_tlvs *)evt_buf;
+	event = (wmi_peer_sta_ps_statechange_event_fixed_param *)
+						param_buf->fixed_param;
+
+	WMI_MAC_ADDR_TO_CHAR_ARRAY(&event->peer_macaddr, ev->peer_macaddr);
+	ev->peer_ps_state = event->peer_ps_state;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_inst_rssi_stats_event_tlv() - extract inst rssi stats from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param inst_rssi_resp: Pointer to hold inst rssi response
+ *
+ * @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS extract_inst_rssi_stats_event_tlv(
+	wmi_unified_t wmi_handle, void *evt_buf,
+	wmi_host_inst_stats_resp *inst_rssi_resp)
+{
+	WMI_INST_RSSI_STATS_EVENTID_param_tlvs *param_buf;
+	wmi_inst_rssi_stats_resp_fixed_param *event;
+
+	param_buf = (WMI_INST_RSSI_STATS_EVENTID_param_tlvs *)evt_buf;
+	event = (wmi_inst_rssi_stats_resp_fixed_param *)param_buf->fixed_param;
+
+	qdf_mem_copy(&(inst_rssi_resp->peer_macaddr),
+		     &(event->peer_macaddr), sizeof(wmi_mac_addr));
+	inst_rssi_resp->iRSSI = event->iRSSI;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * send_pdev_caldata_version_check_cmd_tlv() - send caldata check cmd to fw
+ * @wmi_handle: wmi handle
+ * @param:	reserved param
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+send_pdev_caldata_version_check_cmd_tlv(wmi_unified_t wmi_handle,
+						uint32_t param)
+{
+	wmi_pdev_check_cal_version_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	int32_t len = sizeof(wmi_pdev_check_cal_version_cmd_fixed_param);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		qdf_print("%s:wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+	cmd = (wmi_pdev_check_cal_version_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+			WMITLV_TAG_STRUC_wmi_pdev_check_cal_version_cmd_fixed_param,
+			WMITLV_GET_STRUCT_TLVLEN
+			(wmi_pdev_check_cal_version_cmd_fixed_param));
+	cmd->pdev_id = param; /* set to 0x0 as expected from FW */
+	wmi_mtrace(WMI_PDEV_CHECK_CAL_VERSION_CMDID, NO_SESSION, 0);
+	if (wmi_unified_cmd_send(wmi_handle, buf, len,
+			WMI_PDEV_CHECK_CAL_VERSION_CMDID)) {
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_pdev_caldata_version_check_ev_param_tlv() - extract caldata from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold peer caldata version data
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS extract_pdev_caldata_version_check_ev_param_tlv(
+			wmi_unified_t wmi_handle,
+			void *evt_buf,
+			wmi_host_pdev_check_cal_version_event *param)
+{
+	WMI_PDEV_CHECK_CAL_VERSION_EVENTID_param_tlvs *param_tlvs;
+	wmi_pdev_check_cal_version_event_fixed_param *event;
+
+	param_tlvs = (WMI_PDEV_CHECK_CAL_VERSION_EVENTID_param_tlvs *) evt_buf;
+	if (!param_tlvs) {
+		WMI_LOGE("invalid cal version event buf");
+		return QDF_STATUS_E_FAILURE;
+	}
+	event =  param_tlvs->fixed_param;
+	if (event->board_mcn_detail[WMI_BOARD_MCN_STRING_MAX_SIZE] != '\0')
+		event->board_mcn_detail[WMI_BOARD_MCN_STRING_MAX_SIZE] = '\0';
+	WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(param->board_mcn_detail,
+			event->board_mcn_detail, WMI_BOARD_MCN_STRING_BUF_SIZE);
+
+	param->software_cal_version = event->software_cal_version;
+	param->board_cal_version = event->board_cal_version;
+	param->cal_ok  = event->cal_status;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+#ifdef WLAN_SUPPORT_FILS
+/**
+ * send_vdev_fils_enable_cmd_tlv() - enable/Disable FD Frame command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to hold FILS discovery enable param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE on failure
+ */
+static QDF_STATUS
+send_vdev_fils_enable_cmd_tlv(wmi_unified_t wmi_handle,
+			      struct config_fils_params *param)
+{
+	wmi_enable_fils_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	QDF_STATUS status;
+	uint32_t len = sizeof(wmi_enable_fils_cmd_fixed_param);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s : wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+	cmd = (wmi_enable_fils_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_enable_fils_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+		       wmi_enable_fils_cmd_fixed_param));
+	cmd->vdev_id = param->vdev_id;
+	cmd->fd_period = param->fd_period;
+	WMI_LOGI("Setting FD period to %d vdev id : %d",
+		 param->fd_period, param->vdev_id);
+
+	wmi_mtrace(WMI_ENABLE_FILS_CMDID, cmd->vdev_id, 0);
+	status = wmi_unified_cmd_send(wmi_handle, buf, len,
+				      WMI_ENABLE_FILS_CMDID);
+	if (status != QDF_STATUS_SUCCESS) {
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_swfda_vdev_id_tlv() - extract swfda vdev id from event
+ * @wmi_handle: wmi handle
+ * @evt_buf: pointer to event buffer
+ * @vdev_id: pointer to hold vdev id
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_INVAL on failure
+ */
+static QDF_STATUS
+extract_swfda_vdev_id_tlv(wmi_unified_t wmi_handle,
+			  void *evt_buf, uint32_t *vdev_id)
+{
+	WMI_HOST_SWFDA_EVENTID_param_tlvs *param_buf;
+	wmi_host_swfda_event_fixed_param *swfda_event;
+
+	param_buf = (WMI_HOST_SWFDA_EVENTID_param_tlvs *)evt_buf;
+	if (!param_buf) {
+		WMI_LOGE("Invalid swfda event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+	swfda_event = param_buf->fixed_param;
+	*vdev_id = swfda_event->vdev_id;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * send_fils_discovery_send_cmd_tlv() - WMI FILS Discovery send function
+ * @wmi_handle: wmi handle
+ * @param: pointer to hold FD send cmd parameter
+ *
+ * Return : QDF_STATUS_SUCCESS on success and QDF_STATUS_E_NOMEM on failure.
+ */
+static QDF_STATUS
+send_fils_discovery_send_cmd_tlv(wmi_unified_t wmi_handle,
+				 struct fd_params *param)
+{
+	QDF_STATUS ret;
+	wmi_fd_send_from_host_cmd_fixed_param *cmd;
+	wmi_buf_t wmi_buf;
+	qdf_dma_addr_t dma_addr;
+
+	wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
+	if (!wmi_buf) {
+		WMI_LOGE("%s : wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+	cmd = (wmi_fd_send_from_host_cmd_fixed_param *)wmi_buf_data(wmi_buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_fd_send_from_host_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+		       wmi_fd_send_from_host_cmd_fixed_param));
+	cmd->vdev_id = param->vdev_id;
+	cmd->data_len = qdf_nbuf_len(param->wbuf);
+	dma_addr = qdf_nbuf_get_frag_paddr(param->wbuf, 0);
+	qdf_dmaaddr_to_32s(dma_addr, &cmd->frag_ptr_lo, &cmd->frag_ptr_hi);
+	cmd->frame_ctrl = param->frame_ctrl;
+
+	wmi_mtrace(WMI_PDEV_SEND_FD_CMDID, cmd->vdev_id, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd),
+				   WMI_PDEV_SEND_FD_CMDID);
+	if (ret != QDF_STATUS_SUCCESS) {
+		WMI_LOGE("%s: Failed to send fils discovery frame: %d",
+			 __func__, ret);
+		wmi_buf_free(wmi_buf);
+	}
+
+	return ret;
+}
+#endif /* WLAN_SUPPORT_FILS */
+
+/**
+ * send_set_qboost_param_cmd_tlv() - send set qboost command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to qboost params
+ * @macaddr: vdev mac address
+ *
+ *  @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS
+send_set_qboost_param_cmd_tlv(wmi_unified_t wmi_handle,
+			      uint8_t macaddr[IEEE80211_ADDR_LEN],
+			      struct set_qboost_params *param)
+{
+	WMI_QBOOST_CFG_CMD_fixed_param *cmd;
+	wmi_buf_t buf;
+	int32_t len;
+	QDF_STATUS ret;
+
+	len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cmd = (WMI_QBOOST_CFG_CMD_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_WMI_QBOOST_CFG_CMD_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				WMI_QBOOST_CFG_CMD_fixed_param));
+	cmd->vdev_id = param->vdev_id;
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr);
+	cmd->qb_enable = param->value;
+
+	wmi_mtrace(WMI_QBOOST_CFG_CMDID, cmd->vdev_id, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd),
+			WMI_QBOOST_CFG_CMDID);
+
+	if (ret != 0) {
+		WMI_LOGE("Setting qboost cmd failed");
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ * send_gpio_config_cmd_tlv() - send gpio config to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to hold gpio config param
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+send_gpio_config_cmd_tlv(wmi_unified_t wmi_handle,
+			 struct gpio_config_params *param)
+{
+	wmi_gpio_config_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	int32_t len;
+	QDF_STATUS ret;
+
+	len = sizeof(*cmd);
+
+	/* Sanity Checks */
+	if (param->pull_type > WMI_GPIO_PULL_DOWN ||
+	    param->intr_mode > WMI_GPIO_INTTYPE_LEVEL_HIGH) {
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cmd = (wmi_gpio_config_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_gpio_config_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				wmi_gpio_config_cmd_fixed_param));
+	cmd->gpio_num = param->gpio_num;
+	cmd->input = param->input;
+	cmd->pull_type = param->pull_type;
+	cmd->intr_mode = param->intr_mode;
+
+	wmi_mtrace(WMI_GPIO_CONFIG_CMDID, NO_SESSION, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd),
+			WMI_GPIO_CONFIG_CMDID);
+
+	if (ret != 0) {
+		WMI_LOGE("Sending GPIO config cmd failed");
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ * send_gpio_output_cmd_tlv() - send gpio output to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to hold gpio output param
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+send_gpio_output_cmd_tlv(wmi_unified_t wmi_handle,
+			 struct gpio_output_params *param)
+{
+	wmi_gpio_output_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	int32_t len;
+	QDF_STATUS ret;
+
+	len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cmd = (wmi_gpio_output_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_gpio_output_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				wmi_gpio_output_cmd_fixed_param));
+	cmd->gpio_num = param->gpio_num;
+	cmd->set = param->set;
+
+	wmi_mtrace(WMI_GPIO_OUTPUT_CMDID, NO_SESSION, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd),
+			WMI_GPIO_OUTPUT_CMDID);
+
+	if (ret != 0) {
+		WMI_LOGE("Sending GPIO output cmd failed");
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+
+}
+
+/**
+ * send_mcast_group_update_cmd_tlv() - send mcast group update cmd to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to hold mcast update param
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+send_mcast_group_update_cmd_tlv(wmi_unified_t wmi_handle,
+				struct mcast_group_update_params *param)
+{
+	wmi_peer_mcast_group_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	QDF_STATUS ret;
+	int32_t len;
+	int offset = 0;
+	static char dummymask[4] = { 0xFF, 0xFF, 0xFF, 0xFF};
+
+	len = sizeof(*cmd);
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+	cmd = (wmi_peer_mcast_group_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_peer_mcast_group_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				wmi_peer_mcast_group_cmd_fixed_param));
+	/* confirm the buffer is 4-byte aligned */
+	QDF_ASSERT((((size_t) cmd) & 0x3) == 0);
+	qdf_mem_zero(cmd, sizeof(*cmd));
+
+	cmd->vdev_id = param->vap_id;
+	/* construct the message assuming our endianness matches the target */
+	cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_ACTION_M &
+		(param->action << WMI_PEER_MCAST_GROUP_FLAG_ACTION_S);
+	cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_M &
+		(param->wildcard << WMI_PEER_MCAST_GROUP_FLAG_WILDCARD_S);
+	if (param->is_action_delete)
+		cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_DELETEALL_M;
+
+	if (param->is_mcast_addr_len)
+		cmd->flags |=  WMI_PEER_MCAST_GROUP_FLAG_IPV6_M;
+
+	if (param->is_filter_mode_snoop)
+		cmd->flags |= WMI_PEER_MCAST_GROUP_FLAG_SRC_FILTER_EXCLUDE_M;
+
+	/* unicast address spec only applies for non-wildcard cases */
+	if (!param->wildcard && param->ucast_mac_addr) {
+		WMI_CHAR_ARRAY_TO_MAC_ADDR(param->ucast_mac_addr,
+					   &cmd->ucast_mac_addr);
+	}
+
+	if (param->mcast_ip_addr) {
+		QDF_ASSERT(param->mcast_ip_addr_bytes <=
+			   sizeof(cmd->mcast_ip_addr));
+		offset = sizeof(cmd->mcast_ip_addr) -
+			 param->mcast_ip_addr_bytes;
+		qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_addr) + offset,
+			     param->mcast_ip_addr,
+			     param->mcast_ip_addr_bytes);
+	}
+	if (!param->mask)
+		param->mask = &dummymask[0];
+
+	qdf_mem_copy(((uint8_t *)&cmd->mcast_ip_mask) + offset,
+		     param->mask,
+		     param->mcast_ip_addr_bytes);
+
+	if (param->srcs && param->nsrcs) {
+		cmd->num_filter_addr = param->nsrcs;
+		QDF_ASSERT((param->nsrcs * param->mcast_ip_addr_bytes) <=
+			sizeof(cmd->filter_addr));
+
+		qdf_mem_copy(((uint8_t *) &cmd->filter_addr), param->srcs,
+			     param->nsrcs * param->mcast_ip_addr_bytes);
+	}
+
+	wmi_mtrace(WMI_PEER_MCAST_GROUP_CMDID, cmd->vdev_id, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
+				      WMI_PEER_MCAST_GROUP_CMDID);
+
+	if (ret != QDF_STATUS_SUCCESS) {
+		WMI_LOGE("%s : WMI Failed", __func__);
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ * send_pdev_qvit_cmd_tlv() - send qvit command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to pdev_qvit_params
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+send_pdev_qvit_cmd_tlv(wmi_unified_t wmi_handle,
+		       struct pdev_qvit_params *param)
+{
+	wmi_buf_t buf;
+	QDF_STATUS ret = QDF_STATUS_E_INVAL;
+	uint8_t *cmd;
+	static uint8_t msgref = 1;
+	uint8_t segnumber = 0, seginfo, numsegments;
+	uint16_t chunk_len, total_bytes;
+	uint8_t *bufpos;
+	QVIT_SEG_HDR_INFO_STRUCT seghdrinfo;
+
+	bufpos = param->utf_payload;
+	total_bytes = param->len;
+	ASSERT(total_bytes / MAX_WMI_QVIT_LEN ==
+	       (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN));
+	numsegments = (uint8_t) (total_bytes / MAX_WMI_QVIT_LEN);
+
+	if (param->len - (numsegments * MAX_WMI_QVIT_LEN))
+		numsegments++;
+
+	while (param->len) {
+		if (param->len > MAX_WMI_QVIT_LEN)
+			chunk_len = MAX_WMI_QVIT_LEN;    /* MAX message */
+		else
+			chunk_len = param->len;
+
+		buf = wmi_buf_alloc(wmi_handle,
+				    (chunk_len + sizeof(seghdrinfo) +
+				     WMI_TLV_HDR_SIZE));
+		if (!buf) {
+			WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
+			return QDF_STATUS_E_NOMEM;
+		}
+
+		cmd = (uint8_t *) wmi_buf_data(buf);
+
+		seghdrinfo.len = total_bytes;
+		seghdrinfo.msgref = msgref;
+		seginfo = ((numsegments << 4) & 0xF0) | (segnumber & 0xF);
+		seghdrinfo.segmentInfo = seginfo;
+
+		segnumber++;
+
+		WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE,
+			       (chunk_len + sizeof(seghdrinfo)));
+		cmd += WMI_TLV_HDR_SIZE;
+		qdf_mem_copy(cmd, &seghdrinfo, sizeof(seghdrinfo));
+		qdf_mem_copy(&cmd[sizeof(seghdrinfo)], bufpos, chunk_len);
+
+		wmi_mtrace(WMI_PDEV_QVIT_CMDID, NO_SESSION, 0);
+		ret = wmi_unified_cmd_send(wmi_handle, buf,
+					   (chunk_len + sizeof(seghdrinfo) +
+					    WMI_TLV_HDR_SIZE),
+					   WMI_PDEV_QVIT_CMDID);
+
+		if (ret != 0) {
+			WMI_LOGE("Failed to send WMI_PDEV_QVIT_CMDID command");
+			wmi_buf_free(buf);
+			break;
+		}
+
+		param->len -= chunk_len;
+		bufpos += chunk_len;
+	}
+	msgref++;
+
+	return ret;
+}
+
+/**
+ * send_wmm_update_cmd_tlv() - send wmm update command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to wmm update param
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+send_wmm_update_cmd_tlv(wmi_unified_t wmi_handle,
+			struct wmm_update_params *param)
+{
+	wmi_pdev_set_wmm_params_cmd_fixed_param *cmd;
+	wmi_wmm_params *wmm_param;
+	wmi_buf_t buf;
+	QDF_STATUS ret;
+	int32_t len;
+	int ac = 0;
+	struct wmi_host_wmeParams *wmep;
+	uint8_t *buf_ptr;
+
+	len = sizeof(*cmd) + (WME_NUM_AC * sizeof(*wmm_param));
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	buf_ptr = (uint8_t *) wmi_buf_data(buf);
+	cmd = (wmi_pdev_set_wmm_params_cmd_fixed_param *) buf_ptr;
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_pdev_set_wmm_params_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN
+			       (wmi_pdev_set_wmm_params_cmd_fixed_param));
+
+	cmd->reserved0 = WMI_HOST_PDEV_ID_SOC;
+
+	buf_ptr += sizeof(wmi_pdev_set_wmm_params_cmd_fixed_param);
+
+	for (ac = 0; ac < WME_NUM_AC; ac++) {
+		wmep = &param->wmep_array[ac];
+		wmm_param = (wmi_wmm_params *)buf_ptr;
+		WMITLV_SET_HDR(&wmm_param->tlv_header,
+			WMITLV_TAG_STRUC_wmi_wmm_params,
+			WMITLV_GET_STRUCT_TLVLEN(wmi_wmm_params));
+		wmm_param->aifs = wmep->wmep_aifsn;
+		wmm_param->cwmin = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmin);
+		wmm_param->cwmax = ATH_EXPONENT_TO_VALUE(wmep->wmep_logcwmax);
+		wmm_param->txoplimit = ATH_TXOP_TO_US(wmep->wmep_txopLimit);
+		wmm_param->acm = wmep->wmep_acm;
+		wmm_param->no_ack = wmep->wmep_noackPolicy;
+		buf_ptr += sizeof(wmi_wmm_params);
+	}
+	wmi_mtrace(WMI_PDEV_SET_WMM_PARAMS_CMDID, NO_SESSION, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
+				   WMI_PDEV_SET_WMM_PARAMS_CMDID);
+
+	if (ret != 0) {
+		WMI_LOGE("Sending WMM update CMD failed");
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ * extract_vdev_start_resp_tlv() - extract vdev start response
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param vdev_rsp: Pointer to hold vdev response
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_vdev_start_resp_tlv(wmi_unified_t wmi_handle,
+	void *evt_buf, wmi_host_vdev_start_resp *vdev_rsp)
+{
+	WMI_VDEV_START_RESP_EVENTID_param_tlvs *param_buf;
+	wmi_vdev_start_response_event_fixed_param *ev;
+
+	param_buf = (WMI_VDEV_START_RESP_EVENTID_param_tlvs *) evt_buf;
+	if (!param_buf) {
+		qdf_print("Invalid start response event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	ev = param_buf->fixed_param;
+	if (!ev) {
+		qdf_print("Invalid start response event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	qdf_mem_zero(vdev_rsp, sizeof(*vdev_rsp));
+
+	vdev_rsp->vdev_id = ev->vdev_id;
+	vdev_rsp->requestor_id = ev->requestor_id;
+	switch (ev->resp_type) {
+	case WMI_VDEV_START_RESP_EVENT:
+		vdev_rsp->resp_type = WMI_HOST_VDEV_START_RESP_EVENT;
+		break;
+	case WMI_VDEV_RESTART_RESP_EVENT:
+		vdev_rsp->resp_type = WMI_HOST_VDEV_RESTART_RESP_EVENT;
+		break;
+	default:
+		qdf_print("Invalid start response event buffer");
+		break;
+	};
+	vdev_rsp->status = ev->status;
+	vdev_rsp->chain_mask = ev->chain_mask;
+	vdev_rsp->smps_mode = ev->smps_mode;
+	vdev_rsp->mac_id = ev->mac_id;
+	vdev_rsp->cfgd_tx_streams = ev->cfgd_tx_streams;
+	vdev_rsp->cfgd_rx_streams = ev->cfgd_rx_streams;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_vdev_delete_resp_tlv() - extract vdev delete response
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param delete_rsp: Pointer to hold vdev delete response
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_vdev_delete_resp_tlv(wmi_unified_t wmi_handle,
+	void *evt_buf, struct wmi_host_vdev_delete_resp *delete_rsp)
+{
+	WMI_VDEV_DELETE_RESP_EVENTID_param_tlvs *param_buf;
+	wmi_vdev_delete_resp_event_fixed_param *ev;
+
+	param_buf = (WMI_VDEV_DELETE_RESP_EVENTID_param_tlvs *) evt_buf;
+	if (!param_buf) {
+		WMI_LOGE("Invalid vdev delete response event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	ev = param_buf->fixed_param;
+	if (!ev) {
+		WMI_LOGE("Invalid vdev delete response event");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	qdf_mem_zero(delete_rsp, sizeof(*delete_rsp));
+	delete_rsp->vdev_id = ev->vdev_id;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_vdev_stopped_param_tlv() - extract vdev stop param from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param vdev_id: Pointer to hold vdev identifier
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_vdev_stopped_param_tlv(wmi_unified_t wmi_handle,
+	void *evt_buf, uint32_t *vdev_id)
+{
+	WMI_VDEV_STOPPED_EVENTID_param_tlvs *param_buf;
+	wmi_vdev_stopped_event_fixed_param *resp_event;
+
+	param_buf = (WMI_VDEV_STOPPED_EVENTID_param_tlvs *) evt_buf;
+	if (!param_buf) {
+		WMI_LOGE("Invalid event buffer");
+		return QDF_STATUS_E_INVAL;
+	}
+	resp_event = param_buf->fixed_param;
+	*vdev_id = resp_event->vdev_id;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_mgmt_tx_compl_param_tlv() - extract MGMT tx completion event params
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param param: Pointer to hold MGMT TX completion params
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_mgmt_tx_compl_param_tlv(wmi_unified_t wmi_handle,
+	void *evt_buf, wmi_host_mgmt_tx_compl_event *param)
+{
+	WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *param_buf;
+	wmi_mgmt_tx_compl_event_fixed_param *cmpl_params;
+
+	param_buf = (WMI_MGMT_TX_COMPLETION_EVENTID_param_tlvs *)
+		evt_buf;
+	if (!param_buf) {
+		WMI_LOGE("%s: Invalid mgmt Tx completion event", __func__);
+		return QDF_STATUS_E_INVAL;
+	}
+	cmpl_params = param_buf->fixed_param;
+
+	param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host(
+							cmpl_params->pdev_id);
+	param->desc_id = cmpl_params->desc_id;
+	param->status = cmpl_params->status;
+	param->ppdu_id = cmpl_params->ppdu_id;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_chan_info_event_tlv() - extract chan information from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param chan_info: Pointer to hold chan information
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS extract_chan_info_event_tlv(wmi_unified_t wmi_handle,
+	void *evt_buf, wmi_host_chan_info_event *chan_info)
+{
+	WMI_CHAN_INFO_EVENTID_param_tlvs *param_buf;
+	wmi_chan_info_event_fixed_param *ev;
+
+	param_buf = (WMI_CHAN_INFO_EVENTID_param_tlvs *) evt_buf;
+
+	ev = (wmi_chan_info_event_fixed_param *) param_buf->fixed_param;
+	if (!ev) {
+		WMI_LOGE("%s: Failed to allocmemory", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	chan_info->err_code = ev->err_code;
+	chan_info->freq = ev->freq;
+	chan_info->cmd_flags = ev->cmd_flags;
+	chan_info->noise_floor = ev->noise_floor;
+	chan_info->rx_clear_count = ev->rx_clear_count;
+	chan_info->cycle_count = ev->cycle_count;
+	chan_info->tx_frame_cnt = ev->tx_frame_cnt;
+	chan_info->mac_clk_mhz = ev->mac_clk_mhz;
+	chan_info->pdev_id = wlan_get_pdev_id_from_vdev_id(
+			(struct wlan_objmgr_psoc *)wmi_handle->soc->wmi_psoc,
+			ev->vdev_id, WLAN_SCAN_ID);
+	chan_info->chan_tx_pwr_range = ev->chan_tx_pwr_range;
+	chan_info->chan_tx_pwr_tp = ev->chan_tx_pwr_tp;
+	chan_info->my_bss_rx_cycle_count = ev->my_bss_rx_cycle_count;
+	chan_info->rx_11b_mode_data_duration = ev->rx_11b_mode_data_duration;
+	chan_info->tx_frame_cnt = ev->tx_frame_cnt;
+	chan_info->rx_frame_count = ev->rx_frame_count;
+	chan_info->mac_clk_mhz = ev->mac_clk_mhz;
+	chan_info->vdev_id = ev->vdev_id;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * extract_channel_hopping_event_tlv() - extract channel hopping param
+ * from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param ch_hopping: Pointer to hold channel hopping param
+ *
+ * @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS extract_channel_hopping_event_tlv(
+	wmi_unified_t wmi_handle, void *evt_buf,
+	wmi_host_pdev_channel_hopping_event *ch_hopping)
+{
+	WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *param_buf;
+	wmi_pdev_channel_hopping_event_fixed_param *event;
+
+	param_buf = (WMI_PDEV_CHANNEL_HOPPING_EVENTID_param_tlvs *)evt_buf;
+	event = (wmi_pdev_channel_hopping_event_fixed_param *)
+						param_buf->fixed_param;
+
+	ch_hopping->noise_floor_report_iter = event->noise_floor_report_iter;
+	ch_hopping->noise_floor_total_iter = event->noise_floor_total_iter;
+	ch_hopping->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host(
+								event->pdev_id);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+void wmi_ap_attach_tlv(wmi_unified_t wmi_handle)
+{
+	struct wmi_ops *ops = wmi_handle->ops;
+
+	ops->send_peer_add_wds_entry_cmd = send_peer_add_wds_entry_cmd_tlv;
+	ops->send_peer_del_wds_entry_cmd = send_peer_del_wds_entry_cmd_tlv;
+	ops->send_peer_update_wds_entry_cmd =
+					send_peer_update_wds_entry_cmd_tlv;
+	ops->send_pdev_get_tpc_config_cmd = send_pdev_get_tpc_config_cmd_tlv;
+	ops->send_beacon_send_cmd = send_beacon_send_cmd_tlv;
+	ops->send_set_ctl_table_cmd = send_set_ctl_table_cmd_tlv;
+	ops->send_set_mimogain_table_cmd = send_set_mimogain_table_cmd_tlv;
+	ops->send_packet_power_info_get_cmd =
+					send_packet_power_info_get_cmd_tlv;
+	ops->send_vdev_config_ratemask_cmd = send_vdev_config_ratemask_cmd_tlv;
+	ops->send_vdev_set_neighbour_rx_cmd =
+					send_vdev_set_neighbour_rx_cmd_tlv;
+	ops->send_nf_dbr_dbm_info_get_cmd = send_nf_dbr_dbm_info_get_cmd_tlv;
+	ops->send_set_ht_ie_cmd = send_set_ht_ie_cmd_tlv;
+	ops->send_set_vht_ie_cmd = send_set_vht_ie_cmd_tlv;
+	ops->send_set_quiet_mode_cmd = send_set_quiet_mode_cmd_tlv;
+	ops->send_bcn_offload_control_cmd = send_bcn_offload_control_cmd_tlv;
+	ops->extract_tbttoffset_update_params =
+				extract_tbttoffset_update_params_tlv;
+	ops->extract_ext_tbttoffset_update_params =
+				extract_ext_tbttoffset_update_params_tlv;
+	ops->extract_tbttoffset_num_vdevs =
+				extract_tbttoffset_num_vdevs_tlv;
+	ops->extract_ext_tbttoffset_num_vdevs =
+				extract_ext_tbttoffset_num_vdevs_tlv;
+	ops->extract_swba_num_vdevs = extract_swba_num_vdevs_tlv;
+	ops->extract_swba_tim_info = extract_swba_tim_info_tlv;
+	ops->extract_swba_noa_info = extract_swba_noa_info_tlv;
+	ops->extract_offchan_data_tx_compl_param =
+				extract_offchan_data_tx_compl_param_tlv;
+	ops->extract_peer_sta_kickout_ev = extract_peer_sta_kickout_ev_tlv;
+	ops->send_multiple_vdev_restart_req_cmd =
+				send_multiple_vdev_restart_req_cmd_tlv;
+	ops->extract_dcs_interference_type = extract_dcs_interference_type_tlv;
+	ops->extract_dcs_cw_int = extract_dcs_cw_int_tlv;
+	ops->extract_dcs_im_tgt_stats = extract_dcs_im_tgt_stats_tlv;
+	ops->extract_peer_delete_response_event =
+				extract_peer_delete_response_event_tlv;
+	ops->extract_pdev_csa_switch_count_status =
+				extract_pdev_csa_switch_count_status_tlv;
+	ops->extract_pdev_tpc_ev_param = extract_pdev_tpc_ev_param_tlv;
+	ops->extract_pdev_tpc_config_ev_param =
+			extract_pdev_tpc_config_ev_param_tlv;
+	ops->extract_nfcal_power_ev_param = extract_nfcal_power_ev_param_tlv;
+	ops->extract_wds_addr_event = extract_wds_addr_event_tlv;
+	ops->extract_peer_sta_ps_statechange_ev =
+		extract_peer_sta_ps_statechange_ev_tlv;
+	ops->extract_inst_rssi_stats_event = extract_inst_rssi_stats_event_tlv;
+	ops->send_pdev_caldata_version_check_cmd =
+			send_pdev_caldata_version_check_cmd_tlv;
+	ops->extract_pdev_caldata_version_check_ev_param =
+			extract_pdev_caldata_version_check_ev_param_tlv;
+#ifdef WLAN_SUPPORT_FILS
+	ops->send_vdev_fils_enable_cmd = send_vdev_fils_enable_cmd_tlv;
+	ops->extract_swfda_vdev_id = extract_swfda_vdev_id_tlv;
+	ops->send_fils_discovery_send_cmd = send_fils_discovery_send_cmd_tlv;
+#endif /* WLAN_SUPPORT_FILS */
+	ops->send_set_qboost_param_cmd = send_set_qboost_param_cmd_tlv;
+	ops->send_gpio_config_cmd = send_gpio_config_cmd_tlv;
+	ops->send_gpio_output_cmd = send_gpio_output_cmd_tlv;
+	ops->send_mcast_group_update_cmd = send_mcast_group_update_cmd_tlv;
+	ops->send_pdev_qvit_cmd = send_pdev_qvit_cmd_tlv;
+	ops->send_wmm_update_cmd = send_wmm_update_cmd_tlv;
+	ops->extract_vdev_start_resp = extract_vdev_start_resp_tlv;
+	ops->extract_vdev_delete_resp = extract_vdev_delete_resp_tlv;
+	ops->extract_vdev_stopped_param = extract_vdev_stopped_param_tlv;
+	ops->extract_mgmt_tx_compl_param = extract_mgmt_tx_compl_param_tlv;
+	ops->extract_chan_info_event = extract_chan_info_event_tlv;
+	ops->extract_channel_hopping_event = extract_channel_hopping_event_tlv;
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 98 - 782
wmi/src/wmi_unified_api.c


+ 164 - 0
wmi/src/wmi_unified_atf_api.c

@@ -0,0 +1,164 @@
+/*
+ * 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.
+ */
+
+#include "wmi_unified_priv.h"
+#include "wmi_unified_atf_param.h"
+#include "qdf_module.h"
+
+/**
+ *  wmi_unified_set_bwf_cmd_send() - WMI set bwf function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to set bwf param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_set_bwf_cmd_send(void *wmi_hdl,
+				struct set_bwf_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_set_bwf_cmd)
+		return wmi_handle->ops->send_set_bwf_cmd(wmi_handle, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+#ifdef WLAN_ATF_ENABLE
+/**
+ *  wmi_unified_set_atf_cmd_send() - WMI set atf function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to set atf param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS
+wmi_unified_set_atf_cmd_send(void *wmi_hdl,
+			     struct set_atf_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
+
+	if (wmi_handle->ops->send_set_atf_cmd)
+		return wmi_handle->ops->send_set_atf_cmd(wmi_handle, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_send_atf_peer_request_cmd() - send atf peer request command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to atf peer request param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS
+wmi_send_atf_peer_request_cmd(void *wmi_hdl,
+			      struct atf_peer_request_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
+
+	if (wmi_handle->ops->send_atf_peer_request_cmd)
+		return wmi_handle->ops->send_atf_peer_request_cmd(wmi_handle,
+								  param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_send_set_atf_grouping_cmd() - send set atf grouping command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to set atf grouping param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS
+wmi_send_set_atf_grouping_cmd(void *wmi_hdl,
+			      struct atf_grouping_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
+
+	if (wmi_handle->ops->send_set_atf_grouping_cmd)
+		return wmi_handle->ops->send_set_atf_grouping_cmd(wmi_handle,
+								  param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_send_set_atf_group_ac_cmd() - send set atf AC command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to set atf AC group param
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS
+wmi_send_set_atf_group_ac_cmd(void *wmi_hdl,
+			      struct atf_group_ac_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
+
+	if (wmi_handle->ops->send_set_atf_group_ac_cmd)
+		return wmi_handle->ops->send_set_atf_group_ac_cmd(wmi_handle,
+								  param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_atf_peer_stats_ev() - extract atf peer stats
+ * from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param ev: Pointer to hold atf peer stats
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS
+wmi_extract_atf_peer_stats_ev(void *wmi_hdl, void *evt_buf,
+			      wmi_host_atf_peer_stats_event *ev)
+{
+	wmi_unified_t wmi = (wmi_unified_t)wmi_hdl;
+
+	if (wmi->ops->extract_atf_peer_stats_ev)
+		return wmi->ops->extract_atf_peer_stats_ev(wmi, evt_buf, ev);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ * wmi_extract_atf_token_info_ev() - extract atf token info
+ * from event
+ * @wmi_handle: wmi handle
+ * @param evt_buf: pointer to event buffer
+ * @param idx: Index indicating the peer number
+ * @param ev: Pointer to hold atf token info
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS
+wmi_extract_atf_token_info_ev(void *wmi_hdl, void *evt_buf, uint8_t idx,
+			      wmi_host_atf_peer_stats_info *ev)
+{
+	wmi_unified_t wmi = (wmi_unified_t)wmi_hdl;
+
+	if (wmi->ops->extract_atf_token_info_ev)
+		return wmi->ops->extract_atf_token_info_ev(wmi, evt_buf,
+							   idx, ev);
+
+	return QDF_STATUS_E_FAILURE;
+}
+#endif /* WLAN_ATF_ENABLE */

+ 190 - 0
wmi/src/wmi_unified_atf_tlv.c

@@ -0,0 +1,190 @@
+/*
+ * 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.
+ */
+
+#include <osdep.h>
+#include "wmi.h"
+#include "wmi_unified_priv.h"
+#include "wmi_unified_atf_param.h"
+#include "wmi_unified_atf_api.h"
+
+#ifdef WLAN_ATF_ENABLE
+/**
+ * send_set_atf_cmd_tlv() - send set atf command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to set atf param
+ *
+ *  @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS
+send_set_atf_cmd_tlv(wmi_unified_t wmi_handle,
+		     struct set_atf_params *param)
+{
+	wmi_atf_peer_info *peer_info;
+	wmi_peer_atf_request_fixed_param *cmd;
+	wmi_buf_t buf;
+	uint8_t *buf_ptr;
+	int i;
+	int32_t len = 0;
+	QDF_STATUS retval;
+
+	len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
+	len += param->num_peers * sizeof(wmi_atf_peer_info);
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+	buf_ptr = (uint8_t *)wmi_buf_data(buf);
+	cmd = (wmi_peer_atf_request_fixed_param *)buf_ptr;
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_peer_atf_request_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				wmi_peer_atf_request_fixed_param));
+	cmd->num_peers = param->num_peers;
+
+	buf_ptr += sizeof(*cmd);
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
+		       sizeof(wmi_atf_peer_info) *
+		       cmd->num_peers);
+	buf_ptr += WMI_TLV_HDR_SIZE;
+	peer_info = (wmi_atf_peer_info *)buf_ptr;
+
+	for (i = 0; i < cmd->num_peers; i++) {
+		WMITLV_SET_HDR(&peer_info->tlv_header,
+			    WMITLV_TAG_STRUC_wmi_atf_peer_info,
+			    WMITLV_GET_STRUCT_TLVLEN(
+				wmi_atf_peer_info));
+		qdf_mem_copy(&(peer_info->peer_macaddr),
+				&(param->peer_info[i].peer_macaddr),
+				sizeof(wmi_mac_addr));
+		peer_info->atf_units = param->peer_info[i].percentage_peer;
+		peer_info->vdev_id = param->peer_info[i].vdev_id;
+		peer_info->pdev_id =
+			wmi_handle->ops->convert_pdev_id_host_to_target(
+				param->peer_info[i].pdev_id);
+		/*
+		 * TLV definition for peer atf request fixed param combines
+		 * extension stats. Legacy FW for WIN (Non-TLV) has peer atf
+		 * stats and atf extension stats as two different
+		 * implementations.
+		 * Need to discuss with FW on this.
+		 *
+		 * peer_info->atf_groupid = param->peer_ext_info[i].group_index;
+		 * peer_info->atf_units_reserved =
+		 *		param->peer_ext_info[i].atf_index_reserved;
+		 */
+		peer_info++;
+	}
+
+	wmi_mtrace(WMI_PEER_ATF_REQUEST_CMDID, NO_SESSION, 0);
+	retval = wmi_unified_cmd_send(wmi_handle, buf, len,
+		WMI_PEER_ATF_REQUEST_CMDID);
+
+	if (retval != QDF_STATUS_SUCCESS) {
+		WMI_LOGE("%s : WMI Failed", __func__);
+		wmi_buf_free(buf);
+	}
+
+	return retval;
+}
+#endif
+
+/**
+ * send_set_bwf_cmd_tlv() - send set bwf command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to set bwf param
+ *
+ * Return: 0 for success or error code
+ */
+static QDF_STATUS
+send_set_bwf_cmd_tlv(wmi_unified_t wmi_handle,
+		     struct set_bwf_params *param)
+{
+	wmi_bwf_peer_info *peer_info;
+	wmi_peer_bwf_request_fixed_param *cmd;
+	wmi_buf_t buf;
+	QDF_STATUS retval;
+	int32_t len;
+	uint8_t *buf_ptr;
+	int i;
+
+	len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
+	len += param->num_peers * sizeof(wmi_bwf_peer_info);
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+	buf_ptr = (uint8_t *)wmi_buf_data(buf);
+	cmd = (wmi_peer_bwf_request_fixed_param *)buf_ptr;
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_peer_bwf_request_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				wmi_peer_bwf_request_fixed_param));
+	cmd->num_peers = param->num_peers;
+
+	buf_ptr += sizeof(*cmd);
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
+		       sizeof(wmi_bwf_peer_info) *
+		       cmd->num_peers);
+	buf_ptr += WMI_TLV_HDR_SIZE;
+	peer_info = (wmi_bwf_peer_info *)buf_ptr;
+
+	for (i = 0; i < cmd->num_peers; i++) {
+		WMITLV_SET_HDR(&peer_info->tlv_header,
+			       WMITLV_TAG_STRUC_wmi_bwf_peer_info,
+			       WMITLV_GET_STRUCT_TLVLEN(wmi_bwf_peer_info));
+		peer_info->bwf_guaranteed_bandwidth =
+				param->peer_info[i].throughput;
+		peer_info->bwf_max_airtime =
+				param->peer_info[i].max_airtime;
+		peer_info->bwf_peer_priority =
+				param->peer_info[i].priority;
+		qdf_mem_copy(&peer_info->peer_macaddr,
+			     &param->peer_info[i].peer_macaddr,
+			     sizeof(param->peer_info[i].peer_macaddr));
+		peer_info->vdev_id =
+				param->peer_info[i].vdev_id;
+		peer_info->pdev_id =
+			wmi_handle->ops->convert_pdev_id_host_to_target(
+				param->peer_info[i].pdev_id);
+		peer_info++;
+	}
+
+	wmi_mtrace(WMI_PEER_BWF_REQUEST_CMDID, NO_SESSION, 0);
+	retval = wmi_unified_cmd_send(wmi_handle, buf, len,
+				      WMI_PEER_BWF_REQUEST_CMDID);
+
+	if (retval != QDF_STATUS_SUCCESS) {
+		WMI_LOGE("%s : WMI Failed", __func__);
+		wmi_buf_free(buf);
+	}
+
+	return retval;
+}
+
+void wmi_atf_attach_tlv(wmi_unified_t wmi_handle)
+{
+	struct wmi_ops *ops = wmi_handle->ops;
+
+#ifdef WLAN_ATF_ENABLE
+	ops->send_set_atf_cmd = send_set_atf_cmd_tlv;
+#endif
+	ops->send_set_bwf_cmd = send_set_bwf_cmd_tlv;
+}
+

+ 76 - 0
wmi/src/wmi_unified_dbr_api.c

@@ -0,0 +1,76 @@
+/*
+ * 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.
+ */
+
+#include "wmi_unified_priv.h"
+#include "qdf_module.h"
+
+QDF_STATUS wmi_unified_dbr_ring_cfg(void *wmi_hdl,
+				struct direct_buf_rx_cfg_req *cfg)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_dbr_cfg_cmd)
+		return wmi_handle->ops->send_dbr_cfg_cmd(wmi_handle, cfg);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS wmi_extract_dbr_buf_release_fixed(
+			void *wmi_hdl,
+			uint8_t *evt_buf,
+			struct direct_buf_rx_rsp *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_dbr_buf_release_fixed)
+		return wmi_handle->ops->extract_dbr_buf_release_fixed(
+				wmi_handle,
+				evt_buf, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+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_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->extract_dbr_buf_release_entry)
+		return wmi_handle->ops->extract_dbr_buf_release_entry(
+				wmi_handle,
+				evt_buf, idx, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS wmi_extract_dbr_buf_metadata(
+			void *wmi_hdl,
+			uint8_t *evt_buf, uint8_t idx,
+			struct direct_buf_rx_metadata *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl;
+
+	if (wmi_handle->ops->extract_dbr_buf_metadata)
+		return wmi_handle->ops->extract_dbr_buf_metadata(
+				wmi_handle,
+				evt_buf, idx, param);
+
+	return QDF_STATUS_E_FAILURE;
+}

+ 169 - 0
wmi/src/wmi_unified_dbr_tlv.c

@@ -0,0 +1,169 @@
+/*
+ * 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.
+ */
+
+#include <osdep.h>
+#include "wmi.h"
+#include "wmi_unified_priv.h"
+#include "wmi_unified_dbr_param.h"
+#include "wmi_unified_dbr_api.h"
+
+/**
+ * send_dbr_cfg_cmd_tlv() - configure DMA rings for Direct Buf RX
+ * @wmi_handle: wmi handle
+ * @data_len: len of dma cfg req
+ * @data: dma cfg req
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+static QDF_STATUS send_dbr_cfg_cmd_tlv(wmi_unified_t wmi_handle,
+				struct direct_buf_rx_cfg_req *cfg)
+{
+	wmi_buf_t buf;
+	wmi_dma_ring_cfg_req_fixed_param *cmd;
+	QDF_STATUS ret;
+	int32_t len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
+	if (!buf) {
+		WMI_LOGE(FL("wmi_buf_alloc failed"));
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cmd = (wmi_dma_ring_cfg_req_fixed_param *)wmi_buf_data(buf);
+
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_dma_ring_cfg_req_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(wmi_dma_ring_cfg_req_fixed_param));
+
+	cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
+						cfg->pdev_id);
+	cmd->mod_id = cfg->mod_id;
+	cmd->base_paddr_lo = cfg->base_paddr_lo;
+	cmd->base_paddr_hi = cfg->base_paddr_hi;
+	cmd->head_idx_paddr_lo = cfg->head_idx_paddr_lo;
+	cmd->head_idx_paddr_hi = cfg->head_idx_paddr_hi;
+	cmd->tail_idx_paddr_lo = cfg->tail_idx_paddr_lo;
+	cmd->tail_idx_paddr_hi = cfg->tail_idx_paddr_hi;
+	cmd->num_elems = cfg->num_elems;
+	cmd->buf_size = cfg->buf_size;
+	cmd->num_resp_per_event = cfg->num_resp_per_event;
+	cmd->event_timeout_ms = cfg->event_timeout_ms;
+
+	WMI_LOGD("%s: wmi_dma_ring_cfg_req_fixed_param pdev id %d mod id %d"
+		  "base paddr lo %x base paddr hi %x head idx paddr lo %x"
+		  "head idx paddr hi %x tail idx paddr lo %x"
+		  "tail idx addr hi %x num elems %d buf size %d num resp %d"
+		  "event timeout %d", __func__, cmd->pdev_id,
+		  cmd->mod_id, cmd->base_paddr_lo, cmd->base_paddr_hi,
+		  cmd->head_idx_paddr_lo, cmd->head_idx_paddr_hi,
+		  cmd->tail_idx_paddr_lo, cmd->tail_idx_paddr_hi,
+		  cmd->num_elems, cmd->buf_size, cmd->num_resp_per_event,
+		  cmd->event_timeout_ms);
+	wmi_mtrace(WMI_PDEV_DMA_RING_CFG_REQ_CMDID, NO_SESSION, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
+				WMI_PDEV_DMA_RING_CFG_REQ_CMDID);
+	if (QDF_IS_STATUS_ERROR(ret)) {
+		WMI_LOGE(FL(":wmi cmd send failed"));
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+static QDF_STATUS extract_dbr_buf_release_fixed_tlv(wmi_unified_t wmi_handle,
+		uint8_t *event, struct direct_buf_rx_rsp *param)
+{
+	WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *param_buf;
+	wmi_dma_buf_release_fixed_param *ev;
+
+	param_buf = (WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *)event;
+	if (!param_buf)
+		return QDF_STATUS_E_INVAL;
+
+	ev = param_buf->fixed_param;
+	if (!ev)
+		return QDF_STATUS_E_INVAL;
+
+	param->pdev_id = wmi_handle->ops->convert_pdev_id_target_to_host(
+								ev->pdev_id);
+	param->mod_id = ev->mod_id;
+	param->num_buf_release_entry = ev->num_buf_release_entry;
+	param->num_meta_data_entry = ev->num_meta_data_entry;
+	WMI_LOGD("%s:pdev id %d mod id %d num buf release entry %d", __func__,
+		 param->pdev_id, param->mod_id, param->num_buf_release_entry);
+
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS extract_dbr_buf_release_entry_tlv(wmi_unified_t wmi_handle,
+		uint8_t *event, uint8_t idx, struct direct_buf_rx_entry *param)
+{
+	WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *param_buf;
+	wmi_dma_buf_release_entry *entry;
+
+	param_buf = (WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *)event;
+	if (!param_buf)
+		return QDF_STATUS_E_INVAL;
+
+	entry = &param_buf->entries[idx];
+
+	if (!entry) {
+		WMI_LOGE("%s: Entry is NULL", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	WMI_LOGD("%s: paddr_lo[%d] = %x", __func__, idx, entry->paddr_lo);
+
+	param->paddr_lo = entry->paddr_lo;
+	param->paddr_hi = entry->paddr_hi;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+static QDF_STATUS extract_dbr_buf_metadata_tlv(
+		wmi_unified_t wmi_handle, uint8_t *event,
+		uint8_t idx, struct direct_buf_rx_metadata *param)
+{
+	WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *param_buf;
+	wmi_dma_buf_release_spectral_meta_data *entry;
+
+	param_buf = (WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID_param_tlvs *)event;
+	if (!param_buf)
+		return QDF_STATUS_E_INVAL;
+
+	entry = &param_buf->meta_data[idx];
+
+	if (!entry) {
+		WMI_LOGE("%s: Entry is NULL", __func__);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	qdf_mem_copy(param->noisefloor, entry->noise_floor,
+		     sizeof(entry->noise_floor));
+	return QDF_STATUS_SUCCESS;
+}
+
+void wmi_dbr_attach_tlv(wmi_unified_t wmi_handle)
+{
+	struct wmi_ops *ops = wmi_handle->ops;
+
+	ops->send_dbr_cfg_cmd = send_dbr_cfg_cmd_tlv;
+	ops->extract_dbr_buf_release_entry = extract_dbr_buf_release_entry_tlv;
+	ops->extract_dbr_buf_metadata = extract_dbr_buf_metadata_tlv;
+	ops->extract_dbr_buf_release_fixed = extract_dbr_buf_release_fixed_tlv;
+}

+ 138 - 0
wmi/src/wmi_unified_smart_ant_api.c

@@ -0,0 +1,138 @@
+/*
+ * 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.
+ */
+
+#include "wmi_unified_priv.h"
+#include "wmi_unified_param.h"
+#include "qdf_module.h"
+
+/**
+ *  wmi_unified_set_ant_switch_tbl_cmd_send() - WMI ant switch tbl cmd function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold ant switch tbl param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_set_ant_switch_tbl_cmd_send(void *wmi_hdl,
+				struct ant_switch_tbl_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_set_ant_switch_tbl_cmd)
+		return wmi_handle->ops->send_set_ant_switch_tbl_cmd(wmi_handle,
+				param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_smart_ant_enable_cmd_send() - WMI smart ant enable function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold antenna param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_smart_ant_enable_cmd_send(void *wmi_hdl,
+				struct smart_ant_enable_params *param)
+{
+	wmi_unified_t wmi_handle = (wmi_unified_t) wmi_hdl;
+
+	if (wmi_handle->ops->send_smart_ant_enable_cmd)
+		return wmi_handle->ops->send_smart_ant_enable_cmd(wmi_handle,
+				param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_smart_ant_set_rx_ant_cmd_send() - WMI set rx antenna function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold antenna param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_smart_ant_set_rx_ant_cmd_send(void *wmi_hdl,
+				struct smart_ant_rx_ant_params *param)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->send_smart_ant_set_rx_ant_cmd)
+		return wmi->ops->send_smart_ant_set_rx_ant_cmd(wmi, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_smart_ant_set_tx_ant_cmd_send() - WMI set tx antenna function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold antenna param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+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)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->send_smart_ant_set_tx_ant_cmd)
+		return wmi->ops->send_smart_ant_set_tx_ant_cmd(wmi, macaddr,
+				param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_smart_ant_set_training_info_cmd_send() - WMI set tx antenna function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param param    : pointer to hold antenna param
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+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)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->send_smart_ant_set_training_info_cmd)
+		return wmi->ops->send_smart_ant_set_training_info_cmd(wmi,
+				macaddr, param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+/**
+ *  wmi_unified_smart_ant_node_config_cmd_send() - WMI set node config function
+ *  @param wmi_handle      : handle to WMI.
+ *  @param macaddr        : MAC address
+ *  @param param    : pointer to hold node parameter
+ *
+ *  @return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+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)
+{
+	wmi_unified_t wmi = (wmi_unified_t) wmi_hdl;
+
+	if (wmi->ops->send_smart_ant_set_node_config_cmd)
+		return wmi->ops->send_smart_ant_set_node_config_cmd(wmi,
+				  macaddr, param);
+
+	return QDF_STATUS_E_FAILURE;
+}

+ 484 - 0
wmi/src/wmi_unified_smart_ant_tlv.c

@@ -0,0 +1,484 @@
+/*
+ * 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.
+ */
+
+#include <osdep.h>
+#include "wmi.h"
+#include "wmi_unified_priv.h"
+#include "wmi_unified_smart_ant_param.h"
+#include "wmi_unified_smart_ant_api.h"
+
+/**
+ *  send_smart_ant_enable_cmd_tlv() - WMI smart ant enable function
+ *
+ *  @param wmi_handle  : handle to WMI.
+ *  @param param       : pointer to antenna param
+ *
+ *  This function sends smart antenna enable command to FW
+ *
+ *  @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS send_smart_ant_enable_cmd_tlv(wmi_unified_t wmi_handle,
+				struct smart_ant_enable_params *param)
+{
+	/* Send WMI COMMAND to Enable */
+	wmi_pdev_smart_ant_enable_cmd_fixed_param *cmd;
+	wmi_pdev_smart_ant_gpio_handle *gpio_param;
+	wmi_buf_t buf;
+	uint8_t *buf_ptr;
+	int len = 0;
+	QDF_STATUS ret;
+	int loop = 0;
+
+	len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
+	len += WMI_HAL_MAX_SANTENNA * sizeof(wmi_pdev_smart_ant_gpio_handle);
+	buf = wmi_buf_alloc(wmi_handle, len);
+
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	buf_ptr = wmi_buf_data(buf);
+	qdf_mem_zero(buf_ptr, len);
+	cmd = (wmi_pdev_smart_ant_enable_cmd_fixed_param *)buf_ptr;
+
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_pdev_smart_ant_enable_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(
+				wmi_pdev_smart_ant_enable_cmd_fixed_param));
+
+	cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
+								param->pdev_id);
+	cmd->enable = param->enable;
+	cmd->mode = param->mode;
+	cmd->rx_antenna = param->rx_antenna;
+	cmd->tx_default_antenna = param->rx_antenna;
+
+	/* TLV indicating array of structures to follow */
+	buf_ptr += sizeof(wmi_pdev_smart_ant_enable_cmd_fixed_param);
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
+		       WMI_HAL_MAX_SANTENNA *
+		       sizeof(wmi_pdev_smart_ant_gpio_handle));
+
+	buf_ptr += WMI_TLV_HDR_SIZE;
+	gpio_param = (wmi_pdev_smart_ant_gpio_handle *)buf_ptr;
+
+	for (loop = 0; loop < WMI_HAL_MAX_SANTENNA; loop++) {
+		WMITLV_SET_HDR(&gpio_param->tlv_header,
+			       WMITLV_TAG_STRUC_wmi_pdev_smart_ant_gpio_handle,
+			       WMITLV_GET_STRUCT_TLVLEN(
+			       wmi_pdev_smart_ant_gpio_handle));
+		if (param->mode == SMART_ANT_MODE_SERIAL) {
+			if (loop < WMI_HOST_MAX_SERIAL_ANTENNA) {
+				gpio_param->gpio_pin = param->gpio_pin[loop];
+				gpio_param->gpio_func = param->gpio_func[loop];
+			} else {
+				gpio_param->gpio_pin = 0;
+				gpio_param->gpio_func = 0;
+			}
+		} else if (param->mode == SMART_ANT_MODE_PARALLEL) {
+			gpio_param->gpio_pin = param->gpio_pin[loop];
+			gpio_param->gpio_func = param->gpio_func[loop];
+		}
+		/* Setting it to 0 for now */
+		gpio_param->pdev_id =
+			wmi_handle->ops->convert_pdev_id_host_to_target(
+								param->pdev_id);
+		gpio_param++;
+	}
+
+	wmi_mtrace(WMI_PDEV_SMART_ANT_ENABLE_CMDID, NO_SESSION, 0);
+	ret = wmi_unified_cmd_send(wmi_handle,
+				buf,
+				len,
+				WMI_PDEV_SMART_ANT_ENABLE_CMDID);
+
+	if (ret != 0) {
+		WMI_LOGE(" %s :WMI Failed\n", __func__);
+		WMI_LOGE("enable:%d mode:%d  rx_antenna: 0x%08x PINS: [%d %d %d %d] Func[%d %d %d %d] cmdstatus=%d\n",
+			 cmd->enable,
+			 cmd->mode,
+			 cmd->rx_antenna,
+			 param->gpio_pin[0], param->gpio_pin[1],
+			 param->gpio_pin[2], param->gpio_pin[3],
+			 param->gpio_func[0], param->gpio_func[1],
+			 param->gpio_func[2], param->gpio_func[3],
+			 ret);
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ *  send_smart_ant_set_rx_ant_cmd_tlv() - WMI set rx antenna function
+ *
+ *  @param wmi_handle     : handle to WMI.
+ *  @param param	  : pointer to rx antenna param
+ *  @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS send_smart_ant_set_rx_ant_cmd_tlv(wmi_unified_t wmi_handle,
+				struct smart_ant_rx_ant_params *param)
+{
+	wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	uint8_t *buf_ptr;
+	uint32_t len;
+	QDF_STATUS ret;
+
+	len = sizeof(*cmd);
+	buf = wmi_buf_alloc(wmi_handle, len);
+	WMI_LOGD("%s:\n", __func__);
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	buf_ptr = wmi_buf_data(buf);
+	cmd = (wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param *)buf_ptr;
+	WMITLV_SET_HDR(&cmd->tlv_header,
+	    WMITLV_TAG_STRUC_wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param,
+	    WMITLV_GET_STRUCT_TLVLEN(
+		wmi_pdev_smart_ant_set_rx_antenna_cmd_fixed_param));
+	cmd->rx_antenna = param->antenna;
+	cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
+								param->pdev_id);
+
+	wmi_mtrace(WMI_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID, NO_SESSION, 0);
+	ret = wmi_unified_cmd_send(wmi_handle,
+				buf,
+				len,
+				WMI_PDEV_SMART_ANT_SET_RX_ANTENNA_CMDID);
+
+	if (ret != 0) {
+		WMI_LOGE(" %s :WMI Failed\n", __func__);
+		WMI_LOGE("%s: rx_antenna: 0x%08x cmdstatus=%d\n",
+			 __func__,
+			 cmd->rx_antenna,
+			 ret);
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ *  send_smart_ant_set_tx_ant_cmd_tlv() - WMI set tx antenna function
+ *  @param wmi_handle  : handle to WMI.
+ *  @param macaddr     : vdev mac address
+ *  @param param       : pointer to tx antenna param
+ *
+ *  @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS send_smart_ant_set_tx_ant_cmd_tlv(wmi_unified_t wmi_handle,
+				uint8_t macaddr[IEEE80211_ADDR_LEN],
+				struct smart_ant_tx_ant_params *param)
+{
+	wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *cmd;
+	wmi_peer_smart_ant_set_tx_antenna_series *ant_tx_series;
+	wmi_buf_t buf;
+	int32_t len = 0;
+	int i;
+	uint8_t *buf_ptr;
+	QDF_STATUS ret;
+
+	len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
+	len += (WMI_SMART_ANT_MAX_RATE_SERIES) *
+		sizeof(wmi_peer_smart_ant_set_tx_antenna_series);
+	buf = wmi_buf_alloc(wmi_handle, len);
+
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	buf_ptr = (uint8_t *)wmi_buf_data(buf);
+	qdf_mem_zero(buf_ptr, len);
+	cmd = (wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param *)buf_ptr;
+
+	WMITLV_SET_HDR(&cmd->tlv_header,
+	    WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param,
+	    WMITLV_GET_STRUCT_TLVLEN(
+			wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param));
+
+	cmd->vdev_id = param->vdev_id;
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr);
+
+	buf_ptr += sizeof(wmi_peer_smart_ant_set_tx_antenna_cmd_fixed_param);
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
+		       sizeof(wmi_peer_smart_ant_set_tx_antenna_series));
+	buf_ptr += WMI_TLV_HDR_SIZE;
+	ant_tx_series = (wmi_peer_smart_ant_set_tx_antenna_series *)buf_ptr;
+
+	for (i = 0; i < WMI_SMART_ANT_MAX_RATE_SERIES; i++) {
+		WMITLV_SET_HDR(&ant_tx_series->tlv_header,
+		    WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_tx_antenna_series,
+		    WMITLV_GET_STRUCT_TLVLEN(
+				wmi_peer_smart_ant_set_tx_antenna_series));
+		ant_tx_series->antenna_series = param->antenna_array[i];
+		ant_tx_series++;
+	}
+
+	wmi_mtrace(WMI_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID, cmd->vdev_id, 0);
+	ret = wmi_unified_cmd_send(wmi_handle,
+				   buf,
+				   len,
+				   WMI_PEER_SMART_ANT_SET_TX_ANTENNA_CMDID);
+
+	if (ret != 0) {
+		WMI_LOGE(" %s :WMI Failed\n", __func__);
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+/**
+ * send_set_ant_switch_tbl_cmd_tlv() - send ant switch tbl cmd to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to hold ant switch tbl param
+ *
+ *  @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS
+send_set_ant_switch_tbl_cmd_tlv(wmi_unified_t wmi_handle,
+				struct ant_switch_tbl_params *param)
+{
+	uint8_t len;
+	wmi_buf_t buf;
+	wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *cmd;
+	wmi_pdev_set_ant_ctrl_chain *ctrl_chain;
+	uint8_t *buf_ptr;
+
+	len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
+	len += sizeof(wmi_pdev_set_ant_ctrl_chain);
+	buf = wmi_buf_alloc(wmi_handle, len);
+
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	buf_ptr = (uint8_t *)wmi_buf_data(buf);
+	qdf_mem_zero(buf_ptr, len);
+	cmd = (wmi_pdev_set_ant_switch_tbl_cmd_fixed_param *)buf_ptr;
+
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_pdev_set_ant_switch_tbl_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(
+			wmi_pdev_set_ant_switch_tbl_cmd_fixed_param));
+
+	cmd->antCtrlCommon1 = param->ant_ctrl_common1;
+	cmd->antCtrlCommon2 = param->ant_ctrl_common2;
+	cmd->mac_id =
+		wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id);
+
+	/* TLV indicating array of structures to follow */
+	buf_ptr += sizeof(wmi_pdev_set_ant_switch_tbl_cmd_fixed_param);
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
+		       sizeof(wmi_pdev_set_ant_ctrl_chain));
+	buf_ptr += WMI_TLV_HDR_SIZE;
+	ctrl_chain = (wmi_pdev_set_ant_ctrl_chain *)buf_ptr;
+
+	ctrl_chain->pdev_id =
+		wmi_handle->ops->convert_pdev_id_host_to_target(param->pdev_id);
+	ctrl_chain->antCtrlChain = param->antCtrlChain;
+
+	wmi_mtrace(WMI_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID, NO_SESSION, 0);
+	if (wmi_unified_cmd_send(wmi_handle, buf, len,
+				 WMI_PDEV_SET_ANTENNA_SWITCH_TABLE_CMDID)) {
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ *  send_smart_ant_set_training_info_cmd_tlv() - WMI set smart antenna
+ *  training information function
+ *  @param wmi_handle  : handle to WMI.
+ *  @macaddr	   : vdev mac address
+ *  @param param       : pointer to tx antenna param
+ *  @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS send_smart_ant_set_training_info_cmd_tlv(
+				wmi_unified_t wmi_handle,
+				uint8_t macaddr[IEEE80211_ADDR_LEN],
+				struct smart_ant_training_info_params *param)
+{
+	wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *cmd;
+	wmi_peer_smart_ant_set_train_antenna_param *train_param;
+	wmi_buf_t buf;
+	uint8_t *buf_ptr;
+	int32_t len = 0;
+	QDF_STATUS ret;
+	int loop;
+
+	len = sizeof(*cmd) + WMI_TLV_HDR_SIZE;
+	len += (WMI_SMART_ANT_MAX_RATE_SERIES) *
+		 sizeof(wmi_peer_smart_ant_set_train_antenna_param);
+	buf = wmi_buf_alloc(wmi_handle, len);
+
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	buf_ptr = (uint8_t *)wmi_buf_data(buf);
+	qdf_mem_zero(buf_ptr, len);
+	cmd = (wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param *)buf_ptr;
+
+	WMITLV_SET_HDR(&cmd->tlv_header,
+	WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(
+			wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param));
+
+	cmd->vdev_id = param->vdev_id;
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr);
+	cmd->num_pkts = param->numpkts;
+
+	buf_ptr += sizeof(wmi_peer_smart_ant_set_train_antenna_cmd_fixed_param);
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
+		       sizeof(wmi_peer_smart_ant_set_train_antenna_param) *
+		       WMI_SMART_ANT_MAX_RATE_SERIES);
+
+	buf_ptr += WMI_TLV_HDR_SIZE;
+	train_param = (wmi_peer_smart_ant_set_train_antenna_param *)buf_ptr;
+
+	for (loop = 0; loop < WMI_SMART_ANT_MAX_RATE_SERIES; loop++) {
+		WMITLV_SET_HDR(&train_param->tlv_header,
+		WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_train_antenna_param,
+			    WMITLV_GET_STRUCT_TLVLEN(
+				wmi_peer_smart_ant_set_train_antenna_param));
+		train_param->train_rate_series = param->rate_array[loop];
+		train_param->train_antenna_series = param->antenna_array[loop];
+		train_param->rc_flags = 0;
+		WMI_LOGI(FL("Series number:%d\n"), loop);
+		WMI_LOGI(FL("Rate [0x%02x] Tx_Antenna [0x%08x]\n"),
+			 train_param->train_rate_series,
+			 train_param->train_antenna_series);
+		train_param++;
+	}
+
+	wmi_mtrace(WMI_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID, cmd->vdev_id, 0);
+	ret = wmi_unified_cmd_send(wmi_handle,
+				buf,
+				len,
+				WMI_PEER_SMART_ANT_SET_TRAIN_INFO_CMDID);
+
+	if (ret != 0) {
+		WMI_LOGE(" %s :WMI Failed\n", __func__);
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return ret;
+}
+
+/**
+ *  send_smart_ant_set_node_config_cmd_tlv() - WMI set node
+ *  configuration function
+ *  @param wmi_handle		   : handle to WMI.
+ *  @macaddr			   : vdev mad address
+ *  @param param		   : pointer to tx antenna param
+ *
+ *  @return QDF_STATUS_SUCCESS  on success and -ve on failure.
+ */
+static QDF_STATUS send_smart_ant_set_node_config_cmd_tlv(
+				wmi_unified_t wmi_handle,
+				uint8_t macaddr[IEEE80211_ADDR_LEN],
+				struct smart_ant_node_config_params *param)
+{
+	wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	uint8_t *buf_ptr;
+	int32_t len = 0, args_tlv_len;
+	int ret;
+	int i = 0;
+	uint32_t *node_config_args;
+
+	args_tlv_len = WMI_TLV_HDR_SIZE + param->args_count * sizeof(uint32_t);
+	len = sizeof(*cmd) + args_tlv_len;
+
+	if (param->args_count == 0) {
+		WMI_LOGE("%s: Can't send a command with %d arguments\n",
+			  __func__, param->args_count);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s:wmi_buf_alloc failed\n", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	cmd = (wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param *)
+						wmi_buf_data(buf);
+	buf_ptr = (uint8_t *)cmd;
+	WMITLV_SET_HDR(&cmd->tlv_header,
+	WMITLV_TAG_STRUC_wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(
+		wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param));
+	cmd->vdev_id = param->vdev_id;
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->peer_macaddr);
+	cmd->cmd_id = param->cmd_id;
+	cmd->args_count = param->args_count;
+	buf_ptr += sizeof(
+		wmi_peer_smart_ant_set_node_config_ops_cmd_fixed_param);
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_UINT32,
+			(cmd->args_count * sizeof(uint32_t)));
+	buf_ptr += WMI_TLV_HDR_SIZE;
+	node_config_args = (uint32_t *)buf_ptr;
+
+	for (i = 0; i < param->args_count; i++) {
+		node_config_args[i] = param->args_arr[i];
+		WMI_LOGI("%d", param->args_arr[i]);
+	}
+
+	wmi_mtrace(WMI_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID,
+		   cmd->vdev_id, 0);
+	ret = wmi_unified_cmd_send(wmi_handle,
+			   buf,
+			   len,
+			   WMI_PEER_SMART_ANT_SET_NODE_CONFIG_OPS_CMDID);
+
+	if (ret != 0) {
+		WMI_LOGE("%s: WMI FAILED:Sent cmd_id: 0x%x\n Node: %02x:%02x:%02x:%02x:%02x:%02x cmdstatus=%d\n",
+			 __func__, param->cmd_id, macaddr[0],
+			 macaddr[1], macaddr[2], macaddr[3],
+			 macaddr[4], macaddr[5], ret);
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
+void wmi_smart_ant_attach_tlv(wmi_unified_t wmi_handle)
+{
+	struct wmi_ops *ops = wmi_handle->ops;
+
+	ops->send_smart_ant_enable_cmd = send_smart_ant_enable_cmd_tlv;
+	ops->send_smart_ant_set_rx_ant_cmd = send_smart_ant_set_rx_ant_cmd_tlv;
+	ops->send_smart_ant_set_tx_ant_cmd = send_smart_ant_set_tx_ant_cmd_tlv;
+	ops->send_smart_ant_set_training_info_cmd =
+				send_smart_ant_set_training_info_cmd_tlv;
+	ops->send_smart_ant_set_node_config_cmd =
+				send_smart_ant_set_node_config_cmd_tlv;
+	ops->send_set_ant_switch_tbl_cmd = send_set_ant_switch_tbl_cmd_tlv;
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 69 - 913
wmi/src/wmi_unified_tlv.c


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels