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 1/7] mac80211: Mark channel as unusable if a regulatory MESH CSA is received
Date: Tue, 16 May 2017 11:23:10 +0200 [thread overview]
Message-ID: <20170516092316.15636-2-sw@simonwunderlich.de> (raw)
In-Reply-To: <20170516092316.15636-1-sw@simonwunderlich.de>
From: Benjamin Berg <benjamin@sipsolutions.net>
In the Mesh Channel Switch Parameters (8.4.2.105) the reason is specified
to WLAN_REASON_MESH_CHAN_REGULATORY in the case that a regulatory
limitation was the cause for the switch. This means another station
detected a radar event.
Mark the channel as unusable if this happens.
Signed-off-by: Benjamin Berg <benjamin@sipsolutions.net>
[sw: style cleanup, rebase]
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
---
net/mac80211/ieee80211_i.h | 1 +
net/mac80211/mesh.c | 21 +++++++++++++++++++++
net/mac80211/spectmgmt.c | 5 +++++
3 files changed, 27 insertions(+)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index f8f6c148f554..60bed6c69801 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1440,6 +1440,7 @@ struct ieee80211_csa_ie {
u8 count;
u8 ttl;
u16 pre_value;
+ u16 reason_code;
};
/* Parsed Information Elements */
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c
index 737e1f082b0d..3702e3d9141d 100644
--- a/net/mac80211/mesh.c
+++ b/net/mac80211/mesh.c
@@ -916,6 +916,21 @@ void ieee80211_stop_mesh(struct ieee80211_sub_if_data *sdata)
ieee80211_configure_filter(local);
}
+static void ieee80211_mesh_csa_mark_radar(struct ieee80211_sub_if_data *sdata)
+{
+ int err;
+
+ /* if the current channel is a DFS channel, mark the channel as
+ * unavailable.
+ */
+ err = cfg80211_chandef_dfs_required(sdata->local->hw.wiphy,
+ &sdata->vif.bss_conf.chandef,
+ NL80211_IFTYPE_MESH_POINT);
+ if (err > 0)
+ cfg80211_radar_event(sdata->local->hw.wiphy,
+ &sdata->vif.bss_conf.chandef, GFP_ATOMIC);
+}
+
static bool
ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
struct ieee802_11_elems *elems, bool beacon)
@@ -954,6 +969,12 @@ ieee80211_mesh_process_chnswitch(struct ieee80211_sub_if_data *sdata,
if (err)
return false;
+ /* Mark the channel unavailable if the reason for the switch is
+ * regulatory.
+ */
+ if (csa_ie.reason_code == WLAN_REASON_MESH_CHAN_REGULATORY)
+ ieee80211_mesh_csa_mark_radar(sdata);
+
params.chandef = csa_ie.chandef;
params.count = csa_ie.count;
diff --git a/net/mac80211/spectmgmt.c b/net/mac80211/spectmgmt.c
index 0782e486fe89..d2ea0017c79d 100644
--- a/net/mac80211/spectmgmt.c
+++ b/net/mac80211/spectmgmt.c
@@ -76,6 +76,11 @@ int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
csa_ie->mode = elems->mesh_chansw_params_ie->mesh_flags;
csa_ie->pre_value = le16_to_cpu(
elems->mesh_chansw_params_ie->mesh_pre_value);
+
+ if (elems->mesh_chansw_params_ie->mesh_flags &
+ WLAN_EID_CHAN_SWITCH_PARAM_REASON)
+ csa_ie->reason_code = le16_to_cpu(
+ elems->mesh_chansw_params_ie->mesh_reason);
}
new_freq = ieee80211_channel_to_frequency(new_chan_no, new_band);
--
2.11.0
next prev 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 ` Simon Wunderlich [this message]
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 ` [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-2-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).