diff mbox series

[v2,mac80211-next,6/6] cfg80211: introduce NL80211_EXT_FEATURE_RADAR_OFFCHAN feature flag

Message ID 241849ccaf2c228873c6f8495bf87b19159ba458.1634979655.git.lorenzo@kernel.org (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series add offchannel radar chain support | expand

Commit Message

Lorenzo Bianconi Oct. 23, 2021, 9:10 a.m. UTC
Introduce NL80211_EXT_FEATURE_RADAR_OFFCHAN feature flag in order to
notify userland the underlay hw supports offchannel radar/CAC detection.

Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
---
 include/uapi/linux/nl80211.h | 4 ++++
 net/wireless/mlme.c          | 4 ++++
 2 files changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index 87ece3e68b8b..3e734826792f 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h
@@ -6060,6 +6060,9 @@  enum nl80211_feature_flags {
  *	frames. Userspace has to share FILS AAD details to the driver by using
  *	@NL80211_CMD_SET_FILS_AAD.
  *
+ * @NL80211_EXT_FEATURE_RADAR_OFFCHAN: Device supports offchannel radar/CAC
+ *	detection.
+ *
  * @NUM_NL80211_EXT_FEATURES: number of extended features.
  * @MAX_NL80211_EXT_FEATURES: highest extended feature index.
  */
@@ -6126,6 +6129,7 @@  enum nl80211_ext_feature_index {
 	NL80211_EXT_FEATURE_PROT_RANGE_NEGO_AND_MEASURE,
 	NL80211_EXT_FEATURE_BSS_COLOR,
 	NL80211_EXT_FEATURE_FILS_CRYPTO_OFFLOAD,
+	NL80211_EXT_FEATURE_RADAR_OFFCHAN,
 
 	/* add new features before the definition below */
 	NUM_NL80211_EXT_FEATURES,
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 532df85d1c26..247ee0a01e8b 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -1040,6 +1040,10 @@  cfg80211_start_offchan_radar_detection(struct cfg80211_registered_device *rdev,
 	unsigned int cac_time_ms;
 	int err = -EBUSY;
 
+	if (!wiphy_ext_feature_isset(&rdev->wiphy,
+				     NL80211_EXT_FEATURE_RADAR_OFFCHAN))
+		return -EOPNOTSUPP;
+
 	mutex_lock(&rdev->offchan_mutex);
 	if (rdev->offchan_radar_wdev)
 		goto out;