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
This commit is contained in:
Amar Singhal 2016-10-19 09:45:05 -07:00 • committed by Prakash Dhavali
commit b6d0dc4148
2 changed files with 38 additions and 42 deletions

View file

@ -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;
}

View file

@ -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) {