qcacld-3.0: Update ap power type for 6G roaming case

Update the ap power type when STA moves in/out of 6G
during roaming in beacon process API. Add new API
wlan_reg_get_6g_power_type to return ap power type
and country code match.

Currently, after roaming, the lim join req is null and
the null check in TPC calculation API returns without
calculating the TPC power again. This change should
fix the issue and recalculate TPC power after roaming.

Change-Id: Ibe9fa7ed0f0e1cdaf427e78279f3e675344d8abe
CRs-Fixed: 2968240
This commit is contained in:
Gururaj Pandurangi 2021-06-10 19:22:41 -07:00 • committed by Madan Koyyalamudi
commit 29d7f0ecec
6 changed files with 52 additions and 40 deletions

View file

@ -2320,7 +2320,8 @@ void lim_handle_add_bss_rsp(struct mac_context *mac_ctx,
}
tx_ops = wlan_reg_get_tx_ops(mac_ctx->psoc);
lim_calculate_tpc(mac_ctx, session_entry, false);
lim_calculate_tpc(mac_ctx, session_entry, false, 0,
false);
if (tx_ops->set_tpc_power)
tx_ops->set_tpc_power(mac_ctx->psoc,
@ -2805,7 +2806,7 @@ static void lim_process_switch_channel_join_req(
goto error;
}
lim_calculate_tpc(mac_ctx, session_entry, false);
lim_calculate_tpc(mac_ctx, session_entry, false, 0, false);
if (tx_ops->set_tpc_power)
tx_ops->set_tpc_power(mac_ctx->psoc,

View file

@ -1957,7 +1957,9 @@ uint8_t lim_get_max_tx_power(struct mac_context *mac,
void lim_calculate_tpc(struct mac_context *mac,
struct pe_session *session,
bool is_pwr_constraint_absolute)
bool is_pwr_constraint_absolute,
uint8_t ap_pwr_type,
bool ctry_code_match)
{
bool is_psd_power = false;
bool is_tpe_present = false, is_6ghz_freq = false;
@ -1972,11 +1974,6 @@ void lim_calculate_tpc(struct mac_context *mac,
uint8_t tpe_power;
bool skip_tpe = false;
if (LIM_IS_STA_ROLE(session) && !session->lim_join_req) {
pe_err("Join Request is NULL");
return;
}
mlme_obj = wlan_vdev_mlme_get_cmpt_obj(session->vdev);
if (!mlme_obj) {
pe_err("vdev component object is NULL");
@ -2002,12 +1999,17 @@ void lim_calculate_tpc(struct mac_context *mac,
} else {
is_6ghz_freq = true;
is_psd_power = wlan_reg_is_6g_psd_power(mac->pdev);
/* Power mode calculation for 6G*/
ap_power_type_6g = session->ap_power_type;
if (LIM_IS_STA_ROLE(session)) {
if (session->lim_join_req->same_ctry_code)
ap_power_type_6g = session->ap_power_type;
else
ap_power_type_6g =
if (!session->lim_join_req) {
if (!ctry_code_match)
ap_power_type_6g = ap_pwr_type;
} else {
if (!session->lim_join_req->same_ctry_code)
ap_power_type_6g =
session->lim_join_req->ap_power_type_6g;
}
}
}

View file

@ -183,6 +183,8 @@ uint8_t lim_get_max_tx_power(struct mac_context *mac,
* @session: PE Session Entry
* @is_pwr_constraint_absolute: If local power constraint is an absolute
* value or an offset value.
* @ap_pwr_type: Ap power type for 6G
* @ctry_code_match: check for country IE and sta programmed ctry match
*
* This function is used to get the maximum possible tx power from the list
* of tx powers mentioned in @attr.
@ -191,7 +193,9 @@ uint8_t lim_get_max_tx_power(struct mac_context *mac,
*/
void lim_calculate_tpc(struct mac_context *mac,
struct pe_session *session,
bool is_pwr_constraint_absolute);
bool is_pwr_constraint_absolute,
uint8_t ap_pwr_type,
bool ctry_code_match);
/* AID pool management functions */
void lim_init_peer_idxpool(struct mac_context *, struct pe_session *);

View file

@ -270,7 +270,7 @@ rrm_process_link_measurement_request(struct mac_context *mac,
ap_pwr_constraint = mlme_obj->reg_tpc_obj.ap_constraint_power;
mlme_obj->reg_tpc_obj.ap_constraint_power =
pLinkReq->MaxTxPower.maxTxPower;
lim_calculate_tpc(mac, pe_session, true);
lim_calculate_tpc(mac, pe_session, true, 0, false);
LinkReport.txPower =
mlme_obj->reg_tpc_obj.chan_power_info[0].tx_power;

View file

@ -713,6 +713,9 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
int8_t regMax = 0, maxTxPower = 0;
QDF_STATUS status;
bool skip_tpe = false;
uint8_t programmed_country[REG_ALPHA2_LEN + 1];
enum reg_6g_ap_type pwr_type_6g = REG_INDOOR_AP;
bool ctry_code_match = false;
qdf_mem_zero(&beaconParams, sizeof(tUpdateBeaconParams));
beaconParams.paramChangeBitmap = 0;
@ -744,8 +747,22 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
return;
}
if (!wlan_reg_is_6ghz_chan_freq(bcn->chan_freq))
if (!wlan_reg_is_6ghz_chan_freq(bcn->chan_freq)) {
skip_tpe = wlan_mlme_skip_tpe(mac_ctx->psoc);
} else {
if (!bcn->countryInfoParam.countryString[0]) {
pe_err("Channel is 6G but country IE not present");
return;
}
wlan_reg_read_current_country(mac_ctx->psoc,
programmed_country);
status = wlan_reg_get_6g_power_type_for_ctry(
bcn->countryInfoParam.countryString,
programmed_country, &pwr_type_6g,
&ctry_code_match);
if (QDF_IS_STATUS_ERROR(status))
return;
}
if (wlan_reg_is_ext_tpc_supported(mac_ctx->psoc)) {
tx_ops = wlan_reg_get_tx_ops(mac_ctx->psoc);
@ -773,7 +790,8 @@ static void __sch_beacon_process_for_session(struct mac_context *mac_ctx,
if ((ap_constraint_change && local_constraint) ||
(tpe_change && !skip_tpe)) {
lim_calculate_tpc(mac_ctx, session, false);
lim_calculate_tpc(mac_ctx, session, false, pwr_type_6g,
ctry_code_match);
if (tx_ops->set_tpc_power)
tx_ops->set_tpc_power(mac_ctx->psoc,

View file

@ -14792,6 +14792,8 @@ QDF_STATUS csr_send_join_req_msg(struct mac_context *mac, uint32_t sessionId,
bool follow_ap_edca;
bool reconn_after_assoc_timeout = false;
uint8_t programmed_country[REG_ALPHA2_LEN + 1];
enum reg_6g_ap_type power_type_6g;
bool ctry_code_match;
if (!pSession) {
sme_err("session %d not found", sessionId);
@ -15558,30 +15560,15 @@ QDF_STATUS csr_send_join_req_msg(struct mac_context *mac, uint32_t sessionId,
sme_debug("Channel is 6G but country IE not present");
wlan_reg_read_current_country(mac->psoc,
programmed_country);
if (qdf_mem_cmp(pIes->Country.country,
programmed_country,
REG_ALPHA2_LEN)) {
sme_debug("Country IE:%c%c, STA country:%c%c",
pIes->Country.country[0],
pIes->Country.country[1],
programmed_country[0],
programmed_country[1]);
csr_join_req->same_ctry_code = false;
if (wlan_reg_is_us(programmed_country)) {
sme_err("US VLP not in place yet, connection not allowed");
status = QDF_STATUS_E_NOSUPPORT;
break;
}
if (wlan_reg_is_etsi(programmed_country)) {
sme_debug("STA ctry:%c%c, doesn't match with AP ctry, switch to VLP",
programmed_country[0],
programmed_country[1]);
csr_join_req->ap_power_type_6g =
REG_VERY_LOW_POWER_AP;
}
} else {
csr_join_req->same_ctry_code = true;
}
status = wlan_reg_get_6g_power_type_for_ctry(
pIes->Country.country,
programmed_country, &power_type_6g,
&ctry_code_match);
if (QDF_IS_STATUS_ERROR(status))
break;
csr_join_req->ap_power_type_6g = power_type_6g;
csr_join_req->same_ctry_code = ctry_code_match;
status = csr_iterate_triplets(pIes->Country);
}