Bladeren bron

qcacld-3.0: Adapt wma layer with common wmi layer

Modify wmi layer API calls with respect to new common wmi layer.
Register all wmi service events using standard wmi event register API.
Remove TLV formation of common API from wma layer.
Pass rx scheduling context of wmi events during event registration.

CRs-Fixed: 976998
Change-Id: Id490db96c28778ec371dd633d43dfa002c08c16a
Govind Singh 9 jaren geleden
bovenliggende
commit
d76a5b05cb

+ 12 - 72
core/utils/fwlog/dbglog_host.c

@@ -79,11 +79,6 @@ module_dbg_print mod_print[WLAN_MODULE_ID_MAX];
 
 A_UINT32 dbglog_process_type = DBGLOG_PROCESS_NET_RAW;
 
-A_STATUS
-wmi_config_debug_module_cmd(wmi_unified_t wmi_handle, A_UINT32 param,
-			    A_UINT32 val, A_UINT32 *module_id_bitmap,
-			    A_UINT32 bitmap_len);
-
 const char *dbglog_get_module_str(A_UINT32 module_id)
 {
 	switch (module_id) {
@@ -1284,7 +1279,7 @@ int dbglog_module_log_enable(wmi_unified_t wmi_handle, A_UINT32 mod_id,
 		/* set it to ERROR level */
 		WMI_DBGLOG_SET_LOG_LEVEL(val, DBGLOG_ERR);
 	}
-	wmi_config_debug_module_cmd(wmi_handle, WMI_DEBUG_LOG_PARAM_LOG_LEVEL,
+	wma_config_debug_module_cmd(wmi_handle, WMI_DEBUG_LOG_PARAM_LOG_LEVEL,
 				    val, NULL, 0);
 
 	return 0;
@@ -1300,7 +1295,7 @@ int dbglog_vap_log_enable(wmi_unified_t wmi_handle, A_UINT16 vap_id,
 		return -EINVAL;
 	}
 
-	wmi_config_debug_module_cmd(wmi_handle,
+	wma_config_debug_module_cmd(wmi_handle,
 				    isenable ? WMI_DEBUG_LOG_PARAM_VDEV_ENABLE :
 				    WMI_DEBUG_LOG_PARAM_VDEV_DISABLE, vap_id,
 				    NULL, 0);
@@ -1321,7 +1316,7 @@ int dbglog_set_log_lvl(wmi_unified_t wmi_handle, DBGLOG_LOG_LVL log_lvl)
 
 	WMI_DBGLOG_SET_MODULE_ID(val, WMI_DEBUG_LOG_MODULE_ALL);
 	WMI_DBGLOG_SET_LOG_LEVEL(val, log_lvl);
-	wmi_config_debug_module_cmd(wmi_handle, WMI_DEBUG_LOG_PARAM_LOG_LEVEL,
+	wma_config_debug_module_cmd(wmi_handle, WMI_DEBUG_LOG_PARAM_LOG_LEVEL,
 				    val, NULL, 0);
 
 	return 0;
@@ -1333,75 +1328,17 @@ int dbglog_set_mod_log_lvl(wmi_unified_t wmi_handle, A_UINT32 mod_log_lvl)
 	/* set the global module level to log_lvl */
 	WMI_DBGLOG_SET_MODULE_ID(val, (mod_log_lvl / 10));
 	WMI_DBGLOG_SET_LOG_LEVEL(val, (mod_log_lvl % 10));
-	wmi_config_debug_module_cmd(wmi_handle, WMI_DEBUG_LOG_PARAM_LOG_LEVEL,
+	wma_config_debug_module_cmd(wmi_handle, WMI_DEBUG_LOG_PARAM_LOG_LEVEL,
 				    val, NULL, 0);
 
 	return 0;
 }
 
-A_STATUS
-wmi_config_debug_module_cmd(wmi_unified_t wmi_handle, A_UINT32 param,
-			    A_UINT32 val, A_UINT32 *module_id_bitmap,
-			    A_UINT32 bitmap_len)
-{
-	wmi_buf_t buf;
-	wmi_debug_log_config_cmd_fixed_param *configmsg;
-	A_STATUS status = A_OK;
-	int i;
-	int len;
-	int8_t *buf_ptr;
-	int32_t *module_id_bitmap_array;        /* Used to fomr the second tlv */
-
-	ASSERT(bitmap_len < MAX_MODULE_ID_BITMAP_WORDS);
-
-	/* Allocate size for 2 tlvs - including tlv hdr space for second tlv */
-	len = sizeof(wmi_debug_log_config_cmd_fixed_param) + WMI_TLV_HDR_SIZE +
-	      (sizeof(int32_t) * MAX_MODULE_ID_BITMAP_WORDS);
-	buf = wmi_buf_alloc(wmi_handle, len);
-	if (buf == NULL)
-		return A_NO_MEMORY;
-
-	configmsg =
-		(wmi_debug_log_config_cmd_fixed_param *) (wmi_buf_data(buf));
-	buf_ptr = (int8_t *) configmsg;
-	WMITLV_SET_HDR(&configmsg->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_debug_log_config_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (wmi_debug_log_config_cmd_fixed_param));
-	configmsg->dbg_log_param = param;
-	configmsg->value = val;
-	/* Filling in the data part of second tlv -- should follow first tlv _ WMI_TLV_HDR_SIZE */
-	module_id_bitmap_array = (A_UINT32 *) (buf_ptr +
-					       sizeof
-					       (wmi_debug_log_config_cmd_fixed_param)
-					       + WMI_TLV_HDR_SIZE);
-	WMITLV_SET_HDR(buf_ptr + sizeof(wmi_debug_log_config_cmd_fixed_param),
-		       WMITLV_TAG_ARRAY_UINT32,
-		       sizeof(A_UINT32) * MAX_MODULE_ID_BITMAP_WORDS);
-	if (module_id_bitmap) {
-		for (i = 0; i < bitmap_len; ++i) {
-			module_id_bitmap_array[i] = module_id_bitmap[i];
-		}
-	}
-
-	AR_DEBUG_PRINTF(ATH_DEBUG_ERR,
-			("wmi_dbg_cfg_send: param 0x%x val 0x%x \n ", param,
-			 val));
-
-	status = wmi_unified_cmd_send(wmi_handle, buf,
-				      len, WMI_DBGLOG_CFG_CMDID);
-
-	if (status != A_OK)
-		qdf_nbuf_free(buf);
-
-	return status;
-}
-
 void
 dbglog_set_vap_enable_bitmap(wmi_unified_t wmi_handle,
 			     A_UINT32 vap_enable_bitmap)
 {
-	wmi_config_debug_module_cmd(wmi_handle,
+	wma_config_debug_module_cmd(wmi_handle,
 				    WMI_DEBUG_LOG_PARAM_VDEV_ENABLE_BITMAP,
 				    vap_enable_bitmap, NULL, 0);
 }
@@ -1410,7 +1347,7 @@ void
 dbglog_set_mod_enable_bitmap(wmi_unified_t wmi_handle, A_UINT32 log_level,
 			     A_UINT32 *mod_enable_bitmap, A_UINT32 bitmap_len)
 {
-	wmi_config_debug_module_cmd(wmi_handle,
+	wma_config_debug_module_cmd(wmi_handle,
 				    WMI_DEBUG_LOG_PARAM_MOD_ENABLE_BITMAP,
 				    log_level, mod_enable_bitmap, bitmap_len);
 }
@@ -4408,20 +4345,23 @@ int dbglog_init(wmi_unified_t wmi_handle)
 	res =
 		wmi_unified_register_event_handler(wmi_handle,
 						   WMI_DEBUG_MESG_EVENTID,
-						   dbglog_parse_debug_logs);
+						   dbglog_parse_debug_logs,
+						   WMA_RX_WORK_CTX);
 	if (res != 0)
 		return res;
 
 	/* Register handler for FW diag events */
 	res = wmi_unified_register_event_handler(wmi_handle,
 						 WMI_DIAG_DATA_CONTAINER_EVENTID,
-						 fw_diag_data_event_handler);
+						 fw_diag_data_event_handler,
+						 WMA_RX_SERIALIZER_CTX);
 	if (res != 0)
 		return res;
 
 	/* Register handler for new FW diag  Event, LOG, MSG combined */
 	res = wmi_unified_register_event_handler(wmi_handle, WMI_DIAG_EVENTID,
-						 diag_fw_handler);
+						 diag_fw_handler,
+						 WMA_RX_SERIALIZER_CTX);
 	if (res != 0)
 		return res;
 

+ 19 - 4
core/wma/inc/wma.h

@@ -114,6 +114,7 @@
 
 #define     ALIGNED_WORD_SIZE       4
 #define WLAN_HAL_MSG_TYPE_MAX_ENUM_SIZE    0x7FFF
+#define WMA_WILDCARD_PDEV_ID 0x0
 
 /* Prefix used by scan req ids generated on the host */
 #define WMA_HOST_SCAN_REQID_PREFIX       0xA000
@@ -452,6 +453,18 @@ enum wma_tdls_peer_reason {
 };
 #endif /* FEATURE_WLAN_TDLS */
 
+/**
+ * enum wma_rx_exec_ctx - wma rx execution context
+ * @WMA_RX_WORK_CTX: work queue context execution
+ * @WMA_RX_TASKLET_CTX: tasklet context execution
+ * @WMA_RX_SERIALIZER_CTX: MC thread context execution
+ *
+ */
+enum wma_rx_exec_ctx {
+	WMA_RX_WORK_CTX,
+	WMA_RX_TASKLET_CTX,
+	WMA_RX_SERIALIZER_CTX
+};
 /**
  * struct wma_mem_chunk - memory chunks
  * @vaddr: virtual address
@@ -1916,8 +1929,7 @@ typedef struct {
 	void *evt_buf;
 } wma_process_fw_event_params;
 
-int wma_process_fw_event_handler(struct wmi_unified *wmi_handle,
-		wmi_buf_t evt_buf);
+int wma_process_fw_event_handler(void *ctx, void *ev, uint8_t rx_ctx);
 
 A_UINT32 e_csr_auth_type_to_rsn_authmode(eCsrAuthType authtype,
 					 eCsrEncryptionType encr);
@@ -1971,7 +1983,7 @@ QDF_STATUS wma_get_scan_id(uint32_t *scan_id);
 
 QDF_STATUS wma_send_soc_set_dual_mac_config(tp_wma_handle wma_handle,
 		struct sir_dual_mac_config *msg);
-int wma_crash_inject(tp_wma_handle wma_handle, uint32_t type,
+QDF_STATUS wma_crash_inject(tp_wma_handle wma_handle, uint32_t type,
 			uint32_t delay_time_ms);
 
 struct wma_target_req *wma_fill_vdev_req(tp_wma_handle wma,
@@ -1997,7 +2009,10 @@ int wma_mgmt_tx_completion_handler(void *handle, uint8_t *cmpl_event_params,
 				   uint32_t len);
 void wma_set_dfs_region(tp_wma_handle wma, uint8_t dfs_region);
 uint32_t wma_get_vht_ch_width(void);
-
+QDF_STATUS
+wma_config_debug_module_cmd(wmi_unified_t wmi_handle, A_UINT32 param,
+		A_UINT32 val, A_UINT32 *module_id_bitmap,
+		A_UINT32 bitmap_len);
 #ifdef FEATURE_LFR_SUBNET_DETECTION
 QDF_STATUS wma_set_gateway_params(tp_wma_handle wma,
 					struct gateway_param_update_req *req);

+ 8 - 7
core/wma/inc/wma_api.h

@@ -92,11 +92,11 @@ QDF_STATUS wma_wmi_service_close(void *cds_context);
 
 QDF_STATUS wma_wmi_work_close(void *cds_context);
 
-void wma_rx_ready_event(WMA_HANDLE handle, void *ev);
+int wma_rx_ready_event(void *handle, uint8_t *ev, uint32_t len);
 
-void wma_rx_service_ready_event(WMA_HANDLE handle, void *ev);
+int  wma_rx_service_ready_event(void *handle, uint8_t *ev, uint32_t len);
 
-void wma_rx_service_ready_ext_event(WMA_HANDLE handle, void *ev);
+int wma_rx_service_ready_ext_event(void *handle, uint8_t *ev, uint32_t len);
 
 void wma_setneedshutdown(void *cds_context);
 
@@ -120,10 +120,10 @@ QDF_STATUS wma_get_wcnss_software_version(void *p_cds_gctx,
 int wma_runtime_suspend(void);
 int wma_runtime_resume(void);
 int wma_bus_suspend(void);
-int wma_suspend_target(WMA_HANDLE handle, int disable_target_intr);
+QDF_STATUS wma_suspend_target(WMA_HANDLE handle, int disable_target_intr);
 void wma_target_suspend_acknowledge(void *context);
 int wma_bus_resume(void);
-int wma_resume_target(WMA_HANDLE handle);
+QDF_STATUS wma_resume_target(WMA_HANDLE handle);
 QDF_STATUS wma_disable_wow_in_fw(WMA_HANDLE handle);
 QDF_STATUS wma_disable_d0wow_in_fw(WMA_HANDLE handle);
 bool wma_is_wow_mode_selected(WMA_HANDLE handle);
@@ -131,8 +131,9 @@ QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle);
 QDF_STATUS wma_enable_d0wow_in_fw(WMA_HANDLE handle);
 bool wma_check_scan_in_progress(WMA_HANDLE handle);
 void wma_set_peer_authorized_cb(void *wma_ctx, wma_peer_authorized_fp auth_cb);
-int wma_set_peer_param(void *wma_ctx, uint8_t *peer_addr, uint32_t param_id,
-		       uint32_t param_value, uint32_t vdev_id);
+QDF_STATUS wma_set_peer_param(void *wma_ctx, uint8_t *peer_addr,
+		  uint32_t param_id,
+		  uint32_t param_value, uint32_t vdev_id);
 #ifdef NOT_YET
 QDF_STATUS wma_update_channel_list(WMA_HANDLE handle, void *scan_chan_info);
 #endif

+ 5 - 32
core/wma/inc/wma_internal.h

@@ -532,10 +532,6 @@ static inline uint8_t *wma_find_bssid_by_vdev_id(tp_wma_handle wma,
 void *wma_find_vdev_by_bssid(tp_wma_handle wma, uint8_t *bssid,
 				    uint8_t *vdev_id);
 
-int wma_unified_vdev_create_send(wmi_unified_t wmi_handle, uint8_t if_id,
-				 uint32_t type, uint32_t subtype,
-				 uint8_t macaddr[IEEE80211_ADDR_LEN]);
-
 QDF_STATUS wma_vdev_detach(tp_wma_handle wma_handle,
 			struct del_sta_self_params *pdel_sta_self_req_param,
 			uint8_t generateRsp);
@@ -543,15 +539,9 @@ QDF_STATUS wma_vdev_detach(tp_wma_handle wma_handle,
 int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info,
 				       uint32_t len);
 
-int wmi_unified_vdev_set_param_send(wmi_unified_t wmi_handle, uint32_t if_id,
+QDF_STATUS wma_vdev_set_param(wmi_unified_t wmi_handle, uint32_t if_id,
 				uint32_t param_id, uint32_t param_value);
 
-int32_t wmi_unified_peer_flush_tids_send(wmi_unified_t wmi,
-						uint8_t peer_addr
-						[IEEE80211_ADDR_LEN],
-						uint32_t peer_tid_bitmap,
-						uint8_t vdev_id);
-
 void wma_remove_peer(tp_wma_handle wma, uint8_t *bssid,
 			    uint8_t vdev_id, ol_txrx_peer_handle peer,
 			    bool roam_synch_in_progress);
@@ -590,16 +580,10 @@ void wma_remove_vdev_req(tp_wma_handle wma, uint8_t vdev_id,
 
 void wma_add_bss(tp_wma_handle wma, tpAddBssParams params);
 
-int wmi_unified_vdev_up_send(wmi_unified_t wmi,
-				    uint8_t vdev_id, uint16_t aid,
-				    uint8_t bssid[IEEE80211_ADDR_LEN]);
-
 void wma_add_sta(tp_wma_handle wma, tpAddStaParams add_sta);
 
 void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta);
 
-int32_t wmi_unified_vdev_stop_send(wmi_unified_t wmi, uint8_t vdev_id);
-
 void wma_delete_bss(tp_wma_handle wma, tpDeleteBssParams params);
 
 int32_t wma_find_vdev_by_type(tp_wma_handle wma, int32_t type);
@@ -693,14 +677,14 @@ void wma_hidden_ssid_vdev_restart(tp_wma_handle wma_handle,
 
 void wma_enable_sta_ps_mode(tp_wma_handle wma, tpEnablePsParams ps_req);
 
-int32_t wmi_unified_set_sta_ps_param(wmi_unified_t wmi_handle,
+QDF_STATUS wma_unified_set_sta_ps_param(wmi_unified_t wmi_handle,
 					    uint32_t vdev_id, uint32_t param,
 					    uint32_t value);
 
 QDF_STATUS
 wma_set_ibss_pwrsave_params(tp_wma_handle wma, uint8_t vdev_id);
 
-int32_t wma_set_ap_peer_uapsd(tp_wma_handle wma, uint32_t vdev_id,
+QDF_STATUS wma_set_ap_peer_uapsd(tp_wma_handle wma, uint32_t vdev_id,
 				     uint8_t *peer_addr, uint8_t uapsd_value,
 				     uint8_t max_sp);
 
@@ -713,9 +697,6 @@ void wma_set_tx_power(WMA_HANDLE handle,
 void wma_set_max_tx_power(WMA_HANDLE handle,
 				 tMaxTxPowerParams *tx_pwr_params);
 
-int32_t wmi_unified_set_sta_ps(wmi_unified_t wmi_handle,
-				      uint32_t vdev_id, uint8_t val);
-
 void wma_disable_sta_ps_mode(tp_wma_handle wma, tpDisablePsParams ps_req);
 
 void wma_enable_uapsd_mode(tp_wma_handle wma, tpEnableUapsdParams ps_req);
@@ -880,9 +861,6 @@ int32_t wma_txrx_fw_stats_reset(tp_wma_handle wma_handle,
 int32_t wma_set_txrx_fw_stats_level(tp_wma_handle wma_handle,
 				    uint8_t vdev_id, uint32_t value);
 
-int wmi_crash_inject(wmi_unified_t wmi_handle, uint32_t type,
-		     uint32_t delay_time_ms);
-
 void wma_get_stats_req(WMA_HANDLE handle,
 		       tAniGetPEStatsReq *get_stats_param);
 
@@ -917,11 +895,6 @@ WLAN_PHY_MODE wma_chan_to_mode(u8 chan, phy_ch_width chan_width,
 
 QDF_STATUS wma_get_link_speed(WMA_HANDLE handle, tSirLinkSpeedInfo *pLinkSpeed);
 
-#ifdef FEATURE_GREEN_AP
-int32_t wmi_unified_pdev_green_ap_ps_enable_cmd(wmi_unified_t wmi_handle,
-						uint32_t value);
-#endif
-
 int wma_profile_data_report_event_handler(void *handle, uint8_t *event_buf,
 				       uint32_t len);
 
@@ -932,7 +905,7 @@ void wma_wow_tx_complete(void *wma);
 
 int wmi_unified_nat_keepalive_enable(tp_wma_handle wma, uint8_t vdev_id);
 
-int wmi_unified_csa_offload_enable(tp_wma_handle wma, uint8_t vdev_id);
+int wma_unified_csa_offload_enable(tp_wma_handle wma, uint8_t vdev_id);
 
 #ifdef WLAN_FEATURE_NAN
 int wma_nan_rsp_event_handler(void *handle, uint8_t *event_buf, uint32_t len);
@@ -1104,7 +1077,7 @@ QDF_STATUS wma_process_ch_avoid_update_req(tp_wma_handle wma_handle,
 					   ch_avoid_update_req);
 #endif
 
-int wma_suspend_target(WMA_HANDLE handle, int disable_target_intr);
+QDF_STATUS wma_suspend_target(WMA_HANDLE handle, int disable_target_intr);
 
 #ifdef FEATURE_WLAN_TDLS
 

+ 15 - 11
core/wma/src/wma_data.c

@@ -788,7 +788,7 @@ int32_t wmi_unified_send_txbf(tp_wma_handle wma, tpAddStaParams params)
 	WMA_LOGD("txbf_en.sutxbfee %d txbf_en.mutxbfee %d, sutxbfer %d",
 		 txbf_en.sutxbfee, txbf_en.mutxbfee, txbf_en.sutxbfer);
 
-	return wmi_unified_vdev_set_param_send(wma->wmi_handle,
+	return wma_vdev_set_param(wma->wmi_handle,
 						params->smesessionId,
 						WMI_VDEV_PARAM_TXBF,
 						*((A_UINT8 *) &txbf_en));
@@ -1403,6 +1403,7 @@ QDF_STATUS wma_process_rate_update_indicate(tp_wma_handle wma,
 	uint8_t rate = 0;
 	uint32_t short_gi;
 	struct wma_txrx_node *intr = wma->interfaces;
+	QDF_STATUS status;
 
 	/* Get the vdev id */
 	pdev = wma_find_vdev_by_addr(wma, pRateUpdateParams->bssid.bytes,
@@ -1449,20 +1450,20 @@ QDF_STATUS wma_process_rate_update_indicate(tp_wma_handle wma,
 		qdf_mem_free(pRateUpdateParams);
 		return ret;
 	}
-	ret = wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
+	status = wma_vdev_set_param(wma->wmi_handle, vdev_id,
 					      WMI_VDEV_PARAM_SGI, short_gi);
-	if (ret) {
-		WMA_LOGE("%s: Failed to Set WMI_VDEV_PARAM_SGI (%d), ret = %d",
-			 __func__, short_gi, ret);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		WMA_LOGE("%s: Failed to Set WMI_VDEV_PARAM_SGI (%d), status = %d",
+			 __func__, short_gi, status);
 		qdf_mem_free(pRateUpdateParams);
-		return QDF_STATUS_E_FAILURE;
+		return status;
 	}
-	ret = wmi_unified_vdev_set_param_send(wma->wmi_handle,
+	status = wma_vdev_set_param(wma->wmi_handle,
 					      vdev_id, paramId, rate);
 	qdf_mem_free(pRateUpdateParams);
-	if (ret) {
-		WMA_LOGE("%s: Failed to Set rate, ret = %d", __func__, ret);
-		return QDF_STATUS_E_FAILURE;
+	if (QDF_IS_STATUS_ERROR(status)) {
+		WMA_LOGE("%s: Failed to Set rate, status = %d", __func__, status);
+		return status;
 	}
 
 	return QDF_STATUS_SUCCESS;
@@ -2965,6 +2966,7 @@ void wma_tx_abort(uint8_t vdev_id)
 	tp_wma_handle wma;
 	uint32_t peer_tid_bitmap = PEER_ALL_TID_BITMASK;
 	struct wma_txrx_node *iface;
+	struct peer_flush_params param = {0};
 
 	wma = cds_get_context(QDF_MODULE_ID_WMA);
 	if (NULL == wma) {
@@ -2984,8 +2986,10 @@ void wma_tx_abort(uint8_t vdev_id)
 
 	/* Flush all TIDs except MGMT TID for this peer in Target */
 	peer_tid_bitmap &= ~(0x1 << WMI_MGMT_TID);
+	param.peer_tid_bitmap = peer_tid_bitmap;
+	param.vdev_id = vdev_id;
 	wmi_unified_peer_flush_tids_send(wma->wmi_handle, iface->bssid,
-					 peer_tid_bitmap, vdev_id);
+					 &param);
 }
 
 #if defined(FEATURE_LRO)

+ 139 - 440
core/wma/src/wma_dev_if.c

@@ -211,86 +211,6 @@ enum wlan_op_mode wma_get_txrx_vdev_type(uint32_t type)
 	return vdev_type;
 }
 
-/**
- * wma_unified_vdev_create_send() - send VDEV create command to fw
- * @wmi_handle: wmi handle
- * @if_id: vdev id
- * @type: vdev type
- * @subtype: vdev subtype
- * @macaddr: vdev mac address
- *
- * Return: 0 for success or error code
- */
-int wma_unified_vdev_create_send(wmi_unified_t wmi_handle, uint8_t if_id,
-				 uint32_t type, uint32_t subtype,
-				 uint8_t macaddr[IEEE80211_ADDR_LEN])
-{
-	wmi_vdev_create_cmd_fixed_param *cmd;
-	wmi_buf_t buf;
-	int len = sizeof(*cmd);
-	int ret;
-
-	buf = wmi_buf_alloc(wmi_handle, len);
-	if (!buf) {
-		WMA_LOGP("%s:wmi_buf_alloc failed", __FUNCTION__);
-		return -ENOMEM;
-	}
-	cmd = (wmi_vdev_create_cmd_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_vdev_create_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (wmi_vdev_create_cmd_fixed_param));
-	cmd->vdev_id = if_id;
-	cmd->vdev_type = type;
-	cmd->vdev_subtype = subtype;
-	WMI_CHAR_ARRAY_TO_MAC_ADDR(macaddr, &cmd->vdev_macaddr);
-	WMA_LOGE("%s: ID = %d VAP Addr = %02x:%02x:%02x:%02x:%02x:%02x",
-		 __func__, if_id,
-		 macaddr[0], macaddr[1], macaddr[2],
-		 macaddr[3], macaddr[4], macaddr[5]);
-	ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_VDEV_CREATE_CMDID);
-	if (ret != EOK) {
-		WMA_LOGE("Failed to send WMI_VDEV_CREATE_CMDID");
-		wmi_buf_free(buf);
-	}
-	return ret;
-}
-
-/**
- * wma_unified_vdev_delete_send() - send VDEV delete command to fw
- * @wmi_handle: wmi handle
- * @if_id: vdev id
- *
- * Return: 0 for success or error code
- */
-static int wma_unified_vdev_delete_send(wmi_unified_t wmi_handle, uint8_t if_id)
-{
-	wmi_vdev_delete_cmd_fixed_param *cmd;
-	wmi_buf_t buf;
-	int ret;
-
-	buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
-	if (!buf) {
-		WMA_LOGP("%s:wmi_buf_alloc failed", __FUNCTION__);
-		return -ENOMEM;
-	}
-
-	cmd = (wmi_vdev_delete_cmd_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_vdev_delete_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (wmi_vdev_delete_cmd_fixed_param));
-	cmd->vdev_id = if_id;
-	ret = wmi_unified_cmd_send(wmi_handle, buf,
-				   sizeof(wmi_vdev_delete_cmd_fixed_param),
-				   WMI_VDEV_DELETE_CMDID);
-	if (ret != EOK) {
-		WMA_LOGE("Failed to send WMI_VDEV_DELETE_CMDID");
-		wmi_buf_free(buf);
-	}
-	return ret;
-}
-
 /**
  * wma_find_req() - find target request for vdev id
  * @wma: wma handle
@@ -606,9 +526,9 @@ static QDF_STATUS wma_handle_vdev_detach(tp_wma_handle wma_handle,
 	struct wma_target_req *msg = NULL;
 	cds_msg_t sme_msg = { 0 };
 
-	if (wma_unified_vdev_delete_send(wma_handle->wmi_handle, vdev_id)) {
+	status = wmi_unified_vdev_delete_send(wma_handle->wmi_handle, vdev_id);
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMA_LOGE("Unable to remove an interface");
-		status = QDF_STATUS_E_FAILURE;
 		goto out;
 	}
 
@@ -720,45 +640,6 @@ QDF_STATUS wma_vdev_detach(tp_wma_handle wma_handle,
 	return status;
 }
 
-/**
- * wmi_unified_peer_delete_send() - send PEER delete command to fw
- * @wmi: wmi handle
- * @peer_addr: peer mac addr
- * @vdev_id: vdev id
- *
- * Return: 0 for success or error code
- */
-static int32_t wmi_unified_peer_delete_send(wmi_unified_t wmi,
-					    uint8_t
-					    peer_addr[IEEE80211_ADDR_LEN],
-					    uint8_t vdev_id)
-{
-	wmi_peer_delete_cmd_fixed_param *cmd;
-	wmi_buf_t buf;
-	int32_t len = sizeof(*cmd);
-
-	buf = wmi_buf_alloc(wmi, len);
-	if (!buf) {
-		WMA_LOGP("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
-	}
-	cmd = (wmi_peer_delete_cmd_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_peer_delete_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (wmi_peer_delete_cmd_fixed_param));
-	WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr);
-	cmd->vdev_id = vdev_id;
-
-	if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_DELETE_CMDID)) {
-		WMA_LOGP("%s: Failed to send peer delete command", __func__);
-		qdf_nbuf_free(buf);
-		return -EIO;
-	}
-	WMA_LOGD("%s: peer_addr %pM vdev_id %d", __func__, peer_addr, vdev_id);
-	return 0;
-}
-
 /**
  * wma_vdev_start_rsp() - send vdev start response to upper layer
  * @wma: wma handle
@@ -905,6 +786,9 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info,
 	wmi_vdev_start_response_event_fixed_param *resp_event;
 	struct wma_target_req *req_msg;
 	struct wma_txrx_node *iface;
+	struct vdev_up_params param = {0};
+	QDF_STATUS status;
+
 #ifdef FEATURE_AP_MCC_CH_AVOIDANCE
 	tpAniSirGlobal mac_ctx = cds_get_context(QDF_MODULE_ID_PE);
 	if (NULL == mac_ctx) {
@@ -957,9 +841,12 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info,
 		WMA_LOGE("%s: vdev restart event recevied for hidden ssid set using IOCTL",
 			__func__);
 
+		param.vdev_id = resp_event->vdev_id;
+		param.assoc_id = 0;
 		if (wmi_unified_vdev_up_send
-			    (wma->wmi_handle, resp_event->vdev_id, 0,
-			    wma->interfaces[resp_event->vdev_id].bssid) < 0) {
+			    (wma->wmi_handle,
+			    wma->interfaces[resp_event->vdev_id].bssid,
+				&param) != QDF_STATUS_SUCCESS) {
 			WMA_LOGE("%s : failed to send vdev up", __func__);
 			return -EEXIST;
 		}
@@ -1007,10 +894,12 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info,
 		params->status = resp_event->status;
 		if (resp_event->resp_type == WMI_VDEV_RESTART_RESP_EVENT &&
 		    (iface->type == WMI_VDEV_TYPE_STA)) {
-			if (wmi_unified_vdev_up_send(wma->wmi_handle,
-						     resp_event->vdev_id,
-						     iface->aid,
-						     iface->bssid)) {
+			param.vdev_id = resp_event->vdev_id;
+			param.assoc_id = iface->aid;
+			status = wmi_unified_vdev_up_send(wma->wmi_handle,
+						 iface->bssid,
+						 &param);
+			if (QDF_IS_STATUS_ERROR(status)) {
 				WMA_LOGE("%s:vdev_up failed vdev_id %d",
 					 __func__, resp_event->vdev_id);
 				wma->interfaces[resp_event->vdev_id].vdev_up =
@@ -1028,9 +917,11 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info,
 				IEEE80211_ADDR_LEN);
 		wma_vdev_start_rsp(wma, bssParams, resp_event);
 	} else if (req_msg->msg_type == WMA_OCB_SET_CONFIG_CMD) {
+		param.vdev_id = resp_event->vdev_id;
+		param.assoc_id = iface->aid;
 		if (wmi_unified_vdev_up_send(wma->wmi_handle,
-					     resp_event->vdev_id, iface->aid,
-					     iface->bssid) < 0) {
+					     iface->bssid,
+					     &param) != QDF_STATUS_SUCCESS) {
 			WMA_LOGE(FL("failed to send vdev up"));
 			return -EEXIST;
 		}
@@ -1050,86 +941,24 @@ int wma_vdev_start_resp_handler(void *handle, uint8_t *cmd_param_info,
 }
 
 /**
- * wmi_unified_vdev_set_param_send() - set per vdev params in fw
+ * wma_vdev_set_param() - set per vdev params in fw
  * @wmi_handle: wmi handle
  * @if_if: vdev id
  * @param_id: parameter id
  * @param_value: parameter value
  *
- * Return: 0 for success or error code
+ * Return: QDF_STATUS_SUCCESS for success or error code
  */
-int
-wmi_unified_vdev_set_param_send(wmi_unified_t wmi_handle, uint32_t if_id,
+QDF_STATUS
+wma_vdev_set_param(wmi_unified_t wmi_handle, uint32_t if_id,
 				uint32_t param_id, uint32_t param_value)
 {
-	int ret;
-	wmi_vdev_set_param_cmd_fixed_param *cmd;
-	wmi_buf_t buf;
-	uint16_t len = sizeof(*cmd);
+	struct vdev_set_params param = {0};
+	param.if_id = if_id;
+	param.param_id = param_id;
+	param.param_value = param_value;
 
-	buf = wmi_buf_alloc(wmi_handle, len);
-	if (!buf) {
-		WMA_LOGE("%s:wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
-	}
-	cmd = (wmi_vdev_set_param_cmd_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_vdev_set_param_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (wmi_vdev_set_param_cmd_fixed_param));
-	cmd->vdev_id = if_id;
-	cmd->param_id = param_id;
-	cmd->param_value = param_value;
-	WMA_LOGD("Setting vdev %d param = %x, value = %u",
-		 if_id, param_id, param_value);
-	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
-				   WMI_VDEV_SET_PARAM_CMDID);
-	if (ret < 0) {
-		WMA_LOGE("Failed to send set param command ret = %d", ret);
-		wmi_buf_free(buf);
-	}
-	return ret;
-}
-
-/**
- * wmi_unified_peer_flush_tids_send() - flush peer tids packets in fw
- * @wmi: wmi handle
- * @peer_addr: peer mac address
- * @peer_tid_bitmap: peer tid bitmap
- * @vdev_id: vdev id
- *
- * Return: 0 for sucess or error code
- */
-int32_t wmi_unified_peer_flush_tids_send(wmi_unified_t wmi,
-					 uint8_t peer_addr[IEEE80211_ADDR_LEN],
-					 uint32_t peer_tid_bitmap,
-					 uint8_t vdev_id)
-{
-	wmi_peer_flush_tids_cmd_fixed_param *cmd;
-	wmi_buf_t buf;
-	int32_t len = sizeof(*cmd);
-
-	buf = wmi_buf_alloc(wmi, len);
-	if (!buf) {
-		WMA_LOGP("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
-	}
-	cmd = (wmi_peer_flush_tids_cmd_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_peer_flush_tids_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (wmi_peer_flush_tids_cmd_fixed_param));
-	WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr);
-	cmd->peer_tid_bitmap = peer_tid_bitmap;
-	cmd->vdev_id = vdev_id;
-
-	if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_FLUSH_TIDS_CMDID)) {
-		WMA_LOGP("%s: Failed to send flush tid command", __func__);
-		qdf_nbuf_free(buf);
-		return -EIO;
-	}
-	WMA_LOGD("%s: peer_addr %pM vdev_id %d", __func__, peer_addr, vdev_id);
-	return 0;
+	return wmi_unified_vdev_set_param_send(wmi_handle, &param);
 }
 
 /**
@@ -1153,39 +982,24 @@ void wma_set_peer_authorized_cb(void *wma_ctx, wma_peer_authorized_fp auth_cb)
  * @param_value: parameter value
  * @vdev_id: vdev id
  *
- * Return: 0 for success or error code
+ * Return: QDF_STATUS_SUCCESS for success or error code
  */
-int wma_set_peer_param(void *wma_ctx, uint8_t *peer_addr, uint32_t param_id,
-		       uint32_t param_value, uint32_t vdev_id)
+QDF_STATUS wma_set_peer_param(void *wma_ctx, uint8_t *peer_addr,
+			      uint32_t param_id, uint32_t param_value,
+			      uint32_t vdev_id)
 {
 	tp_wma_handle wma_handle = (tp_wma_handle) wma_ctx;
-	wmi_peer_set_param_cmd_fixed_param *cmd;
-	wmi_buf_t buf;
+	struct peer_set_params param = {0};
 	int err;
 
-	buf = wmi_buf_alloc(wma_handle->wmi_handle, sizeof(*cmd));
-	if (!buf) {
-		WMA_LOGE("Failed to allocate buffer to send set_param cmd");
-		return -ENOMEM;
-	}
-	cmd = (wmi_peer_set_param_cmd_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_peer_set_param_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-				(wmi_peer_set_param_cmd_fixed_param));
-	cmd->vdev_id = vdev_id;
-	WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr);
-	cmd->param_id = param_id;
-	cmd->param_value = param_value;
-	err = wmi_unified_cmd_send(wma_handle->wmi_handle, buf,
-				   sizeof(wmi_peer_set_param_cmd_fixed_param),
-				   WMI_PEER_SET_PARAM_CMDID);
-	if (err) {
-		WMA_LOGE("Failed to send set_param cmd");
-		qdf_mem_free(buf);
-		return -EIO;
-	}
-	return 0;
+	param.vdev_id = vdev_id;
+	param.param_value = param_value;
+	param.param_id = param_id;
+
+	err = wmi_set_peer_param_send(wma_handle->wmi_handle, peer_addr,
+					   &param);
+
+	return err;
 }
 
 /**
@@ -1205,6 +1019,8 @@ void wma_remove_peer(tp_wma_handle wma, uint8_t *bssid,
 #define PEER_ALL_TID_BITMASK 0xffffffff
 	uint32_t peer_tid_bitmap = PEER_ALL_TID_BITMASK;
 	uint8_t *peer_addr = bssid;
+	struct peer_flush_params param = {0};
+
 	if (!wma->interfaces[vdev_id].peer_count) {
 		WMA_LOGE("%s: Can't remove peer with peer_addr %pM vdevid %d peer_count %d",
 			__func__, bssid, vdev_id,
@@ -1221,8 +1037,10 @@ void wma_remove_peer(tp_wma_handle wma, uint8_t *bssid,
 		return;
 	/* Flush all TIDs except MGMT TID for this peer in Target */
 	peer_tid_bitmap &= ~(0x1 << WMI_MGMT_TID);
