developer | 4a4b5a4 | 2023-06-08 15:07:09 +0800 | [diff] [blame^] | 1 | From b6a99ac9380eb282d251a349709483579186bc51 Mon Sep 17 00:00:00 2001 |
| 2 | From: Shayne Chen <shayne.chen@mediatek.com> |
| 3 | Date: Tue, 29 Mar 2022 16:06:30 +0800 |
| 4 | Subject: [PATCH] cfg80211: mtk: extend CAC time for weather radar channels |
| 5 | |
| 6 | Signed-off-by: Shayne Chen <shayne.chen@mediatek.com> |
| 7 | Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com> |
| 8 | --- |
| 9 | include/net/cfg80211.h | 1 + |
| 10 | net/wireless/chan.c | 6 ++++++ |
| 11 | net/wireless/nl80211.c | 3 +++ |
| 12 | 3 files changed, 10 insertions(+) |
| 13 | |
| 14 | diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h |
| 15 | index 8e05f55..585d934 100644 |
| 16 | --- a/include/net/cfg80211.h |
| 17 | +++ b/include/net/cfg80211.h |
| 18 | @@ -142,6 +142,7 @@ enum ieee80211_channel_flags { |
| 19 | (IEEE80211_CHAN_NO_HT40PLUS | IEEE80211_CHAN_NO_HT40MINUS) |
| 20 | |
| 21 | #define IEEE80211_DFS_MIN_CAC_TIME_MS 60000 |
| 22 | +#define IEEE80211_DFS_WEATHER_MIN_CAC_TIME_MS 600000 |
| 23 | #define IEEE80211_DFS_MIN_NOP_TIME_MS (30 * 60 * 1000) |
| 24 | |
| 25 | /** |
| 26 | diff --git a/net/wireless/chan.c b/net/wireless/chan.c |
| 27 | index 5f50ac4..6b42040 100644 |
| 28 | --- a/net/wireless/chan.c |
| 29 | +++ b/net/wireless/chan.c |
| 30 | @@ -843,6 +843,12 @@ static unsigned int cfg80211_get_chans_dfs_cac_time(struct wiphy *wiphy, |
| 31 | if (!(c->flags & IEEE80211_CHAN_RADAR)) |
| 32 | continue; |
| 33 | |
| 34 | + /* weather radar in ETSI */ |
| 35 | + if (reg_get_dfs_region(wiphy) == NL80211_DFS_ETSI && |
| 36 | + freq >= MHZ_TO_KHZ(5590) && freq <= MHZ_TO_KHZ(5650) && |
| 37 | + dfs_cac_ms < IEEE80211_DFS_WEATHER_MIN_CAC_TIME_MS) |
| 38 | + dfs_cac_ms = IEEE80211_DFS_WEATHER_MIN_CAC_TIME_MS; |
| 39 | + |
| 40 | if (c->dfs_cac_ms > dfs_cac_ms) |
| 41 | dfs_cac_ms = c->dfs_cac_ms; |
| 42 | } |
| 43 | diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c |
| 44 | index bc6b5ac..bc07fe8 100644 |
| 45 | --- a/net/wireless/nl80211.c |
| 46 | +++ b/net/wireless/nl80211.c |
| 47 | @@ -9354,6 +9354,9 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, |
| 48 | if (WARN_ON(!cac_time_ms)) |
| 49 | cac_time_ms = IEEE80211_DFS_MIN_CAC_TIME_MS; |
| 50 | |
| 51 | + pr_info("%s: region = %u, center freq1 = %u, center freq2 = %u, cac time ms = %u\n", |
| 52 | + __func__, dfs_region, chandef.center_freq1, chandef.center_freq2, cac_time_ms); |
| 53 | + |
| 54 | err = rdev_start_radar_detection(rdev, dev, &chandef, cac_time_ms); |
| 55 | if (!err) { |
| 56 | wdev->chandef = chandef; |
| 57 | -- |
| 58 | 2.18.0 |
| 59 | |