Skip to contentSkip to conversation

nl80211: Add support to notify radar event info received from STA

PATCH Superseded Sriram R 2 participants 3 messages Oct 19, 2018 – Nov 12, 2018 802.11 (including cfg80211/NL80211)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Sriram R

author
#0 lore raw

PATCH 1/1 nl80211: Add support to notify radar event info received from STA

Currently radar detection and corresponding channel switch is handled at the AP device. STA ignores these detected radar events since the radar signal can be seen mostly by the AP as well. But in scenarios where a radar signal is seen only at STA, notifying this event to the AP which can trigger a channel switch can be useful.
Stations can report such radar events autonomously through Spectrum management (Measurement Report) action frame to its AP. The userspace on processing the report can notify the kernel with the use of the added NL80211_CMD_NOTIFY_RADAR to indicate the detected event and inturn adding the reported channel to NOL.

---
 include/uapi/linux/nl80211.h |  7 ++++++
 net/wireless/nl80211.c       | 52 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+)
include/uapi/linux/nl80211.h +7 -0
index dc6d5a1..192b358 100644
@@ -1036,6 +1036,11 @@
  * @NL80211_CMD_GET_FTM_RESPONDER_STATS: Retrieve FTM responder statistics, in
  *	the %NL80211_ATTR_FTM_RESPONDER_STATS attribute.
  *
+ * @NL80211_CMD_NOTIFY_RADAR: Notify the kernel that a radar signal was
+ *	detected and reported by a neighboring device on the channel
+ *	indicated by %NL80211_ATTR_WIPHY_FREQ and other attributes
+ *	determining the width and type.
+ *
  * @NL80211_CMD_MAX: highest used command number
  * @__NL80211_CMD_AFTER_LAST: internal use
  */
@@ -1250,6 +1255,8 @@ enum nl80211_commands {
 
 	NL80211_CMD_GET_FTM_RESPONDER_STATS,
 
+	NL80211_CMD_NOTIFY_RADAR,
+
 	/* add new commands above here */
 
 	/* used to define NL80211_CMD_MAX below */
net/wireless/nl80211.c +52 -0

64 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#1 lore raw

On Fri, 2018-10-19 at 14:42 +0530, Sriram R wrote:
[...]

This looks fine, but I think it would be nice to have some extended netlink error reporting for at least some of these errors:

Quoted 10 lines
net/wireless/nl80211.c +10 -0
+	dfs_region = reg_get_dfs_region(wiphy);
+	if (dfs_region == NL80211_DFS_UNSET)
+		return -EINVAL;
+
+	err = nl80211_parse_chandef(rdev, info, &chandef);
+	if (err)
+		return err;
+
+	err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype);
+	if (err < 0)

net/wireless/nl80211.c static int nl80211_start_radar_detection(struct sk_buff *skb, · line 7953

Quoted 10 lines
net/wireless/nl80211.c +10 -0
+		return err;
+
+	if (err == 0)
+		return -EINVAL;
+
+	/* Do not process this notification if radar is already detected
+	 * by kernel on this channel
+	 */
+	if (chandef.chan->dfs_state == NL80211_DFS_UNAVAILABLE)
+		return -EINVAL;

And maybe that last one should just return 0?

johannes

author
#2 lore raw
Quoted 6 lines · Johannes Berg

On Fri, 2018-10-19 at 14:42 +0530, Sriram R wrote:
[...]

This looks fine, but I think it would be nice to have some extended netlink error reporting for at least some of these errors:

Sure Johannes, I'll add them in the next patch revision.

Quoted 14 lines
Quoted 14 lines
net/wireless/nl80211.c +14 -0
+	dfs_region = reg_get_dfs_region(wiphy);
+	if (dfs_region == NL80211_DFS_UNSET)
+		return -EINVAL;
+
+	err = nl80211_parse_chandef(rdev, info, &chandef);
+	if (err)
+		return err;
+
+	err = cfg80211_chandef_dfs_required(wiphy, &chandef, wdev->iftype);
+	if (err < 0)
+		return err;
+
+	if (err == 0)
+		return -EINVAL;
Quoted 8 lines

net/wireless/nl80211.c static int nl80211_start_radar_detection(struct sk_buff *skb, · line 7953

Quoted 6 lines
net/wireless/nl80211.c +6 -0
+
+	/* Do not process this notification if radar is already detected
+	 * by kernel on this channel
+	 */
+	if (chandef.chan->dfs_state == NL80211_DFS_UNAVAILABLE)
+		return -EINVAL;

And maybe that last one should just return 0?

You're right. I'll return success here.
Thanks,
Sriram.R

Quoted 2 lines

johannes