瀏覽代碼

qcacld-3.0: Fix tx power calculation

Fix the TPE IE population for SAP. The total power and PSD power were
swapped. Fix the TPC power calculation logic for non-PSD case when
TPE IE is present.

Change-Id: I0fb9b9318d1b5a3e1c8071714b7e3f6129828c92
CRs-Fixed: 2910658
Gururaj Pandurangi 4 年之前
父節點
當前提交
21cec91ea2
共有 2 個文件被更改,包括 33 次插入42 次删除
  1. 21 13
      core/mac/src/pe/lim/lim_process_sme_req_messages.c
  2. 12 29
      core/mac/src/sys/legacy/src/utils/src/parser_api.c

+ 21 - 13
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -4218,6 +4218,7 @@ void lim_calculate_tpc(struct mac_context *mac,
 	qdf_freq_t oper_freq, start_freq = 0;
 	struct ch_params ch_params;
 	struct vdev_mlme_obj *mlme_obj;
+	uint8_t tpe_power;
 
 	mlme_obj = wlan_vdev_mlme_get_cmpt_obj(session->vdev);
 	if (!mlme_obj) {
@@ -4259,10 +4260,10 @@ void lim_calculate_tpc(struct mac_context *mac,
 		if (is_tpe_present) {
 			if (is_6ghz_freq) {
 				ap_power_type_6g = session->ap_power_type;
-				wlan_reg_get_client_power_for_connecting_ap
-				(mac->pdev, ap_power_type_6g,
-				 mlme_obj->reg_tpc_obj.frequency[i],
-				 &is_psd_power, &reg_max, &psd_power);
+				wlan_reg_get_client_power_for_connecting_ap(
+				mac->pdev, ap_power_type_6g,
+				mlme_obj->reg_tpc_obj.frequency[i],
+				&is_psd_power, &reg_max, &psd_power);
 			}
 		} else {
 			/* center frequency calculation */
@@ -4270,8 +4271,8 @@ void lim_calculate_tpc(struct mac_context *mac,
 				mlme_obj->reg_tpc_obj.frequency[i] =
 						start_freq + (20 * i);
 			} else {
-				wlan_reg_set_channel_params_for_freq
-					(mac->pdev, oper_freq, 0, &ch_params);
+				wlan_reg_set_channel_params_for_freq(
+					mac->pdev, oper_freq, 0, &ch_params);
 				mlme_obj->reg_tpc_obj.frequency[i] =
 					ch_params.mhz_freq_seg0;
 				ch_params.ch_width =
@@ -4286,10 +4287,14 @@ void lim_calculate_tpc(struct mac_context *mac,
 					 mlme_obj->reg_tpc_obj.frequency[i],
 					 &is_psd_power, &reg_max, &psd_power);
 				} else {
-					wlan_reg_get_6g_chan_ap_power
-					(mac->pdev,
-					 mlme_obj->reg_tpc_obj.frequency[i],
-					 &is_psd_power, &reg_max, &psd_power);
+					ap_power_type_6g =
+						wlan_reg_get_cur_6g_ap_pwr_type(
+							mac->pdev,
+							&ap_power_type_6g);
+					wlan_reg_get_6g_chan_ap_power(
+					mac->pdev,
+					mlme_obj->reg_tpc_obj.frequency[i],
+					&is_psd_power, &reg_max, &psd_power);
 				}
 			}
 		}
@@ -4312,9 +4317,12 @@ void lim_calculate_tpc(struct mac_context *mac,
 		}
 		/* If TPE is present */
 		if (is_tpe_present) {
-			max_tx_power = QDF_MIN(max_tx_power, (int8_t)
-					       mlme_obj->reg_tpc_obj.tpe[i]);
-			pe_debug("TPE: %d", mlme_obj->reg_tpc_obj.tpe[i]);
+			if (!is_psd_power && mlme_obj->reg_tpc_obj.eirp_power)
+				tpe_power =  mlme_obj->reg_tpc_obj.eirp_power;
+			else
+				tpe_power = mlme_obj->reg_tpc_obj.tpe[i];
+			max_tx_power = QDF_MIN(max_tx_power, (int8_t)tpe_power);
+			pe_debug("TPE: %d", tpe_power);
 		}
 
 		/** If firmware updated max tx power is non zero,

+ 12 - 29
core/mac/src/sys/legacy/src/utils/src/parser_api.c

@@ -346,9 +346,9 @@ populate_dot11f_tx_power_env(struct mac_context *mac,
 
 		bw_val = wlan_reg_get_bw_value(chan_width);
 		bw_threshold = 20;
-		power_for_bss = reg_power + 13;
+		power_for_bss = eirp_power + 13;
 
-		while ((eirp_power > power_for_bss) &&
+		while ((reg_power > power_for_bss) &&
 		       (bw_threshold < bw_val)) {
 			bw_threshold = 2 * bw_threshold;
 			power_for_bss += 3;
@@ -364,18 +364,11 @@ populate_dot11f_tx_power_env(struct mac_context *mac,
 			tpe_ptr->max_tx_pwr_interpret = 2;
 			tpe_ptr->max_tx_pwr_category = 0;
 			tpe_ptr->num_tx_power = num_tx_power;
-			for (count = 0, bw_val = 20; count < num_tx_power;
-			     count++, bw_val += 20) {
-				if (bw_val >= bw_threshold)
-					tpe_ptr->tx_power[count] =
-								eirp_power * 2;
-				else
-					tpe_ptr->tx_power[count] =
-								reg_power * 2;
+			for (count = 0; count < num_tx_power; count++) {
+				tpe_ptr->tx_power[count] = reg_power * 2;
 				pe_debug("non-psd default TPE %d %d",
 					 count, tpe_ptr->tx_power[count]);
 			}
-
 			num_tpe_ies++;
 			tpe_ptr++;
 		}
@@ -390,9 +383,9 @@ populate_dot11f_tx_power_env(struct mac_context *mac,
 		if (reg_power) {
 			bw_val = wlan_reg_get_bw_value(chan_width);
 			bw_threshold = 20;
-			power_for_bss = reg_power + 13;
+			power_for_bss = eirp_power + 13;
 
-			while ((eirp_power > power_for_bss) &&
+			while ((reg_power > power_for_bss) &&
 			       (bw_threshold < bw_val)) {
 				bw_threshold = 2 * bw_threshold;
 				power_for_bss += 3;
@@ -406,20 +399,13 @@ populate_dot11f_tx_power_env(struct mac_context *mac,
 				tpe_ptr->max_tx_pwr_interpret = 2;
 				tpe_ptr->max_tx_pwr_category = 1;
 				tpe_ptr->num_tx_power = num_tx_power;
-				for (count = 0, bw_val = 20;
-				     count < num_tx_power;
-				     count++, bw_val += 20) {
-					if (bw_val >= bw_threshold)
-						tpe_ptr->tx_power[count] =
-								eirp_power * 2;
-					else
-						tpe_ptr->tx_power[count] =
-								reg_power * 2;
+				for (count = 0; count < num_tx_power; count++) {
+					tpe_ptr->tx_power[count] =
+							reg_power * 2;
 					pe_debug("non-psd subord TPE %d %d",
 						 count,
 						 tpe_ptr->tx_power[count]);
 				}
-
 				num_tpe_ies++;
 				tpe_ptr++;
 			}
@@ -453,11 +439,10 @@ populate_dot11f_tx_power_env(struct mac_context *mac,
 							&psd_tpe,
 							&reg_power,
 							&eirp_power);
-			tpe_ptr->tx_power[count] = reg_power * 2;
+			tpe_ptr->tx_power[count] = eirp_power * 2;
 			pe_debug("psd default TPE %d %d",
 				 count, tpe_ptr->tx_power[count]);
 		}
-
 		num_tpe_ies++;
 		tpe_ptr++;
 
@@ -468,7 +453,7 @@ populate_dot11f_tx_power_env(struct mac_context *mac,
 						      &reg_power,
 						      &eirp_power);
 
-		if (reg_power) {
+		if (eirp_power) {
 			tpe_ptr->present = 1;
 			tpe_ptr->max_tx_pwr_count = max_tx_pwr_count_psd;
 			tpe_ptr->max_tx_pwr_interpret = 3;
@@ -484,16 +469,14 @@ populate_dot11f_tx_power_env(struct mac_context *mac,
 							&psd_tpe,
 							&reg_power,
 							&eirp_power);
-				tpe_ptr->tx_power[count] = reg_power * 2;
+				tpe_ptr->tx_power[count] = eirp_power * 2;
 				pe_debug("psd subord TPE %d %d",
 					 count, tpe_ptr->tx_power[count]);
 			}
-
 			num_tpe_ies++;
 			tpe_ptr++;
 		}
 	}
-
 	*num_tpe = num_tpe_ies;
 }