+	param.peer_tid_bitmap = peer_tid_bitmap;
+	param.vdev_id = vdev_id;
 	wmi_unified_peer_flush_tids_send(wma->wmi_handle, bssid,
-					 peer_tid_bitmap, vdev_id);
+					 &param);
 
 	if ((peer) && (wma_is_vdev_in_ibss_mode(wma, vdev_id))) {
 		WMA_LOGD("%s: bssid %pM peer->mac_addr %pM", __func__,
@@ -1234,46 +1052,6 @@ void wma_remove_peer(tp_wma_handle wma, uint8_t *bssid,
 #undef PEER_ALL_TID_BITMASK
 }
 
-/**
- * wmi_unified_peer_create_send() - send peer create command to fw
- * @wmi: wmi handle
- * @peer_addr: peer mac address
- * @peer_type: peer type
- * @vdev_id: vdev id
- *
- * Return: 0 for success or error code
- */
-static int wmi_unified_peer_create_send(wmi_unified_t wmi,
-					const uint8_t *peer_addr,
-					uint32_t peer_type, uint32_t vdev_id)
-{
-	wmi_peer_create_cmd_fixed_param *cmd;
-	wmi_buf_t buf;
-	int32_t len = sizeof(*cmd);
-
-	buf = wmi_buf_alloc(wmi, len);
-	if (!buf) {
-		WMA_LOGP("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
-	}
-	cmd = (wmi_peer_create_cmd_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_peer_create_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (wmi_peer_create_cmd_fixed_param));
-	WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_addr, &cmd->peer_macaddr);
-	cmd->peer_type = peer_type;
-	cmd->vdev_id = vdev_id;
-
-	if (wmi_unified_cmd_send(wmi, buf, len, WMI_PEER_CREATE_CMDID)) {
-		WMA_LOGP("%s: failed to send WMI_PEER_CREATE_CMDID", __func__);
-		qdf_nbuf_free(buf);
-		return -EIO;
-	}
-	WMA_LOGD("%s: peer_addr %pM vdev_id %d", __func__, peer_addr, vdev_id);
-	return 0;
-}
-
 /**
  * wma_create_peer() - send peer create command to fw
  * @wma: wma handle
@@ -1293,6 +1071,7 @@ QDF_STATUS wma_create_peer(tp_wma_handle wma, ol_txrx_pdev_handle pdev,
 			  bool roam_synch_in_progress)
 {
 	ol_txrx_peer_handle peer;
+	struct peer_create_params param = {0};
 
 	if (++wma->interfaces[vdev_id].peer_count >
 	    wma->wlan_resource_config.num_peers) {
@@ -1312,8 +1091,11 @@ QDF_STATUS wma_create_peer(tp_wma_handle wma, ol_txrx_pdev_handle pdev,
 			 wma->interfaces[vdev_id].peer_count);
 		return QDF_STATUS_SUCCESS;
 	}
-	if (wmi_unified_peer_create_send(wma->wmi_handle, peer_addr,
-					 peer_type, vdev_id) < 0) {
+	param.peer_addr = peer_addr;
+	param.peer_type = peer_type;
+	param.vdev_id = vdev_id;
+	if (wmi_unified_peer_create_send(wma->wmi_handle,
+					 &param) != QDF_STATUS_SUCCESS) {
 		WMA_LOGP("%s : Unable to create peer in Target", __func__);
 		ol_txrx_peer_detach(peer);
 		goto err;
@@ -1344,38 +1126,6 @@ err:
 	return QDF_STATUS_E_FAILURE;
 }
 
-/**
- * wmi_unified_vdev_down_send() - send vdev down command to fw
- * @wmi: wmi handle
- * @vdev_id: vdev id
- *
- * Return: 0 for success or error code
- */
-static int wmi_unified_vdev_down_send(wmi_unified_t wmi, uint8_t vdev_id)
-{
-	wmi_vdev_down_cmd_fixed_param *cmd;
-	wmi_buf_t buf;
-	int32_t len = sizeof(*cmd);
-
-	buf = wmi_buf_alloc(wmi, len);
-	if (!buf) {
-		WMA_LOGP("%s : wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
-	}
-	cmd = (wmi_vdev_down_cmd_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_vdev_down_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_down_cmd_fixed_param));
-	cmd->vdev_id = vdev_id;
-	if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_DOWN_CMDID)) {
-		WMA_LOGP("%s: Failed to send vdev down", __func__);
-		qdf_nbuf_free(buf);
-		return -EIO;
-	}
-	WMA_LOGE("%s: vdev_id %d", __func__, vdev_id);
-	return 0;
-}
-
 #ifdef QCA_IBSS_SUPPORT
 
 /**
@@ -1753,8 +1503,9 @@ int wma_vdev_stop_resp_handler(void *handle, uint8_t *cmd_param_info,
 					peer, false);
 		}
 
-		if (wmi_unified_vdev_down_send
-			    (wma->wmi_handle, resp_event->vdev_id) < 0) {
+		if (wmi_unified_vdev_down_send(wma->wmi_handle,
+						resp_event->vdev_id) !=
+						QDF_STATUS_SUCCESS) {
 			WMA_LOGE("Failed to send vdev down cmd: vdev %d",
 				 resp_event->vdev_id);
 		} else {
@@ -1841,24 +1592,27 @@ ol_txrx_vdev_handle wma_vdev_attach(tp_wma_handle wma_handle,
 	struct sAniSirGlobal *mac = cds_get_context(QDF_MODULE_ID_PE);
 	uint32_t cfg_val;
 	uint16_t val16;
-	int ret;
+	QDF_STATUS ret;
 	tSirMacHTCapabilityInfo *phtCapInfo;
 	cds_msg_t sme_msg = { 0 };
+	struct vdev_create_params params = { 0 };
 
 	if (NULL == mac) {
 		WMA_LOGE("%s: Failed to get mac", __func__);
 		goto end;
 	}
 
+	params.if_id = self_sta_req->session_id;
+	params.type = self_sta_req->type;
+	params.subtype = self_sta_req->sub_type;
+
 	/* Create a vdev in target */
