[PATCH mac80211-next 2/4] cfg80211: introduce NL80211_ATTR_RADAR_OFFCHAN netlink attribute
From: Lorenzo Bianconi <lorenzo@kernel.org>
Date: 2021-10-19 11:59:48
Subsystem:
802.11 (including cfg80211/nl80211), the rest · Maintainers:
Johannes Berg, Linus Torvalds
Introduce NL80211_ATTR_RADAR_OFFCHAN netlink attribute in order to configure offchannel radar chain if supported by the underlay driver. Tested-by: Evelyn Tsai <redacted> Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> --- include/uapi/linux/nl80211.h | 6 ++++++ net/wireless/nl80211.c | 12 ++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h
index eda608b1eb09..96e622777bb2 100644
--- a/include/uapi/linux/nl80211.h
+++ b/include/uapi/linux/nl80211.h@@ -2639,6 +2639,10 @@ enum nl80211_commands { * Mandatory parameter for the transmitting interface to enable MBSSID. * Optional for the non-transmitting interfaces. * + * @NL80211_ATTR_RADAR_OFFCHAN: Configure dedicated chain available for radar + * detection on some hw. The chain can't be used to transmits or receives + * frames. The driver is supposed to implement CAC management in sw or fw. + * * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -3145,6 +3149,8 @@ enum nl80211_attrs { NL80211_ATTR_MBSSID_CONFIG, NL80211_ATTR_MBSSID_ELEMS, + NL80211_ATTR_RADAR_OFFCHAN, + /* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 3f37e4d5c5d2..a296f180624e 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c@@ -776,6 +776,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = { [NL80211_ATTR_MBSSID_CONFIG] = NLA_POLICY_NESTED(nl80211_mbssid_config_policy), [NL80211_ATTR_MBSSID_ELEMS] = { .type = NLA_NESTED }, + [NL80211_ATTR_RADAR_OFFCHAN] = { .type = NLA_FLAG }, }; /* policy for the key attributes */
@@ -9279,10 +9280,12 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, if (err) return err; - if (netif_carrier_ok(dev)) + if (!nla_get_flag(info->attrs[NL80211_ATTR_RADAR_OFFCHAN]) && + netif_carrier_ok(dev)) return -EBUSY; - if (wdev->cac_started) + if (!nla_get_flag(info->attrs[NL80211_ATTR_RADAR_OFFCHAN]) && + wdev->cac_started) return -EBUSY; err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype);
@@ -9299,6 +9302,11 @@ static int nl80211_start_radar_detection(struct sk_buff *skb, if (wiphy_ext_feature_isset(wiphy, NL80211_EXT_FEATURE_DFS_OFFLOAD)) return -EOPNOTSUPP; + if (nla_get_flag(info->attrs[NL80211_ATTR_RADAR_OFFCHAN])) { + /* offchannel radar detection */ + return rdev_set_radar_offchan(rdev, &chandef); + } + if (!rdev->ops->start_radar_detection) return -EOPNOTSUPP;
--
2.31.1