From ee0332a4135335b21000e7d09df850d733ec2235 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Fri, 15 Nov 2019 21:20:02 +0530 Subject: [PATCH] qcacld-3.0: Update regulatory configs before use Currently regulatory comnfigs are getting updated from wiphy init inside regulatory init api which is too late in the driver init sequence. There are some apis in driver init sequence which uses these ini configs before wiphy init, one such example is scm_11d_cc_db_init. since the ini configs are not populated this may lead to undefined behaviour. To resolve above issue, populate ini configs at the same place where all other components inis are getting populated. Change-Id: I9cb2f069fba3eb76a2c8f7285b6d371cf5fa8de4 CRs-Fixed: 2570148 --- core/hdd/inc/wlan_hdd_regulatory.h | 8 ++++++++ core/hdd/src/wlan_hdd_main.c | 4 ++++ core/hdd/src/wlan_hdd_regulatory.c | 12 +++++++++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_regulatory.h b/core/hdd/inc/wlan_hdd_regulatory.h index 3fe46d95bcfa..789231c80035 100644 --- a/core/hdd/inc/wlan_hdd_regulatory.h +++ b/core/hdd/inc/wlan_hdd_regulatory.h @@ -32,6 +32,14 @@ struct hdd_context; #define IEEE80211_CHAN_NO_IBSS IEEE80211_CHAN_NO_IR #endif +/** + * hdd_update_regulatory_config() - API to update regulatory config parameters + * @hdd_ctx: HDD context + * + * Return: 0 on success, err on failure + */ +int hdd_update_regulatory_config(struct hdd_context *hdd_ctx); + int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy); void hdd_program_country_code(struct hdd_context *hdd_ctx); void hdd_reset_global_reg_params(void); diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index a530c45949b7..fa8c705860b7 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -15442,6 +15442,10 @@ int hdd_update_components_config(struct hdd_context *hdd_ctx) return ret; ret = hdd_update_dfs_config(hdd_ctx); + if (ret) + return ret; + + ret = hdd_update_regulatory_config(hdd_ctx); return ret; } diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 7e0f78e1a259..45065cac673a 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -1458,10 +1458,18 @@ static void hdd_regulatory_dyn_cbk(struct wlan_objmgr_psoc *psoc, hdd_ctx->reg.alpha2); } +int hdd_update_regulatory_config(struct hdd_context *hdd_ctx) +{ + struct reg_config_vars config_vars; + + reg_program_config_vars(hdd_ctx, &config_vars); + ucfg_reg_set_config_vars(hdd_ctx->psoc, config_vars); + return 0; +} + int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy) { bool offload_enabled; - struct reg_config_vars config_vars; struct regulatory_channel *cur_chan_list; enum country_src cc_src; uint8_t alpha2[REG_ALPHA2_LEN + 1]; @@ -1471,12 +1479,10 @@ int hdd_regulatory_init(struct hdd_context *hdd_ctx, struct wiphy *wiphy) return -ENOMEM; } - reg_program_config_vars(hdd_ctx, &config_vars); ucfg_reg_register_chan_change_callback(hdd_ctx->psoc, hdd_regulatory_dyn_cbk, NULL); - ucfg_reg_set_config_vars(hdd_ctx->psoc, config_vars); wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED; /* Check the kernel version for upstream commit aced43ce780dc5 that