-	if (wma_unified_vdev_create_send(wma_handle->wmi_handle,
-					 self_sta_req->session_id,
-					 self_sta_req->type,
-					 self_sta_req->sub_type,
-					 self_sta_req->self_mac_addr)) {
+	status = wmi_unified_vdev_create_send(wma_handle->wmi_handle,
+						self_sta_req->self_mac_addr,
+						&params);
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMA_LOGP("%s: Unable to add an interface for ath_dev",
 			 __func__);
-		status = QDF_STATUS_E_RESOURCES;
 		goto end;
 	}
 
@@ -1866,7 +1620,7 @@ ol_txrx_vdev_handle wma_vdev_attach(tp_wma_handle wma_handle,
 
 	if (wlan_op_mode_unknown == txrx_vdev_type) {
 		WMA_LOGE("Failed to get txrx vdev type");
-		wma_unified_vdev_delete_send(wma_handle->wmi_handle,
+		wmi_unified_vdev_delete_send(wma_handle->wmi_handle,
 					     self_sta_req->session_id);
 		goto end;
 	}
@@ -1883,7 +1637,7 @@ ol_txrx_vdev_handle wma_vdev_attach(tp_wma_handle wma_handle,
 	if (NULL == txrx_vdev_handle) {
 		WMA_LOGP("%s: ol_txrx_vdev_attach failed", __func__);
 		status = QDF_STATUS_E_FAILURE;
-		wma_unified_vdev_delete_send(wma_handle->wmi_handle,
+		wmi_unified_vdev_delete_send(wma_handle->wmi_handle,
 					     self_sta_req->session_id);
 		goto end;
 	}
@@ -1958,32 +1712,32 @@ ol_txrx_vdev_handle wma_vdev_attach(tp_wma_handle wma_handle,
 		if (status != QDF_STATUS_SUCCESS) {
 			WMA_LOGE("%s: Failed to create peer", __func__);
 			status = QDF_STATUS_E_FAILURE;
-			wma_unified_vdev_delete_send(wma_handle->wmi_handle,
+			wmi_unified_vdev_delete_send(wma_handle->wmi_handle,
 						     self_sta_req->session_id);
 		}
 	}
 
-	ret = wmi_unified_vdev_set_param_send(wma_handle->wmi_handle,
+	ret = wma_vdev_set_param(wma_handle->wmi_handle,
 				self_sta_req->session_id,
 				WMI_VDEV_PARAM_MCC_RTSCTS_PROTECTION_ENABLE,
 				mac->roam.configParam.mcc_rts_cts_prot_enable);
-	if (ret)
+	if (QDF_IS_STATUS_ERROR(ret))
 		WMA_LOGE("Failed to set WMI VDEV MCC_RTSCTS_PROTECTION_ENABLE");
 
-	ret = wmi_unified_vdev_set_param_send(wma_handle->wmi_handle,
+	ret = wma_vdev_set_param(wma_handle->wmi_handle,
 			self_sta_req->session_id,
 			WMI_VDEV_PARAM_MCC_BROADCAST_PROBE_ENABLE,
 			mac->roam.configParam.mcc_bcast_prob_resp_enable);
-	if (ret)
+	if (QDF_IS_STATUS_ERROR(ret))
 		WMA_LOGE("Failed to set WMI VDEV MCC_BROADCAST_PROBE_ENABLE");
 
 	if (wlan_cfg_get_int(mac, WNI_CFG_RTS_THRESHOLD,
 			     &cfg_val) == eSIR_SUCCESS) {
-		ret = wmi_unified_vdev_set_param_send(wma_handle->wmi_handle,
+		ret = wma_vdev_set_param(wma_handle->wmi_handle,
 						      self_sta_req->session_id,
 						      WMI_VDEV_PARAM_RTS_THRESHOLD,
 						      cfg_val);
-		if (ret)
+		if (QDF_IS_STATUS_ERROR(ret))
 			WMA_LOGE("Failed to set WMI_VDEV_PARAM_RTS_THRESHOLD");
 	} else {
 		WMA_LOGE("Failed to get value for WNI_CFG_RTS_THRESHOLD, leaving unchanged");
@@ -1991,11 +1745,11 @@ ol_txrx_vdev_handle wma_vdev_attach(tp_wma_handle wma_handle,
 
 	if (wlan_cfg_get_int(mac, WNI_CFG_FRAGMENTATION_THRESHOLD,
 			     &cfg_val) == eSIR_SUCCESS) {
-		ret = wmi_unified_vdev_set_param_send(wma_handle->wmi_handle,
+		ret = wma_vdev_set_param(wma_handle->wmi_handle,
 						      self_sta_req->session_id,
 						      WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD,
 						      cfg_val);
-		if (ret)
+		if (QDF_IS_STATUS_ERROR(ret))
 			WMA_LOGE("Failed to set WMI_VDEV_PARAM_FRAGMENTATION_THRESHOLD");
 	} else {
 		WMA_LOGE("Failed to get value for WNI_CFG_FRAGMENTATION_THRESHOLD, leaving unchanged");
@@ -2004,11 +1758,11 @@ ol_txrx_vdev_handle wma_vdev_attach(tp_wma_handle wma_handle,
 	if (wlan_cfg_get_int(mac, WNI_CFG_HT_CAP_INFO, &cfg_val) == eSIR_SUCCESS) {
 		val16 = (uint16_t) cfg_val;
 		phtCapInfo = (tSirMacHTCapabilityInfo *) &cfg_val;
-		ret = wmi_unified_vdev_set_param_send(wma_handle->wmi_handle,
+		ret = wma_vdev_set_param(wma_handle->wmi_handle,
 						      self_sta_req->session_id,
 						      WMI_VDEV_PARAM_TX_STBC,
 						      phtCapInfo->txSTBC);
-		if (ret)
+		if (QDF_IS_STATUS_ERROR(ret))
 			WMA_LOGE("Failed to set WMI_VDEV_PARAM_TX_STBC");
 	} else {
 		WMA_LOGE("Failed to get value of HT_CAP, TX STBC unchanged");
@@ -2017,11 +1771,13 @@ ol_txrx_vdev_handle wma_vdev_attach(tp_wma_handle wma_handle,
 	if ((self_sta_req->type == WMI_VDEV_TYPE_STA) &&
 	    (self_sta_req->sub_type == 0)) {
 		wma_handle->roam_offload_enabled = true;
-		wmi_unified_vdev_set_param_send(wma_handle->wmi_handle,
+		ret = wma_vdev_set_param(wma_handle->wmi_handle,
 						self_sta_req->session_id,
 						WMI_VDEV_PARAM_ROAM_FW_OFFLOAD,
 						(WMI_ROAM_FW_OFFLOAD_ENABLE_FLAG |
 						 WMI_ROAM_BMISS_FINAL_SCAN_ENABLE_FLAG));
+		if (QDF_IS_STATUS_ERROR(ret))
+			WMA_LOGE("Failed to set WMI_VDEV_PARAM_ROAM_FW_OFFLOAD");
 	}
 
 	/* Initialize BMISS parameters */
@@ -2761,7 +2517,7 @@ void wma_vdev_resp_timer(void *data)
 		}
 
 		if (wmi_unified_vdev_down_send(wma->wmi_handle,
-					       tgt_req->vdev_id) < 0) {
+				tgt_req->vdev_id) != QDF_STATUS_SUCCESS) {
 			WMA_LOGE("Failed to send vdev down cmd: vdev %d",
 				 tgt_req->vdev_id);
 		} else {
@@ -2995,37 +2751,37 @@ wma_vdev_set_bss_params(tp_wma_handle wma, int vdev_id,
 			uint8_t dtimPeriod, uint8_t shortSlotTimeSupported,
 			uint8_t llbCoexist, int8_t maxTxPower)
 {
-	int ret;
+	QDF_STATUS ret;
 	uint32_t slot_time;
 	struct wma_txrx_node *intr = wma->interfaces;
 
 	/* Beacon Interval setting */
-	ret = wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
+	ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
 					      WMI_VDEV_PARAM_BEACON_INTERVAL,
 					      beaconInterval);
 
-	if (ret)
+	if (QDF_IS_STATUS_ERROR(ret))
 		WMA_LOGE("failed to set WMI_VDEV_PARAM_BEACON_INTERVAL");
 
 	ret = wmi_unified_vdev_set_gtx_cfg_send(wma->wmi_handle, vdev_id,
 						&intr[vdev_id].config.gtx_info);
-	if (ret)
+	if (QDF_IS_STATUS_ERROR(ret))
 		WMA_LOGE("failed to set WMI_VDEV_PARAM_DTIM_PERIOD");
 
-	ret = wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
+	ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
 					      WMI_VDEV_PARAM_DTIM_PERIOD,
 					      dtimPeriod);
-	if (ret)
+	if (QDF_IS_STATUS_ERROR(ret))
 		WMA_LOGE("failed to set WMI_VDEV_PARAM_DTIM_PERIOD");
 
 	if (!maxTxPower) {
 		WMA_LOGW("Setting Tx power limit to 0");
 	}
 
-	ret = wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
+	ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
 					      WMI_VDEV_PARAM_TX_PWRLIMIT,
 					      maxTxPower);
-	if (ret)
+	if (QDF_IS_STATUS_ERROR(ret))
 		WMA_LOGE("failed to set WMI_VDEV_PARAM_TX_PWRLIMIT");
 	else
 		intr[vdev_id].max_tx_power = maxTxPower;
@@ -3036,10 +2792,10 @@ wma_vdev_set_bss_params(tp_wma_handle wma, int vdev_id,
 	else
 		slot_time = WMI_VDEV_SLOT_TIME_LONG;
 
-	ret = wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
+	ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
 					      WMI_VDEV_PARAM_SLOT_TIME,
 					      slot_time);
-	if (ret)
+	if (QDF_IS_STATUS_ERROR(ret))
 		WMA_LOGE("failed to set WMI_VDEV_PARAM_SLOT_TIME");
 
 	/* Initialize protection mode in case of coexistence */
@@ -3063,8 +2819,9 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, tpAddBssParams add_bss)
 	uint8_t vdev_id, peer_id;
 	QDF_STATUS status;
 	int8_t maxTxPower;
+	struct pdev_params param = {0};
 #ifdef WLAN_FEATURE_11W
-	int ret = 0;
+	QDF_STATUS ret;
 #endif /* WLAN_FEATURE_11W */
 	struct sir_hw_mode_params hw_mode = {0};
 
@@ -3128,9 +2885,11 @@ static void wma_add_bss_ap_mode(tp_wma_handle wma, tpAddBssParams add_bss)
 		 * when 802.11w PMF is enabled for hw encr/decr
 		 * use hw MFP Qos bits 0x10
 		 */
-		ret = wmi_unified_pdev_set_param(wma->wmi_handle,
-						 WMI_PDEV_PARAM_PMF_QOS, true);
-		if (ret) {
+		param.param_id = WMI_PDEV_PARAM_PMF_QOS;
+		param.param_value = true;
+		ret = wmi_unified_pdev_param_send(wma->wmi_handle,
+						 &param, WMA_WILDCARD_PDEV_ID);
+		if (QDF_IS_STATUS_ERROR(ret)) {
 			WMA_LOGE("%s: Failed to set QOS MFP/PMF (%d)",
 				 __func__, ret);
 		} else {
@@ -3365,11 +3124,11 @@ static void wma_add_bss_ibss_mode(tp_wma_handle wma, tpAddBssParams add_bss)
 	WMA_LOGD("%s: vdev start request for IBSS sent to target", __func__);
 
 	/* Initialize protection mode to no protection */
-	if (wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
-					    WMI_VDEV_PARAM_PROTECTION_MODE,
-					    IEEE80211_PROT_NONE)) {
+	status = wma_vdev_set_param(wma->wmi_handle, vdev_id,
+					 WMI_VDEV_PARAM_PROTECTION_MODE,
+					 IEEE80211_PROT_NONE);
+	if (QDF_IS_STATUS_ERROR(status))
 		WMA_LOGE("Failed to initialize protection mode");
-	}
 
 	return;
 
@@ -3399,12 +3158,12 @@ static void wma_add_bss_sta_mode(tp_wma_handle wma, tpAddBssParams add_bss)
 	ol_txrx_peer_handle peer;
 	QDF_STATUS status;
 	struct wma_txrx_node *iface;
-	int ret = 0;
 	int pps_val = 0;
 	bool roam_synch_in_progress = false;
 	tpAniSirGlobal pMac = cds_get_context(QDF_MODULE_ID_PE);
 	struct sir_hw_mode_params hw_mode = {0};
 	bool peer_assoc_sent = false;
+	struct pdev_params param = {0};
 
 	if (NULL == pMac) {
 		WMA_LOGE("%s: Unable to get PE context", __func__);
@@ -3596,14 +3355,14 @@ static void wma_add_bss_sta_mode(tp_wma_handle wma, tpAddBssParams add_bss)
 			((pMac->
 			  enable5gEBT << 31) & 0xffff0000) | (PKT_PWR_SAVE_5G_EBT &
 							      0xffff);
-		ret = wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
+		status = wma_vdev_set_param(wma->wmi_handle, vdev_id,
 							WMI_VDEV_PARAM_PACKET_POWERSAVE,
 							pps_val);
-		if (ret)
+		if (QDF_IS_STATUS_ERROR(status))
 			WMA_LOGE("Failed to send wmi packet power save cmd");
 		else
-			WMA_LOGD("Sent PKT_PWR_SAVE_5G_EBT cmd to target, val = %x, ret = %d",
-				pps_val, ret);
+			WMA_LOGD("Sent PKT_PWR_SAVE_5G_EBT cmd to target, val = %x, status = %d",
+				pps_val, status);
 
 		wmi_unified_send_peer_assoc(wma, add_bss->nwType,
 					    &add_bss->staContext);
@@ -3612,12 +3371,14 @@ static void wma_add_bss_sta_mode(tp_wma_handle wma, tpAddBssParams add_bss)
 		if (add_bss->rmfEnabled) {
 			/* when 802.11w PMF is enabled for hw encr/decr
 			   use hw MFP Qos bits 0x10 */
-			ret = wmi_unified_pdev_set_param(wma->wmi_handle,
-							 WMI_PDEV_PARAM_PMF_QOS,
-							 true);
-			if (ret) {
+			param.param_id = WMI_PDEV_PARAM_PMF_QOS;
+			param.param_value = true;
+			status = wmi_unified_pdev_param_send(wma->wmi_handle,
+							 &param,
+							 WMA_WILDCARD_PDEV_ID);
+			if (QDF_IS_STATUS_ERROR(status)) {
 				WMA_LOGE("%s: Failed to set QOS MFP/PMF (%d)",
-					 __func__, ret);
+					 __func__, status);
 			} else {
 				WMA_LOGI("%s: QOS MFP/PMF set to %d",
 					 __func__, true);
@@ -3724,46 +3485,6 @@ void wma_add_bss(tp_wma_handle wma, tpAddBssParams params)
 	}
 }
 
-/**
- * wmi_unified_vdev_up_send() - send vdev up command in fw
- * @wmi: wmi handle
- * @vdev_id: vdev id
- * @aid: association ID
- * @bssid: bssid
- *
- * Return: 0 for success or error code
- */
-int wmi_unified_vdev_up_send(wmi_unified_t wmi,
-			     uint8_t vdev_id, uint16_t aid,
-			     uint8_t bssid[IEEE80211_ADDR_LEN])
-{
-	wmi_vdev_up_cmd_fixed_param *cmd;
-	wmi_buf_t buf;
-	int32_t len = sizeof(*cmd);
-
-	WMA_LOGD("%s: VDEV_UP", __func__);
-	WMA_LOGD("%s: vdev_id %d aid %d bssid %pM", __func__,
-		 vdev_id, aid, bssid);
-	buf = wmi_buf_alloc(wmi, len);
-	if (!buf) {
-		WMA_LOGP("%s: wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
-	}
-	cmd = (wmi_vdev_up_cmd_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_vdev_up_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_up_cmd_fixed_param));
-	cmd->vdev_id = vdev_id;
-	cmd->vdev_assoc_id = aid;
-	WMI_CHAR_ARRAY_TO_MAC_ADDR(bssid, &cmd->vdev_bssid);
-	if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_UP_CMDID)) {
-		WMA_LOGP("%s: Failed to send vdev up command", __func__);
-		qdf_nbuf_free(buf);
-		return -EIO;
-	}
-	return 0;
-}
-
 /**
  * wma_add_sta_req_ap_mode() - process add sta request in ap mode
  * @wma: wma handle
@@ -3783,6 +3504,7 @@ static void wma_add_sta_req_ap_mode(tp_wma_handle wma, tpAddStaParams add_sta)
 	struct wma_txrx_node *iface = NULL;
 	struct wma_target_req *msg;
 	bool peer_assoc_cnf = false;
+	struct pdev_params param;
 
 	pdev = cds_get_context(QDF_MODULE_ID_TXRX);
 
@@ -3915,11 +3637,13 @@ static void wma_add_sta_req_ap_mode(tp_wma_handle wma, tpAddStaParams add_sta)
 		 * when 802.11w PMF is enabled for hw encr/decr
 		 * use hw MFP Qos bits 0x10
 		 */
-		ret = wmi_unified_pdev_set_param(wma->wmi_handle,
-						 WMI_PDEV_PARAM_PMF_QOS, true);
-		if (ret) {
+		param.param_id = WMI_PDEV_PARAM_PMF_QOS;
+		param.param_value = true;
+		status = wmi_unified_pdev_param_send(wma->wmi_handle,
+						 &param, WMA_WILDCARD_PDEV_ID);
+		if (QDF_IS_STATUS_ERROR(status)) {
 			WMA_LOGE("%s: Failed to set QOS MFP/PMF (%d)",
-				 __func__, ret);
+				 __func__, status);
 		} else {
 			WMA_LOGI("%s: QOS MFP/PMF set to %d", __func__, true);
 		}
@@ -3927,10 +3651,10 @@ static void wma_add_sta_req_ap_mode(tp_wma_handle wma, tpAddStaParams add_sta)
 #endif /* WLAN_FEATURE_11W */
 
 	if (add_sta->uAPSD) {
-		ret = wma_set_ap_peer_uapsd(wma, add_sta->smesessionId,
+		status = wma_set_ap_peer_uapsd(wma, add_sta->smesessionId,
 					    add_sta->staMac,
 					    add_sta->uAPSD, add_sta->maxSPLen);
-		if (ret) {
+		if (QDF_IS_STATUS_ERROR(status)) {
 			WMA_LOGE("Failed to set peer uapsd param for %pM",
 				 add_sta->staMac);
 			add_sta->status = QDF_STATUS_E_FAILURE;
@@ -4124,6 +3848,8 @@ static void wma_add_sta_req_sta_mode(tp_wma_handle wma, tpAddStaParams params)
 	int ret = 0;
 	struct wma_target_req *msg;
 	bool peer_assoc_cnf = false;
+	struct vdev_up_params param = {0};
+	struct pdev_params pdev_param = {0};
 
 #ifdef FEATURE_WLAN_TDLS
 	if (STA_ENTRY_TDLS_PEER == params->staType) {
@@ -4233,12 +3959,14 @@ static void wma_add_sta_req_sta_mode(tp_wma_handle wma, tpAddStaParams params)
 		if (params->rmfEnabled) {
 			/* when 802.11w PMF is enabled for hw encr/decr
 			   use hw MFP Qos bits 0x10 */
-			ret = wmi_unified_pdev_set_param(wma->wmi_handle,
-							 WMI_PDEV_PARAM_PMF_QOS,
-							 true);
-			if (ret) {
+			pdev_param.param_id = WMI_PDEV_PARAM_PMF_QOS;
+			pdev_param.param_value = true;
+			status = wmi_unified_pdev_param_send(wma->wmi_handle,
+							 &pdev_param,
+							 WMA_WILDCARD_PDEV_ID);
+			if (QDF_IS_STATUS_ERROR(status)) {
 				WMA_LOGE("%s: Failed to set QOS MFP/PMF (%d)",
-					 __func__, ret);
+					 __func__, status);
 			} else {
 				WMA_LOGI("%s: QOS MFP/PMF set to %d",
 					 __func__, true);
@@ -4269,7 +3997,7 @@ static void wma_add_sta_req_sta_mode(tp_wma_handle wma, tpAddStaParams params)
 	if (WMI_SERVICE_IS_ENABLED(wma->wmi_service_bitmap,
 				   WMI_SERVICE_CSA_OFFLOAD)) {
 		params->csaOffloadEnable = 1;
-		if (wmi_unified_csa_offload_enable(wma, params->smesessionId) <
+		if (wma_unified_csa_offload_enable(wma, params->smesessionId) <
 		    0) {
 			WMA_LOGE("Unable to enable CSA offload for vdev_id:%d",
 				 params->smesessionId);
@@ -4285,8 +4013,10 @@ static void wma_add_sta_req_sta_mode(tp_wma_handle wma, tpAddStaParams params)
 		}
 	}
 
-	if (wmi_unified_vdev_up_send(wma->wmi_handle, params->smesessionId,
-				     params->assocId, params->bssId) < 0) {
+	param.vdev_id = params->smesessionId;
+	param.assoc_id = params->assocId;
+	if (wmi_unified_vdev_up_send(wma->wmi_handle, params->bssId,
+				     &param) != QDF_STATUS_SUCCESS) {
 		WMA_LOGP("%s: Failed to send vdev up cmd: vdev %d bssid %pM",
 			 __func__, params->smesessionId, params->bssId);
 		status = QDF_STATUS_E_FAILURE;
@@ -4592,37 +4322,6 @@ void wma_delete_sta(tp_wma_handle wma, tpDeleteStaParams del_sta)
 	}
 }
 
-/**
- * wmi_unified_vdev_stop_send() - send vdev stop command to fw
- * @wmi: wmi handle
- * @vdev_id: vdev id
- *
- * Return: 0 for success or erro code
- */
-int32_t wmi_unified_vdev_stop_send(wmi_unified_t wmi, uint8_t vdev_id)
-{
-	wmi_vdev_stop_cmd_fixed_param *cmd;
-	wmi_buf_t buf;
-	int32_t len = sizeof(*cmd);
-
-	buf = wmi_buf_alloc(wmi, len);
-	if (!buf) {
-		WMA_LOGP("%s : wmi_buf_alloc failed", __func__);
-		return -ENOMEM;
-	}
-	cmd = (wmi_vdev_stop_cmd_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_vdev_stop_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN(wmi_vdev_stop_cmd_fixed_param));
-	cmd->vdev_id = vdev_id;
-	if (wmi_unified_cmd_send(wmi, buf, len, WMI_VDEV_STOP_CMDID)) {
-		WMA_LOGP("%s: Failed to send vdev stop command", __func__);
-		qdf_nbuf_free(buf);
-		return -EIO;
-	}
-	return 0;
-}
-
 /**
  * wma_delete_bss() - process delete bss request from upper layer
  * @wma: wma handle

+ 48 - 138
core/wma/src/wma_features.c

@@ -1079,15 +1079,16 @@ void wma_setup_egap_support(struct wma_tgt_cfg *tgt_cfg, WMA_HANDLE handle)
 void wma_register_egap_event_handle(WMA_HANDLE handle)
 {
 	tp_wma_handle wma_handle = (tp_wma_handle) handle;
-	int status;
+	QDF_STATUS status;
 
 	if (WMI_SERVICE_IS_ENABLED(wma_handle->wmi_service_bitmap,
 				   WMI_SERVICE_EGAP)) {
 		status = wmi_unified_register_event_handler(
 						   wma_handle->wmi_handle,
 						   WMI_AP_PS_EGAP_INFO_EVENTID,
-						   wma_egap_info_status_event);
-		if (status) {
+						   wma_egap_info_status_event,
+						   WMA_RX_SERIALIZER_CTX);
+		if (QDF_IS_STATUS_ERROR(status)) {
 			WMA_LOGE("Failed to register Enhance Green AP event");
 			wma_handle->egap_support = false;
 		} else {
@@ -1097,45 +1098,6 @@ void wma_register_egap_event_handle(WMA_HANDLE handle)
 	} else
 		wma_handle->egap_support = false;
 }
-
-/**
- * wmi_unified_pdev_green_ap_ps_enable_cmd() - enable green ap powersave command
- * @wmi_handle: wmi handle
- * @value: value
- *
- * Return: 0 for success or error code
- */
-int32_t wmi_unified_pdev_green_ap_ps_enable_cmd(wmi_unified_t wmi_handle,
-						       uint32_t value)
-{
-	wmi_pdev_green_ap_ps_enable_cmd_fixed_param *cmd;
-	wmi_buf_t buf;
-	int32_t len = sizeof(*cmd);
-
-	WMA_LOGD("Set Green AP PS val %d", value);
-
-	buf = wmi_buf_alloc(wmi_handle, len);
-	if (!buf) {
-		WMA_LOGP("%s: Green AP PS Mem Alloc Failed", __func__);
-		return -ENOMEM;
-	}
-
-	cmd = (wmi_pdev_green_ap_ps_enable_cmd_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_pdev_green_ap_ps_enable_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (wmi_pdev_green_ap_ps_enable_cmd_fixed_param));
-	cmd->reserved0 = 0;
-	cmd->enable = value;
-
-	if (wmi_unified_cmd_send(wmi_handle, buf, len,
-				 WMI_PDEV_GREEN_AP_PS_ENABLE_CMDID)) {
-		WMA_LOGE("Set Green AP PS param Failed val %d", value);
-		qdf_nbuf_free(buf);
-		return -EIO;
-	}
-	return 0;
-}
 #endif /* FEATURE_GREEN_AP */
 
 /**
@@ -1450,13 +1412,13 @@ int wmi_unified_nat_keepalive_enable(tp_wma_handle wma, uint8_t vdev_id)
 }
 
 /**
- * wmi_unified_csa_offload_enable() - sen CSA offload enable command
+ * wma_unified_csa_offload_enable() - sen CSA offload enable command
  * @wma: wma handle
  * @vdev_id: vdev id
  *
  * Return: 0 for success or error code
  */
-int wmi_unified_csa_offload_enable(tp_wma_handle wma, uint8_t vdev_id)
+int wma_unified_csa_offload_enable(tp_wma_handle wma, uint8_t vdev_id)
 {
 	wmi_csa_offload_enable_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
@@ -2375,16 +2337,18 @@ void wma_register_dfs_event_handler(tp_wma_handle wma_handle)
 		WMA_LOGD("%s:Phyerror Filtering offload is Disabled in ini",
 			 __func__);
 		wmi_unified_register_event_handler(wma_handle->wmi_handle,
-						   WMI_PHYERR_EVENTID,
-						   wma_unified_phyerr_rx_event_handler);
+					WMI_PHYERR_EVENTID,
+					wma_unified_phyerr_rx_event_handler,
+					WMA_RX_WORK_CTX);
 		WMA_LOGD("%s: WMI_PHYERR_EVENTID event handler registered",
 			 __func__);
 	} else {
 		WMA_LOGD("%s:Phyerror Filtering offload is Enabled in ini",
 			 __func__);
 		wmi_unified_register_event_handler(wma_handle->wmi_handle,
-						   WMI_DFS_RADAR_EVENTID,
-						   wma_unified_dfs_radar_rx_event_handler);
+					WMI_DFS_RADAR_EVENTID,
+					wma_unified_dfs_radar_rx_event_handler,
+					WMA_RX_WORK_CTX);
 		WMA_LOGD("%s:WMI_DFS_RADAR_EVENTID event handler registered",
 			 __func__);
 	}
@@ -2554,7 +2518,7 @@ QDF_STATUS wma_pktlog_wmi_send_cmd(WMA_HANDLE handle,
 			       WMITLV_TAG_STRUC_wmi_pdev_pktlog_disable_cmd_fixed_param,
 			       WMITLV_GET_STRUCT_TLVLEN
 				       (wmi_pdev_pktlog_disable_cmd_fixed_param));
-		disable_cmd->reserved0 = 0;
+		disable_cmd->pdev_id = 0;
 		if (wmi_unified_cmd_send(wma_handle->wmi_handle, buf, len,
 					 WMI_PDEV_PKTLOG_DISABLE_CMDID)) {
 			WMA_LOGE("failed to send pktlog disable cmdid");
@@ -3537,13 +3501,12 @@ void wma_enable_disable_wakeup_event(WMA_HANDLE handle,
 QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle)
 {
 	tp_wma_handle wma = handle;
-	wmi_wow_enable_cmd_fixed_param *cmd;
-	wmi_buf_t buf;
-	int32_t len;
 	int ret;
 	struct hif_opaque_softc *scn;
 	int host_credits;
 	int wmi_pending_cmds;
+	struct wow_cmd_params param = {0};
+
 #ifdef CONFIG_CNSS
 	tpAniSirGlobal pMac = cds_get_context(QDF_MODULE_ID_PE);
 
@@ -3553,29 +3516,6 @@ QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle)
 	}
 #endif /* CONFIG_CNSS */
 
-	len = sizeof(wmi_wow_enable_cmd_fixed_param);
-
-	buf = wmi_buf_alloc(wma->wmi_handle, len);
-	if (!buf) {
-		WMA_LOGE("%s: Failed allocate wmi buffer", __func__);
-		return QDF_STATUS_E_NOMEM;
-	}
-
-	cmd = (wmi_wow_enable_cmd_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_wow_enable_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (wmi_wow_enable_cmd_fixed_param));
-	cmd->enable = true;
-	if (htc_can_suspend_link(wma->htc_handle))
-		cmd->pause_iface_config = WOW_IFACE_PAUSE_ENABLED;
-	else
-		cmd->pause_iface_config = WOW_IFACE_PAUSE_DISABLED;
-
-	WMA_LOGI("suspend type: %s",
-		cmd->pause_iface_config == WOW_IFACE_PAUSE_ENABLED ?
-		"WOW_IFACE_PAUSE_ENABLED" : "WOW_IFACE_PAUSE_DISABLED");
-
 	qdf_event_reset(&wma->target_suspend);
 	wma->wow_nack = 0;
 
@@ -3594,8 +3534,10 @@ QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle)
 #endif
 	}
 
-	ret = wmi_unified_cmd_send(wma->wmi_handle, buf, len,
-				   WMI_WOW_ENABLE_CMDID);
+	param.enable = true;
+	param.can_suspend_link = hif_can_suspend_link(wma->htc_handle);
+	ret = wmi_unified_wow_enable_send(wma->wmi_handle, &param,
+				   WMA_WILDCARD_PDEV_ID);
 	if (ret) {
 		WMA_LOGE("Failed to enable wow in fw");
 		goto error;
@@ -3665,7 +3607,6 @@ QDF_STATUS wma_enable_wow_in_fw(WMA_HANDLE handle)
 	return QDF_STATUS_SUCCESS;
 
 error:
-	wmi_buf_free(buf);
 	return QDF_STATUS_E_FAILURE;
 }
 
@@ -6288,6 +6229,7 @@ void wma_send_regdomain_info_to_fw(uint32_t reg_dmn, uint16_t regdmn2G,
 	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
 	int32_t cck_mask_val = 0;
 	int ret = 0;
+	struct pdev_params pdev_param = {0};
 
 	if (NULL == wma) {
 		WMA_LOGE("%s: wma context is NULL", __func__);
@@ -6323,9 +6265,12 @@ void wma_send_regdomain_info_to_fw(uint32_t reg_dmn, uint16_t regdmn2G,
 		cck_mask_val = 1;
 
 	cck_mask_val |= (wma->self_gen_frm_pwr << 16);
-	ret = wmi_unified_pdev_set_param(wma->wmi_handle,
-					 WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK,
-					 cck_mask_val);
+	pdev_param.param_id = WMI_PDEV_PARAM_TX_CHAIN_MASK_CCK;
+	pdev_param.param_value = cck_mask_val;
+	ret = wmi_unified_pdev_param_send(wma->wmi_handle,
+					 &pdev_param,
+					 WMA_WILDCARD_PDEV_ID);
+
 	if (ret)
 		WMA_LOGE("failed to set PDEV tx_chain_mask_cck %d",
 			 ret);
@@ -6526,58 +6471,37 @@ int wma_bus_resume(void)
  * @handle: wma handle
  * @disable_target_intr: disable target interrupt
  *
- * Return: 0 for success or error code
+ * Return: QDF_STATUS_SUCCESS for success or error code
  */
-int wma_suspend_target(WMA_HANDLE handle, int disable_target_intr)
+QDF_STATUS wma_suspend_target(WMA_HANDLE handle, int disable_target_intr)
 {
 	tp_wma_handle wma_handle = (tp_wma_handle) handle;
-	wmi_pdev_suspend_cmd_fixed_param *cmd;
-	wmi_buf_t wmibuf;
-	uint32_t len = sizeof(*cmd);
 	struct hif_opaque_softc *scn;
-	int ret;
+	QDF_STATUS status;
+	struct suspend_params param = {0};
+
 #ifdef CONFIG_CNSS
 	tpAniSirGlobal pmac = cds_get_context(QDF_MODULE_ID_PE);
 #endif
 
 	if (!wma_handle || !wma_handle->wmi_handle) {
 		WMA_LOGE("WMA is closed. can not issue suspend cmd");
-		return -EINVAL;
+		return QDF_STATUS_E_INVAL;
 	}
 
 #ifdef CONFIG_CNSS
 	if (NULL == pmac) {
 		WMA_LOGE("%s: Unable to get PE context", __func__);
-		return -EINVAL;
+		return QDF_STATUS_E_INVAL;
 	}
 #endif
-
-	/*
-	 * send the comand to Target to ignore the
-	 * PCIE reset so as to ensure that Host and target
-	 * states are in sync
-	 */
-	wmibuf = wmi_buf_alloc(wma_handle->wmi_handle, len);
-	if (wmibuf == NULL)
-		return -ENOMEM;
-
-	cmd = (wmi_pdev_suspend_cmd_fixed_param *) wmi_buf_data(wmibuf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_pdev_suspend_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (wmi_pdev_suspend_cmd_fixed_param));
-	if (disable_target_intr) {
-		cmd->suspend_opt = WMI_PDEV_SUSPEND_AND_DISABLE_INTR;
-	} else {
-		cmd->suspend_opt = WMI_PDEV_SUSPEND;
-	}
 	qdf_event_reset(&wma_handle->target_suspend);
-	ret = wmi_unified_cmd_send(wma_handle->wmi_handle, wmibuf, len,
-				 WMI_PDEV_SUSPEND_CMDID);
-	if (ret < 0) {
-		qdf_nbuf_free(wmibuf);
-		return ret;
-	}
+	param.disable_target_intr = disable_target_intr;
+	status = wmi_unified_suspend_send(wma_handle->wmi_handle,
+				&param,
+				WMA_WILDCARD_PDEV_ID);
+	if (QDF_IS_STATUS_ERROR(status))
+		return status;
 
 	wmi_set_target_suspend(wma_handle->wmi_handle, true);
 
@@ -6597,7 +6521,7 @@ int wma_suspend_target(WMA_HANDLE handle, int disable_target_intr)
 			WMA_LOGE("%s: LOGP is in progress, ignore!", __func__);
 		}
 #endif
-		return -EFAULT;
+		return QDF_STATUS_E_FAULT;
 	}
 
 	scn = cds_get_context(QDF_MODULE_ID_HIF);
@@ -6605,10 +6529,10 @@ int wma_suspend_target(WMA_HANDLE handle, int disable_target_intr)
 	if (scn == NULL) {
 		WMA_LOGE("%s: Failed to get HIF context", __func__);
 		QDF_ASSERT(0);
-		return -EFAULT;
+		return QDF_STATUS_E_FAULT;
 	}
 
-	return 0;
+	return QDF_STATUS_SUCCESS;
 }
 
 /**
@@ -6639,40 +6563,26 @@ void wma_target_suspend_acknowledge(void *context)
  * wma_resume_target() - resume target
  * @handle: wma handle
  *
- * Return: 0 for success or error code
+ * Return: QDF_STATUS_SUCCESS for success or error code
  */
-int wma_resume_target(WMA_HANDLE handle)
+QDF_STATUS wma_resume_target(WMA_HANDLE handle)
 {
 	int ret;
 	tp_wma_handle wma = (tp_wma_handle) handle;
-	wmi_buf_t wmibuf;
-	wmi_pdev_resume_cmd_fixed_param *cmd;
 	QDF_STATUS qdf_status = QDF_STATUS_SUCCESS;
 #ifdef CONFIG_CNSS
 	tpAniSirGlobal pMac = cds_get_context(QDF_MODULE_ID_PE);
 	if (NULL == pMac) {
 		WMA_LOGE("%s: Unable to get PE context", __func__);
-		return -EINVAL;
+		return QDF_STATUS_E_INVAL;
 	}
 #endif /* CONFIG_CNSS */
 
-	wmibuf = wmi_buf_alloc(wma->wmi_handle, sizeof(*cmd));
-	if (wmibuf == NULL) {
-		return -ENOMEM;
-	}
-	cmd = (wmi_pdev_resume_cmd_fixed_param *) wmi_buf_data(wmibuf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_wmi_pdev_resume_cmd_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (wmi_pdev_resume_cmd_fixed_param));
-	cmd->reserved0 = 0;
 	qdf_event_reset(&wma->wma_resume_event);
-	ret = wmi_unified_cmd_send(wma->wmi_handle, wmibuf, sizeof(*cmd),
-				   WMI_PDEV_RESUME_CMDID);
-	if (ret != EOK) {
+	qdf_status = wmi_unified_resume_send(wma->wmi_handle,
+					WMA_WILDCARD_PDEV_ID);
+	if (QDF_IS_STATUS_ERROR(qdf_status))
 		WMA_LOGE("Failed to send WMI_PDEV_RESUME_CMDID command");
-		wmi_buf_free(wmibuf);
-	}
 
 	qdf_status = qdf_wait_single_event(&(wma->wma_resume_event),
 			WMA_RESUME_TIMEOUT);

File diff suppressed because it is too large
+ 241 - 166
core/wma/src/wma_main.c


+ 47 - 32
core/wma/src/wma_mgmt.c

@@ -566,6 +566,7 @@ void wma_set_sap_keepalive(tp_wma_handle wma, uint8_t vdev_id)
 {
 	uint32_t min_inactive_time, max_inactive_time, max_unresponsive_time;
 	struct sAniSirGlobal *mac = cds_get_context(QDF_MODULE_ID_PE);
+	QDF_STATUS status;
 
 	if (NULL == mac) {
 		WMA_LOGE("%s: Failed to get mac", __func__);
@@ -577,19 +578,25 @@ void wma_set_sap_keepalive(tp_wma_handle wma, uint8_t vdev_id)
 
 	min_inactive_time = max_inactive_time / 2;
 
-	if (wmi_unified_vdev_set_param_send(wma->wmi_handle,
-		vdev_id, WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
-					min_inactive_time))
+	status = wma_vdev_set_param(wma->wmi_handle,
+				vdev_id,
+				WMI_VDEV_PARAM_AP_KEEPALIVE_MIN_IDLE_INACTIVE_TIME_SECS,
+				min_inactive_time);
+	if (QDF_IS_STATUS_ERROR(status))
 		WMA_LOGE("Failed to Set AP MIN IDLE INACTIVE TIME");
 
-	if (wmi_unified_vdev_set_param_send(wma->wmi_handle,
-		vdev_id, WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
-					    max_inactive_time))
+	status = wma_vdev_set_param(wma->wmi_handle,
+				vdev_id,
+				WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_IDLE_INACTIVE_TIME_SECS,
+				max_inactive_time);
+	if (QDF_IS_STATUS_ERROR(status))
 		WMA_LOGE("Failed to Set AP MAX IDLE INACTIVE TIME");
 
-	if (wmi_unified_vdev_set_param_send(wma->wmi_handle,
-		vdev_id, WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
-					    max_unresponsive_time))
+	status = wma_vdev_set_param(wma->wmi_handle,
+				vdev_id,
+				WMI_VDEV_PARAM_AP_KEEPALIVE_MAX_UNRESPONSIVE_TIME_SECS,
+				max_unresponsive_time);
+	if (QDF_IS_STATUS_ERROR(status))
 		WMA_LOGE("Failed to Set MAX UNRESPONSIVE TIME");
 
 	WMA_LOGD("%s:vdev_id:%d min_inactive_time: %u max_inactive_time: %u"
@@ -1061,7 +1068,7 @@ int32_t wmi_unified_send_peer_assoc(tp_wma_handle wma,
 
 #ifdef FEATURE_WLAN_WAPI
 	if (params->encryptType == eSIR_ED_WPI) {
-		ret = wmi_unified_vdev_set_param_send(wma->wmi_handle,
+		ret = wma_vdev_set_param(wma->wmi_handle,
 						      params->smesessionId,
 						      WMI_VDEV_PARAM_DROP_UNENCRY,
 						      false);
@@ -1228,16 +1235,16 @@ int wmi_unified_vdev_set_gtx_cfg_send(wmi_unified_t wmi_handle, uint32_t if_id,
 void wma_update_protection_mode(tp_wma_handle wma, uint8_t vdev_id,
 			   uint8_t llbcoexist)
 {
-	int ret;
+	QDF_STATUS ret;
 	enum ieee80211_protmode prot_mode;
 
 	prot_mode = llbcoexist ? IEEE80211_PROT_CTSONLY : IEEE80211_PROT_NONE;
 
-	ret = wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
+	ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
 					      WMI_VDEV_PARAM_PROTECTION_MODE,
 					      prot_mode);
 
-	if (ret)
+	if (QDF_IS_STATUS_ERROR(ret))
 		WMA_LOGE("Failed to send wmi protection mode cmd");
 	else
 		WMA_LOGD("Updated protection mode %d to target", prot_mode);
@@ -1255,13 +1262,13 @@ static void
 wma_update_beacon_interval(tp_wma_handle wma, uint8_t vdev_id,
 			   uint16_t beaconInterval)
 {
-	int ret;
+	QDF_STATUS ret;
 
-	ret = wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
+	ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
 					      WMI_VDEV_PARAM_BEACON_INTERVAL,
 					      beaconInterval);
 
-	if (ret)
+	if (QDF_IS_STATUS_ERROR(ret))
 		WMA_LOGE("Failed to update beacon interval");
 	else
 		WMA_LOGI("Updated beacon interval %d for vdev %d",
@@ -1311,7 +1318,7 @@ void wma_update_cfg_params(tp_wma_handle wma, tSirMsgQ *cfgParam)
 	uint8_t vdev_id;
 	uint32_t param_id;
 	uint32_t cfg_val;
-	int ret;
+	QDF_STATUS ret;
 	/* get mac to acess CFG data base */
 	struct sAniSirGlobal *pmac;
 
@@ -1343,10 +1350,10 @@ void wma_update_cfg_params(tp_wma_handle wma, tSirMsgQ *cfgParam)
 
 	for (vdev_id = 0; vdev_id < wma->max_bssid; vdev_id++) {
 		if (wma->interfaces[vdev_id].handle != 0) {
-			ret = wmi_unified_vdev_set_param_send(wma->wmi_handle,
+			ret = wma_vdev_set_param(wma->wmi_handle,
 							      vdev_id, param_id,
 							      cfg_val);
-			if (ret)
+			if (QDF_IS_STATUS_ERROR(ret))
 				WMA_LOGE("Update cfg params failed for vdevId %d",
 					vdev_id);
 		}
@@ -1739,6 +1746,7 @@ void wma_adjust_ibss_heart_beat_timer(tp_wma_handle wma,
 	int16_t new_peer_num;
 	uint16_t new_timer_value_sec;
 	uint32_t new_timer_value_ms;
+	QDF_STATUS status;
 
 	if (peer_num_delta != 1 && peer_num_delta != -1) {
 		WMA_LOGE("Invalid peer_num_delta value %d", peer_num_delta);
@@ -1784,9 +1792,10 @@ void wma_adjust_ibss_heart_beat_timer(tp_wma_handle wma,
 
 	new_timer_value_ms = ((uint32_t) new_timer_value_sec) * 1000;
 
-	if (wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
-					    WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS,
-					    new_timer_value_ms)) {
+	status = wma_vdev_set_param(wma->wmi_handle, vdev_id,
+					 WMI_VDEV_PARAM_IBSS_MAX_BCN_LOST_MS,
+					 new_timer_value_ms);
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMA_LOGE("Failed to set IBSS link monitoring timer value");
 		return;
 	}
@@ -2568,6 +2577,7 @@ void wma_send_beacon(tp_wma_handle wma, tpSendbeaconParams bcn_info)
 	QDF_STATUS status;
 	uint8_t *p2p_ie;
 	tpAniBeaconStruct beacon;
+	struct vdev_up_params param = {0};
 
 	beacon = (tpAniBeaconStruct) (bcn_info->beacon);
 	vdev = wma_find_vdev_by_addr(wma, beacon->macHdr.sa, &vdev_id);
@@ -2604,8 +2614,12 @@ void wma_send_beacon(tp_wma_handle wma, tpSendbeaconParams bcn_info)
 		return;
 	}
 	if (!wma->interfaces[vdev_id].vdev_up) {
-		if (wmi_unified_vdev_up_send(wma->wmi_handle, vdev_id, 0,
-					     bcn_info->bssId) < 0) {
+		param.vdev_id = vdev_id;
+		param.assoc_id = 0;
+		status = wmi_unified_vdev_up_send(wma->wmi_handle,
+						  bcn_info->bssId,
+						  &param);
+		if (QDF_IS_STATUS_ERROR(status)) {
 			WMA_LOGE("%s : failed to send vdev up", __func__);
 			return;
 		}
@@ -2813,7 +2827,7 @@ void wma_process_update_userpos(tp_wma_handle wma_handle,
 QDF_STATUS wma_set_htconfig(uint8_t vdev_id, uint16_t ht_capab, int value)
 {
 	tp_wma_handle wma = cds_get_context(QDF_MODULE_ID_WMA);
-	int ret = -EIO;
+	QDF_STATUS ret = QDF_STATUS_E_FAILURE;
 
 	if (NULL == wma) {
 		WMA_LOGE("%s: Failed to get wma", __func__);
@@ -2822,17 +2836,17 @@ QDF_STATUS wma_set_htconfig(uint8_t vdev_id, uint16_t ht_capab, int value)
 
 	switch (ht_capab) {
 	case WNI_CFG_HT_CAP_INFO_ADVANCE_CODING:
-		ret = wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
+		ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
 						      WMI_VDEV_PARAM_LDPC,
 						      value);
 		break;
 	case WNI_CFG_HT_CAP_INFO_TX_STBC:
-		ret = wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
+		ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
 						      WMI_VDEV_PARAM_TX_STBC,
 						      value);
 		break;
 	case WNI_CFG_HT_CAP_INFO_RX_STBC:
-		ret = wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
+		ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
 						      WMI_VDEV_PARAM_RX_STBC,
 						      value);
 		break;
@@ -2840,16 +2854,16 @@ QDF_STATUS wma_set_htconfig(uint8_t vdev_id, uint16_t ht_capab, int value)
 	case WNI_CFG_HT_CAP_INFO_SHORT_GI_40MHZ:
 		WMA_LOGE("%s: ht_capab = %d, value = %d", __func__, ht_capab,
 			 value);
-		ret = wmi_unified_vdev_set_param_send(wma->wmi_handle, vdev_id,
+		ret = wma_vdev_set_param(wma->wmi_handle, vdev_id,
 						WMI_VDEV_PARAM_SGI, value);
-		if (ret == 0)
+		if (ret == QDF_STATUS_SUCCESS)
 			wma->interfaces[vdev_id].config.shortgi = value;
 		break;
 	default:
 		WMA_LOGE("%s:INVALID HT CONFIG", __func__);
 	}
 
-	return (ret) ? QDF_STATUS_E_FAILURE : QDF_STATUS_SUCCESS;
+	return ret;
 }
 
 /**
@@ -3380,7 +3394,8 @@ QDF_STATUS wma_register_mgmt_frm_client(
 
 	if (wmi_unified_register_event_handler(wma_handle->wmi_handle,
 					       WMI_MGMT_RX_EVENTID,
-					       wma_mgmt_rx_process) != 0) {
+					       wma_mgmt_rx_process,
+					       WMA_RX_WORK_CTX) != 0) {
 		WMA_LOGE("Failed to register rx mgmt handler with wmi");
 		return QDF_STATUS_E_FAILURE;
 	}

+ 10 - 5
core/wma/src/wma_ocb.c

@@ -1087,34 +1087,39 @@ int wma_ocb_register_event_handlers(tp_wma_handle wma_handle)
 	/* Initialize the members in WMA used by wma_ocb */
 	status = wmi_unified_register_event_handler(wma_handle->wmi_handle,
 			WMI_OCB_SET_CONFIG_RESP_EVENTID,
-			wma_ocb_set_config_event_handler);
+			wma_ocb_set_config_event_handler,
+			WMA_RX_SERIALIZER_CTX);
 	if (status)
 		return status;
 
 	status = wmi_unified_register_event_handler(
 			wma_handle->wmi_handle,
 			WMI_OCB_GET_TSF_TIMER_RESP_EVENTID,
-			wma_ocb_get_tsf_timer_resp_event_handler);
+			wma_ocb_get_tsf_timer_resp_event_handler,
+			WMA_RX_SERIALIZER_CTX);
 	if (status)
 		return status;
 
 	status = wmi_unified_register_event_handler(
 			wma_handle->wmi_handle,
 			WMI_DCC_GET_STATS_RESP_EVENTID,
-			wma_dcc_get_stats_resp_event_handler);
+			wma_dcc_get_stats_resp_event_handler,
+			WMA_RX_SERIALIZER_CTX);
 	if (status)
 		return status;
 
 	status = wmi_unified_register_event_handler(
 			wma_handle->wmi_handle,
 			WMI_DCC_UPDATE_NDL_RESP_EVENTID,
-			wma_dcc_update_ndl_resp_event_handler);
+			wma_dcc_update_ndl_resp_event_handler,
+			WMA_RX_SERIALIZER_CTX);
 	if (status)
 		return status;
 
 	status = wmi_unified_register_event_handler(wma_handle->wmi_handle,
 			WMI_DCC_STATS_EVENTID,
-			wma_dcc_stats_event_handler);
+			wma_dcc_stats_event_handler,
+			WMA_RX_SERIALIZER_CTX);
 	if (status)
 		return status;
 

File diff suppressed because it is too large
+ 165 - 207
core/wma/src/wma_power.c


+ 40 - 29
core/wma/src/wma_scan_roam.c

@@ -2021,32 +2021,32 @@ QDF_STATUS wma_roam_scan_bmiss_cnt(tp_wma_handle wma_handle,
 				   A_INT32 first_bcnt,
 				   A_UINT32 final_bcnt, uint32_t vdev_id)
 {
-	int status = 0;
+	QDF_STATUS status;
 
 	WMA_LOGI("%s: first_bcnt=%d, final_bcnt=%d", __func__, first_bcnt,
 		 final_bcnt);
 
-	status = wmi_unified_vdev_set_param_send(wma_handle->wmi_handle,
+	status = wma_vdev_set_param(wma_handle->wmi_handle,
 						 vdev_id,
 						 WMI_VDEV_PARAM_BMISS_FIRST_BCNT,
 						 first_bcnt);
-	if (status != EOK) {
-		WMA_LOGE("wmi_unified_vdev_set_param_send WMI_VDEV_PARAM_BMISS_FIRST_BCNT returned Error %d",
+	if (QDF_IS_STATUS_ERROR(status)) {
+		WMA_LOGE("wma_vdev_set_param WMI_VDEV_PARAM_BMISS_FIRST_BCNT returned Error %d",
 			status);
-		return QDF_STATUS_E_FAILURE;
+		return status;
 	}
 
-	status = wmi_unified_vdev_set_param_send(wma_handle->wmi_handle,
+	status = wma_vdev_set_param(wma_handle->wmi_handle,
 						 vdev_id,
 						 WMI_VDEV_PARAM_BMISS_FINAL_BCNT,
 						 final_bcnt);
-	if (status != EOK) {
-		WMA_LOGE("wmi_unified_vdev_set_param_send WMI_VDEV_PARAM_BMISS_FINAL_BCNT returned Error %d",
+	if (QDF_IS_STATUS_ERROR(status)) {
+		WMA_LOGE("wma_vdev_set_param WMI_VDEV_PARAM_BMISS_FINAL_BCNT returned Error %d",
 			status);
-		return QDF_STATUS_E_FAILURE;
+		return status;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return status;
 }
 
 /**
@@ -4121,39 +4121,48 @@ void wma_register_extscan_event_handler(tp_wma_handle wma_handle)
 	}
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
 					   WMI_EXTSCAN_START_STOP_EVENTID,
-					   wma_extscan_start_stop_event_handler);
+					   wma_extscan_start_stop_event_handler,
+					   WMA_RX_SERIALIZER_CTX);
 
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
-					   WMI_EXTSCAN_CAPABILITIES_EVENTID,
-					   wma_extscan_capabilities_event_handler);
+					WMI_EXTSCAN_CAPABILITIES_EVENTID,
+					wma_extscan_capabilities_event_handler,
+					WMA_RX_SERIALIZER_CTX);
 
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
-					   WMI_EXTSCAN_HOTLIST_MATCH_EVENTID,
-					   wma_extscan_hotlist_match_event_handler);
+				WMI_EXTSCAN_HOTLIST_MATCH_EVENTID,
+				wma_extscan_hotlist_match_event_handler,
+				WMA_RX_SERIALIZER_CTX);
 
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
-					   WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID,
-					   wma_extscan_change_results_event_handler);
+				WMI_EXTSCAN_WLAN_CHANGE_RESULTS_EVENTID,
+				wma_extscan_change_results_event_handler,
+				WMA_RX_SERIALIZER_CTX);
 
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
-					   WMI_EXTSCAN_OPERATION_EVENTID,
-					   wma_extscan_operations_event_handler);
+				WMI_EXTSCAN_OPERATION_EVENTID,
+				wma_extscan_operations_event_handler,
+				WMA_RX_SERIALIZER_CTX);
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
-					   WMI_EXTSCAN_TABLE_USAGE_EVENTID,
-					   wma_extscan_table_usage_event_handler);
+				WMI_EXTSCAN_TABLE_USAGE_EVENTID,
+				wma_extscan_table_usage_event_handler,
+				WMA_RX_SERIALIZER_CTX);
 
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
-					   WMI_EXTSCAN_CACHED_RESULTS_EVENTID,
-					   wma_extscan_cached_results_event_handler);
+				WMI_EXTSCAN_CACHED_RESULTS_EVENTID,
+				wma_extscan_cached_results_event_handler,
+				WMA_RX_SERIALIZER_CTX);
 
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
 			WMI_PASSPOINT_MATCH_EVENTID,
-			wma_passpoint_match_event_handler);
+			wma_passpoint_match_event_handler,
+			WMA_RX_SERIALIZER_CTX);
 
 
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
 			WMI_EXTSCAN_HOTLIST_SSID_MATCH_EVENTID,
-			wma_extscan_hotlist_ssid_match_event_handler);
+			wma_extscan_hotlist_ssid_match_event_handler,
+			WMA_RX_SERIALIZER_CTX);
 
 	return;
 }
@@ -6040,6 +6049,7 @@ QDF_STATUS  wma_ipa_offload_enable_disable(tp_wma_handle wma,
 	ol_txrx_vdev_handle vdev;
 	struct txrx_pdev_cfg_t *cfg;
 	int32_t intra_bss_fwd = 0;
+	QDF_STATUS status;
 
 	if (!wma || !wma->wmi_handle) {
 		WMA_LOGE("%s: WMA is closed, can not issue  cmd",
@@ -6109,14 +6119,15 @@ QDF_STATUS  wma_ipa_offload_enable_disable(tp_wma_handle wma,
 	}
 
 	/* Disable/enable WMI_VDEV_PARAM_INTRA_BSS_FWD */
-	if (wmi_unified_vdev_set_param_send(wma->wmi_handle,
+	status = wma_vdev_set_param(wma->wmi_handle,
 		ipa_offload->vdev_id, WMI_VDEV_PARAM_INTRA_BSS_FWD,
-		intra_bss_fwd)) {
+		intra_bss_fwd);
+	if (QDF_IS_STATUS_ERROR(status)) {
 		WMA_LOGE("Failed to disable WMI_VDEV_PARAM_INTRA_BSS_FWD");
-		return QDF_STATUS_E_FAILURE;
+		return status;
 	}
 
-	return QDF_STATUS_SUCCESS;
+	return status;
 }
 
 /** wma_set_epno_network_list() - set epno network list

+ 47 - 142
core/wma/src/wma_utils.c

@@ -69,7 +69,7 @@
 #include "dfs.h"
 #include "wma_internal.h"
 #include "cds_concurrency.h"
-
+#include "wmi_unified_param.h"
 #include "linux/ieee80211.h"
 
 /* MCS Based rate table */
@@ -764,14 +764,17 @@ void wma_register_ll_stats_event_handler(tp_wma_handle wma_handle)
 	}
 
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
-					   WMI_IFACE_LINK_STATS_EVENTID,
-					   wma_unified_link_iface_stats_event_handler);
+				WMI_IFACE_LINK_STATS_EVENTID,
+				wma_unified_link_iface_stats_event_handler,
+				WMA_RX_SERIALIZER_CTX);
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
-					   WMI_PEER_LINK_STATS_EVENTID,
-					   wma_unified_link_peer_stats_event_handler);
+				WMI_PEER_LINK_STATS_EVENTID,
+				wma_unified_link_peer_stats_event_handler,
+				WMA_RX_SERIALIZER_CTX);
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
-					   WMI_RADIO_LINK_STATS_EVENTID,
-					   wma_unified_link_radio_stats_event_handler);
+				WMI_RADIO_LINK_STATS_EVENTID,
+				wma_unified_link_radio_stats_event_handler,
+				WMA_RX_SERIALIZER_CTX);
 
 	return;
 }
@@ -1952,46 +1955,6 @@ int32_t wma_set_txrx_fw_stats_level(tp_wma_handle wma_handle,
 	return 0;
 }
 
-/**
- * wmi_crash_inject() - inject fw crash
- * @wma_handle: wma handle
- * @type: type
- * @delay_time_ms: delay time in ms
- *
- * Return: 0 for success or return error
- */
-int wmi_crash_inject(wmi_unified_t wmi_handle, uint32_t type,
-		     uint32_t delay_time_ms)
-{
-	int ret = 0;
-	WMI_FORCE_FW_HANG_CMD_fixed_param *cmd;
-	uint16_t len = sizeof(*cmd);
-	wmi_buf_t buf;
-
-	buf = wmi_buf_alloc(wmi_handle, len);
-	if (!buf) {
-		WMA_LOGE("%s: wmi_buf_alloc failed!", __func__);
-		return -ENOMEM;
-	}
-
-	cmd = (WMI_FORCE_FW_HANG_CMD_fixed_param *) wmi_buf_data(buf);
-	WMITLV_SET_HDR(&cmd->tlv_header,
-		       WMITLV_TAG_STRUC_WMI_FORCE_FW_HANG_CMD_fixed_param,
-		       WMITLV_GET_STRUCT_TLVLEN
-			       (WMI_FORCE_FW_HANG_CMD_fixed_param));
-	cmd->type = type;
-	cmd->delay_time_ms = delay_time_ms;
-
-	ret = wmi_unified_cmd_send(wmi_handle, buf, len, WMI_FORCE_FW_HANG_CMDID);
-	if (ret < 0) {
-		WMA_LOGE("%s: Failed to send set param command, ret = %d",
-			 __func__, ret);
-		wmi_buf_free(buf);
-	}
-
-	return ret;
-}
-
 /**
  * wma_get_stats_rsp_buf() - fill get stats response buffer
  * @get_stats_param: get stats parameters
@@ -2333,7 +2296,7 @@ static int
 wma_process_utf_event(WMA_HANDLE handle, uint8_t *datap, uint32_t dataplen)
 {
 	tp_wma_handle wma_handle = (tp_wma_handle) handle;
-	SEG_HDR_INFO_STRUCT segHdrInfo;
+	struct seg_hdr_info segHdrInfo;
 	uint8_t totalNumOfSegments, currentSeq;
 	WMI_PDEV_UTF_EVENTID_param_tlvs *param_buf;
 	uint8_t *data;
@@ -2347,7 +2310,7 @@ wma_process_utf_event(WMA_HANDLE handle, uint8_t *datap, uint32_t dataplen)
 	data = param_buf->data;
 	datalen = param_buf->num_data;
 
-	segHdrInfo = *(SEG_HDR_INFO_STRUCT *) &(data[0]);
+	segHdrInfo = *(struct seg_hdr_info *) &(data[0]);
 
 	wma_handle->utf_event_info.currentSeq = (segHdrInfo.segmentInfo & 0xF);
 
@@ -2423,113 +2386,31 @@ void wma_utf_attach(tp_wma_handle wma_handle)
 
 	ret = wmi_unified_register_event_handler(wma_handle->wmi_handle,
 						 WMI_PDEV_UTF_EVENTID,
-						 wma_process_utf_event);
+						 wma_process_utf_event,
+						 WMA_RX_SERIALIZER_CTX);
 
 	if (ret)
 		WMA_LOGP("%s: Failed to register UTF event callback", __func__);
 }
 
-/**
- * wmi_unified_pdev_utf_cmd() - send utf command to fw
- * @wmi_handle: wmi handle
- * @utf_payload: utf payload
- * @len: length
- *
- * Return: 0 for success or error code
- */
-static int
-wmi_unified_pdev_utf_cmd(wmi_unified_t wmi_handle, uint8_t *utf_payload,
-			 uint16_t len)
-{
-	wmi_buf_t buf;
-	uint8_t *cmd;
-	int ret = 0;
-	static uint8_t msgref = 1;
-	uint8_t segNumber = 0, segInfo, numSegments;
-	uint16_t chunk_len, total_bytes;
-	uint8_t *bufpos;
-	SEG_HDR_INFO_STRUCT segHdrInfo;
-
-	bufpos = utf_payload;
-	total_bytes = len;
-	ASSERT(total_bytes / MAX_WMI_UTF_LEN ==
-	       (uint8_t) (total_bytes / MAX_WMI_UTF_LEN));
-	numSegments = (uint8_t) (total_bytes / MAX_WMI_UTF_LEN);
-
-	if (len - (numSegments * MAX_WMI_UTF_LEN))
-		numSegments++;
-
-	while (len) {
-		if (len > MAX_WMI_UTF_LEN)
-			chunk_len = MAX_WMI_UTF_LEN;    /* MAX messsage */
-		else
-			chunk_len = len;
-
-		buf = wmi_buf_alloc(wmi_handle,
-				    (chunk_len + sizeof(segHdrInfo) +
-				     WMI_TLV_HDR_SIZE));
-		if (!buf) {
-			WMA_LOGE("%s:wmi_buf_alloc failed", __func__);
-			return -ENOMEM;
-		}
-
-		cmd = (uint8_t *) wmi_buf_data(buf);
-
-		segHdrInfo.len = total_bytes;
-		segHdrInfo.msgref = msgref;
-		segInfo = ((numSegments << 4) & 0xF0) | (segNumber & 0xF);
-		segHdrInfo.segmentInfo = segInfo;
-		segHdrInfo.pad = 0;
-
-		WMA_LOGD("%s:segHdrInfo.len = %d, segHdrInfo.msgref = %d,"
-			 " segHdrInfo.segmentInfo = %d",
-			 __func__, segHdrInfo.len, segHdrInfo.msgref,
-			 segHdrInfo.segmentInfo);
-
-		WMA_LOGD("%s:total_bytes %d segNumber %d totalSegments %d"
-			 "chunk len %d", __func__, total_bytes, segNumber,
-			 numSegments, chunk_len);
-
-		segNumber++;
-
-		WMITLV_SET_HDR(cmd, WMITLV_TAG_ARRAY_BYTE,
-			       (chunk_len + sizeof(segHdrInfo)));
-		cmd += WMI_TLV_HDR_SIZE;
-		memcpy(cmd, &segHdrInfo, sizeof(segHdrInfo));   /* 4 bytes */
-		memcpy(&cmd[sizeof(segHdrInfo)], bufpos, chunk_len);
-
-		ret = wmi_unified_cmd_send(wmi_handle, buf,
-					   (chunk_len + sizeof(segHdrInfo) +
-					    WMI_TLV_HDR_SIZE),
-					   WMI_PDEV_UTF_CMDID);
-
-		if (ret != EOK) {
-			WMA_LOGE("Failed to send WMI_PDEV_UTF_CMDID command");
-			wmi_buf_free(buf);
-			break;
-		}
-
-		len -= chunk_len;
-		bufpos += chunk_len;
-	}
-
-	msgref++;
-
-	return ret;
-}
-
 /**
  * wma_utf_cmd() - utf command
  * @wma_handle: wma handle
  * @data: data
  * @len: length
  *
- * Return: 0 for success or error code
+ * Return: QDF_STATUS_SUCCESS for success or error code
  */
-int wma_utf_cmd(tp_wma_handle wma_handle, uint8_t *data, uint16_t len)
+QDF_STATUS wma_utf_cmd(tp_wma_handle wma_handle, uint8_t *data, uint16_t len)
 {
+	struct pdev_utf_params param = {0};
+
 	wma_handle->utf_event_info.length = 0;
-	return wmi_unified_pdev_utf_cmd(wma_handle->wmi_handle, data, len);
+	param.utf_payload = data;
+	param.len = len;
+
+	return wmi_unified_pdev_utf_cmd_send(wma_handle->wmi_handle, &param,
+						WMA_WILDCARD_PDEV_ID);
 }
 
 /**
@@ -3636,3 +3517,27 @@ uint32_t wma_get_vht_ch_width(void)
 
 	return fw_ch_wd;
 }
+
+/**
+ * wma_config_debug_module_cmd - set debug log config
+ * @wmi_handle: wmi layer handle
+ * @param: debug log parameter
+ * @val: debug log value
+ * @module_id_bitmap: debug module id bitmap
+ * @bitmap_len:  debug module bitmap length
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+QDF_STATUS
+wma_config_debug_module_cmd(wmi_unified_t wmi_handle, A_UINT32 param,
+			    A_UINT32 val, A_UINT32 *module_id_bitmap,
+			    A_UINT32 bitmap_len)
+{
+	struct dbglog_params dbg_param;
+	dbg_param.param = param;
+	dbg_param.val = val;
+	dbg_param.module_id_bitmap = module_id_bitmap;
+	dbg_param.bitmap_len = bitmap_len;
+
+	return wmi_unified_dbglog_cmd_send(wmi_handle, &dbg_param);
+}

Some files were not shown because too many files changed in this diff