wlan:Fix race condition between NV country and kernel country code.
During wlan init kernel gives last stored CC and wlan driver
also reads country from NV and gives regulatory hint for the
NV country. There is race condition where SME may delay
processing country from kernel which causes channel list to
be out of sync betweeen kernel and driver.
Due to this race first NV country is processed and
updated to kernel . After this SME processes
WNI_SME_GENERIC_CHANGE_COUNTRY_CODE command and will
change driver channel list as per previously stored CC
of kernel while kernel has channel list of NV country.
Fix this by ignoring country from kernel if driver has non zero
default cc in NV during driver load time.
CRs-Fixed: 695944
Change-Id: Iff52ce0f1fdff85dcb0a8f9cea91f94019f684cb
diff --git a/CORE/SME/src/csr/csrApiRoam.c b/CORE/SME/src/csr/csrApiRoam.c
index 1e02953..4095685 100644
--- a/CORE/SME/src/csr/csrApiRoam.c
+++ b/CORE/SME/src/csr/csrApiRoam.c
@@ -423,6 +423,11 @@
vos_mem_copy(pMac->scan.countryCodeCurrent, pMac->scan.countryCodeDefault,
WNI_CFG_COUNTRY_CODE_LEN);
status = csrInitGetChannels( pMac );
+
+ /* reset info based on new cc, and we are done */
+ csrResetCountryInformation(pMac, eANI_BOOLEAN_TRUE, eANI_BOOLEAN_TRUE);
+ csrScanFilterResults(pMac);
+
return status;
}
diff --git a/CORE/VOSS/src/vos_nvitem.c b/CORE/VOSS/src/vos_nvitem.c
index 5abbe6b..6330c4f 100644
--- a/CORE/VOSS/src/vos_nvitem.c
+++ b/CORE/VOSS/src/vos_nvitem.c
@@ -3676,6 +3676,20 @@
/* first lookup the country in the local database */
+ if (!(pnvEFSTable->halnv.tables.defaultCountryTable.countryCode[0] == '0' &&
+ pnvEFSTable->halnv.tables.defaultCountryTable.countryCode[1] == '0') &&
+ (vos_is_load_unload_in_progress( VOS_MODULE_ID_VOSS, NULL)))
+ {
+ VOS_TRACE(VOS_MODULE_ID_VOSS, VOS_TRACE_LEVEL_INFO,
+ (" Default Country in nv is non Zero and Driver load/unload"
+ "is in progress; avoid updating country from kernel\n"));
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0))
+ return;
+#else
+ return 0;
+#endif
+ }
+
country_code[0] = request->alpha2[0];
country_code[1] = request->alpha2[1];
@@ -3717,7 +3731,7 @@
if (request->alpha2[0] == '0' && request->alpha2[1] == '0')
{
sme_GenericChangeCountryCode(pHddCtx->hHal, country_code,
- REGDOMAIN_COUNT);
+ REGDOMAIN_COUNT);
}
else
{