瀏覽代碼

qcacmn: User country set based on INI config params

Do not allow userspace to configure regulatory country
when below INIs are set as:
gCountryCodePriority=0
g11dSupportEnabled=1

Change-Id: Iaae8e209fb99802f67d906fcd70d2c7c0a2f8f06
CRs-Fixed: 3499558
Vishal Miskin 2 年之前
父節點
當前提交
210aad0930

+ 19 - 0
umac/regulatory/core/src/reg_utils.c

@@ -966,6 +966,25 @@ bool reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq)
 	return true;
 }
 
+bool reg_is_user_country_set_allowed(struct wlan_objmgr_psoc *psoc)
+{
+	struct wlan_regulatory_psoc_priv_obj *psoc_reg;
+
+	psoc_reg = reg_get_psoc_obj(psoc);
+	if (!IS_VALID_PSOC_REG_OBJ(psoc_reg)) {
+		reg_err("psoc reg component is NULL");
+		return false;
+	}
+
+	if (!psoc_reg->user_ctry_priority &&
+	    psoc_reg->enable_11d_supp_original) {
+		reg_err_rl("country set from userspace is not allowed");
+		return false;
+	}
+
+	return true;
+}
+
 #ifdef CONFIG_BAND_6GHZ
 enum reg_6g_ap_type reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
 {

+ 16 - 0
umac/regulatory/core/src/reg_utils.h

@@ -207,6 +207,16 @@ bool reg_get_fcc_constraint(struct wlan_objmgr_pdev *pdev, uint32_t freq);
  * Return: True if 6 GHz band set else return flase
  */
 bool reg_is_6ghz_band_set(struct wlan_objmgr_pdev *pdev);
+
+/**
+ * reg_is_user_country_set_allowed() - Checks whether user country is allowed
+ * to set
+ * @psoc: psoc ptr
+ *
+ * Return: bool
+ */
+bool reg_is_user_country_set_allowed(struct wlan_objmgr_psoc *psoc);
+
 /**
  * reg_read_current_country() - Get the current regulatory country
  * @psoc: The physical SoC to get current country from
@@ -505,6 +515,12 @@ bool reg_is_6ghz_band_set(struct wlan_objmgr_pdev *pdev)
 	return true;
 }
 
+static inline
+bool reg_is_user_country_set_allowed(struct wlan_objmgr_psoc *psoc)
+{
+	return true;
+}
+
 static inline enum reg_6g_ap_type
 reg_decide_6g_ap_pwr_type(struct wlan_objmgr_pdev *pdev)
 {

+ 15 - 0
umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h

@@ -768,6 +768,12 @@ QDF_STATUS ucfg_reg_enable_disable_opclass_chans(struct wlan_objmgr_pdev *pdev,
 						 uint8_t *ieee_chan_list,
 						 uint8_t chan_list_size,
 						 bool global_tbl_lookup);
+
+static inline
+bool ucfg_reg_is_user_country_set_allowed(struct wlan_objmgr_psoc *psoc)
+{
+	return true;
+}
 #else
 static inline QDF_STATUS
 ucfg_reg_enable_disable_opclass_chans(struct wlan_objmgr_pdev *pdev,
@@ -779,6 +785,15 @@ ucfg_reg_enable_disable_opclass_chans(struct wlan_objmgr_pdev *pdev,
 {
 	return QDF_STATUS_E_NOSUPPORT;
 }
+
+/**
+ * ucfg_reg_is_user_country_set_allowed() - Checks whether user country is
+ * allowed to set
+ * @psoc: psoc ptr
+ *
+ * Return: bool
+ */
+bool ucfg_reg_is_user_country_set_allowed(struct wlan_objmgr_psoc *psoc);
 #endif
 
 #endif

+ 5 - 0
umac/regulatory/dispatcher/src/wlan_reg_ucfg_api.c

@@ -171,6 +171,11 @@ QDF_STATUS ucfg_reg_set_keep_6ghz_sta_cli_connection(
 	return reg_set_keep_6ghz_sta_cli_connection(pdev,
 						keep_6ghz_sta_cli_connection);
 }
+
+bool ucfg_reg_is_user_country_set_allowed(struct wlan_objmgr_psoc *psoc)
+{
+	return reg_is_user_country_set_allowed(psoc);
+}
 #endif
 
 QDF_STATUS ucfg_reg_get_default_country(struct wlan_objmgr_psoc *psoc,