Pārlūkot izejas kodu

qcacmn: Replace radar checks to use regulatory channel list

In DFS, to check if a channel is radar, we use the flags that
are filled from UMAC to check for radar. Since the channel list
in UMAC are dynamically calculated, the dynamic flags will not be
consistent over multiple channel pointers.

Use the radar information in regulatory for individual subchannels
to check for radar in a given channel. Define these new APIs
under a feature specific macro.

Change-Id: I7f86560c3d29d2366c6506ccf63204263cbc0ef1
CRs-Fixed: 2841168
Vignesh Mohan 4 gadi atpakaļ
vecāks
revīzija
d32051f608

+ 38 - 0
umac/dfs/core/src/dfs.h

@@ -2952,6 +2952,11 @@ static inline int dfs_is_disable_radar_marking_set(struct wlan_dfs *dfs,
  */
 #if defined(WLAN_DFS_FULL_OFFLOAD) && defined(QCA_DFS_NOL_OFFLOAD)
 bool dfs_get_disable_radar_marking(struct wlan_dfs *dfs);
+#else
+static inline bool dfs_get_disable_radar_marking(struct wlan_dfs *dfs)
+{
+	return false;
+}
 #endif
 
 /**
@@ -3161,4 +3166,37 @@ static inline void dfs_postnol_attach(struct wlan_dfs *dfs)
 {
 }
 #endif
+
+#ifdef CONFIG_HOST_FIND_CHAN
+/**
+ * wlan_is_chan_radar() - Checks if a given dfs channel is in NOL or not.
+ * @dfs: Pointer to wlan_dfs structure.
+ * @chan: Pointer to the dfs channel structure.
+ *
+ * Return: True if the channel has detected radar, else false.
+ */
+bool wlan_is_chan_radar(struct wlan_dfs *dfs, struct dfs_channel *chan);
+
+/**
+ * wlan_is_chan_history_radar() - Checks if a given dfs channel is in NOL
+ * history or not.
+ * @dfs: Pointer to wlan_dfs structure.
+ * @chan: Pointer to the dfs channel structure.
+ *
+ * Return: True if the channel is marked as radar history, else false.
+ */
+bool wlan_is_chan_history_radar(struct wlan_dfs *dfs, struct dfs_channel *chan);
+#else
+static inline bool
+wlan_is_chan_radar(struct wlan_dfs *dfs, struct dfs_channel *chan)
+{
+	return false;
+}
+
+static inline bool
+wlan_is_chan_history_radar(struct wlan_dfs *dfs, struct dfs_channel *chan)
+{
+	return false;
+}
+#endif /* CONFIG_HOST_FIND_CHAN */
 #endif  /* _DFS_H_ */

+ 7 - 2
umac/dfs/core/src/dfs_channel.h

@@ -282,13 +282,18 @@
 	 WLAN_IS_CHAN_11AXA_HE80_80(_c)) \
 	&& WLAN_IS_CHAN_DFS_CFREQ2(_c)))
 
-#define WLAN_IS_CHAN_RADAR(_c)    \
+#ifdef CONFIG_HOST_FIND_CHAN
+#define WLAN_IS_CHAN_RADAR wlan_is_chan_radar
+#define WLAN_IS_CHAN_HISTORY_RADAR wlan_is_chan_history_radar
+#else
+#define WLAN_IS_CHAN_RADAR(_dfs, _c)    \
 	(((_c)->dfs_ch_flags & WLAN_CHAN_DFS_RADAR) == \
 	 WLAN_CHAN_DFS_RADAR)
 
-#define WLAN_IS_CHAN_HISTORY_RADAR(_c)    \
+#define WLAN_IS_CHAN_HISTORY_RADAR(_dfs, _c)    \
 	(((_c)->dfs_ch_flagext & WLAN_CHAN_HISTORY_RADAR) == \
 	WLAN_CHAN_HISTORY_RADAR)
+#endif
 
 #define WLAN_CHAN_CLR_HISTORY_RADAR(_c)    \
 	((_c)->dfs_ch_flagext &= ~WLAN_CHAN_HISTORY_RADAR)

+ 2 - 2
umac/dfs/core/src/filtering/dfs_process_phyerr.c

