linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Sojka <sojkam1@fel.cvut.cz>
To: linux-wireless@vger.kernel.org
Cc: bernd.lehmann@volkswagen.de, s.sander@nordsys.de,
	wireless-regdb@lists.infradead.org, ath9k-devel@lists.ath9k.org,
	ath9k-devel@qca.qualcomm.com,
	"Jan Kaisrlík" <kaisrja1@fel.cvut.cz>,
	"Michal Sojka" <sojkam1@fel.cvut.cz>,
	"Felix Fietkau" <nbd@openwrt.org>
Subject: [PATCH v2 4/8] cfg80211: reg: Properly handle rules for 5 and 10 MHz channels
Date: Mon, 23 Nov 2015 19:27:17 +0100	[thread overview]
Message-ID: <1448303241-27747-5-git-send-email-sojkam1@fel.cvut.cz> (raw)
In-Reply-To: <1448303241-27747-1-git-send-email-sojkam1@fel.cvut.cz>

Regulatory rules are applied to channels as if the channel is at least
20 MHz wide. This is a problem when dealing with 5 and 10 MHz channels
because side channels of a regulatory rule get disabled even when they
fall into rule's frequency range.

This problem was already fixed in commit
4edd56981c8fbb349b1529a2feaf772636eb1c83, but only for custom regulatory
domains provided by drivers. Here we fix it also for all other (e.g.
user-supplied) regulatory domains.

Before that, similar commit was
reverted (e33e2241e272eddc38339692500bd1c7d8753a77) due to it allowing
running AP on channel 12 in the US regulatory domain. I have checked
that this is not possible with this change:

  # iw reg set US
  # iw dev wlan0 interface add wlan0_ap  type __ap
  # iw dev wlan0_ap set channel 12
  command failed: Invalid argument (-22)

Cc: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
 net/wireless/reg.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 0a4f548..35eaeeb 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1201,11 +1201,6 @@ static uint32_t reg_rule_to_chan_bw_flags(const struct ieee80211_regdomain *regd
 	return bw_flags;
 }
 
-/*
- * Note that right now we assume the desired channel bandwidth
- * is always 20 MHz for each individual channel (HT40 uses 20 MHz
- * per channel, the primary and the extension channel).
- */
 static void handle_channel(struct wiphy *wiphy,
 			   enum nl80211_reg_initiator initiator,
 			   struct ieee80211_channel *chan)
@@ -1221,7 +1216,8 @@ static void handle_channel(struct wiphy *wiphy,
 
 	flags = chan->orig_flags;
 
-	reg_rule = freq_reg_info(wiphy, MHZ_TO_KHZ(chan->center_freq));
+	reg_rule = __freq_reg_info(wiphy, MHZ_TO_KHZ(chan->center_freq),
+				   MHZ_TO_KHZ(5));
 	if (IS_ERR(reg_rule)) {
 		/*
 		 * We will disable all channels that do not match our
-- 
2.5.3


  parent reply	other threads:[~2015-11-23 18:27 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-23 18:27 [PATCH v2 0/8] Regulatory and ath9k support for ITS-G5 band (5.9 GHz) Michal Sojka
2015-11-23 18:27 ` [PATCH v2 1/8] cfg80211: reg: Remove unused function parameter Michal Sojka
2015-11-23 18:27 ` [PATCH v2 2/8] cfg80211: Remove unused cfg80211_can_use_iftype_chan() Michal Sojka
2015-11-26 16:46   ` Johannes Berg
2015-11-23 18:27 ` [PATCH v2 3/8] cfg80211: reg: Refactor calculation of bandwidth flags Michal Sojka
2015-11-26 17:48   ` Johannes Berg
2015-11-23 18:27 ` Michal Sojka [this message]
2015-11-26 17:51   ` [PATCH v2 4/8] cfg80211: reg: Properly handle rules for 5 and 10 MHz channels Johannes Berg
2015-11-30  9:56   ` Jouni Malinen
2015-11-30 10:30     ` Johannes Berg
2015-11-23 18:27 ` [PATCH v2 5/8] cfg80211: Add support for OCB-only channels Michal Sojka
2015-11-27  8:33   ` Johannes Berg
2015-11-27  8:59     ` Michal Sojka
2015-11-23 18:27 ` [PATCH v2 6/8] cfg80211: reg: Add NL80211_RRF_USER_REGD_NEEDED flag Michal Sojka
2015-11-27  8:35   ` Johannes Berg
2015-11-27  9:43     ` Michal Sojka
2015-11-27  9:52       ` Johannes Berg
2015-11-23 18:27 ` [PATCH v2 7/8] cfg80211: Add Kconfig option for ITS-G5 band (5.9 GHz) Michal Sojka
2015-11-26 17:55   ` Johannes Berg
2015-11-26 21:10     ` Michal Sojka
2015-11-27  8:25       ` Johannes Berg
2015-11-27  8:44         ` Michal Sojka
2015-11-23 18:27 ` [PATCH v2 8/8] ath9k: Add support " Michal Sojka

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=1448303241-27747-5-git-send-email-sojkam1@fel.cvut.cz \
    --to=sojkam1@fel.cvut.cz \
    --cc=ath9k-devel@lists.ath9k.org \
    --cc=ath9k-devel@qca.qualcomm.com \
    --cc=bernd.lehmann@volkswagen.de \
    --cc=kaisrja1@fel.cvut.cz \
    --cc=linux-wireless@vger.kernel.org \
    --cc=nbd@openwrt.org \
    --cc=s.sander@nordsys.de \
    --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).