diff --git a/core/mac/src/include/parser_api.h b/core/mac/src/include/parser_api.h index bca5e4a1de62..8fc74b31861e 100644 --- a/core/mac/src/include/parser_api.h +++ b/core/mac/src/include/parser_api.h @@ -697,7 +697,7 @@ populate_dot_11_f_ext_chann_switch_ann(struct mac_context *mac_ptr, void populate_dot11f_vht_tx_power_env(struct mac_context *mac, tDot11fIEvht_transmit_power_env *pDot11f, - enum phy_ch_width ch_width, uint8_t chan); + enum phy_ch_width ch_width, uint32_t chan_freq); /* / Populate a tDot11fIEChannelSwitchWrapper */ void populate_dot11f_chan_switch_wrapper(struct mac_context *mac, diff --git a/core/mac/src/pe/lim/lim_assoc_utils.c b/core/mac/src/pe/lim/lim_assoc_utils.c index 46df2c47eee5..261f1a554476 100644 --- a/core/mac/src/pe/lim/lim_assoc_utils.c +++ b/core/mac/src/pe/lim/lim_assoc_utils.c @@ -4485,9 +4485,8 @@ QDF_STATUS lim_is_dot11h_power_capabilities_in_range(struct mac_context *mac, int8_t localMaxTxPower; uint8_t local_pwr_constraint; - localMaxTxPower = lim_get_regulatory_max_transmit_power( - mac, wlan_reg_freq_to_chan( - mac->pdev, pe_session->curr_op_freq)); + localMaxTxPower = wlan_reg_get_channel_reg_power_for_freq( + mac->pdev, pe_session->curr_op_freq); local_pwr_constraint = mac->mlme_cfg->power.local_power_constraint; localMaxTxPower -= (int8_t)local_pwr_constraint; diff --git a/core/mac/src/pe/lim/lim_ft.c b/core/mac/src/pe/lim/lim_ft.c index 14457e9598e3..fa78ca743f9d 100644 --- a/core/mac/src/pe/lim/lim_ft.c +++ b/core/mac/src/pe/lim/lim_ft.c @@ -611,11 +611,11 @@ void lim_fill_ft_session(struct mac_context *mac, ft_session->shortSlotTimeSupported = true; } - regMax = lim_get_regulatory_max_transmit_power( - mac, wlan_reg_freq_to_chan(mac->pdev, - ft_session->curr_op_freq)); + regMax = wlan_reg_get_channel_reg_power_for_freq( + mac->pdev, ft_session->curr_op_freq); localPowerConstraint = regMax; lim_extract_ap_capability(mac, (uint8_t *) pbssDescription->ieFields, + lim_get_ielen_from_bss_description(pbssDescription), &ft_session->limCurrentBssQosCaps, ¤tBssUapsd, 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 3b8caf8aaf62..35c3645f96b9 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 @@ -634,10 +634,8 @@ __lim_handle_sme_start_bss_request(struct mac_context *mac_ctx, uint32_t *msg_bu /* Update the phymode */ session->gLimPhyMode = sme_start_bss_req->nwType; - session->maxTxPower = - lim_get_regulatory_max_transmit_power(mac_ctx, - wlan_reg_freq_to_chan( - mac_ctx->pdev, session->curr_op_freq)); + session->maxTxPower = wlan_reg_get_channel_reg_power_for_freq( + mac_ctx->pdev, session->curr_op_freq); /* Store the dot 11 mode in to the session Table */ session->dot11mode = sme_start_bss_req->dot11mode; #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH @@ -1591,9 +1589,8 @@ __lim_process_sme_join_req(struct mac_context *mac_ctx, void *msg_buf) session->limCurrentBssCaps = session->lim_join_req->bssDescription.capabilityInfo; - reg_max = lim_get_regulatory_max_transmit_power( - mac_ctx, wlan_reg_freq_to_chan(mac_ctx->pdev, - session->curr_op_freq)); + reg_max = wlan_reg_get_channel_reg_power_for_freq( + mac_ctx->pdev, session->curr_op_freq); local_power_constraint = reg_max; lim_extract_ap_capability(mac_ctx, @@ -1919,9 +1916,8 @@ static void __lim_process_sme_reassoc_req(struct mac_context *mac_ctx, session_entry->limReassocBssCaps = session_entry->pLimReAssocReq->bssDescription.capabilityInfo; - reg_max = lim_get_regulatory_max_transmit_power( - mac_ctx, wlan_reg_freq_to_chan( - mac_ctx->pdev, session_entry->curr_op_freq)); + reg_max = wlan_reg_get_channel_reg_power_for_freq( + mac_ctx->pdev, session_entry->curr_op_freq); local_pwr_constraint = reg_max; lim_extract_ap_capability(mac_ctx, diff --git a/core/mac/src/pe/lim/lim_utils.c b/core/mac/src/pe/lim/lim_utils.c index 3eddda122aea..425fc649bb94 100644 --- a/core/mac/src/pe/lim/lim_utils.c +++ b/core/mac/src/pe/lim/lim_utils.c @@ -8193,79 +8193,6 @@ void lim_send_start_bss_confirm(struct mac_context *mac_ctx, } } -/** - * lim_get_dot11d_transmit_power() - regulatory max transmit power - * @mac: pointer to mac data - * @channel: channel number - * - * Return: int8_t - power - */ -static int8_t -lim_get_dot11d_transmit_power(struct mac_context *mac, uint8_t channel) -{ - uint32_t cfg_length = 0; - int8_t max_tx_pwr = 0; - tSirMacChanInfo *country_info = NULL; - uint8_t count = 0; - uint8_t first_channel; - uint8_t maxChannels; - int32_t rem_length = 0; - - if (WLAN_REG_IS_5GHZ_CH(channel)) - cfg_length = mac->mlme_cfg->power.max_tx_power_5.len; - else if (WLAN_REG_IS_24GHZ_CH(channel)) - cfg_length = mac->mlme_cfg->power.max_tx_power_24.len; - else - return max_tx_pwr; - - country_info = qdf_mem_malloc(cfg_length); - if (!country_info) - goto error; - - if (WLAN_REG_IS_5GHZ_CH(channel)) { - if (cfg_length > CFG_MAX_TX_POWER_5_LEN) - goto error; - qdf_mem_copy(country_info, - mac->mlme_cfg->power.max_tx_power_5.data, - cfg_length); - } else if (WLAN_REG_IS_24GHZ_CH(channel)) { - if (cfg_length > CFG_MAX_TX_POWER_2_4_LEN) - goto error; - qdf_mem_copy(country_info, - mac->mlme_cfg->power.max_tx_power_24.data, - cfg_length); - } - - /* Identify the channel and maxtxpower */ - rem_length = cfg_length; - while (rem_length >= (sizeof(tSirMacChanInfo))) { - first_channel = wlan_reg_freq_to_chan( - mac->pdev, - country_info[count].first_freq); - maxChannels = country_info[count].numChannels; - max_tx_pwr = country_info[count].maxTxPower; - count++; - rem_length -= (sizeof(tSirMacChanInfo)); - - if ((channel >= first_channel) && - (channel < (first_channel + maxChannels))) { - break; - } - } - -error: - if (country_info) - qdf_mem_free(country_info); - - return max_tx_pwr; -} - -int8_t lim_get_regulatory_max_transmit_power(struct mac_context *mac, - uint8_t channel) -{ - return lim_get_dot11d_transmit_power(mac, channel); -} - QDF_STATUS lim_get_capability_info(struct mac_context *mac, uint16_t *pcap, struct pe_session *pe_session) { diff --git a/core/mac/src/pe/lim/lim_utils.h b/core/mac/src/pe/lim/lim_utils.h index 4e35d67c0b12..3d9a689d3ddf 100644 --- a/core/mac/src/pe/lim/lim_utils.h +++ b/core/mac/src/pe/lim/lim_utils.h @@ -1831,17 +1831,6 @@ static inline void lim_copy_set_key_req_mac_addr(struct qdf_mac_addr *dst, } #endif -/** - * lim_get_regulatory_max_transmit_power() - Get regulatory max transmit - * power on given channel - * @mac: pointer to mac data - * @channel: channel number - * - * Return: int8_t - power - */ -int8_t lim_get_regulatory_max_transmit_power(struct mac_context *mac, - uint8_t channel); - /** * lim_get_capability_info() - Get capability information * @mac: pointer to mac data diff --git a/core/mac/src/pe/sch/sch_beacon_gen.c b/core/mac/src/pe/sch/sch_beacon_gen.c index db71ba129bdd..deeaea47a537 100644 --- a/core/mac/src/pe/sch/sch_beacon_gen.c +++ b/core/mac/src/pe/sch/sch_beacon_gen.c @@ -460,9 +460,7 @@ sch_set_fixed_beacon_fields(struct mac_context *mac_ctx, struct pe_session *sess populate_dot11f_vht_tx_power_env(mac_ctx, &bcn_2->vht_transmit_power_env, session->ch_width, - wlan_reg_freq_to_chan( - mac_ctx->pdev, - session->curr_op_freq)); + session->curr_op_freq); populate_dot11f_qcn_ie(mac_ctx, &bcn_2->qcn_ie, QCN_IE_ATTR_ID_ALL); } diff --git a/core/mac/src/pe/sch/sch_beacon_process.c b/core/mac/src/pe/sch/sch_beacon_process.c index 047f20814734..0847e44909f1 100644 --- a/core/mac/src/pe/sch/sch_beacon_process.c +++ b/core/mac/src/pe/sch/sch_beacon_process.c @@ -854,9 +854,8 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx, rx_pkt_info, session, &beaconParams, &sendProbeReq, pMh); /* Obtain the Max Tx power for the current regulatory */ - regMax = lim_get_regulatory_max_transmit_power( - mac_ctx, wlan_reg_freq_to_chan( - mac_ctx->pdev, session->curr_op_freq)); + regMax = wlan_reg_get_channel_reg_power_for_freq( + mac_ctx->pdev, session->curr_op_freq); local_constraint = regMax; 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 d183e9100df3..18b48b1131d2 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 @@ -265,7 +265,7 @@ populate_dot11_supp_operating_classes(struct mac_context *mac_ptr, void populate_dot11f_vht_tx_power_env(struct mac_context *mac, tDot11fIEvht_transmit_power_env *pDot11f, - enum phy_ch_width ch_width, uint8_t chan) + enum phy_ch_width ch_width, uint32_t chan_freq) { uint8_t num_tx_power, i, tx_power; int reg_max; @@ -292,7 +292,7 @@ populate_dot11f_vht_tx_power_env(struct mac_context *mac, return; } - reg_max = lim_get_regulatory_max_transmit_power(mac, chan); + reg_max = wlan_reg_get_channel_reg_power_for_freq(mac->pdev, chan_freq); /* in 0.5 dB steps */ reg_max *= 2; @@ -1761,9 +1761,8 @@ populate_dot11f_tpc_report(struct mac_context *mac, nSirStatus); return QDF_STATUS_E_FAILURE; } - tx_power = lim_get_regulatory_max_transmit_power( - mac, wlan_reg_freq_to_chan( - mac->pdev, pe_session->curr_op_freq)); + tx_power = wlan_reg_get_channel_reg_power_for_freq( + mac->pdev, pe_session->curr_op_freq); pDot11f->tx_power = tx_power; pDot11f->link_margin = 0; pDot11f->present = 1;