瀏覽代碼

qcacmn: Add an API to check if given 6 GHz freq is Tx-able

Add an API to check if the given input 6 GHz frequency is Tx-able
in the given power mode.

Change-Id: I9e94c1c3ec7c4c31d18bde6e88905a9239636f00
CRs-Fixed: 3305006
Amith A 2 年之前
父節點
當前提交
60e23f8e3b

+ 18 - 0
umac/regulatory/core/src/reg_services_common.c

@@ -9505,6 +9505,24 @@ reg_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
 	return !(super_chan_ent->chan_flags_arr[in_6g_pwr_mode] &
 		 REGULATORY_CHAN_AFC_NOT_DONE);
 }
+
+bool
+reg_is_6ghz_freq_txable(struct wlan_objmgr_pdev *pdev,
+			qdf_freq_t freq,
+			enum supported_6g_pwr_types in_6ghz_pwr_mode)
+{
+	bool is_freq_enabled;
+	enum reg_afc_dev_deploy_type reg_afc_deploy_type;
+
+	is_freq_enabled = reg_is_freq_enabled(pdev, freq, in_6ghz_pwr_mode);
+	if (!is_freq_enabled)
+		return false;
+
+	reg_get_afc_dev_deploy_type(pdev, &reg_afc_deploy_type);
+
+	return (reg_afc_deploy_type != AFC_DEPLOYMENT_OUTDOOR) ||
+		reg_is_afc_done(pdev, freq);
+}
 #endif
 
 #ifdef CONFIG_BAND_6GHZ

+ 25 - 0
umac/regulatory/core/src/reg_services_common.h

@@ -2678,6 +2678,23 @@ QDF_STATUS reg_get_regd_rules(struct wlan_objmgr_pdev *pdev,
 bool reg_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
 				    enum channel_enum chan_idx,
 				    enum supported_6g_pwr_types in_6g_pwr_mode);
+
+/**
+ * reg_is_6ghz_freq_txable() - Check if the given 6 GHz frequency is tx-able.
+ * @pdev: Pointer to pdev
+ * @freq: Frequency in MHz
+ * @in_6ghz_pwr_type: Input AP power type
+ *
+ * An SP channel is tx-able if the channel is present in the AFC response.
+ * In case of non-OUTDOOR mode, a channel is always tx-able (Assuming it is
+ * enabled by regulatory).
+ *
+ * Return: True if the frequency is tx-able, else false.
+ */
+bool
+reg_is_6ghz_freq_txable(struct wlan_objmgr_pdev *pdev,
+			qdf_freq_t freq,
+			enum supported_6g_pwr_types in_6ghz_pwr_mode);
 #else
 static inline bool
 reg_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
@@ -2686,6 +2703,14 @@ reg_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
 {
 	return false;
 }
+
+static inline bool
+reg_is_6ghz_freq_txable(struct wlan_objmgr_pdev *pdev,
+			qdf_freq_t freq,
+			enum supported_6g_pwr_types in_6ghz_pwr_mode)
+{
+	return false;
+}
 #endif
 
 #ifdef CONFIG_BAND_6GHZ

+ 26 - 1
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -836,6 +836,23 @@ wlan_reg_get_afc_dev_deploy_type(struct wlan_objmgr_pdev *pdev,
 bool
 wlan_reg_is_sta_connect_allowed(struct wlan_objmgr_pdev *pdev,
 				enum reg_6g_ap_type root_ap_pwr_mode);
+
+/**
+ * wlan_reg_is_6ghz_freq_txable() - Check if the given frequency is tx-able.
+ * @pdev: Pointer to pdev
+ * @freq: Frequency in MHz
+ * @in_6ghz_pwr_type: Input AP power type
+ *
+ * An SP channel is tx-able if the channel is present in the AFC response.
+ * In case of non-OUTDOOR mode a channel is always tx-able (Assuming it is
+ * enabled by regulatory).
+ *
+ * Return: True if the frequency is tx-able, else false.
+ */
+bool
+wlan_reg_is_6ghz_freq_txable(struct wlan_objmgr_pdev *pdev,
+			     qdf_freq_t freq,
+			     enum supported_6g_pwr_types in_6ghz_pwr_mode);
 #else
 static inline bool
 wlan_reg_is_afc_power_event_received(struct wlan_objmgr_pdev *pdev)
@@ -862,6 +879,14 @@ wlan_reg_is_sta_connect_allowed(struct wlan_objmgr_pdev *pdev,
 {
 	return true;
 }
+
+static inline bool
+wlan_reg_is_6ghz_freq_txable(struct wlan_objmgr_pdev *pdev,
+			     qdf_freq_t freq,
+			     enum supported_6g_pwr_types in_6ghz_pwr_mode)
+{
+	return false;
+}
 #endif
 
 /**
@@ -2605,6 +2630,7 @@ wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev,
 }
 #endif
 
+#ifdef CONFIG_BAND_6GHZ
 /**
  * wlan_is_sup_chan_entry_afc_done() - Checks if the super chan entry of given
  * channel idx and power mode has REGULATORY_CHAN_AFC_NOT_DONE flag cleared.
@@ -2616,7 +2642,6 @@ wlan_reg_get_chan_state_for_320(struct wlan_objmgr_pdev *pdev,
  * Return: True if REGULATORY_CHAN_AFC_NOT_DONE flag is clear for the super
  * chan entry.
  */
-#ifdef CONFIG_BAND_6GHZ
 bool
 wlan_is_sup_chan_entry_afc_done(struct wlan_objmgr_pdev *pdev,
 				enum channel_enum chan_idx,

+ 10 - 0
umac/regulatory/dispatcher/src/wlan_reg_services_api.c

@@ -193,6 +193,16 @@ wlan_reg_get_6g_afc_mas_chan_list(struct wlan_objmgr_pdev *pdev,
 }
 
 qdf_export_symbol(wlan_reg_get_6g_afc_mas_chan_list);
+
+bool
+wlan_reg_is_6ghz_freq_txable(struct wlan_objmgr_pdev *pdev,
+			     qdf_freq_t freq,
+			     enum supported_6g_pwr_types in_6ghz_pwr_mode)
+{
+	return reg_is_6ghz_freq_txable(pdev, freq, in_6ghz_pwr_mode);
+}
+
+qdf_export_symbol(wlan_reg_is_6ghz_freq_txable);
 #endif
 
 /**