Ver código fonte

Merge "qca-wifi: Add regulatory APIs for REGULATORY_CHAN_BLOCKED"

Linux Build Service Account 4 anos atrás
pai
commit
b6f0feb077

+ 63 - 0
umac/regulatory/core/reg_channel.c

@@ -194,4 +194,67 @@ bool reg_is_phymode_chwidth_allowed(
 	return false;
 }
 
+void reg_set_chan_blocked(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
+{
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+	struct regulatory_channel *cur_chan_list;
+	int i;
+
+	pdev_priv_obj = reg_get_pdev_obj(pdev);
+
+	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
+		reg_err("reg pdev priv obj is NULL");
+		return;
+	}
+
+	cur_chan_list = pdev_priv_obj->cur_chan_list;
+
+	for (i = 0; i < NUM_CHANNELS; i++) {
+		if (cur_chan_list[i].center_freq == freq) {
+			cur_chan_list[i].is_chan_hop_blocked = true;
+			break;
+		}
+	}
+}
+
+bool reg_is_chan_blocked(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
+{
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+	struct regulatory_channel *cur_chan_list;
+	int i;
+
+	pdev_priv_obj = reg_get_pdev_obj(pdev);
+
+	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
+		reg_err("reg pdev priv obj is NULL");
+		return false;
+	}
+
+	cur_chan_list = pdev_priv_obj->cur_chan_list;
+
+	for (i = 0; i < NUM_CHANNELS; i++)
+		if (cur_chan_list[i].center_freq == freq)
+			return cur_chan_list[i].is_chan_hop_blocked;
+
+	return false;
+}
+
+void reg_clear_allchan_blocked(struct wlan_objmgr_pdev *pdev)
+{
+	struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj;
+	struct regulatory_channel *cur_chan_list;
+	int i;
+
+	pdev_priv_obj = reg_get_pdev_obj(pdev);
+
+	if (!IS_VALID_PDEV_REG_OBJ(pdev_priv_obj)) {
+		reg_err("reg pdev priv obj is NULL");
+		return;
+	}
+
+	cur_chan_list = pdev_priv_obj->cur_chan_list;
+
+	for (i = 0; i < NUM_CHANNELS; i++)
+		cur_chan_list[i].is_chan_hop_blocked = false;
+}
 #endif

+ 44 - 0
umac/regulatory/core/reg_channel.h

@@ -165,6 +165,36 @@ bool reg_is_phymode_chwidth_allowed(
 		enum phy_ch_width ch_width,
 		qdf_freq_t primary_freq);
 
+/**
+ * reg_set_chan_blocked() - Set is_chan_hop_blocked to true for a frequency
+ * in the current chan list.
+ * @pdev: Pointer to pdev.
+ * @freq: Channel frequency in MHz.
+ *
+ * Return: void.
+ */
+void reg_set_chan_blocked(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
+
+/**
+ * wlan_reg_is_chan_blocked() - Check if is_chan_hop_blocked to true for a
+ * frequency in the current chan list.
+ * @pdev: Pointer to pdev.
+ * @freq: Channel frequency in MHz.
+ *
+ * Return: true if is_chan_hop_blocked is true for the input frequency, else
+ * false.
+ */
+bool reg_is_chan_blocked(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq);
+
+/**
+ * reg_is_chan_blocked() - Clear is_chan_hop_blocked for channel in the
+ * current chan list.
+ * @pdev: Pointer to pdev.
+ *
+ * Return: void.
+ */
+void reg_clear_allchan_blocked(struct wlan_objmgr_pdev *pdev);
+
 #else
 static inline bool reg_is_phymode_chwidth_allowed(
 		struct wlan_regulatory_pdev_priv_obj *pdev_priv_obj,
@@ -175,6 +205,20 @@ static inline bool reg_is_phymode_chwidth_allowed(
 	return false;
 }
 
+static inline
+void reg_set_chan_blocked(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
+{
+}
+
+static inline
+bool reg_is_chan_blocked(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
+{
+	return false;
+}
+
+static inline void reg_clear_allchan_blocked(struct wlan_objmgr_pdev *pdev)
+{
+}
 #endif /* CONFIG_HOST_FIND_CHAN */
 
 #endif /* __REG_CHANNEL_H_ */

+ 47 - 0
umac/regulatory/dispatcher/inc/wlan_reg_channel_api.h

@@ -34,6 +34,38 @@
 #define WLAN_CHAN_DISALLOW_ADHOC   0x0040  /* ad-hoc is not allowed */
 #define WLAN_CHAN_PSC              0x0400  /* 6GHz PSC frequency */
 
+/**
+ * wlan_reg_set_chan_blocked() - Set is_chan_hop_blocked to true for a frequency
+ * in the current chan list.
+ * @pdev: Pointer to pdev.
+ * @freq: Channel frequency in MHz.
+ *
+ * Return: void.
+ */
+void wlan_reg_set_chan_blocked(struct wlan_objmgr_pdev *pdev,
+			       qdf_freq_t freq);
+
+/**
+ * wlan_reg_is_chan_blocked() - Check if is_chan_hop_blocked to true for a
+ * frequency in the current chan list.
+ * @pdev: Pointer to pdev.
+ * @freq: Channel frequency in MHz.
+ *
+ * Return: true if is_chan_hop_blocked is true for the input frequency, else
+ * false.
+ */
+bool wlan_reg_is_chan_blocked(struct wlan_objmgr_pdev *pdev,
+			      qdf_freq_t freq);
+
+/**
+ * wlan_reg_is_chan_blocked() - Clear is_chan_hop_blocked for channel in the
+ * current chan list.
+ * @pdev: Pointer to pdev.
+ *
+ * Return: void.
+ */
+void wlan_reg_clear_allchan_blocked(struct wlan_objmgr_pdev *pdev);
+
 /**
  * wlan_reg_is_phymode_chwidth_allowed() - Check if requested phymode is allowed
  * @pdev: pdev pointer.
@@ -87,6 +119,21 @@ void wlan_reg_get_chan_flags(struct wlan_objmgr_pdev *pdev,
 			     qdf_freq_t freq2,
 			     uint16_t *flags);
 #else
+static inline
+void wlan_reg_set_chan_blocked(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
+{
+}
+
+static inline
+bool wlan_reg_is_chan_blocked(struct wlan_objmgr_pdev *pdev, qdf_freq_t freq)
+{
+	return false;
+}
+
+static inline void wlan_reg_clear_allchan_blocked(struct wlan_objmgr_pdev *pdev)
+{
+}
+
 static inline bool
 wlan_reg_is_phymode_chwidth_allowed(struct wlan_objmgr_pdev *pdev,
 				    enum reg_phymode phy_in,

+ 16 - 0
umac/regulatory/dispatcher/src/wlan_reg_channel_api.c

@@ -132,4 +132,20 @@ void wlan_reg_get_chan_flags(struct wlan_objmgr_pdev *pdev,
 		*flags |= WLAN_CHAN_PSC;
 }
 
+void wlan_reg_set_chan_blocked(struct wlan_objmgr_pdev *pdev,
+			       qdf_freq_t freq)
+{
+	reg_set_chan_blocked(pdev, freq);
+}
+
+bool wlan_reg_is_chan_blocked(struct wlan_objmgr_pdev *pdev,
+			      qdf_freq_t freq)
+{
+	return reg_is_chan_blocked(pdev, freq);
+}
+
+void wlan_reg_clear_allchan_blocked(struct wlan_objmgr_pdev *pdev)
+{
+	 reg_clear_allchan_blocked(pdev);
+}
 #endif /* CONFIG_HOST_FIND_CHAN */