浏览代码

qcacld-3.0: Add a fallback mechanism if TPE IE is absent

Add a fallback mechanism if a 6 GHz AP does not advertise
TPE IE.
1) Currently for the 6 GHz band, is_psd_power is obtained
from AP's TPE IE. But if it is not present, obtain it
from the regulatory channel list.
2) If is_psd_power is false, current logic calculates
center frequencies for BW > 20 MHz. These center
frequencies are then passed as input to fetch EIRP power
which is incorrect and results in zero which makes overall
tx power as zero. Thus, use operating frequency itself to
obtain EIRP power.
3) Despite these checks, if regulatory power results in
zero due to invalid frequency or other inputs, assign this
field to the regulatory channel power of the operating
frequency.

Change-Id: I70ae301de21cb8d696fee3c3f9d5fd30d1b53a8b
CRs-Fixed: 3327259
Gururaj Pandurangi 2 年之前
父节点
当前提交
ef65651bc0
共有 1 个文件被更改,包括 24 次插入11 次删除
  1. 24 11
      core/mac/src/pe/lim/lim_process_sme_req_messages.c

+ 24 - 11
core/mac/src/pe/lim/lim_process_sme_req_messages.c

@@ -5556,6 +5556,12 @@ void lim_calculate_tpc(struct mac_context *mac,
 		num_pwr_levels = mlme_obj->reg_tpc_obj.num_pwr_levels;
 		is_psd_power = mlme_obj->reg_tpc_obj.is_psd_power;
 	} else {
+		/**
+		 * Set is_psd_power based on reg channel list if it is a 6 GHz
+		 * channel and TPE IE is absent.
+		 */
+		if (is_6ghz_freq)
+			is_psd_power = wlan_reg_is_6g_psd_power(mac->pdev);
 		num_pwr_levels = lim_get_num_pwr_levels(is_psd_power,
 							session->ch_width);
 	}
@@ -5590,14 +5596,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_pwrmode(
-					mac->pdev, oper_freq, 0, &ch_params,
-					REG_CURRENT_PWR_MODE);
-				mlme_obj->reg_tpc_obj.frequency[i] =
-					ch_params.mhz_freq_seg0;
-				if (ch_params.ch_width != CH_WIDTH_INVALID)
-					ch_params.ch_width =
-						get_next_higher_bw[ch_params.ch_width];
+				/* Use operating frequency to fetch EIRP pwr */
+				mlme_obj->reg_tpc_obj.frequency[i] = oper_freq;
 			}
 			if (is_6ghz_freq) {
 				if (LIM_IS_STA_ROLE(session)) {
@@ -5616,7 +5616,19 @@ void lim_calculate_tpc(struct mac_context *mac,
 				}
 			}
 		}
-		mlme_obj->reg_tpc_obj.reg_max[i] = reg_max;
+		/* Check for regulatory channel power. If it is zero due to
+		 * invalid frequency or other inputs, then assign the regulatory
+		 * power of operating frequency to reg_max.
+		 */
+		if (reg_max) {
+			mlme_obj->reg_tpc_obj.reg_max[i] = reg_max;
+		} else {
+			pe_debug("Reg power due to invalid freq: %d",
+				 mlme_obj->reg_tpc_obj.frequency[i]);
+			reg_max = mlme_obj->reg_tpc_obj.reg_max[0];
+			mlme_obj->reg_tpc_obj.reg_max[i] = reg_max;
+		}
+
 		mlme_obj->reg_tpc_obj.chan_power_info[i].chan_cfreq =
 					mlme_obj->reg_tpc_obj.frequency[i];
 
@@ -5665,8 +5677,9 @@ void lim_calculate_tpc(struct mac_context *mac,
 		mlme_obj->reg_tpc_obj.chan_power_info[i].tx_power =
 						(uint8_t)max_tx_power;
 
-		pe_debug("freq: %d max_tx_power: %d",
-			 mlme_obj->reg_tpc_obj.frequency[i], max_tx_power);
+		pe_debug("freq: %d reg power: %d, max_tx_power: %d",
+			 mlme_obj->reg_tpc_obj.frequency[i], reg_max,
+			 max_tx_power);
 	}
 
 	mlme_obj->reg_tpc_obj.num_pwr_levels = num_pwr_levels;