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 4/7] mac80211: Allow following CSA to DFS channels if userspace handles it
Date: Tue, 16 May 2017 11:23:13 +0200	[thread overview]
Message-ID: <20170516092316.15636-5-sw@simonwunderlich.de> (raw)
In-Reply-To: <20170516092316.15636-1-sw@simonwunderlich.de>

From: Benjamin Berg <benjamin@sipsolutions.net>

If userspace has flagged support for DFS earlier, then we can follow CSA
to DFS channels. So instead of rejecting the switch, allow it to happen
if the flag has been set during mesh setup.

Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
 net/mac80211/cfg.c         |  1 +
 net/mac80211/ieee80211_i.h |  2 ++
 net/mac80211/mesh.c        | 15 ++++++++++++---
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 6c2e6060cd54..6980a936a437 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1874,6 +1874,7 @@ static int copy_mesh_setup(struct ieee80211_if_mesh *ifmsh,
 	ifmsh->user_mpm = setup->user_mpm;
 	ifmsh->mesh_auth_id = setup->auth_id;
 	ifmsh->security = IEEE80211_MESH_SEC_NONE;
+	ifmsh->userspace_handles_dfs = setup->userspace_handles_dfs;
 	if (setup->is_authenticated)
 		ifmsh->security |= IEEE80211_MESH_SEC_AUTHED;
 	if (setup->is_secure)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 60bed6c69801..c960e4999380 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -643,6 +643,8 @@ struct ieee80211_if_mesh {
 	unsigned long wrkq_flags;
 	unsigned long mbss_changed;
 
+	bool userspace_handles_dfs;
+
 	u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
 	size_t mesh_id_len;
 	/* Active Path Selection Protocol Identifier */
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 3702e3d9141d..4807a5d77572 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -979,7 +979,9 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
 	params.count = csa_ie.count;
 
 	if (!cfg80211_chandef_usable(sdata->local->hw.wiphy, &params.chandef,
-				     IEEE80211_CHAN_DISABLED)) {
+				     IEEE80211_CHAN_DISABLED) ||
+	    !cfg80211_reg_can_beacon(sdata->local->hw.wiphy, &params.chandef,
+				     NL80211_IFTYPE_MESH_POINT)) {
 		sdata_info(sdata,
 			   "mesh STA %pM switches to unsupported channel (%d MHz, width:%d, CF1/2: %d/%d MHz), aborting\n",
 			   sdata->vif.addr,
@@ -995,9 +997,16 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
 					    NL80211_IFTYPE_MESH_POINT);
 	if (err < 0)
 		return false;
-	if (err > 0)
-		/* TODO: DFS not (yet) supported */
+	if (err > 0 && !ifmsh->userspace_handles_dfs) {
+		sdata_info(sdata,
+			   "mesh STA %pM switches to channel requiring DFS (%d MHz, width:%d, CF1/2: %d/%d MHz), aborting\n",
+			   sdata->vif.addr,
+			   params.chandef.chan->center_freq,
+			   params.chandef.width,
+			   params.chandef.center_freq1,
+			   params.chandef.center_freq2);
 		return false;
+	}
 
 	params.radar_required = err;
 
-- 
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 ` [PATCH 2/7] wireless: Only join DFS channels in mesh mode if userspace flags support Simon Wunderlich
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 ` Simon Wunderlich [this message]
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-5-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).