diff --git a/core/cds/inc/cds_reg_service.h b/core/cds/inc/cds_reg_service.h index 81565193fb88..bbe9fa41baf0 100644 --- a/core/cds/inc/cds_reg_service.h +++ b/core/cds/inc/cds_reg_service.h @@ -283,6 +283,7 @@ struct channel_power { * @SOURCE_11D: source 11D */ enum country_src { + SOURCE_UNKNOWN, SOURCE_QUERY, SOURCE_CORE, SOURCE_DRIVER, diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 666bc778e6fc..64de8caf969a 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -672,9 +672,10 @@ void hdd_reg_notifier(struct wiphy *wiphy, hdd_ctx->reg.cc_src = SOURCE_CORE; if (is_wiphy_custom_regulatory(wiphy)) reset = true; - } else if (NL80211_REGDOM_SET_BY_DRIVER == request->initiator) + } else if (NL80211_REGDOM_SET_BY_DRIVER == request->initiator) { hdd_ctx->reg.cc_src = SOURCE_DRIVER; - else { + sme_set_cc_src(hdd_ctx->hHal, SOURCE_DRIVER); + } else { hdd_ctx->reg.cc_src = SOURCE_USERSPACE; hdd_restore_custom_reg_settings(wiphy, request->alpha2, diff --git a/core/mac/inc/ani_global.h b/core/mac/inc/ani_global.h index 7634b016536a..d0fbfaf0acdb 100644 --- a/core/mac/inc/ani_global.h +++ b/core/mac/inc/ani_global.h @@ -966,8 +966,8 @@ typedef struct sAniSirGlobal { enum auth_tx_ack_status auth_ack_status; uint8_t user_configured_nss; bool sta_prefer_80MHz_over_160MHz; - bool is_11d_hint; struct wlan_objmgr_psoc *psoc; + enum country_src reg_hint_src; } tAniSirGlobal; typedef enum { diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 6f7afab14416..d5dad9671201 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -1363,4 +1363,5 @@ QDF_STATUS sme_power_debug_stats_req(tHalHandle hal, void (*callback_fn) (struct power_stats_response *response, void *context), void *power_stats_context); #endif +void sme_set_cc_src(tHalHandle hal_handle, enum country_src); #endif /* #if !defined( __SME_API_H ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index 0b100adf2aa7..9a44572cdc25 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -7675,6 +7675,12 @@ QDF_STATUS sme_get_cfg_valid_channels(tHalHandle hHal, uint8_t *aValidChannels, return status; } +void sme_set_cc_src(tHalHandle hHal, enum country_src cc_src) +{ + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hHal); + + mac_ctx->reg_hint_src = cc_src; +} /* --------------------------------------------------------------------------- \fn sme_handle_change_country_code @@ -7830,23 +7836,25 @@ sme_handle_generic_change_country_code(tpAniSirGlobal mac_ctx, sms_log(mac_ctx, LOG1, FL(" called")); - if (!mac_ctx->is_11d_hint) { - if (user_ctry_priority) - mac_ctx->roam.configParam.Is11dSupportEnabled = false; - else { - if (mac_ctx->roam.configParam.Is11dSupportEnabled && - mac_ctx->scan.countryCode11d[0] != 0) { + if (SOURCE_11D != mac_ctx->reg_hint_src) { + if (SOURCE_DRIVER != mac_ctx->reg_hint_src) { + if (user_ctry_priority) + mac_ctx->roam.configParam.Is11dSupportEnabled = + false; + else { + if (mac_ctx->roam.configParam.Is11dSupportEnabled && + mac_ctx->scan.countryCode11d[0] != 0) { - sms_log(mac_ctx, LOGW, - FL("restore 11d")); + sms_log(mac_ctx, LOGW, + FL("restore 11d")); - status = csr_get_regulatory_domain_for_country( - mac_ctx, - mac_ctx->scan.countryCode11d, - ®_domain_id, - SOURCE_11D); - - return QDF_STATUS_E_FAILURE; + status = csr_get_regulatory_domain_for_country( + mac_ctx, + mac_ctx->scan.countryCode11d, + ®_domain_id, + SOURCE_11D); + return QDF_STATUS_E_FAILURE; + } } } } else { @@ -7858,7 +7866,6 @@ sme_handle_generic_change_country_code(tpAniSirGlobal mac_ctx, qdf_mem_copy(mac_ctx->scan.countryCode11d, msg->countryCode, WNI_CFG_COUNTRY_CODE_LEN); - mac_ctx->is_11d_hint = false; } qdf_mem_copy(mac_ctx->scan.countryCodeCurrent, @@ -7883,6 +7890,8 @@ sme_handle_generic_change_country_code(tpAniSirGlobal mac_ctx, */ mac_ctx->scan.curScanType = eSIR_ACTIVE_SCAN; + mac_ctx->reg_hint_src = SOURCE_UNKNOWN; + sme_disconnect_connected_sessions(mac_ctx); sms_log(mac_ctx, LOG1, FL(" returned")); diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index a7149c92668b..92fa1afda4e2 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -3713,7 +3713,7 @@ bool csr_learn_11dcountry_information(tpAniSirGlobal pMac, goto free_ie; } - pMac->is_11d_hint = true; + pMac->reg_hint_src = SOURCE_11D; status = csr_get_regulatory_domain_for_country(pMac, pCountryCodeSelected, &domainId, SOURCE_11D); if (status != QDF_STATUS_SUCCESS) {