linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Wunderlich <sw@simonwunderlich.de>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, benjamin@sipsolutions.net,
	Simon Wunderlich <sw@simonwunderlich.de>
Subject: [PATCH 2/7] wireless: Only join DFS channels in mesh mode if userspace flags support
Date: Tue, 16 May 2017 11:23:11 +0200	[thread overview]
Message-ID: <20170516092316.15636-3-sw@simonwunderlich.de> (raw)
In-Reply-To: <20170516092316.15636-1-sw@simonwunderlich.de>

From: Benjamin Berg <benjamin@sipsolutions.net>

When joining a mesh network it is not guaranteed that userspace has a
daemon listening for radar events. This is however required for channels
requiring DFS. To flag that userspace will handle radar events, it needs
to set NL80211_ATTR_HANDLE_DFS.

This matches the current mechanism used for IBSS mode.

Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 include/net/cfg80211.h | 4 ++++
 net/wireless/mesh.c    | 8 ++++++++
 net/wireless/nl80211.c | 3 +++
 3 files changed, 15 insertions(+)

diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index b083e6cbae8c..fa25fbb67cb6 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1441,6 +1441,9 @@ struct mesh_config {
  * @mcast_rate: multicat rate for Mesh Node [6Mbps is the default for 802.11a]
  * @basic_rates: basic rates to use when creating the mesh
  * @beacon_rate: bitrate to be used for beacons
+ * @userspace_handles_dfs: whether user space controls DFS operation, i.e.
+ *	changes the channel when a radar is detected. This is required
+ *	to operate on DFS channels.
  *
  * These parameters are fixed when the mesh is created.
  */
@@ -1462,6 +1465,7 @@ struct mesh_setup {
 	int mcast_rate[NUM_NL80211_BANDS];
 	u32 basic_rates;
 	struct cfg80211_bitrate_mask beacon_rate;
+	bool userspace_handles_dfs;
 };
 
 /**
diff --git a/net/wireless/mesh.c b/net/wireless/mesh.c
index ec0b1c20ac99..421a6b80ec62 100644
--- a/net/wireless/mesh.c
+++ b/net/wireless/mesh.c
@@ -174,6 +174,14 @@ int __cfg80211_join_mesh(struct cfg80211_registered_device *rdev,
 							       scan_width);
 	}
 
+	err = cfg80211_chandef_dfs_required(&rdev->wiphy,
+					    &setup->chandef,
+					    NL80211_IFTYPE_MESH_POINT);
+	if (err < 0)
+		return err;
+	if (err > 0 && !setup->userspace_handles_dfs)
+		return -EINVAL;
+
 	if (!cfg80211_reg_can_beacon(&rdev->wiphy, &setup->chandef,
 				     NL80211_IFTYPE_MESH_POINT))
 		return -EINVAL;
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c3bc9da30cff..d47e55e3f445 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -9962,6 +9962,9 @@ static int nl80211_join_mesh(struct sk_buff *skb, struct genl_info *info)
 			return err;
 	}
 
+	setup.userspace_handles_dfs =
+		nla_get_flag(info->attrs[NL80211_ATTR_HANDLE_DFS]);
+
 	return cfg80211_join_mesh(rdev, dev, &setup, &cfg);
 }
 
-- 
2.11.0

  parent reply	other threads:[~2017-05-16  9:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16  9:23 [PATCH 0/7] extend mac80211 mesh DFS and CSA functionality Simon Wunderlich
2017-05-16  9:23 ` [PATCH 1/7] mac80211: Mark channel as unusable if a regulatory MESH CSA is received Simon Wunderlich
2017-05-16  9:23 ` Simon Wunderlich [this message]
2017-05-16  9:23 ` [PATCH 3/7] wireless: Require HANDLE_DFS flag to switch channel for non-AP mode Simon Wunderlich
2017-05-16  9:23 ` [PATCH 4/7] mac80211: Allow following CSA to DFS channels if userspace handles it Simon Wunderlich
2017-05-16  9:23 ` [PATCH 5/7] mac80211: add wide bandwidth channel switch announcement to CSA action frames and mesh beacons Simon Wunderlich
2017-05-19 11:33   ` Johannes Berg
2017-05-19 11:45     ` Simon Wunderlich
2017-05-19 11:51       ` Johannes Berg
2017-05-16  9:23 ` [PATCH 6/7] mac80211: enable VHT for mesh channel processing Simon Wunderlich
2017-05-16  9:23 ` [PATCH 7/7] mac80211: mark as action frame when parsing IEs of CSA action frames Simon Wunderlich
2017-05-19 11:35   ` Johannes Berg
2017-05-16  9:44 ` [PATCH 0/7] extend mac80211 mesh DFS and CSA functionality Bastian Bittorf
2017-05-16 10:18   ` Simon Wunderlich
2017-05-16 11:55     ` Bastian Bittorf
2017-05-16 12:04       ` Simon Wunderlich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170516092316.15636-3-sw@simonwunderlich.de \
    --to=sw@simonwunderlich.de \
    --cc=benjamin@sipsolutions.net \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).