blob: 1f465430c177863ba4aae326ac6ab33eda826135 [file] [log] [blame]
developer43a264f2024-03-26 14:09:54 +08001From c35a634d57fc0a12d7415c05aaf239e29e0e8357 Mon Sep 17 00:00:00 2001
developere35b8e42023-10-16 11:04:00 +08002From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
3Date: Wed, 5 Jul 2023 09:49:02 +0800
developerd243af02023-12-21 14:49:33 +08004Subject: [PATCH 27/37] mtk: cfg80211: add support for updating background
developere35b8e42023-10-16 11:04:00 +08005 channel
6
7Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
8---
9 include/net/cfg80211.h | 14 ++++++++++++++
10 include/uapi/linux/nl80211.h | 6 ++++++
11 net/wireless/mlme.c | 12 ++++++++++++
12 3 files changed, 32 insertions(+)
13
14diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
developer43a264f2024-03-26 14:09:54 +080015index 19c8abe..2e499ed 100644
developere35b8e42023-10-16 11:04:00 +080016--- a/include/net/cfg80211.h
17+++ b/include/net/cfg80211.h
developer43a264f2024-03-26 14:09:54 +080018@@ -8540,6 +8540,20 @@ void cfg80211_sta_update_dfs_state(struct wireless_dev *wdev,
developere35b8e42023-10-16 11:04:00 +080019 const struct cfg80211_chan_def *csa_chandef,
20 bool associated);
21
22+/**
23+ * cfg80211_background_radar_update_channel - notify background chandef has been updated
24+ * @wiphy: the wiphy
25+ * @chandef: the updated chandef
26+ * @expand: whether or not the operating channel should expand its width
27+ * after offchan CAC
28+ *
29+ * Update the background chandef based on driver's decision, and notify the userspace
30+ * that the current channel of background chain should be updated.
31+ */
32+void cfg80211_background_radar_update_channel(struct wiphy *wiphy,
33+ const struct cfg80211_chan_def *chandef,
34+ bool expand);
35+
36 /**
37 * cfg80211_background_cac_abort - Channel Availability Check offchan abort event
38 * @wiphy: the wiphy
39diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
40index 60c6f79..6e96ad9 100644
41--- a/include/uapi/linux/nl80211.h
42+++ b/include/uapi/linux/nl80211.h
43@@ -6671,6 +6671,10 @@ enum nl80211_smps_mode {
44 * applicable for ETSI dfs domain where pre-CAC is valid for ever.
45 * @NL80211_RADAR_CAC_STARTED: Channel Availability Check has been started,
46 * should be generated by HW if NL80211_EXT_FEATURE_DFS_OFFLOAD is enabled.
47+ * @NL80211_RADAR_BACKGROUND_CHAN_UPDATE: background channel is updated by the
48+ * driver.
49+ * @NL80211_RADAR_BACKGROUND_CHAN_EXPAND: background channel is updated by the
50+ * driver and required to expand main operating channel.
51 * @NL80211_RADAR_STA_CAC_SKIPPED: STA set the DFS state to available
52 * when receiving CSA/assoc resp
53 * @NL80211_RADAR_STA_CAC_EXPIRED: STA set the DFS state to usable
54@@ -6683,6 +6687,8 @@ enum nl80211_radar_event {
55 NL80211_RADAR_NOP_FINISHED,
56 NL80211_RADAR_PRE_CAC_EXPIRED,
57 NL80211_RADAR_CAC_STARTED,
58+ NL80211_RADAR_BACKGROUND_CHAN_UPDATE,
59+ NL80211_RADAR_BACKGROUND_CHAN_EXPAND,
60 NL80211_RADAR_STA_CAC_SKIPPED,
61 NL80211_RADAR_STA_CAC_EXPIRED,
62 };
63diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
developer43a264f2024-03-26 14:09:54 +080064index e264609..8e77205 100644
developere35b8e42023-10-16 11:04:00 +080065--- a/net/wireless/mlme.c
66+++ b/net/wireless/mlme.c
developer43a264f2024-03-26 14:09:54 +080067@@ -1173,6 +1173,18 @@ cfg80211_start_background_radar_detection(struct cfg80211_registered_device *rde
developere35b8e42023-10-16 11:04:00 +080068 return 0;
69 }
70
71+void cfg80211_background_radar_update_channel(struct wiphy *wiphy,
72+ const struct cfg80211_chan_def *chandef,
73+ bool expand)
74+{
75+ enum nl80211_radar_event event;
76+
77+ event = expand ? NL80211_RADAR_BACKGROUND_CHAN_EXPAND :
78+ NL80211_RADAR_BACKGROUND_CHAN_UPDATE;
79+ nl80211_radar_notify(wiphy_to_rdev(wiphy), chandef, event, NULL, GFP_ATOMIC);
80+}
81+EXPORT_SYMBOL(cfg80211_background_radar_update_channel);
82+
83 void cfg80211_stop_background_radar_detection(struct wireless_dev *wdev)
84 {
85 struct wiphy *wiphy = wdev->wiphy;
86--
developerd243af02023-12-21 14:49:33 +0800872.18.0
developere35b8e42023-10-16 11:04:00 +080088