Эх сурвалжийг харах

qcacmn: Modify sanity checks for various radar sources

In the current code, dfs_radarevent_basic_sanity() function is used to
check A) if the current channel is a non-dfs channel B) if it is a non-dfs
channel, a few queues and variables related to dfs filtering are reset.

dfs_radarevent_basic_sanity() is called from two different places namely:
i)dfs_process_radar_ind()
ii)dfs_process_radarevent()

While is okay to perform (B) for (ii) there is no need to do the same for
(i), as (i) is for full-offload chips only and there is no filtering done
in the HOST and thus resetting variable related to dfs filtering is
meaningless.

Instead of calling, dfs_radarevent_basic_sanity() from both (i) and (ii)
define two new functions:
C)dfs_radar_pulse_event_basic_sanity (Call from dfs_process_radarevent)
D)dfs_radar_found_event_basic_sanity (Call from dfs_process_radar_ind)

While both (C) and (D) check if the current channel is a non-DFS channel,
only (C) resets the variables related to filtering.

CRs-Fixed: 2764060
Change-Id: I8466687e889e5f2b9a57c89ef775f14f13dd8066
Vignesh U 4 жил өмнө
parent
commit
f8a1105640

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

@@ -2678,17 +2678,6 @@ void dfs_update_cur_chan_flags(struct wlan_dfs *dfs,
 		uint64_t flags,
 		uint16_t flagext);
 
-/**
- * dfs_radarevent_basic_sanity() - Check basic sanity of the radar event
- * @dfs: Pointer to wlan_dfs structure.
- * @chan: Current channel.
- *
- * Return: If a radar event found on NON-DFS channel  return 0.  Otherwise,
- * return 1.
- */
-int dfs_radarevent_basic_sanity(struct wlan_dfs *dfs,
-		struct dfs_channel *chan);
-
 /**
  * wlan_psoc_get_dfs_txops() - Get dfs_tx_ops pointer
  * @psoc: Pointer to psoc structure.

+ 61 - 1
umac/dfs/core/src/filtering/dfs_process_radarevent.c

@@ -1433,6 +1433,65 @@ void dfs_radar_found_action(struct wlan_dfs *dfs,
 	}
 }
 
+/**
+ * dfs_is_radar_source_legacy_agile() - Check if radar pulse event is received
+ * on a Zero CAC agile channel.
+ * @dfs: Pointer to wlan_dfs structure.
+ *
+ * Return: If a radar pulse event is received on a zero cac agile
+ * channel return true. Otherwise, return false.
+ */
+#if defined(ATH_SUPPORT_ZERO_CAC_DFS)
+static
+bool dfs_is_radar_source_legacy_agile(struct wlan_dfs *dfs)
+{
+	if (dfs_is_legacy_precac_enabled(dfs) &&
+	    dfs_is_precac_timer_running(dfs) &&
+	    dfs->dfs_precac_secondary_freq_mhz)
+		return true;
+	return false;
+}
+#else
+static
+bool dfs_is_radar_source_legacy_agile(struct wlan_dfs *dfs)
+{
+	return false;
+}
+#endif
+
+/**
+ * dfs_radar_pulse_event_basic_sanity() - Check if radar pulse event is received
+ * on a DFS channel or Zero CAC agile channel.
+ * @dfs: Pointer to wlan_dfs structure.
+ * @chan: Current channel.
+ *
+ * Return: If a radar pulse event is received on DFS channel or zero cac agile
+ * channel return true. Otherwise, return false.
+ */
+static
+bool dfs_radar_pulse_event_basic_sanity(struct wlan_dfs *dfs,
+					struct dfs_channel *chan)
+{
+	if (!chan) {
+		dfs_err(dfs, WLAN_DEBUG_DFS1,
+			"dfs->dfs_curchan is NULL");
+		return false;
+	}
+
+	if (dfs_is_radar_source_legacy_agile(dfs))
+		return true;
+
+	if (!WLAN_IS_PRIMARY_OR_SECONDARY_CHAN_DFS(chan)) {
+		dfs_debug(dfs, WLAN_DEBUG_DFS1,
+			  "radar event on a non-DFS chan");
+		dfs_reset_radarq(dfs);
+		dfs_reset_alldelaylines(dfs);
+		dfs_reset_bangradar(dfs);
+		return false;
+	}
+	return true;
+}
+
 void dfs_process_radarevent(
 	struct wlan_dfs *dfs,
 	struct dfs_channel *chan)
@@ -1443,8 +1502,9 @@ void dfs_process_radarevent(
 	int false_radar_found = 0;
 	bool bangradar = false;
 
-	if (!dfs_radarevent_basic_sanity(dfs, chan))
+	if (!dfs_radar_pulse_event_basic_sanity(dfs, chan))
 		return;
+
 	/*
 	 * TEST : Simulate radar bang, make sure we add the channel to NOL
 	 * (bug 29968)

+ 24 - 19
umac/dfs/core/src/misc/dfs_process_radar_found_ind.c

@@ -888,27 +888,32 @@ void dfs_reset_bangradar(struct wlan_dfs *dfs)
 	dfs->dfs_bangradar_type = DFS_NO_BANGRADAR;
 }
 
-int dfs_radarevent_basic_sanity(struct wlan_dfs *dfs,
-		struct dfs_channel *chan)
+/**
+ * dfs_radar_found_event_basic_sanity() - Check if radar event is received on a
+ * DFS channel.
+ * @dfs: Pointer to wlan_dfs structure.
+ * @chan: Current channel.
+ *
+ * Return: If a radar event found on NON-DFS channel return false. Otherwise,
+ * return true.
+ */
+static
+bool dfs_radar_found_event_basic_sanity(struct wlan_dfs *dfs,
+					struct dfs_channel *chan)
 {
-		if (!chan) {
-			dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
-				"dfs->dfs_curchan is NULL");
-			return 0;
-		}
+	if (!chan) {
+		dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS,
+			"dfs->dfs_curchan is NULL");
+		return false;
+	}
 
-		if (!(WLAN_IS_PRIMARY_OR_SECONDARY_CHAN_DFS(chan))) {
-			dfs_debug(dfs, WLAN_DEBUG_DFS_ALWAYS,
-				  "radar event on non-DFS chan");
-			if (!(dfs->dfs_is_offload_enabled)) {
-				dfs_reset_radarq(dfs);
-				dfs_reset_alldelaylines(dfs);
-				dfs_reset_bangradar(dfs);
-			}
-			return 0;
-		}
+	if (!(WLAN_IS_PRIMARY_OR_SECONDARY_CHAN_DFS(chan))) {
+		dfs_debug(dfs, WLAN_DEBUG_DFS_ALWAYS,
+			  "radar event on non-DFS chan");
+		return false;
+	}
 
-	return 1;
+	return true;
 }
 
 void dfs_send_csa_to_current_chan(struct wlan_dfs *dfs)
@@ -1332,7 +1337,7 @@ dfs_process_radar_ind_on_home_chan(struct wlan_dfs *dfs,
 	 * Detector we need to process it since Agile Detector has a
 	 * different channel.
 	 */
-	if (!dfs_radarevent_basic_sanity(dfs, dfs_curchan))
+	if (!dfs_radar_found_event_basic_sanity(dfs, dfs_curchan))
 		goto exit;
 
 	dfs_compute_radar_found_cfreq(dfs, radar_found, &freq_center);