Browse Source

qcacmn: Fix CTL power configuration issued through acfg tool

When CTL array is configured using acfg_tool, the CTL values are not
impacting powers due to incorrect band value passed to the FW. It is
found that the memory copy for band and CTL array are done together
in a single operation.

However, with convergence, both acfg_tool and wifitool will call the same
underlying WMI API to set the CTL table. In order for concurrent working,
we need to copy the band value separately for acfg_tool, before copying
the CTL array. This fixes memory corruption that is currently seen
as evident from the garbage value for CTL band.

CRs-Fixed: 1087168
Change-Id: I42f6bc39eb3930e8c995ff76294b7d77676f2299
Sathish Kumar 8 years ago
parent
commit
07918bf4b7
2 changed files with 12 additions and 13 deletions
  1. 3 3
      wmi/inc/wmi_unified_param.h
  2. 9 10
      wmi/src/wmi_unified_non_tlv.c

+ 3 - 3
wmi/inc/wmi_unified_param.h

@@ -3969,15 +3969,15 @@ struct ratepwr_table_params {
 /**
  * struct ctl_table_params - Ctl table params
  * @ctl_array: pointer to ctl array
- * @ctl_len: ctl length
+ * @ctl_cmd_len: ctl command length
  * @is_acfg_ctl: is acfg_ctl table
  */
 struct ctl_table_params {
 	uint8_t *ctl_array;
-	uint16_t ctl_len;
-	bool is_acfg_ctl;
+	uint16_t ctl_cmd_len;
 	uint32_t target_type;
 	bool is_2g;
+	uint32_t ctl_band;
 };
 
 /**

+ 9 - 10
wmi/src/wmi_unified_non_tlv.c

@@ -3768,7 +3768,7 @@ send_set_ctl_table_cmd_non_tlv(wmi_unified_t wmi_handle,
 			param->target_type == TARGET_TYPE_QCA9888) {
 		if (param->is_2g) {
 			/* For 2G, CTL array length should be 688*/
-			if (!param->is_acfg_ctl && param->ctl_len !=
+			if (param->ctl_cmd_len !=
 					(4 + (WHAL_NUM_CTLS_2G_11B * 2) +
 					 (WHAL_NUM_BAND_EDGES_2G_11B * 3) +
 					 1 + (WHAL_NUM_CTLS_2G_11B *
@@ -3786,7 +3786,7 @@ send_set_ctl_table_cmd_non_tlv(wmi_unified_t wmi_handle,
 			}
 		} else {
 			/* For 5G, CTL array length should be 1540 */
-			if (!param->is_acfg_ctl && param->ctl_len !=
+			if (param->ctl_cmd_len !=
 					(4 + (WHAL_NUM_CTLS_5G_11A * 2) +
 					 (WHAL_NUM_BAND_EDGES_5G_11A * 3) +
 					 1 + (WHAL_NUM_CTLS_5G_11A *
@@ -3812,7 +3812,7 @@ send_set_ctl_table_cmd_non_tlv(wmi_unified_t wmi_handle,
 			}
 		}
 	} else {
-		if (!param->is_acfg_ctl && param->ctl_len !=
+		if (param->ctl_cmd_len !=
 			WHAL_NUM_CTLS_2G * WHAL_NUM_BAND_EDGES_2G * 2 +
 			WHAL_NUM_CTLS_5G * WHAL_NUM_BAND_EDGES_5G * 2) {
 			qdf_print("CTL array len not correct\n");
@@ -3821,7 +3821,7 @@ send_set_ctl_table_cmd_non_tlv(wmi_unified_t wmi_handle,
 	}
 
 	len = sizeof(wmi_pdev_set_ctl_table_cmd);
-	len += roundup(param->ctl_len, sizeof(A_UINT32)) - sizeof(A_UINT32);
+	len += roundup(param->ctl_cmd_len, sizeof(A_UINT32)) - sizeof(A_UINT32);
 	qdf_print("wmi buf len = %d\n", len);
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf) {
@@ -3830,12 +3830,11 @@ send_set_ctl_table_cmd_non_tlv(wmi_unified_t wmi_handle,
 	}
 	cmd = (wmi_pdev_set_ctl_table_cmd *)wmi_buf_data(buf);
 
-	cmd->ctl_len = param->ctl_len;
-	WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&cmd->ctl_info[0], param->ctl_array,
-		param->ctl_len);
-
-	if (param->is_acfg_ctl)
-		len = param->ctl_len;
+	cmd->ctl_len = param->ctl_cmd_len;
+	WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&cmd->ctl_info[0], &param->ctl_band,
+		sizeof(param->ctl_band));
+	WMI_HOST_IF_MSG_COPY_CHAR_ARRAY(&cmd->ctl_info[1], param->ctl_array,
+		param->ctl_cmd_len - sizeof(param->ctl_band));
 
 	if (wmi_unified_cmd_send(wmi_handle, buf, len,
 			WMI_PDEV_SET_CTL_TABLE_CMDID)) {