[][MAC80211][core][Add dfs state check before extending CAC time for weather radar]

[Description]
Add dfs state check before extending CAC time for weather radar

[Release-log]
N/A

Change-Id: Ieaa9aed7a4e803a02562bcb622d3c96ce33bca52
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7715823
diff --git a/autobuild_mac80211_release/package/kernel/mac80211_dev/patches/subsys/mtk-0002-cfg80211-mtk-extend-CAC-time-for-weather-radar-chann.patch b/autobuild_mac80211_release/package/kernel/mac80211_dev/patches/subsys/mtk-0002-cfg80211-mtk-extend-CAC-time-for-weather-radar-chann.patch
index c0f4c01..e3288e4 100644
--- a/autobuild_mac80211_release/package/kernel/mac80211_dev/patches/subsys/mtk-0002-cfg80211-mtk-extend-CAC-time-for-weather-radar-chann.patch
+++ b/autobuild_mac80211_release/package/kernel/mac80211_dev/patches/subsys/mtk-0002-cfg80211-mtk-extend-CAC-time-for-weather-radar-chann.patch
@@ -1,4 +1,4 @@
-From 7097dfcbf442fde86cfb34f8e91fb5c0e6546630 Mon Sep 17 00:00:00 2001
+From a1d6921a833c7d85170cb54145bfcf98d7f11283 Mon Sep 17 00:00:00 2001
 From: Shayne Chen <shayne.chen@mediatek.com>
 Date: Tue, 29 Mar 2022 16:06:30 +0800
 Subject: [PATCH] cfg80211: mtk: extend CAC time for weather radar channels
@@ -7,12 +7,12 @@
 Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
 ---
  include/net/cfg80211.h | 1 +
- net/wireless/chan.c    | 6 ++++++
+ net/wireless/chan.c    | 7 +++++++
  net/wireless/nl80211.c | 3 +++
- 3 files changed, 10 insertions(+)
+ 3 files changed, 11 insertions(+)
 
 diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
-index 8d72357..a6bf255 100644
+index 98a2971..28c0a5f 100644
 --- a/include/net/cfg80211.h
 +++ b/include/net/cfg80211.h
 @@ -149,6 +149,7 @@ enum ieee80211_channel_flags {
@@ -24,17 +24,18 @@
  
  /**
 diff --git a/net/wireless/chan.c b/net/wireless/chan.c
-index d5ed976..fef0ba5 100644
+index d5ed976..62f0169 100644
 --- a/net/wireless/chan.c
 +++ b/net/wireless/chan.c
-@@ -931,6 +931,12 @@ static unsigned int cfg80211_get_chans_dfs_cac_time(struct wiphy *wiphy,
+@@ -931,6 +931,13 @@ static unsigned int cfg80211_get_chans_dfs_cac_time(struct wiphy *wiphy,
  		if (!(c->flags & IEEE80211_CHAN_RADAR))
  			continue;
  
 +		/* weather radar in ETSI */
 +		if (reg_get_dfs_region(wiphy) == NL80211_DFS_ETSI &&
-+		    freq >= MHZ_TO_KHZ(5590) && freq <= MHZ_TO_KHZ(5650) &&
-+		    dfs_cac_ms < IEEE80211_DFS_WEATHER_MIN_CAC_TIME_MS)
++		    freq >= MHZ_TO_KHZ(5600) && freq <= MHZ_TO_KHZ(5640) &&
++		    dfs_cac_ms < IEEE80211_DFS_WEATHER_MIN_CAC_TIME_MS &&
++		    c->dfs_state == NL80211_DFS_USABLE)
 +			dfs_cac_ms = IEEE80211_DFS_WEATHER_MIN_CAC_TIME_MS;
 +
  		if (c->dfs_cac_ms > dfs_cac_ms)