Commit 42639fcd authored by Bob Copeland's avatar Bob Copeland Committed by John W. Linville

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.  This also halves scan time, from 10 seconds
down to less than 5 when using world regulatory.

Changes-licensed-under: 3-Clause-BSD
Signed-off-by: default avatarBob Copeland <me@bobcopeland.com>
Reported-by: default avatarSimon Farnsworth <simon@farnz.org.uk>
Tested-By: default avatarSimon Farnsworth <simon@farnz.org.uk>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent d5522e03
...@@ -64,6 +64,10 @@ static int modparam_nohwcrypt; ...@@ -64,6 +64,10 @@ static int modparam_nohwcrypt;
module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444); module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption."); 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 * * Internal defines *
...@@ -862,6 +866,20 @@ ath5k_ieee2mhz(short chan) ...@@ -862,6 +866,20 @@ ath5k_ieee2mhz(short chan)
return 2212 + chan * 20; return 2212 + chan * 20;
} }
/*
* Returns true for the channel numbers used 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 static unsigned int
ath5k_copy_channels(struct ath5k_hw *ah, ath5k_copy_channels(struct ath5k_hw *ah,
struct ieee80211_channel *channels, struct ieee80211_channel *channels,
...@@ -899,6 +917,9 @@ ath5k_copy_channels(struct ath5k_hw *ah, ...@@ -899,6 +917,9 @@ ath5k_copy_channels(struct ath5k_hw *ah,
if (!ath5k_channel_ok(ah, freq, chfreq)) if (!ath5k_channel_ok(ah, freq, chfreq))
continue; continue;
if (!modparam_all_channels && !ath5k_is_standard_channel(ch))
continue;
/* Write channel info and increment counter */ /* Write channel info and increment counter */
channels[count].center_freq = freq; channels[count].center_freq = freq;
channels[count].band = (chfreq == CHANNEL_2GHZ) ? channels[count].band = (chfreq == CHANNEL_2GHZ) ?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment