From patchwork Mon Jan 27 10:21:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peer, Ilan" X-Patchwork-Id: 3541951 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6A665C02DC for ; Mon, 27 Jan 2014 10:20:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BDFB820131 for ; Mon, 27 Jan 2014 10:20:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F1ABC20125 for ; Mon, 27 Jan 2014 10:20:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753731AbaA0KUl (ORCPT ); Mon, 27 Jan 2014 05:20:41 -0500 Received: from mga11.intel.com ([192.55.52.93]:12225 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753095AbaA0KU1 (ORCPT ); Mon, 27 Jan 2014 05:20:27 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 27 Jan 2014 02:20:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.95,728,1384329600"; d="scan'208";a="471327397" Received: from unknown (HELO ipeer-e6430-1.jer.intel.com) ([10.12.217.190]) by fmsmga002.fm.intel.com with ESMTP; 27 Jan 2014 02:20:16 -0800 From: Ilan Peer To: linux-wireless@vger.kernel.org Cc: wireless-regdb@lists.infradead.org, Ilan Peer Subject: [PATCH v3 6/6] mac80211: Enable initiating radiation on indoor channels Date: Mon, 27 Jan 2014 12:21:58 +0200 Message-Id: <1390818118-27261-7-git-send-email-ilan.peer@intel.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1390818118-27261-1-git-send-email-ilan.peer@intel.com> References: <1390818118-27261-1-git-send-email-ilan.peer@intel.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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);