qca-wifi: Remove Channels from ETSI PreCAC Required List when in NOL

When a channel is marked as radar detected and added to preCAC NOL
list, it is removed only from etsi precac done list, but not from etsi
precac required list. Since a channel that is part of NOL, cannot also be
a part of etsi precac required list, this needs to be corrected.

Therefore, once radar is detected on a channel, remove it from both etsi
precac required list and etsi precac done list.

Change-Id: I4d809a24acd4b73db254790e2698ffc5414cf0fe
CRs-Fixed: 2403489
diff --git a/umac/dfs/core/src/misc/dfs_etsi_precac.c b/umac/dfs/core/src/misc/dfs_etsi_precac.c
index 17e4ff2..4c38ab9 100644
--- a/umac/dfs/core/src/misc/dfs_etsi_precac.c
+++ b/umac/dfs/core/src/misc/dfs_etsi_precac.c
@@ -113,6 +113,12 @@
 		return;
 	}
 
+	/*
+	 * Here, the radar affected channels are only removed from etsi-precac
+	 * done list and etsi precac required list, but not added to NOL.
+	 * They are added to NOL by the dfs_radar_add_channel_list_to_nol()
+	 * function.
+	 */
 	PRECAC_LIST_LOCK(dfs);
 	for (i = 0; i < num_channels; i++) {
 		TAILQ_FOREACH_SAFE(precac_entry, &dfs->dfs_etsiprecac_done_list,
@@ -122,8 +128,16 @@
 
 		TAILQ_REMOVE(&dfs->dfs_etsiprecac_done_list,
 			     precac_entry, pe_list);
-		TAILQ_INSERT_TAIL(&dfs->dfs_etsiprecac_required_list,
-				  precac_entry, pe_list);
+		qdf_mem_free(precac_entry);
+		}
+		TAILQ_FOREACH_SAFE(precac_entry,
+				   &dfs->dfs_etsiprecac_required_list,
+				   pe_list, tmp_precac_entry) {
+					if (channels[i] != precac_entry->ieee)
+						continue;
+		TAILQ_REMOVE(&dfs->dfs_etsiprecac_required_list,
+			     precac_entry, pe_list);
+		qdf_mem_free(tmp_precac_entry);
 		}
 	}
 	PRECAC_LIST_UNLOCK(dfs);
@@ -282,6 +296,9 @@
 			 time_added);
 	}
 	PRECAC_LIST_UNLOCK(dfs);
+	dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS,
+		 "NOL list of VHT20 frequencies");
+	DFS_PRINT_NOL_LOCKED(dfs);
 }
 
 void dfs_reset_etsiprecaclists(struct wlan_dfs *dfs)