linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ilan Peer <ilan.peer@intel.com>
To: linux-wireless@vger.kernel.org
Cc: wireless-regdb@lists.infradead.org, Ilan Peer <ilan.peer@intel.com>
Subject: [PATCH v3 6/6] mac80211: Enable initiating radiation on indoor channels
Date: Mon, 27 Jan 2014 12:21:58 +0200	[thread overview]
Message-ID: <1390818118-27261-7-git-send-email-ilan.peer@intel.com> (raw)
In-Reply-To: <1390818118-27261-1-git-send-email-ilan.peer@intel.com>

Allow active scanning and frame injection on channels marked with
IEEE80211_CHAN_NO_IR iff the channel is also marked with
IEEE80211_CHAN_INDOOR_ONLY and the wireless core thinks that it
operates in an indoor environment.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
 net/mac80211/scan.c |   15 +++++++++------
 net/mac80211/tx.c   |    3 ++-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 88c8161..e78aa29 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -527,8 +527,8 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
 		/* We need to ensure power level is at max for scanning. */
 		ieee80211_hw_config(local, 0);
 
-		if ((req->channels[0]->flags &
-		     IEEE80211_CHAN_NO_IR) ||
+		if (!regulatory_ir_allowed(local->hw.wiphy,
+					   req->channels[0]) ||
 		    !local->scan_req->n_ssids) {
 			next_delay = IEEE80211_PASSIVE_CHANNEL_TIME;
 		} else {
@@ -568,13 +568,14 @@ static int __ieee80211_start_scan(struct ieee80211_sub_if_data *sdata,
 }
 
 static unsigned long
-ieee80211_scan_get_channel_time(struct ieee80211_channel *chan)
+ieee80211_scan_get_channel_time(struct wiphy *wiphy,
+				struct ieee80211_channel *chan)
 {
 	/*
 	 * TODO: channel switching also consumes quite some time,
 	 * add that delay as well to get a better estimation
 	 */
-	if (chan->flags & IEEE80211_CHAN_NO_IR)
+	if (!regulatory_ir_allowed(wiphy, chan))
 		return IEEE80211_PASSIVE_CHANNEL_TIME;
 	return IEEE80211_PROBE_DELAY + IEEE80211_CHANNEL_TIME;
 }
@@ -588,6 +589,7 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
 	struct ieee80211_sub_if_data *sdata;
 	struct ieee80211_channel *next_chan;
 	enum mac80211_scan_state next_scan_state;
+	struct wiphy *wiphy = local->hw.wiphy;
 
 	/*
 	 * check if at least one STA interface is associated,
@@ -623,7 +625,8 @@ static void ieee80211_scan_state_decision(struct ieee80211_local *local,
 	 */
 
 	bad_latency = time_after(jiffies +
-				 ieee80211_scan_get_channel_time(next_chan),
+				 ieee80211_scan_get_channel_time(wiphy,
+								 next_chan),
 				 local->leave_oper_channel_time + HZ / 8);
 
 	if (associated && !tx_empty) {
@@ -698,7 +701,7 @@ static void ieee80211_scan_state_set_channel(struct ieee80211_local *local,
 	 *
 	 * In any case, it is not necessary for a passive scan.
 	 */
-	if (chan->flags & IEEE80211_CHAN_NO_IR ||
+	if (!regulatory_ir_allowed(local->hw.wiphy, chan) ||
 	    !local->scan_req->n_ssids) {
 		*next_delay = IEEE80211_PASSIVE_CHANNEL_TIME;
 		local->next_scan_state = SCAN_DECISION;
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 27c990b..171d0c5 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1732,7 +1732,8 @@ 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_IR | IEEE80211_CHAN_RADAR)))
+	if (!regulatory_ir_allowed(local->hw.wiphy, chan) ||
+	    chan->flags & IEEE80211_CHAN_RADAR)
 		goto fail_rcu;
 
 	ieee80211_xmit(sdata, skb, chan->band);
-- 
1.7.10.4


  parent reply	other threads:[~2014-01-27 10:20 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 10:21 [PATCH v3 0/6] Enable additional channels for use Ilan Peer
2014-01-27 10:21 ` [PATCH v3 1/6] cfg80211: Add indoor only and GO concurrent channel attributes Ilan Peer
2014-02-18 22:49   ` Luis R. Rodriguez
2014-02-19 14:44     ` Peer, Ilan
2014-01-27 10:21 ` [PATCH v3 2/6] cfg80211: Add Kconfig option for cellular BS hints Ilan Peer
2014-02-18 22:59   ` Luis R. Rodriguez
2014-01-27 10:21 ` [PATCH v3 3/6] cfg80211: Enable GO operation on additional channels Ilan Peer
2014-01-31 14:11   ` Johannes Berg
2014-02-02 19:20     ` Peer, Ilan
2014-02-03 12:46       ` Johannes Berg
2014-02-03 13:24         ` Peer, Ilan
2014-02-18 23:38   ` Luis R. Rodriguez
2014-02-19 14:52     ` Peer, Ilan
2014-02-19 15:47       ` Luis R. Rodriguez
2014-02-20  7:31         ` Peer, Ilan
2014-01-27 10:21 ` [PATCH v3 4/6] cfg80211: Add an option to hint indoor operation Ilan Peer
2014-01-31 14:13   ` Johannes Berg
2014-02-03 11:14   ` Ilan Peer
2014-02-19  0:07   ` Luis R. Rodriguez
2014-02-19 15:18     ` Peer, Ilan
2014-01-27 10:21 ` [PATCH v3 5/6] cfg80211: Enable GO operation on indoor channels Ilan Peer
2014-02-19  0:10   ` Luis R. Rodriguez
2014-01-27 10:21 ` Ilan Peer [this message]
2014-02-19  0:15   ` [PATCH v3 6/6] mac80211: Enable initiating radiation " Luis R. Rodriguez
2014-02-19 15:28     ` Peer, Ilan
2014-02-19 16:03       ` Luis R. Rodriguez
2014-02-20  7:58         ` Peer, Ilan
2014-02-21 23:31           ` Luis R. Rodriguez
2014-02-22 18:55             ` Peer, Ilan
2014-02-22 20:22               ` Luis R. Rodriguez
2014-02-23  7:23                 ` Peer, Ilan
2014-02-23  9:43                   ` Luis R. Rodriguez
2014-01-27 10:24 ` [PATCH v3 0/6] Enable additional channels for use Peer, Ilan
2014-02-09 16:06 ` Peer, Ilan
2014-02-18 22:17   ` Luis R. Rodriguez
2014-02-18 22:18     ` Luis R. Rodriguez

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=1390818118-27261-7-git-send-email-ilan.peer@intel.com \
    --to=ilan.peer@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=wireless-regdb@lists.infradead.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).