Pārlūkot izejas kodu

qcacmn: Add support of sending multiple COEX config

Add an API to support sending multiple COEX config in one WMI command.
This is to optimize and save target host to firmware WMI command
communication time.

Change-Id: Ie510ee3ebfca67a2b748c403ec52a8d7b597f676
CRs-Fixed: 3651226
Will Huang 1 gadu atpakaļ
vecāks
revīzija
b55e7ac81f

+ 7 - 0
umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h

@@ -1412,14 +1412,21 @@ struct wlan_lmac_if_green_ap_tx_ops {
 
 #ifdef FEATURE_COEX
 struct coex_config_params;
+struct coex_multi_config;
 
 /**
  * struct wlan_lmac_if_coex_tx_ops - south bound tx function pointers for coex
  * @coex_config_send: function pointer to send coex config to fw
+ * @coex_multi_config_send: function pointer to send multiple coex config to fw
+ * @coex_get_multi_config_support: function pointer to get multiple coex config
+ * support or not
  */
 struct wlan_lmac_if_coex_tx_ops {
 	QDF_STATUS (*coex_config_send)(struct wlan_objmgr_pdev *pdev,
 				       struct coex_config_params *param);
+	QDF_STATUS (*coex_multi_config_send)(struct wlan_objmgr_pdev *pdev,
+					     struct coex_multi_config *param);
+	bool (*coex_get_multi_config_support)(struct wlan_objmgr_psoc *psoc);
 };
 #endif
 

+ 14 - 0
wmi/inc/wmi_unified_api.h

@@ -2178,6 +2178,20 @@ wmi_unified_send_coex_ver_cfg_cmd(wmi_unified_t wmi_handle,
 QDF_STATUS
 wmi_unified_send_coex_config_cmd(wmi_unified_t wmi_handle,
 				 struct coex_config_params *param);
+
+/**
+ * wmi_unified_send_coex_multi_config_cmd() - send multiple coex config
+ * @wmi_handle: wmi handle
+ * @param: wmi coex multiple cfg cmd params
+ *
+ * Send WMI_COEX_MULTIPLE_CONFIG_CMDID parameters to fw.
+ *
+ * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_** on error
+ */
+QDF_STATUS
+wmi_unified_send_coex_multi_config_cmd(wmi_unified_t wmi_handle,
+				       struct coex_multi_config *param);
+
 #ifdef WLAN_FEATURE_DBAM_CONFIG
 /**
  * wmi_unified_send_dbam_config_cmd() - send dbam config command

+ 35 - 0
wmi/inc/wmi_unified_param.h

@@ -6289,6 +6289,7 @@ typedef enum {
 	wmi_service_tx_compl_tsf64,
 	wmi_service_vdev_delete_all_peer,
 	wmi_service_three_way_coex_config_legacy,
+	wmi_service_multiple_coex_config_support,
 	wmi_service_rx_fse_support,
 	wmi_service_dynamic_hw_mode,
 	wmi_service_sae_roam_support,
@@ -8766,6 +8767,40 @@ struct coex_config_params {
 	uint32_t config_arg6;
 };
 
+/**
+ * struct coex_config_item - Multiple coex config item
+ * @config_type: Configuration type - wmi_coex_config_type enum
+ * @config_arg1: Configuration argument based on config type
+ * @config_arg2: Configuration argument based on config type
+ * @config_arg3: Configuration argument based on config type
+ * @config_arg4: Configuration argument based on config type
+ * @config_arg5: Configuration argument based on config type
+ * @config_arg6: Configuration argument based on config type
+ */
+struct coex_config_item {
+	uint32_t config_type;
+	uint32_t config_arg1;
+	uint32_t config_arg2;
+	uint32_t config_arg3;
+	uint32_t config_arg4;
+	uint32_t config_arg5;
+	uint32_t config_arg6;
+};
+
+#define COEX_MULTI_CONFIG_MAX_CNT  32
+
+/**
+ * struct coex_multi_config - Multiple coex config command parameters
+ * @vdev_id: Vdev id
+ * @num_configs: Number of config items
+ * @cfg_items: Array of coex config items
+ */
+struct coex_multi_config {
+	uint32_t vdev_id;
+	uint32_t num_configs;
+	struct coex_config_item cfg_items[COEX_MULTI_CONFIG_MAX_CNT];
+};
+
 #define WMI_HOST_PDEV_ID_SOC 0xFF
 #define WMI_HOST_PDEV_ID_0   0
 #define WMI_HOST_PDEV_ID_1   1

+ 4 - 0
wmi/inc/wmi_unified_priv.h

@@ -1905,6 +1905,10 @@ QDF_STATUS
 (*send_coex_config_cmd)(wmi_unified_t wmi_handle,
 			struct coex_config_params *param);
 
+QDF_STATUS
+(*send_coex_multi_config_cmd)(wmi_unified_t wmi_handle,
+			      struct coex_multi_config *param);
+
 #ifdef WLAN_FEATURE_DBAM_CONFIG
 QDF_STATUS
 (*send_dbam_config_cmd)(wmi_unified_t wmi_handle,

+ 11 - 0
wmi/src/wmi_unified_api.c

@@ -2943,6 +2943,17 @@ wmi_unified_send_coex_config_cmd(wmi_unified_t wmi_handle,
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS
+wmi_unified_send_coex_multi_config_cmd(wmi_unified_t wmi_handle,
+				       struct coex_multi_config *param)
+{
+	if (wmi_handle->ops->send_coex_multi_config_cmd)
+		return wmi_handle->ops->send_coex_multi_config_cmd(wmi_handle,
+								   param);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 #ifdef WLAN_FEATURE_DBAM_CONFIG
 QDF_STATUS
 wmi_unified_send_dbam_config_cmd(wmi_unified_t wmi_handle,

+ 70 - 0
wmi/src/wmi_unified_tlv.c

@@ -9275,6 +9275,73 @@ send_coex_config_cmd_tlv(wmi_unified_t wmi_handle,
 	return ret;
 }
 
+/**
+ * send_coex_multi_config_cmd_tlv() - send coex multiple config command to fw
+ * @wmi_handle: wmi handle
+ * @param: pointer to coex multiple config parameters
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS
+send_coex_multi_config_cmd_tlv(wmi_unified_t wmi_handle,
+			       struct coex_multi_config *param)
+{
+	wmi_coex_multiple_config_cmd_fixed_param *cmd;
+	WMI_COEX_CONFIG_CMD_fixed_param *dst_cfg;
+	struct coex_config_item *src_cfg;
+	wmi_buf_t buf;
+	QDF_STATUS ret;
+	uint32_t len, i;
+	uint8_t *buf_ptr;
+
+	len = sizeof(*cmd) + WMI_TLV_HDR_SIZE +
+	      param->num_configs * sizeof(*dst_cfg);
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf)
+		return QDF_STATUS_E_FAILURE;
+
+	buf_ptr = (uint8_t *)wmi_buf_data(buf);
+	cmd = (wmi_coex_multiple_config_cmd_fixed_param *)buf_ptr;
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_coex_multiple_config_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+		       wmi_coex_multiple_config_cmd_fixed_param));
+
+	buf_ptr += sizeof(*cmd);
+
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
+		       sizeof(*dst_cfg) * param->num_configs);
+	buf_ptr += WMI_TLV_HDR_SIZE;
+
+	dst_cfg = (WMI_COEX_CONFIG_CMD_fixed_param *)buf_ptr;
+	for (i = 0; i < param->num_configs; i++, dst_cfg++) {
+		src_cfg = &param->cfg_items[i];
+		WMITLV_SET_HDR(&dst_cfg->tlv_header,
+			       WMITLV_TAG_STRUC_WMI_COEX_CONFIG_CMD_fixed_param,
+			       WMITLV_GET_STRUCT_TLVLEN(
+			       WMI_COEX_CONFIG_CMD_fixed_param));
+		dst_cfg->vdev_id = param->vdev_id;
+		dst_cfg->config_type = src_cfg->config_type;
+		dst_cfg->config_arg1 = src_cfg->config_arg1;
+		dst_cfg->config_arg2 = src_cfg->config_arg2;
+		dst_cfg->config_arg3 = src_cfg->config_arg3;
+		dst_cfg->config_arg4 = src_cfg->config_arg4;
+		dst_cfg->config_arg5 = src_cfg->config_arg5;
+		dst_cfg->config_arg6 = src_cfg->config_arg6;
+	}
+
+	wmi_mtrace(WMI_COEX_MULTIPLE_CONFIG_CMDID, param->vdev_id, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
+				   WMI_COEX_MULTIPLE_CONFIG_CMDID);
+
+	if (QDF_IS_STATUS_ERROR(ret)) {
+		wmi_err("Sending COEX MULTIPLE CONFIG CMD failed");
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+
 #ifdef WLAN_FEATURE_DBAM_CONFIG
 
 static enum wmi_coex_dbam_mode_type
@@ -21452,6 +21519,7 @@ struct wmi_ops tlv_ops =  {
 	.send_bss_color_change_enable_cmd =
 		send_bss_color_change_enable_cmd_tlv,
 	.send_coex_config_cmd = send_coex_config_cmd_tlv,
+	.send_coex_multi_config_cmd = send_coex_multi_config_cmd_tlv,
 	.send_set_country_cmd = send_set_country_cmd_tlv,
 	.send_addba_send_cmd = send_addba_send_cmd_tlv,
 	.send_delba_send_cmd = send_delba_send_cmd_tlv,
@@ -22627,6 +22695,8 @@ static void populate_tlv_service(uint32_t *wmi_service)
 			WMI_SERVICE_DELETE_ALL_PEER_SUPPORT;
 	wmi_service[wmi_service_three_way_coex_config_legacy] =
 			WMI_SERVICE_THREE_WAY_COEX_CONFIG_LEGACY;
+	wmi_service[wmi_service_multiple_coex_config_support] =
+			WMI_SERVICE_MULTIPLE_COEX_CONFIG_SUPPORT;
 	wmi_service[wmi_service_rx_fse_support] =
 			WMI_SERVICE_RX_FSE_SUPPORT;
 	wmi_service[wmi_service_sae_roam_support] =