Procházet zdrojové kódy

qcacmn: Add reg_is_chan_disabled_and_not_nol API

Add reg_is_chan_disabled that is used to check if channel
is disabled or not in given channel list.

Rename the API to reg_is_chan_disabled_and_not_nol.

Change-Id: I2b05b0cea0472fc924634ae921e77842f0608a11
Vignesh U před 3 roky
rodič
revize
573fae9a5d

+ 12 - 0
umac/regulatory/core/src/reg_build_chan_list.c

@@ -42,6 +42,18 @@
 #define MAX_PWR_FCC_CHAN_13 2
 #define CHAN_144_CENT_FREQ 5720
 
+static inline bool
+reg_nol_and_history_not_set(struct regulatory_channel *chan)
+{
+	return ((!chan->nol_chan) && (!chan->nol_history));
+}
+
+bool reg_is_chan_disabled_and_not_nol(struct regulatory_channel *chan)
+{
+	return (!reg_is_state_allowed(chan->state) &&
+		(chan->chan_flags & REGULATORY_CHAN_DISABLED) &&
+		reg_nol_and_history_not_set(chan));
+}
 #ifdef CONFIG_BAND_6GHZ
 static void reg_fill_psd_info(enum channel_enum chan_enum,
 			      struct cur_reg_rule *reg_rule,

+ 13 - 0
umac/regulatory/core/src/reg_build_chan_list.h

@@ -35,6 +35,7 @@
 #define MAX_AFC_BW 160
 #endif
 
+#include "reg_priv_objs.h"
 /**
  * reg_reset_reg_rules() - provides the reg domain rules info
  * @reg_rules: reg rules pointer
@@ -208,4 +209,16 @@ QDF_STATUS
 reg_get_secondary_current_chan_list(struct wlan_objmgr_pdev *pdev,
 				    struct regulatory_channel *chan_list);
 #endif
+
+/**
+ * reg_is_chan_disabled_and_not_nol() - In the regulatory channel list, a
+ * channel may be disabled by the regulatory/device or by radar. Radar is
+ * temporary and a radar disabled channel does not mean that the channel is
+ * permanently disabled. The API checks if the channel is disabled, but not due
+ * to radar.
+ * @chan - Regulatory channel object
+ *
+ * Return - True,  the channel is disabled, but not due to radar, else false.
+ */
+bool reg_is_chan_disabled_and_not_nol(struct regulatory_channel *chan);
 #endif

+ 1 - 0
umac/regulatory/core/src/reg_priv_objs.h

@@ -29,6 +29,7 @@
 #ifdef CONFIG_AFC_SUPPORT
 #include "reg_services_common.h"
 #endif
+#include <wlan_objmgr_psoc_obj.h>
 
 #define reg_alert(params...) \
 	QDF_TRACE_FATAL(QDF_MODULE_ID_REGULATORY, params)

+ 6 - 6
umac/regulatory/core/src/reg_services_common.c

@@ -3709,12 +3709,6 @@ reg_get_320_bonded_chan_array(struct wlan_objmgr_pdev *pdev,
 	return num_bonded_pairs;
 }
 
-static inline bool reg_is_state_allowed(enum channel_state chan_state)
-{
-	return !((chan_state == CHANNEL_STATE_INVALID) ||
-		 (chan_state == CHANNEL_STATE_DISABLE));
-}
-
 /**
  * reg_get_320_bonded_channel_state() - Given a bonded channel
  * pointer and freq, determine if the subchannels of the bonded pair
@@ -6649,3 +6643,9 @@ QDF_STATUS reg_is_chwidth_supported(struct wlan_objmgr_pdev *pdev,
 
 	return QDF_STATUS_SUCCESS;
 }
+
+bool reg_is_state_allowed(enum channel_state chan_state)
+{
+	return !((chan_state == CHANNEL_STATE_INVALID) ||
+		 (chan_state == CHANNEL_STATE_DISABLE));
+}

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

@@ -1863,4 +1863,14 @@ void reg_dmn_set_afc_req_id(struct wlan_afc_host_partial_request *afc_req,
 QDF_STATUS reg_is_chwidth_supported(struct wlan_objmgr_pdev *pdev,
 				    enum phy_ch_width ch_width,
 				    bool *is_supported);
+
+/**
+ * reg_is_state_allowed() - Check the state of the regulatory channel if it
+ * is invalid or disabled.
+ * @chan_state: Channel state.
+ *
+ * Return bool: true if the channel is not an invalid channel or disabled
+ * channel.
+ */
+bool reg_is_state_allowed(enum channel_state chan_state);
 #endif

+ 12 - 0
umac/regulatory/dispatcher/inc/wlan_reg_services_api.h

@@ -582,6 +582,18 @@ bool wlan_reg_is_world(uint8_t *country);
 QDF_STATUS wlan_reg_get_dfs_region(struct wlan_objmgr_pdev *pdev,
 			     enum dfs_reg *dfs_reg);
 
+/**
+ * wlan_reg_is_chan_disabled_and_not_nol() - In the regulatory channel list, a
+ * channel may be disabled by the regulatory/device or by radar. Radar is
+ * temporary and a radar disabled channel does not mean that the channel is
+ * permanently disabled. The API checks if the channel is disabled, but not due
+ * to radar.
+ * @chan - Regulatory channel object
+ *
+ * Return - True,  the channel is disabled, but not due to radar, else false.
+ */
+bool wlan_reg_is_chan_disabled_and_not_nol(struct regulatory_channel *chan);
+
 /**
  * wlan_reg_get_current_chan_list() - provide the pdev current channel list
  * @pdev: pdev pointer

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

@@ -120,6 +120,11 @@ QDF_STATUS wlan_reg_get_dfs_region(struct wlan_objmgr_pdev *pdev,
 	return QDF_STATUS_SUCCESS;
 }
 
+bool wlan_reg_is_chan_disabled_and_not_nol(struct regulatory_channel *chan)
+{
+	return reg_is_chan_disabled_and_not_nol(chan);
+}
+
 QDF_STATUS wlan_reg_get_current_chan_list(struct wlan_objmgr_pdev *pdev,
 		struct regulatory_channel *chan_list)
 {