1 From 30ca8b0c4d6c9fb1d76e5894b1e8bf7c6a12224d Mon Sep 17 00:00:00 2001
2 From: Aditya Kumar Singh <quic_adisi@quicinc.com>
3 Date: Tue, 12 Sep 2023 10:48:55 +0530
4 Subject: [PATCH] wifi: cfg80211: export DFS CAC time and usable state helper
7 cfg80211 has cfg80211_chandef_dfs_usable() function to know whether
8 at least one channel in the chandef is in usable state or not. Also,
9 cfg80211_chandef_dfs_cac_time() function is there which tells the CAC
10 time required for the given chandef.
12 Make these two functions visible to drivers by exporting their symbol
13 to global list of kernel symbols.
15 Lower level drivers can make use of these two functions to be aware
16 if CAC is required on the given chandef and for how long. For example
17 drivers which maintains the CAC state internally can make use of these.
19 Signed-off-by: Aditya Kumar Singh <quic_adisi@quicinc.com>
20 Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>
21 Link: https://lore.kernel.org/r/20230912051857.2284-2-quic_adisi@quicinc.com
22 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
24 include/net/cfg80211.h | 24 ++++++++++++++++++++++++
25 net/wireless/chan.c | 2 ++
26 net/wireless/core.h | 17 -----------------
27 3 files changed, 26 insertions(+), 17 deletions(-)
29 --- a/include/net/cfg80211.h
30 +++ b/include/net/cfg80211.h
31 @@ -1008,6 +1008,30 @@ int cfg80211_chandef_dfs_required(struct
32 enum nl80211_iftype iftype);
35 + * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable and we
36 + * can/need start CAC on such channel
37 + * @wiphy: the wiphy to validate against
38 + * @chandef: the channel definition to check
40 + * Return: true if all channels available and at least
41 + * one channel requires CAC (NL80211_DFS_USABLE)
43 +bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
44 + const struct cfg80211_chan_def *chandef);
47 + * cfg80211_chandef_dfs_cac_time - get the DFS CAC time (in ms) for given
48 + * channel definition
49 + * @wiphy: the wiphy to validate against
50 + * @chandef: the channel definition to check
52 + * Returns: DFS CAC time (in ms) which applies for this channel definition
55 +cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,
56 + const struct cfg80211_chan_def *chandef);
59 * nl80211_send_chandef - sends the channel definition.
60 * @msg: the msg to send channel definition
61 * @chandef: the channel definition to check
62 --- a/net/wireless/chan.c
63 +++ b/net/wireless/chan.c
64 @@ -666,6 +666,7 @@ bool cfg80211_chandef_dfs_usable(struct
68 +EXPORT_SYMBOL(cfg80211_chandef_dfs_usable);
71 * Checks if center frequency of chan falls with in the bandwidth
72 @@ -965,6 +966,7 @@ cfg80211_chandef_dfs_cac_time(struct wip
76 +EXPORT_SYMBOL(cfg80211_chandef_dfs_cac_time);
78 static bool cfg80211_secondary_chans_ok(struct wiphy *wiphy,
79 u32 center_freq, u32 bandwidth,
80 --- a/net/wireless/core.h
81 +++ b/net/wireless/core.h
82 @@ -476,29 +476,12 @@ int cfg80211_scan(struct cfg80211_regist
84 extern struct work_struct cfg80211_disconnect_work;
87 - * cfg80211_chandef_dfs_usable - checks if chandef is DFS usable
88 - * @wiphy: the wiphy to validate against
89 - * @chandef: the channel definition to check
91 - * Checks if chandef is usable and we can/need start CAC on such channel.
93 - * Return: true if all channels available and at least
94 - * one channel requires CAC (NL80211_DFS_USABLE)
96 -bool cfg80211_chandef_dfs_usable(struct wiphy *wiphy,
97 - const struct cfg80211_chan_def *chandef);
99 void cfg80211_set_dfs_state(struct wiphy *wiphy,
100 const struct cfg80211_chan_def *chandef,
101 enum nl80211_dfs_state dfs_state);
103 void cfg80211_dfs_channels_update_work(struct work_struct *work);
106 -cfg80211_chandef_dfs_cac_time(struct wiphy *wiphy,
107 - const struct cfg80211_chan_def *chandef);
109 void cfg80211_sched_dfs_chan_update(struct cfg80211_registered_device *rdev);