diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 2f3cabc47ce6..7d933620f875 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -1044,6 +1044,9 @@ struct join_req { struct supported_channels supportedChannels; bool enable_bcast_probe_rsp; bool sae_pmk_cached; + bool same_ctry_code; /* If AP Country IE has same country code as */ + /* STA programmed country */ + uint8_t ap_power_type_6g; /* AP power type for 6G (LPI, SP, or VLP) */ /* Pls make this as last variable in struct */ bool force_24ghz_in_ht20; bool force_rsne_override; 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 c4d23f31aea5..fcfccbf9377e 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 @@ -1971,6 +1971,11 @@ void lim_calculate_tpc(struct mac_context *mac, struct vdev_mlme_obj *mlme_obj; uint8_t tpe_power; + if (!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"); @@ -1995,6 +2000,13 @@ void lim_calculate_tpc(struct mac_context *mac, } else { is_6ghz_freq = true; is_psd_power = wlan_reg_is_6g_psd_power(mac->pdev); + 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 = + session->lim_join_req->ap_power_type_6g; + } } if (mlme_obj->reg_tpc_obj.num_pwr_levels) { @@ -2010,7 +2022,6 @@ void lim_calculate_tpc(struct mac_context *mac, for (i = 0; i < num_pwr_levels; i++) { if (is_tpe_present) { if (is_6ghz_freq) { - ap_power_type_6g = session->ap_power_type; wlan_reg_get_client_power_for_connecting_ap( mac->pdev, ap_power_type_6g, mlme_obj->reg_tpc_obj.frequency[i], @@ -2031,8 +2042,6 @@ void lim_calculate_tpc(struct mac_context *mac, } if (is_6ghz_freq) { if (LIM_IS_STA_ROLE(session)) { - ap_power_type_6g = - session->ap_power_type; wlan_reg_get_client_power_for_connecting_ap (mac->pdev, ap_power_type_6g, mlme_obj->reg_tpc_obj.frequency[i], diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index a8df6bc4d4e7..e7a451986c11 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -15414,10 +15414,30 @@ 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 + 1)) - sme_debug("Country IE does not match country stored in regulatory"); + 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; + return status; + } + 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 = csr_iterate_triplets(pIes->Country); }