From 6a4eac9e68ea1dac9ea0003f7380b85a896a3eaa Mon Sep 17 00:00:00 2001 From: Lincoln Tran Date: Fri, 19 Mar 2021 18:22:11 -0700 Subject: [PATCH] qcacld-3.0: Fix call to set chan params Set channel width when calling wlan_reg_set_channel_params_for_freq. Also, in the case of 160MHz, mhz_freq_seg1 should be used instead of mhz_freq_seg0 to get center frequency. Send total eirp power to FW instead of psd power for PSD case as part of WMI_VDEV_SET_TPC_POWER_CMDID. Change-Id: Id37d2ca37c7ae1ac07df1444129801fcba37f219 CRs-fixed: 2906551 --- .../src/pe/lim/lim_process_sme_req_messages.c | 36 +++++++++++++------ .../src/sys/legacy/src/utils/src/parser_api.c | 26 ++++++++++---- 2 files changed, 44 insertions(+), 18 deletions(-) diff --git a/core/mac/src/pe/lim/lim_process_sme_req_messages.c b/core/mac/src/pe/lim/lim_process_sme_req_messages.c index 138e6ea3ea1b..8de6514de2a7 100644 --- a/core/mac/src/pe/lim/lim_process_sme_req_messages.c +++ b/core/mac/src/pe/lim/lim_process_sme_req_messages.c @@ -1805,9 +1805,14 @@ void lim_parse_tpe_ie(struct mac_context *mac, struct pe_session *session, lim_get_num_tpe_octets(single_tpe.max_tx_pwr_count); vdev_mlme->reg_tpc_obj.num_pwr_levels = num_octets; + ch_params.ch_width = session->ch_width; wlan_reg_set_channel_params_for_freq(mac->pdev, curr_op_freq, 0, &ch_params); - curr_freq = ch_params.mhz_freq_seg0 - bw_val / 2 + 10; + + if (ch_params.mhz_freq_seg1) + curr_freq = ch_params.mhz_freq_seg1 - bw_val / 2 + 10; + else + curr_freq = ch_params.mhz_freq_seg0 - bw_val / 2 + 10; if (!num_octets) { if (!he_op->oper_info_6g_present) @@ -1958,7 +1963,7 @@ void lim_calculate_tpc(struct mac_context *mac, bool is_tpe_present = false, is_6ghz_freq = false; uint8_t i = 0; int8_t max_tx_power; - uint16_t reg_max, eirp_power = 0; + uint16_t reg_max = 0, psd_power = 0; uint16_t local_constraint, bw_val = 0; uint32_t num_pwr_levels, ap_power_type_6g = 0; qdf_freq_t oper_freq, start_freq = 0; @@ -1974,10 +1979,14 @@ void lim_calculate_tpc(struct mac_context *mac, oper_freq = session->curr_op_freq; bw_val = wlan_reg_get_bw_value(session->ch_width); + ch_params.ch_width = session->ch_width; /* start frequency calculation */ wlan_reg_set_channel_params_for_freq(mac->pdev, oper_freq, 0, &ch_params); - start_freq = ch_params.mhz_freq_seg0 - bw_val / 2; + if (ch_params.mhz_freq_seg1) + start_freq = ch_params.mhz_freq_seg1 - bw_val / 2 + 10; + else + start_freq = ch_params.mhz_freq_seg0 - bw_val / 2 + 10; if (!wlan_reg_is_6ghz_chan_freq(oper_freq)) { reg_max = wlan_reg_get_channel_reg_power_for_freq(mac->pdev, @@ -2004,13 +2013,13 @@ void lim_calculate_tpc(struct mac_context *mac, wlan_reg_get_client_power_for_connecting_ap (mac->pdev, ap_power_type_6g, mlme_obj->reg_tpc_obj.frequency[i], - &is_psd_power, ®_max, &eirp_power); + &is_psd_power, ®_max, &psd_power); } } else { /* center frequency calculation */ if (is_psd_power) { mlme_obj->reg_tpc_obj.frequency[i] = - start_freq + 10 + (20 * i); + start_freq + (20 * i); } else { wlan_reg_set_channel_params_for_freq (mac->pdev, oper_freq, 0, &ch_params); @@ -2026,12 +2035,12 @@ void lim_calculate_tpc(struct mac_context *mac, wlan_reg_get_client_power_for_connecting_ap (mac->pdev, ap_power_type_6g, mlme_obj->reg_tpc_obj.frequency[i], - &is_psd_power, ®_max, &eirp_power); + &is_psd_power, ®_max, &psd_power); } else { wlan_reg_get_6g_chan_ap_power (mac->pdev, mlme_obj->reg_tpc_obj.frequency[i], - &is_psd_power, ®_max, &eirp_power); + &is_psd_power, ®_max, &psd_power); } } } @@ -2053,9 +2062,11 @@ void lim_calculate_tpc(struct mac_context *mac, max_tx_power = reg_max - local_constraint; } /* If TPE is present */ - if (is_tpe_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 firmware updated max tx power is non zero, * then allocate the min of firmware updated ap tx @@ -2070,15 +2081,18 @@ void lim_calculate_tpc(struct mac_context *mac, pe_err("HW power limit from FW is zero"); 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); } mlme_obj->reg_tpc_obj.num_pwr_levels = num_pwr_levels; mlme_obj->reg_tpc_obj.is_psd_power = is_psd_power; - mlme_obj->reg_tpc_obj.eirp_power = eirp_power; + mlme_obj->reg_tpc_obj.eirp_power = reg_max; mlme_obj->reg_tpc_obj.power_type_6g = ap_power_type_6g; - pe_debug("num_pwr_levels: %d, is_psd_power: %d, eirp_power: %d, ap_pwr_type: %d", - num_pwr_levels, is_psd_power, eirp_power, ap_power_type_6g); + pe_debug("num_pwr_levels: %d, is_psd_power: %d, total eirp_power: %d, ap_pwr_type: %d", + num_pwr_levels, is_psd_power, reg_max, ap_power_type_6g); } /** diff --git a/core/mac/src/sys/legacy/src/utils/src/parser_api.c b/core/mac/src/sys/legacy/src/utils/src/parser_api.c index 5f6a0e6e1a80..677d946da859 100644 --- a/core/mac/src/sys/legacy/src/utils/src/parser_api.c +++ b/core/mac/src/sys/legacy/src/utils/src/parser_api.c @@ -291,6 +291,8 @@ populate_dot11f_tx_power_env(struct mac_context *mac, chan_freq, &psd_tpe, ®_power, &eirp_power); + pe_debug("chan_freq %d, reg_power %d, psd_power %d", + chan_freq, reg_power, eirp_power); } switch (chan_width) { @@ -354,6 +356,8 @@ populate_dot11f_tx_power_env(struct mac_context *mac, if (bw_threshold < bw_val) add_eirp_power = true; + pe_debug("bw_threshold %d", bw_threshold); + if (add_eirp_power) { tpe_ptr->present = 1; tpe_ptr->max_tx_pwr_count = max_tx_pwr_count; @@ -368,6 +372,8 @@ populate_dot11f_tx_power_env(struct mac_context *mac, else 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++; @@ -409,6 +415,9 @@ populate_dot11f_tx_power_env(struct mac_context *mac, else 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++; @@ -428,7 +437,12 @@ populate_dot11f_tx_power_env(struct mac_context *mac, chan_freq, &chan_params); - psd_start_freq = chan_params.mhz_freq_seg0 - bw_val / 2 + 10; + if (chan_params.mhz_freq_seg1) + psd_start_freq = + chan_params.mhz_freq_seg1 - bw_val / 2 + 10; + else + psd_start_freq = + chan_params.mhz_freq_seg0 - bw_val / 2 + 10; for (count = 0; count < num_tx_power_psd; count++) { wlan_reg_get_client_power_for_6ghz_ap( @@ -440,6 +454,8 @@ populate_dot11f_tx_power_env(struct mac_context *mac, ®_power, &eirp_power); tpe_ptr->tx_power[count] = reg_power * 2; + pe_debug("psd default TPE %d %d", + count, tpe_ptr->tx_power[count]); } num_tpe_ies++; @@ -459,12 +475,6 @@ populate_dot11f_tx_power_env(struct mac_context *mac, tpe_ptr->max_tx_pwr_category = 1; tpe_ptr->num_tx_power = num_tx_power_psd; - chan_params.ch_width = chan_width; - wlan_reg_set_channel_params_for_freq(mac->pdev, - chan_freq, - chan_freq, - &chan_params); - for (count = 0; count < num_tx_power_psd; count++) { wlan_reg_get_client_power_for_6ghz_ap( mac->pdev, @@ -475,6 +485,8 @@ populate_dot11f_tx_power_env(struct mac_context *mac, ®_power, &eirp_power); tpe_ptr->tx_power[count] = reg_power * 2; + pe_debug("psd subord TPE %d %d", + count, tpe_ptr->tx_power[count]); } num_tpe_ies++;