@@ -571,7 +571,7 @@ void dfs_process_phyerr(struct wlan_dfs *dfs, void *buf, uint16_t datalen,
 	if (dfs->dfs_debug_mask & WLAN_DEBUG_DFS_PHYERR_PKT)
 		dfs_dump_phyerr_contents(buf, datalen);
 
-	if (WLAN_IS_CHAN_RADAR(dfs->dfs_curchan)) {
+	if (WLAN_IS_CHAN_RADAR(dfs, dfs->dfs_curchan)) {
 		dfs_debug(dfs, WLAN_DEBUG_DFS1,
 			"Radar already found in the channel, do not queue radar data");
 		return;
@@ -878,7 +878,7 @@ void dfs_process_phyerr_filter_offload(struct wlan_dfs *dfs,
 		return;
 	}
 
-	if (WLAN_IS_CHAN_RADAR(dfs->dfs_curchan)) {
+	if (WLAN_IS_CHAN_RADAR(dfs, dfs->dfs_curchan)) {
 		dfs_debug(dfs, WLAN_DEBUG_DFS1,
 			"Radar already found in the channel, do not queue radar data");
 		return;

+ 0 - 5
umac/dfs/core/src/misc/dfs.c

@@ -335,11 +335,6 @@ bool dfs_get_disable_radar_marking(struct wlan_dfs *dfs)
 {
 	return dfs->dfs_disable_radar_marking;
 }
-#else
-static inline bool dfs_get_disable_radar_marking(struct wlan_dfs *dfs)
-{
-	return QDF_STATUS_SUCCESS;
-}
 #endif
 
 int dfs_control(struct wlan_dfs *dfs,

+ 2 - 2
umac/dfs/core/src/misc/dfs_cac.c

@@ -81,7 +81,7 @@ void dfs_process_cac_completion(struct wlan_dfs *dfs)
 	 * When radar is detected during a CAC we are woken up prematurely to
 	 * switch to a new channel. Check the channel to decide how to act.
 	 */
-	if (WLAN_IS_CHAN_RADAR(dfs->dfs_curchan)) {
+	if (WLAN_IS_CHAN_RADAR(dfs, dfs->dfs_curchan)) {
 		dfs_mlme_mark_dfs(dfs->dfs_pdev_obj,
 				  dfs_curchan->dfs_ch_ieee,
 				  dfs_curchan->dfs_ch_freq,
@@ -174,7 +174,7 @@ static os_timer_func(dfs_cac_timeout)
 	 * When radar is detected during a CAC we are woken up prematurely to
 	 * switch to a new channel. Check the channel to decide how to act.
 	 */
-	if (WLAN_IS_CHAN_RADAR(dfs->dfs_curchan)) {
+	if (WLAN_IS_CHAN_RADAR(dfs, dfs->dfs_curchan)) {
 		dfs_mlme_mark_dfs(dfs->dfs_pdev_obj,
 				dfs->dfs_curchan->dfs_ch_ieee,
 				dfs->dfs_curchan->dfs_ch_freq,

+ 2 - 2
umac/dfs/core/src/misc/dfs_nol.c

@@ -84,7 +84,7 @@ static os_timer_func(dfs_nol_timeout)
 			 &c->dfs_ch_mhz_freq_seg1,
 			 &c->dfs_ch_mhz_freq_seg2,
 			 i);
-		if (WLAN_IS_CHAN_RADAR(c)) {
+		if (WLAN_IS_CHAN_RADAR(dfs, c)) {
 			if (qdf_system_time_after_eq(now,
 						     dfs->dfs_nol_event[i] +
 						     dfs_get_nol_timeout(dfs))) {
@@ -137,7 +137,7 @@ static os_timer_func(dfs_nol_timeout)
 				&(c->dfs_ch_vhtop_ch_freq_seg1),
 				&(c->dfs_ch_vhtop_ch_freq_seg2),
 				i);
-		if (WLAN_IS_CHAN_RADAR(c)) {
+		if (WLAN_IS_CHAN_RADAR(dfs, c)) {
 			if (qdf_system_time_after_eq(now,
 						dfs->dfs_nol_event[i] +
 						dfs_get_nol_timeout(dfs))) {

+ 9 - 7
umac/dfs/core/src/misc/dfs_process_radar_found_ind.c

@@ -195,15 +195,17 @@ dfs_radar_add_channel_list_to_nol_for_freq(struct wlan_dfs *dfs,
 	}
 	*num_channels = num_ch;
 
-	utils_dfs_reg_update_nol_chan_for_freq(dfs->dfs_pdev_obj,
-					     nol_freq_list, num_ch,
-					     DFS_NOL_SET);
-
-	if (dfs->dfs_is_stadfs_enabled)
-		if (dfs_mlme_is_opmode_sta(dfs->dfs_pdev_obj))
-			utils_dfs_reg_update_nol_history_chan_for_freq(
+	if (!dfs_get_disable_radar_marking(dfs)) {
+		utils_dfs_reg_update_nol_chan_for_freq(dfs->dfs_pdev_obj,
+						       nol_freq_list, num_ch,
+						       DFS_NOL_SET);
+
+		if (dfs->dfs_is_stadfs_enabled)
+			if (dfs_mlme_is_opmode_sta(dfs->dfs_pdev_obj))
+				utils_dfs_reg_update_nol_history_chan_for_freq(
 					dfs->dfs_pdev_obj, nol_freq_list,
 					num_ch, DFS_NOL_HISTORY_SET);
+	}
 
 	dfs_nol_update(dfs);
 	utils_dfs_save_nol(dfs->dfs_pdev_obj);