linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bob Copeland <me@bobcopeland.com>
To: "Luis R. Rodriguez" <lrodriguez@atheros.com>
Cc: Johannes Berg <johannes@sipsolutions.net>,
	Christian Lamparter <chunkeey@web.de>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	mickflemm@gmail.com
Subject: Re: [RFC] ath9k's regulatory domain code changes (for ar9170)
Date: Sat, 28 Mar 2009 12:39:29 -0400	[thread overview]
Message-ID: <20090328163929.GA24075@hash.localnet> (raw)
In-Reply-To: <43e72e890903241504u4dfb5c76kbcb11a096bba72fc@mail.gmail.com>

On Tue, Mar 24, 2009 at 03:04:59PM -0700, Luis R. Rodriguez wrote:
> >> > Channel list is a good hint, maybe
> >> > it's time to fix iw/nl80211 to send back all the channels :)
> >
> > I looked into yesterday actually, and it's completely non-trivial and
> > requires userspace interface changes.
> 
> Heh, there goes that idea then. Then in that case I'd advocate even
> more trimming the channels down.

Nick, what do you think of this?  I think it's the best compromise
for now - people can still get all the channels, normal users get a
nice speedup in the default case.

--------------------
>From 7289f60a3acf3bb1cfcc2a7ef7c4d88ffd0e13f1 Mon Sep 17 00:00:00 2001
From: Bob Copeland <me@bobcopeland.com>
Date: Sat, 28 Mar 2009 12:27:31 -0400
Subject: [PATCH] ath5k: reduce exported channel list

Claiming every available 5 ghz channel has a couple of negative
side-effects: scanning takes a long time, and the channel list
overflows the available buffer space for netlink commands,
resulting in:

    $ iw phy phy0 info
    command failed: No buffer space available (-105)

This patch adds a modparam so people who want to see all the channels
can do so by passing all_channels=1.  By default users will see a
smaller list of channels that works with iw.  This also halves scan
time, from 10 seconds down to less than 5.

Changes-licensed-under: 3-Clause-BSD

Signed-off-by: Bob Copeland <me@bobcopeland.com>
---
 drivers/net/wireless/ath5k/base.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/ath5k/base.c b/drivers/net/wireless/ath5k/base.c
index 5d57d77..a018106 100644
--- a/drivers/net/wireless/ath5k/base.c
+++ b/drivers/net/wireless/ath5k/base.c
@@ -64,6 +64,10 @@ static int modparam_nohwcrypt;
 module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
 MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
 
+static int modparam_all_channels;
+module_param_named(all_channels, modparam_all_channels, int, 0444);
+MODULE_PARM_DESC(all_channels, "Expose all channels the device can use.");
+
 
 /******************\
 * Internal defines *
@@ -862,6 +866,20 @@ ath5k_ieee2mhz(short chan)
 		return 2212 + chan * 20;
 }
 
+/*
+ * Returns true for the channel numbers user without all_channels modparam.
+ */
+static bool ath5k_is_standard_channel(short chan)
+{
+	return ((chan <= 14) ||
+		/* UNII 1,2 */
+		((chan & 3) == 0 && chan >= 36 && chan <= 64) ||
+		/* midband */
+		((chan & 3) == 0 && chan >= 100 && chan <= 140) ||
+		/* UNII-3 */
+		((chan & 3) == 1 && chan >= 149 && chan <= 165));
+}
+
 static unsigned int
 ath5k_copy_channels(struct ath5k_hw *ah,
 		struct ieee80211_channel *channels,
@@ -899,6 +917,9 @@ ath5k_copy_channels(struct ath5k_hw *ah,
 		if (!ath5k_channel_ok(ah, freq, chfreq))
 			continue;
 
+		if (!modparam_all_channels && !ath5k_is_standard_channel(ch))
+			continue;
+
 		/* Write channel info and increment counter */
 		channels[count].center_freq = freq;
 		channels[count].band = (chfreq == CHANNEL_2GHZ) ?
-- 
1.6.0.6


-- 
Bob Copeland %% www.bobcopeland.com


  reply	other threads:[~2009-03-28 16:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-24 18:38 [RFC] ath9k's regulatory domain code changes (for ar9170) Christian Lamparter
2009-03-24 18:59 ` Bob Copeland
2009-03-24 18:41   ` Luis R. Rodriguez
2009-03-24 20:03     ` Bob Copeland
2009-03-24 20:10       ` Luis R. Rodriguez
2009-03-24 20:31         ` Johannes Berg
2009-03-24 22:04           ` Luis R. Rodriguez
2009-03-28 16:39             ` Bob Copeland [this message]
2009-03-29 23:13               ` Nick Kossifidis
2009-03-29 23:15                 ` Nick Kossifidis
2009-03-30 12:00                   ` Bob Copeland
2009-03-24 20:33         ` Christian Lamparter
2009-03-24 20:58           ` Luis R. Rodriguez
2009-03-24 22:09             ` Bob Copeland
2009-03-24 21:14               ` Luis R. Rodriguez
2009-03-24 22:24             ` Christian Lamparter
2009-03-24 22:30               ` Bob Copeland
2009-03-24 23:13                 ` Luis R. Rodriguez
2009-03-24 23:17                   ` Luis R. Rodriguez
2009-03-24 23:52                     ` Luis R. Rodriguez
2009-03-25  1:06                       ` Bob Copeland
2009-03-25  2:30                         ` Luis R. Rodriguez
2009-03-25  2:59                           ` Luis R. Rodriguez
2009-03-25  3:15                             ` Luis R. Rodriguez
2009-03-25  3:45                               ` Luis R. Rodriguez
2009-03-29 19:39                                 ` Bob Copeland

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=20090328163929.GA24075@hash.localnet \
    --to=me@bobcopeland.com \
    --cc=chunkeey@web.de \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lrodriguez@atheros.com \
    --cc=mickflemm@gmail.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).