Quellcode durchsuchen

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
Ashish Kumar Dhanotiya vor 5 Jahren
Ursprung
Commit
ee0332a413

+ 8 - 0
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);

+ 4 - 0
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;
 }

+ 9 - 3
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