diff options
| author | Amar Singhal <asinghal@qca.qualcomm.com> | 2015-05-06 09:32:30 -0700 |
|---|---|---|
| committer | AnjaneeDevi Kapparapu <c_akappa@qti.qualcomm.com> | 2015-05-07 17:08:34 +0530 |
| commit | c5a4ffeb18e4243bb7ad4639ae62d3f9b6163996 (patch) | |
| tree | ee007956dfbb0af156454462376c4f2d41050998 | |
| parent | 6c6962a24b92c2364910cb8dba1eb823bc263ddc (diff) | |
qcacld-2.0: Adapt to regulatory design in kernel 3.14
Ignore the CORE callback during wiphy registration.
Also save and restore the regulatory flags in cases
the wiphy regulatory flags can be modified by the
kernel regulatory core
Change-Id: I84f3d885d6815ee97e9c81b41e39edbe51611101
CRs-Fixed: 832363
| -rw-r--r-- | CORE/SERVICES/WMA/regdomain.h | 1 | ||||
| -rw-r--r-- | CORE/VOSS/src/vos_nvitem.c | 162 |
2 files changed, 102 insertions, 61 deletions
diff --git a/CORE/SERVICES/WMA/regdomain.h b/CORE/SERVICES/WMA/regdomain.h index de71a92b1531..072d5564157a 100644 --- a/CORE/SERVICES/WMA/regdomain.h +++ b/CORE/SERVICES/WMA/regdomain.h @@ -323,6 +323,7 @@ struct regulatory { uint8_t ctl_5g; const void *regpair; COUNTRY_CODE_SOURCE cc_src; + uint32_t reg_flags; }; /* Multi-Device RegDomain Support */ typedef struct ath_hal_reg_dmn_tables { diff --git a/CORE/VOSS/src/vos_nvitem.c b/CORE/VOSS/src/vos_nvitem.c index 8dad1864efb5..ee96430e1f4f 100644 --- a/CORE/VOSS/src/vos_nvitem.c +++ b/CORE/VOSS/src/vos_nvitem.c @@ -710,63 +710,83 @@ static void vos_reg_apply_world_flags(struct wiphy *wiphy, } static int regd_init_wiphy(hdd_context_t *pHddCtx, struct regulatory *reg, - struct wiphy *wiphy) + struct wiphy *wiphy) { - const struct ieee80211_regdomain *regd; + const struct ieee80211_regdomain *regd; - if (pHddCtx->cfg_ini->fRegChangeDefCountry) { - regd = vos_custom_world_regdomain(); + if (pHddCtx->cfg_ini->fRegChangeDefCountry) { + regd = vos_custom_world_regdomain(); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) || defined(WITH_BACKPORTS) - wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; + wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; #else - wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; + wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; #endif - } - else if (is_world_regd(reg->reg_domain)) - { - regd = vos_world_regdomain(reg); + } else if (is_world_regd(reg->reg_domain)) { + regd = vos_world_regdomain(reg); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) || defined(WITH_BACKPORTS) - wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; + wiphy->regulatory_flags |= REGULATORY_CUSTOM_REG; #else - wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; + wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY; #endif - } - else - { - regd = vos_default_world_regdomain(); + } else { + regd = vos_default_world_regdomain(); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) || defined(WITH_BACKPORTS) - wiphy->regulatory_flags |= REGULATORY_STRICT_REG; + wiphy->regulatory_flags |= REGULATORY_STRICT_REG; #else - wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; + wiphy->flags |= WIPHY_FLAG_STRICT_REGULATORY; #endif - } - wiphy_apply_custom_regulatory(wiphy, regd); - vos_reg_apply_radar_flags(wiphy); - vos_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); - return 0; + } + + /* + * save the original driver regulatory flags + */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) || defined(WITH_BACKPORTS) + pHddCtx->reg.reg_flags = wiphy->regulatory_flags; +#else + pHddCtx->reg.reg_flags = wiphy->flags; +#endif + + wiphy_apply_custom_regulatory(wiphy, regd); + + /* + * restore the driver regulatory flags since + * wiphy_apply_custom_regulatory may have + * changed them + */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) || defined(WITH_BACKPORTS) + wiphy->regulatory_flags = pHddCtx->reg.reg_flags; +#else + wiphy->flags = pHddCtx->reg.reg_flags; +#endif + + vos_reg_apply_radar_flags(wiphy); + vos_reg_apply_world_flags(wiphy, NL80211_REGDOM_SET_BY_DRIVER, reg); + + return 0; } static int reg_init_from_eeprom(hdd_context_t *pHddCtx, struct regulatory *reg, - struct wiphy *wiphy) + struct wiphy *wiphy) { - int ret_val = 0; - ret_val = regdmn_get_country_alpha2(reg); - if (ret_val) { - adf_os_print(KERN_ERR "Error in getting country code\n"); - return ret_val; - } + int ret_val = 0; - reg->cc_src = COUNTRY_CODE_SET_BY_DRIVER; + ret_val = regdmn_get_country_alpha2(reg); + if (ret_val) { + adf_os_print(KERN_ERR "Error in getting country code\n"); + return ret_val; + } + + reg->cc_src = COUNTRY_CODE_SET_BY_DRIVER; - /* update default country code */ - pnvEFSTable->halnv.tables.defaultCountryTable.countryCode[0] = - reg->alpha2[0]; - pnvEFSTable->halnv.tables.defaultCountryTable.countryCode[1] = - reg->alpha2[1]; + /* update default country code */ + pnvEFSTable->halnv.tables.defaultCountryTable.countryCode[0] = + reg->alpha2[0]; + pnvEFSTable->halnv.tables.defaultCountryTable.countryCode[1] = + reg->alpha2[1]; - regd_init_wiphy(pHddCtx, reg, wiphy); + regd_init_wiphy(pHddCtx, reg, wiphy); - return ret_val; + return ret_val; } static void vos_update_reg_info(hdd_context_t *pHddCtx) @@ -1735,12 +1755,34 @@ int wlan_hdd_linux_reg_notifier(struct wiphy *wiphy, case NL80211_REGDOM_SET_BY_CORE: case NL80211_REGDOM_SET_BY_USER: - /* first lookup the country in the local database */ - country_code[0] = request->alpha2[0]; - country_code[1] = request->alpha2[1]; + if ((VOS_FALSE == init_by_driver) && + (VOS_FALSE == init_by_reg_core)) { - pHddCtx->reg.alpha2[0] = request->alpha2[0]; - pHddCtx->reg.alpha2[1] = request->alpha2[1]; + if (NL80211_REGDOM_SET_BY_CORE == request->initiator) { +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,9,0)) || defined(WITH_BACKPORTS) + return; +#else + return 0; +#endif + } + init_by_reg_core = VOS_TRUE; + } + + if ((NL80211_REGDOM_SET_BY_DRIVER == request->initiator) && + (VOS_TRUE == init_by_driver)) { + + /* + * restore the driver regulatory flags since + * regulatory_hint may have + * changed them + */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,14,0)) || defined(WITH_BACKPORTS) + wiphy->regulatory_flags = pHddCtx->reg.reg_flags;; +#else + wiphy->flags = pHddCtx->reg.reg_flags; +#endif + complete(&pHddCtx->linux_reg_req); + } if (NL80211_REGDOM_SET_BY_CORE == request->initiator) pHddCtx->reg.cc_src = COUNTRY_CODE_SET_BY_CORE; @@ -1748,6 +1790,13 @@ int wlan_hdd_linux_reg_notifier(struct wiphy *wiphy, pHddCtx->reg.cc_src = COUNTRY_CODE_SET_BY_DRIVER; else pHddCtx->reg.cc_src = COUNTRY_CODE_SET_BY_USER; + /* first lookup the country in the local database */ + country_code[0] = request->alpha2[0]; + country_code[1] = request->alpha2[1]; + + pHddCtx->reg.alpha2[0] = request->alpha2[0]; + pHddCtx->reg.alpha2[1] = request->alpha2[1]; + vos_update_reg_info(pHddCtx); vos_reg_apply_world_flags(wiphy, request->initiator, &pHddCtx->reg); @@ -1785,27 +1834,18 @@ int wlan_hdd_linux_reg_notifier(struct wiphy *wiphy, linux_reg_cc[0] = country_code[0]; linux_reg_cc[1] = country_code[1]; - if ((VOS_TRUE == init_by_reg_core) || (VOS_TRUE == init_by_driver)) { - /* now pass the new country information to sme */ - if (request->alpha2[0] == '0' && request->alpha2[1] == '0') - { - sme_GenericChangeCountryCode(pHddCtx->hHal, country_code, - REGDOMAIN_COUNT); - } - else - { - sme_GenericChangeCountryCode(pHddCtx->hHal, country_code, + /* now pass the new country information to sme */ + if (request->alpha2[0] == '0' && request->alpha2[1] == '0') + { + sme_GenericChangeCountryCode(pHddCtx->hHal, country_code, + REGDOMAIN_COUNT); + } + else + { + sme_GenericChangeCountryCode(pHddCtx->hHal, country_code, temp_reg_domain); - } } - if (VOS_FALSE == init_by_driver) { - if (request->initiator != NL80211_REGDOM_SET_BY_CORE) - init_by_reg_core = VOS_TRUE; - } else - if (request->initiator == NL80211_REGDOM_SET_BY_DRIVER) - complete(&pHddCtx->linux_reg_req); - /* send CTL info to firmware */ regdmn_set_regval(&pHddCtx->reg); |
