From: Bernhard Schmidt <bernhard.schmidt@saxnet.de>
To: linux-wireless@vger.kernel.org
Cc: lrodriguez@atheros.com, nbd@openwrt.org, dubowoj@neratec.com,
zefir.kurtisi@neratec.com, simon.wunderlich@saxnet.de
Subject: [PATCH 3/9] [mac80211] enable radar detection
Date: Mon, 28 Feb 2011 17:47:44 +0100 [thread overview]
Message-ID: <201102281747.44842.bernhard.schmidt@saxnet.de> (raw)
In-Reply-To: <201102281740.37036.bernhard.schmidt@saxnet.de>
When switching to channels requiring radar detection, enable it
if the current mode is one which requires beaconing. In all other
cases the radar detection is disabled.
Note, drivers which do not support radar detection are not allowed
to switch to those channels.
Signed-off-by: Bernhard Schmidt <bernhard.schmidt@saxnet.de>
---
include/net/mac80211.h | 4 ++++
net/mac80211/cfg.c | 15 +++++++++++++++
net/mac80211/driver-ops.h | 14 ++++++++++++++
net/mac80211/driver-trace.h | 21 +++++++++++++++++++++
4 files changed, 54 insertions(+), 0 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 2b072fa..495b0c5 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1804,6 +1804,8 @@ enum ieee80211_ampdu_mlme_action {
* return value is 1, then the @remain_on_channel will be used with a
* regular transmission (if supported.)
* @offchannel_tx_cancel_wait: cancel wait associated with offchannel TX
+ *
+ * @radar_detection: Enable or disable radar detection on current channel.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw, struct sk_buff *skb);
@@ -1888,6 +1890,8 @@ struct ieee80211_ops {
enum nl80211_channel_type channel_type,
unsigned int wait);
int (*offchannel_tx_cancel_wait)(struct ieee80211_hw *hw);
+
+ int (*radar_detection)(struct ieee80211_hw *hw, int enable);
};
/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 4a07e67..e50ecaa 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1245,6 +1245,21 @@ static int ieee80211_set_channel(struct wiphy *wiphy,
old_vif_oper_type = sdata->vif.bss_conf.channel_type;
old_oper_type = local->_oper_channel_type;
+ if (sdata && (sdata->vif.type == NL80211_IFTYPE_ADHOC ||
+ sdata->vif.type == NL80211_IFTYPE_AP ||
+ sdata->vif.type == NL80211_IFTYPE_AP_VLAN ||
+ sdata->vif.type == NL80211_IFTYPE_MESH_POINT ||
+ sdata->vif.type == NL80211_IFTYPE_P2P_GO) &&
+ (chan->flags & IEEE80211_CHAN_RADAR)) {
+ /*
+ * Do not allow switching to channels requiring radar
+ * detection if hardware doesn't support detection.
+ */
+ if (drv_radar_detection(local, true))
+ return -EINVAL;
+ } else
+ drv_radar_detection(local, false);
+
if (!ieee80211_set_channel_type(local, sdata, channel_type))
return -EBUSY;
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 3729296..a2bef0c 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -526,4 +526,18 @@ static inline int drv_offchannel_tx_cancel_wait(struct ieee80211_local *local)
return ret;
}
+static inline int drv_radar_detection(struct ieee80211_local *local, int enable)
+{
+ int ret = -EOPNOTSUPP;
+
+ might_sleep();
+
+ trace_drv_radar_detection(local, enable);
+ if (local->ops->radar_detection)
+ ret = local->ops->radar_detection(&local->hw, enable);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 520fe24..aa2c833 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -1150,6 +1150,27 @@ DEFINE_EVENT(local_only_evt, api_remain_on_channel_expired,
TP_ARGS(local)
);
+TRACE_EVENT(drv_radar_detection,
+ TP_PROTO(struct ieee80211_local *local, int enable),
+
+ TP_ARGS(local, enable),
+
+ TP_STRUCT__entry(
+ LOCAL_ENTRY
+ __field(int, enable)
+ ),
+
+ TP_fast_assign(
+ LOCAL_ASSIGN;
+ __entry->enable = enable;
+ ),
+
+ TP_printk(
+ LOCAL_PR_FMT " enable:%d",
+ LOCAL_PR_ARG, __entry->enable
+ )
+);
+
/*
* Tracing for internal functions
* (which may also be called in response to driver calls)
--
1.7.2.3
next prev parent reply other threads:[~2011-02-28 16:48 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-28 16:40 [RFC 0/9 v2] DFS/radar state/userspace handling Bernhard Schmidt
2011-02-28 16:46 ` [PATCH 1/9] [mac80211] add method to access oper chan Bernhard Schmidt
2011-03-01 12:11 ` Johannes Berg
2011-02-28 16:47 ` [PATCH 2/9] [{mac|nl}80211] Add 2 new radar channel flags Bernhard Schmidt
2011-03-01 21:54 ` Luis R. Rodriguez
2011-03-02 8:25 ` Johannes Berg
2011-03-02 9:37 ` Bernhard Schmidt
2011-02-28 16:47 ` Bernhard Schmidt [this message]
2011-03-01 21:56 ` [PATCH 3/9] [mac80211] enable radar detection Luis R. Rodriguez
2011-02-28 16:48 ` [PATCH 4/9] [cfg80211] add preliminary radar processing code Bernhard Schmidt
2011-03-01 12:17 ` Johannes Berg
2011-03-01 21:58 ` Luis R. Rodriguez
2011-03-02 7:32 ` Bernhard Schmidt
2011-03-02 16:26 ` Luis R. Rodriguez
2011-02-28 16:49 ` [PATCH 5/9] [cfg80211] channel availability check (CAC) support Bernhard Schmidt
2011-02-28 16:49 ` [PATCH 6/9] [cfg80211] no operation list (NOL) support Bernhard Schmidt
2011-03-01 12:19 ` Johannes Berg
2011-02-28 16:50 ` [PATCH 7/9] [cfg80211] abide channel closing time Bernhard Schmidt
2011-02-28 16:51 ` [PATCH 8/9] [{cfg|nl}80211] announce flag changes to userspace Bernhard Schmidt
2011-02-28 16:51 ` [PATCH 9/9] [cfg80211] interference reporting Bernhard Schmidt
2011-03-01 12:28 ` [RFC 0/9 v2] DFS/radar state/userspace handling Johannes Berg
2011-03-01 13:07 ` Bernhard Schmidt
2011-03-01 13:15 ` Johannes Berg
2011-03-01 13:26 ` Bernhard Schmidt
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=201102281747.44842.bernhard.schmidt@saxnet.de \
--to=bernhard.schmidt@saxnet.de \
--cc=dubowoj@neratec.com \
--cc=linux-wireless@vger.kernel.org \
--cc=lrodriguez@atheros.com \
--cc=nbd@openwrt.org \
--cc=simon.wunderlich@saxnet.de \
--cc=zefir.kurtisi@neratec.com \
/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).