summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmar Singhal <asinghal@codeaurora.org>2016-10-19 09:45:05 -0700
committerqcabuildsw <qcabuildsw@localhost>2016-11-01 17:27:06 -0700
commit893bc45a497c0e647cd9e57bbb72a79724e074a6 (patch)
tree593cdd73725f928eeea6bdf3d3a0078fc1819ab2
parentfed54d564decc987b719959832103d78adbcaddc (diff)
qcacld-3.0: Restore 11d country correctly
In case user-space country priority is not defined; user-space country code can still take effect if 11d country is not defined. Change-Id: I972b9354aec5cc6a078056d10c0e76eb841998c3 CRs-Fixed: 1082704
-rw-r--r--core/sme/src/common/sme_api.c69
-rw-r--r--core/sme/src/csr/csr_api_scan.c11
2 files changed, 38 insertions, 42 deletions
diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c
index 063c52606517..bcd45914a7bf 100644
--- a/core/sme/src/common/sme_api.c
+++ b/core/sme/src/common/sme_api.c
@@ -7837,48 +7837,45 @@ sme_handle_generic_change_country_code(tpAniSirGlobal mac_ctx,
{
QDF_STATUS status = QDF_STATUS_SUCCESS;
v_REGDOMAIN_t reg_domain_id = 0;
- bool supplicant_priority =
+ bool user_ctry_priority =
mac_ctx->roam.configParam.fSupplicantCountryCodeHasPriority;
tAniGenericChangeCountryCodeReq *msg = pMsgBuf;
sms_log(mac_ctx, LOG1, FL(" called"));
- /* Set the country code given by userspace when 11dOriginal is false
- * when 11doriginal is True,is_11d_country =0 and
- * fSupplicantCountryCodeHasPriority = 0, then revert the country code,
- * and return failure
- */
- if (mac_ctx->roam.configParam.Is11dSupportEnabledOriginal == true
- && !mac_ctx->is_11d_hint && !supplicant_priority) {
- sms_log(mac_ctx, LOGW,
- FL("Incorrect country req, nullify this"));
+ 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) {
- /* we have got a request for a country that should not have been
- * added since the STA is associated; nullify this request. If
- * both countryCode11d[0] and countryCode11d[1] are zero, revert
- * it to World domain to avoid from causing cfg80211 call trace.
- */
- if ((mac_ctx->scan.countryCode11d[0] == 0)
- && (mac_ctx->scan.countryCode11d[1] == 0))
- status = csr_get_regulatory_domain_for_country(mac_ctx,
- "00", (v_REGDOMAIN_t *) &reg_domain_id,
- SOURCE_11D);
- else
- status = csr_get_regulatory_domain_for_country(mac_ctx,
+ sms_log(mac_ctx, LOGW,
+ FL("restore 11d"));
+
+ status = csr_get_regulatory_domain_for_country(
+ mac_ctx,
mac_ctx->scan.countryCode11d,
- (v_REGDOMAIN_t *) &reg_domain_id,
+ &reg_domain_id,
SOURCE_11D);
- return QDF_STATUS_E_FAILURE;
+ return QDF_STATUS_E_FAILURE;
+ }
+ }
+ } else {
+ /* if kernel gets invalid country code; it
+ * resets the country code to world
+ */
+ if (('0' != msg->countryCode[0]) ||
+ ('0' != msg->countryCode[1]))
+ qdf_mem_copy(mac_ctx->scan.countryCode11d,
+ msg->countryCode,
+ WNI_CFG_COUNTRY_CODE_LEN);
+ mac_ctx->is_11d_hint = false;
}
- /* if Supplicant country code has priority, disable 11d */
- if (supplicant_priority && !mac_ctx->is_11d_hint)
- mac_ctx->roam.configParam.Is11dSupportEnabled = false;
-
- qdf_mem_copy(mac_ctx->scan.countryCode11d, msg->countryCode,
- WNI_CFG_COUNTRY_CODE_LEN);
- qdf_mem_copy(mac_ctx->scan.countryCodeCurrent, msg->countryCode,
+ qdf_mem_copy(mac_ctx->scan.countryCodeCurrent,
+ msg->countryCode,
WNI_CFG_COUNTRY_CODE_LEN);
/* get the channels based on new cc */
@@ -7888,21 +7885,19 @@ sme_handle_generic_change_country_code(tpAniSirGlobal mac_ctx,
sms_log(mac_ctx, LOGE, FL("fail to get Channels"));
return status;
}
+
/* reset info based on new cc, and we are done */
csr_apply_channel_power_info_wrapper(mac_ctx);
- /* Country code Changed, Purge Only scan result
- * which does not have channel number belong to 11d
- * channel list
- */
csr_scan_filter_results(mac_ctx);
- /* Do active scans after the country is set by User hints or
+
+ /* scans after the country is set by User hints or
* Country IE
*/
mac_ctx->scan.curScanType = eSIR_ACTIVE_SCAN;
- mac_ctx->is_11d_hint = false;
sme_disconnect_connected_sessions(mac_ctx);
+
sms_log(mac_ctx, LOG1, FL(" returned"));
return QDF_STATUS_SUCCESS;
}
diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c
index fa72e875a92e..24999baabae8 100644
--- a/core/sme/src/csr/csr_api_scan.c
+++ b/core/sme/src/csr/csr_api_scan.c
@@ -3702,9 +3702,13 @@ bool csr_learn_11dcountry_information(tpAniSirGlobal pMac,
else
pCountryCodeSelected = pMac->scan.countryCodeElected;
- if (qdf_mem_cmp(pCountryCodeSelected, pMac->scan.countryCode11d,
- CDS_COUNTRY_CODE_LEN) == 0)
+ if (qdf_mem_cmp(pCountryCodeSelected, pMac->scan.countryCodeCurrent,
+ CDS_COUNTRY_CODE_LEN) == 0) {
+ qdf_mem_copy(pMac->scan.countryCode11d,
+ pMac->scan.countryCodeCurrent,
+ CDS_COUNTRY_CODE_LEN);
goto free_ie;
+ }
pMac->is_11d_hint = true;
status = csr_get_regulatory_domain_for_country(pMac,
@@ -3715,9 +3719,6 @@ bool csr_learn_11dcountry_information(tpAniSirGlobal pMac,
goto free_ie;
}
- /* updating 11d Country Code with Country code selected. */
- qdf_mem_copy(pMac->scan.countryCode11d, pCountryCodeSelected,
- WNI_CFG_COUNTRY_CODE_LEN);
fRet = true;
free_ie:
if (!pIes && pIesLocal) {