qcacld-3.0: Replace channel with frequency in lim

Replace lim_get_regulatory_max_transmit_power() with
wlan_reg_get_channel_reg_power_for_freq()

Change-Id: Id5ef6cb9666bcb24c2b71bcd1a15f46966f508a4
CRs-Fixed: 2557826
This commit is contained in:
Amruta Kulkarni
2019-11-06 10:41:29 -08:00
committed by nshrivas
parent 5abc59e4bf
commit ac761a6f01
9 changed files with 19 additions and 112 deletions

View File

@@ -697,7 +697,7 @@ populate_dot_11_f_ext_chann_switch_ann(struct mac_context *mac_ptr,
void void
populate_dot11f_vht_tx_power_env(struct mac_context *mac, populate_dot11f_vht_tx_power_env(struct mac_context *mac,
tDot11fIEvht_transmit_power_env *pDot11f, 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 */ /* / Populate a tDot11fIEChannelSwitchWrapper */
void void
populate_dot11f_chan_switch_wrapper(struct mac_context *mac, populate_dot11f_chan_switch_wrapper(struct mac_context *mac,

View File

@@ -4485,9 +4485,8 @@ QDF_STATUS lim_is_dot11h_power_capabilities_in_range(struct mac_context *mac,
int8_t localMaxTxPower; int8_t localMaxTxPower;
uint8_t local_pwr_constraint; uint8_t local_pwr_constraint;
localMaxTxPower = lim_get_regulatory_max_transmit_power( localMaxTxPower = wlan_reg_get_channel_reg_power_for_freq(
mac, wlan_reg_freq_to_chan( mac->pdev, pe_session->curr_op_freq);
mac->pdev, pe_session->curr_op_freq));
local_pwr_constraint = mac->mlme_cfg->power.local_power_constraint; local_pwr_constraint = mac->mlme_cfg->power.local_power_constraint;
localMaxTxPower -= (int8_t)local_pwr_constraint; localMaxTxPower -= (int8_t)local_pwr_constraint;

View File

@@ -611,11 +611,11 @@ void lim_fill_ft_session(struct mac_context *mac,
ft_session->shortSlotTimeSupported = true; ft_session->shortSlotTimeSupported = true;
} }
regMax = lim_get_regulatory_max_transmit_power( regMax = wlan_reg_get_channel_reg_power_for_freq(
mac, wlan_reg_freq_to_chan(mac->pdev, mac->pdev, ft_session->curr_op_freq);
ft_session->curr_op_freq));
localPowerConstraint = regMax; localPowerConstraint = regMax;
lim_extract_ap_capability(mac, (uint8_t *) pbssDescription->ieFields, lim_extract_ap_capability(mac, (uint8_t *) pbssDescription->ieFields,
lim_get_ielen_from_bss_description(pbssDescription), lim_get_ielen_from_bss_description(pbssDescription),
&ft_session->limCurrentBssQosCaps, &ft_session->limCurrentBssQosCaps,
&currentBssUapsd, &currentBssUapsd,

View File

@@ -634,10 +634,8 @@ __lim_handle_sme_start_bss_request(struct mac_context *mac_ctx, uint32_t *msg_bu
/* Update the phymode */ /* Update the phymode */
session->gLimPhyMode = sme_start_bss_req->nwType; session->gLimPhyMode = sme_start_bss_req->nwType;
session->maxTxPower = session->maxTxPower = wlan_reg_get_channel_reg_power_for_freq(
lim_get_regulatory_max_transmit_power(mac_ctx, mac_ctx->pdev, session->curr_op_freq);
wlan_reg_freq_to_chan(
mac_ctx->pdev, session->curr_op_freq));
/* Store the dot 11 mode in to the session Table */ /* Store the dot 11 mode in to the session Table */
session->dot11mode = sme_start_bss_req->dot11mode; session->dot11mode = sme_start_bss_req->dot11mode;
#ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH #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->limCurrentBssCaps =
session->lim_join_req->bssDescription.capabilityInfo; session->lim_join_req->bssDescription.capabilityInfo;
reg_max = lim_get_regulatory_max_transmit_power( reg_max = wlan_reg_get_channel_reg_power_for_freq(
mac_ctx, wlan_reg_freq_to_chan(mac_ctx->pdev, mac_ctx->pdev, session->curr_op_freq);
session->curr_op_freq));
local_power_constraint = reg_max; local_power_constraint = reg_max;
lim_extract_ap_capability(mac_ctx, 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->limReassocBssCaps =
session_entry->pLimReAssocReq->bssDescription.capabilityInfo; session_entry->pLimReAssocReq->bssDescription.capabilityInfo;
reg_max = lim_get_regulatory_max_transmit_power( reg_max = wlan_reg_get_channel_reg_power_for_freq(
mac_ctx, wlan_reg_freq_to_chan( mac_ctx->pdev, session_entry->curr_op_freq);
mac_ctx->pdev, session_entry->curr_op_freq));
local_pwr_constraint = reg_max; local_pwr_constraint = reg_max;
lim_extract_ap_capability(mac_ctx, lim_extract_ap_capability(mac_ctx,

View File

@@ -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, QDF_STATUS lim_get_capability_info(struct mac_context *mac, uint16_t *pcap,
struct pe_session *pe_session) struct pe_session *pe_session)
{ {

View File

@@ -1831,17 +1831,6 @@ static inline void lim_copy_set_key_req_mac_addr(struct qdf_mac_addr *dst,
} }
#endif #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 * lim_get_capability_info() - Get capability information
* @mac: pointer to mac data * @mac: pointer to mac data

View File

@@ -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, populate_dot11f_vht_tx_power_env(mac_ctx,
&bcn_2->vht_transmit_power_env, &bcn_2->vht_transmit_power_env,
session->ch_width, session->ch_width,
wlan_reg_freq_to_chan( session->curr_op_freq);
mac_ctx->pdev,
session->curr_op_freq));
populate_dot11f_qcn_ie(mac_ctx, &bcn_2->qcn_ie, populate_dot11f_qcn_ie(mac_ctx, &bcn_2->qcn_ie,
QCN_IE_ATTR_ID_ALL); QCN_IE_ATTR_ID_ALL);
} }

View File

@@ -854,9 +854,8 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
rx_pkt_info, session, rx_pkt_info, session,
&beaconParams, &sendProbeReq, pMh); &beaconParams, &sendProbeReq, pMh);
/* Obtain the Max Tx power for the current regulatory */ /* Obtain the Max Tx power for the current regulatory */
regMax = lim_get_regulatory_max_transmit_power( regMax = wlan_reg_get_channel_reg_power_for_freq(
mac_ctx, wlan_reg_freq_to_chan( mac_ctx->pdev, session->curr_op_freq);
mac_ctx->pdev, session->curr_op_freq));
local_constraint = regMax; local_constraint = regMax;

View File

@@ -265,7 +265,7 @@ populate_dot11_supp_operating_classes(struct mac_context *mac_ptr,
void void
populate_dot11f_vht_tx_power_env(struct mac_context *mac, populate_dot11f_vht_tx_power_env(struct mac_context *mac,
tDot11fIEvht_transmit_power_env *pDot11f, 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; uint8_t num_tx_power, i, tx_power;
int reg_max; int reg_max;
@@ -292,7 +292,7 @@ populate_dot11f_vht_tx_power_env(struct mac_context *mac,
return; 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 */ /* in 0.5 dB steps */
reg_max *= 2; reg_max *= 2;
@@ -1761,9 +1761,8 @@ populate_dot11f_tpc_report(struct mac_context *mac,
nSirStatus); nSirStatus);
return QDF_STATUS_E_FAILURE; return QDF_STATUS_E_FAILURE;
} }
tx_power = lim_get_regulatory_max_transmit_power( tx_power = wlan_reg_get_channel_reg_power_for_freq(
mac, wlan_reg_freq_to_chan( mac->pdev, pe_session->curr_op_freq);
mac->pdev, pe_session->curr_op_freq));
pDot11f->tx_power = tx_power; pDot11f->tx_power = tx_power;
pDot11f->link_margin = 0; pDot11f->link_margin = 0;
pDot11f->present = 1; pDot11f->present = 1;