linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 2/9] [{mac|nl}80211] Add 2 new radar channel flags
Date: Mon, 28 Feb 2011 17:47:06 +0100	[thread overview]
Message-ID: <201102281747.06564.bernhard.schmidt@saxnet.de> (raw)
In-Reply-To: <201102281740.37036.bernhard.schmidt@saxnet.de>

DFS introduces 2 new flags a channel requiring radar detection
might take. The interference flag indicates that interference was
detected either during CAC or in-service monitoring and the
channel is not to be used for the NOP period. The clear flag
indicates that during a full CAC no interference was detected and
it is allowed to open a BSS on that channel. The case were both
flags are set is used to indicate that interference has been
detected and we are in progress of closing on that channel.

Signed-off-by: Bernhard Schmidt <bernhard.schmidt@saxnet.de>
---
 include/linux/nl80211.h |    6 ++++++
 include/net/cfg80211.h  |   18 ++++++++++++------
 net/mac80211/cfg.c      |    6 ++++++
 net/mac80211/tx.c       |    6 ++++--
 net/wireless/nl80211.c  |    4 ++++
 5 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/include/linux/nl80211.h b/include/linux/nl80211.h
index e3c9ec7..2282f56 100644
--- a/include/linux/nl80211.h
+++ b/include/linux/nl80211.h
@@ -1371,6 +1371,10 @@ enum nl80211_band_attr {
  *	(100 * dBm).
  * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number
  *	currently defined
+ * @NL80211_FREQUENCY_ATTR_RADAR_CLEAR: during a full CAC no interference has
+ *	been detected.
+ * @NL80211_FREQUENCY_ATTR_RADAR_INTERFERENCE: either during a CAC or
+ *	in-service monitoring radar interference was detected.
  * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use
  */
 enum nl80211_frequency_attr {
@@ -1381,6 +1385,8 @@ enum nl80211_frequency_attr {
 	NL80211_FREQUENCY_ATTR_NO_IBSS,
 	NL80211_FREQUENCY_ATTR_RADAR,
 	NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
+	NL80211_FREQUENCY_ATTR_RADAR_CLEAR,
+	NL80211_FREQUENCY_ATTR_RADAR_INTERFERENCE,
 
 	/* keep last */
 	__NL80211_FREQUENCY_ATTR_AFTER_LAST,
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 8300699..5636c0a 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -98,14 +98,20 @@ enum ieee80211_band {
  * 	is not permitted.
  * @IEEE80211_CHAN_NO_HT40MINUS: extension channel below this channel
  * 	is not permitted.
+ * @IEEE80211_CHAN_RADAR_CLEAR: during a full CAC no interference has
+ *	been detected.
+ * @IEEE80211_CHAN_RADAR_INTERFERENCE: either during a CAC or in-service
+ *	monitoring radar interference was detected.
  */
 enum ieee80211_channel_flags {
-	IEEE80211_CHAN_DISABLED		= 1<<0,
-	IEEE80211_CHAN_PASSIVE_SCAN	= 1<<1,
-	IEEE80211_CHAN_NO_IBSS		= 1<<2,
-	IEEE80211_CHAN_RADAR		= 1<<3,
-	IEEE80211_CHAN_NO_HT40PLUS	= 1<<4,
-	IEEE80211_CHAN_NO_HT40MINUS	= 1<<5,
+	IEEE80211_CHAN_DISABLED			= 1<<0,
+	IEEE80211_CHAN_PASSIVE_SCAN		= 1<<1,
+	IEEE80211_CHAN_NO_IBSS			= 1<<2,
+	IEEE80211_CHAN_RADAR			= 1<<3,
+	IEEE80211_CHAN_NO_HT40PLUS		= 1<<4,
+	IEEE80211_CHAN_NO_HT40MINUS		= 1<<5,
+	IEEE80211_CHAN_RADAR_CLEAR		= 1<<6,
+	IEEE80211_CHAN_RADAR_INTERFERENCE	= 1<<7,
 };
 
 #define IEEE80211_CHAN_NO_HT40 \
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 2a05b31..4a07e67 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -436,11 +436,17 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata,
 {
 	struct beacon_data *new, *old;
 	int new_head_len, new_tail_len;
+	u32 flags;
 	int size;
 	int err = -EINVAL;
 
 	old = sdata->u.ap.beacon;
 
+	flags = sdata->local->hw.conf.channel->flags;
+	if ((flags & IEEE80211_CHAN_RADAR) &&
+	    !(flags & IEEE80211_CHAN_RADAR_CLEAR))
+		return -EINVAL;
+
 	/* head must not be zero-length */
 	if (params->head && !params->head_len)
 		return -EINVAL;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 081dcaf..c8b5e05 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1629,8 +1629,10 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
 	 * radar detection by itself. We can do that later by adding a
 	 * monitor flag interfaces used for AP support.
 	 */
-	if ((chan->flags & (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_RADAR |
-	     IEEE80211_CHAN_PASSIVE_SCAN)))
+	if ((chan->flags & (IEEE80211_CHAN_NO_IBSS |
+	    IEEE80211_CHAN_PASSIVE_SCAN)) ||
+	    ((chan->flags & IEEE80211_CHAN_RADAR) &&
+	    !(chan->flags & IEEE80211_CHAN_RADAR_CLEAR)))
 		goto fail;
 
 	/* check for not even having the fixed radiotap header part */
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index f4facba..52b76e7 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -307,6 +307,10 @@ static int nl80211_msg_put_channel(struct sk_buff *msg,
 		NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_NO_IBSS);
 	if (chan->flags & IEEE80211_CHAN_RADAR)
 		NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_RADAR);
+	if (chan->flags & IEEE80211_CHAN_RADAR_CLEAR)
+		NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_RADAR_CLEAR);
+	if (chan->flags & IEEE80211_CHAN_RADAR_INTERFERENCE)
+		NLA_PUT_FLAG(msg, NL80211_FREQUENCY_ATTR_RADAR_INTERFERENCE);
 
 	NLA_PUT_U32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER,
 		    DBM_TO_MBM(chan->max_power));
-- 
1.7.2.3

  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 ` Bernhard Schmidt [this message]
2011-03-01 21:54   ` [PATCH 2/9] [{mac|nl}80211] Add 2 new radar channel flags Luis R. Rodriguez
2011-03-02  8:25     ` Johannes Berg
2011-03-02  9:37     ` Bernhard Schmidt
2011-02-28 16:47 ` [PATCH 3/9] [mac80211] enable radar detection Bernhard Schmidt
2011-03-01 21:56   ` 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.06564.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).