diff options
| author | Amar Singhal <asinghal@codeaurora.org> | 2017-08-07 16:06:19 -0700 |
|---|---|---|
| committer | snandini <snandini@codeaurora.org> | 2017-08-13 23:38:18 -0700 |
| commit | c3088d2028773764954df2fd56bbc04ebcdc4859 (patch) | |
| tree | f5a3b358f2b19978e8de790cdf7ce8c6a755abc8 | |
| parent | 5cbc6e6adb6df9a55fcf09fc51ccd0f2bf2d215f (diff) | |
qcacld-3.0: implement new 11d algorithm
Per new US regulations, 11d should be used to chose new country
only if at-least 3 APs with new country are seen; plus no AP with
US country is seen. Apply the same logic for WORLD mode also.
Change-Id: I159e07c8ab6e136c31af33ce1d125fc18063bf5f
CRs-Fixed: 2089601
| -rw-r--r-- | core/sme/src/csr/csr_api_scan.c | 89 |
1 files changed, 88 insertions, 1 deletions
diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c index 2164fcf6e1a4..72f244c1e370 100644 --- a/core/sme/src/csr/csr_api_scan.c +++ b/core/sme/src/csr/csr_api_scan.c @@ -86,6 +86,8 @@ #define CSR_SCAN_IS_OVER_BSS_LIMIT(pMac) \ ((pMac)->scan.nBssLimit <= (csr_ll_count(&(pMac)->scan.scanResultList))) +#define MIN_11D_AP_COUNT 3 + static void csr_set_default_scan_timing(tpAniSirGlobal pMac, tSirScanType scanType, tCsrScanRequest *pScanRequest); @@ -3146,12 +3148,90 @@ csr_remove_from_tmp_list(tpAniSirGlobal mac_ctx, } /* end of loop */ } + +static bool is_us_country(uint8_t *country_code) +{ + if ((country_code[0] == 'U') && + (country_code[1] == 'S')) + return true; + + return false; +} + +static bool is_world_mode(uint8_t *country_code) +{ + if ((country_code[0] == '0') && + (country_code[1] == '0')) + return true; + + return false; +} + +static bool csr_elected_country_algo_fcc(tpAniSirGlobal mac_ctx) +{ + bool ctry_11d_found = false; + uint8_t max_votes = 0; + uint8_t i = 0; + uint8_t ctry_index; + + if (!mac_ctx->scan.countryCodeCount) { + sme_warn("No AP with 11d Country code is present in scan list"); + return ctry_11d_found; + } + + max_votes = mac_ctx->scan.votes11d[0].votes; + if (is_us_country(mac_ctx->scan.votes11d[0].countryCode)) { + ctry_11d_found = true; + ctry_index = 0; + goto algo_done; + } else if (max_votes >= MIN_11D_AP_COUNT) { + ctry_11d_found = true; + ctry_index = 0; + } + + for (i = 1; i < mac_ctx->scan.countryCodeCount; i++) { + if (is_us_country(mac_ctx->scan.votes11d[i].countryCode)) { + ctry_11d_found = true; + ctry_index = i; + goto algo_done; + } + + if ((max_votes < mac_ctx->scan.votes11d[i].votes) && + (mac_ctx->scan.votes11d[i].votes >= MIN_11D_AP_COUNT)) { + sme_debug(" Votes for Country %c%c : %d", + mac_ctx->scan.votes11d[i].countryCode[0], + mac_ctx->scan.votes11d[i].countryCode[1], + mac_ctx->scan.votes11d[i].votes); + max_votes = mac_ctx->scan.votes11d[i].votes; + ctry_index = i; + ctry_11d_found = true; + } + } + +algo_done: + + if (ctry_11d_found) { + qdf_mem_copy(mac_ctx->scan.countryCodeElected, + mac_ctx->scan.votes11d[ctry_index].countryCode, + WNI_CFG_COUNTRY_CODE_LEN); + + sme_debug("Selected Country is %c%c With count %d", + mac_ctx->scan.votes11d[ctry_index].countryCode[0], + mac_ctx->scan.votes11d[ctry_index].countryCode[1], + mac_ctx->scan.votes11d[ctry_index].votes); + } + + return ctry_11d_found; +} + + static void csr_move_temp_scan_results_to_main_list(tpAniSirGlobal pMac, uint8_t reason, uint8_t sessionId) { tCsrRoamSession *pSession; uint32_t i; + bool found_11d_ctry = false; /* remove the BSS descriptions from temporary list */ csr_remove_from_tmp_list(pMac, reason, sessionId); @@ -3171,7 +3251,14 @@ static void csr_move_temp_scan_results_to_main_list(tpAniSirGlobal pMac, return; } } - if (csr_elected_country_info(pMac)) + + if (is_us_country(pMac->scan.countryCodeCurrent) || + is_world_mode(pMac->scan.countryCodeCurrent)) + found_11d_ctry = csr_elected_country_algo_fcc(pMac); + else + found_11d_ctry = csr_elected_country_info(pMac); + + if (found_11d_ctry) csr_learn_11dcountry_information(pMac, NULL, NULL, true); } |
