ath5k 802.11j preparation and cleanup
cover ath5k 802.11j preparation and cleanup
This series prepares ath5k for 802.11j (4.9GHz) support but most of the patches are just cleaning up things i found in the process. 802.11j is still not enabled.
bruno
---
Bruno Randolf (8):
ath5k: Use mac80211 channel mapping function
ath5k: Simplify loop when setting up channels
ath5k: Rename ath5k_copy_channels
ath5k: ath5k_setup_channels cleanup and whitespace
ath5k: Add 802.11j 4.9GHz channels to allowed channels
ath5: Remove unused CTL definitions
ath5k: Remove unused sc->curmode
ath5k: Remove redundant sc->curband
drivers/net/wireless/ath/ath5k/base.c | 95 +++++++++++-------------------- drivers/net/wireless/ath/ath5k/base.h | 3 - drivers/net/wireless/ath/ath5k/eeprom.h | 23 -------- 3 files changed, 34 insertions(+), 87 deletions(-)
Signature · 1 line
Signature
PATCH 1/8 ath5k: Use mac80211 channel mapping function
Use mac80211 channel mapping function instead of own homegrown version.
--- drivers/net/wireless/ath/ath5k/base.c | 23 ++++++++--------------- 1 files changed, 8 insertions(+), 15 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +8 -15
@@ -242,18 +242,6 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re\********************/ /* -* Convert IEEE channel number to MHz frequency. -*/ -static inline short -ath5k_ieee2mhz (short chan) -{ -if (chan <=14 || chan >=27 ) -return ieee80211chan2mhz (chan); -else -return 2212 + chan *20 ; -} - -/* * Returns true for the channel numbers used without all_channels modparam. */ static bool ath5k_is_standard_channel (short chan)
@@ -274,6 +262,7 @@ ath5k_copy_channels(struct ath5k_hw *ah, unsigned int max) {unsigned int i, count, size, chfreq, freq, ch; +enum ieee80211_band band;if (!test_bit (mode, ah->ah_modes))return 0 ;
@@ -283,11 +272,13 @@ ath5k_copy_channels(struct ath5k_hw *ah,/* 1..220, but 2GHz frequencies are filtered by check_channel */ size =220 ; chfreq =CHANNEL_5GHZ ; + band =IEEE80211_BAND_5GHZ ;break ;case AR5K_MODE_11B :case AR5K_MODE_11G : size =26 ; chfreq =CHANNEL_2GHZ ; + band =IEEE80211_BAND_2GHZ ;break ;default :ATH5K_WARN (ah->ah_sc,"bad mode, not copying channels\n" );
@@ -296,7 +287,10 @@ ath5k_copy_channels(struct ath5k_hw *ah,for (i =0 , count =0 ; i < size && max >0 ; i++) { ch = i +1 ; - freq =ath5k_ieee2mhz (ch); + freq =ieee80211_channel_to_frequency (ch, band); + +if (freq ==0 )/* mapping failed - not a standard channel */ +continue ;/* Check if channel is supported by the chipset */ if (!ath5k_channel_ok (ah, freq, chfreq))
@@ -307,8 +301,7 @@ ath5k_copy_channels(struct ath5k_hw *ah,/* Write channel info and increment counter */ channels[count].center_freq = freq; - channels[count].band = (chfreq ==CHANNEL_2GHZ ) ? -IEEE80211_BAND_2GHZ :IEEE80211_BAND_5GHZ ; + channels[count].band = band;switch (mode) {case AR5K_MODE_11A :case AR5K_MODE_11G :
Re: [PATCH 1/8] ath5k: Use mac80211 channel mapping function
Quoted 6 lines · Bruno Randolf
Use mac80211 channel mapping function instead of own homegrown version.
Signed-off-by Bruno Randolf <[email protected]>---
drivers/net/wireless/ath/ath5k/base.c | 23 ++++++++---------------1 files changed, 8 insertions(+), 15 deletions(-)
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
PATCH 2/8 ath5k: Simplify loop when setting up channels
In reply to Bruno RandolfSimplify confusing code and get rid of an unnecessary variable.
--- drivers/net/wireless/ath/ath5k/base.c | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +3 -4
@@ -261,7 +261,7 @@ ath5k_copy_channels(struct ath5k_hw *ah, unsigned int mode, unsigned int max) { -unsigned int i, count, size, chfreq, freq, ch; +unsigned int count, size, chfreq, freq, ch;enum ieee80211_band band;if (!test_bit (mode, ah->ah_modes))
@@ -285,8 +285,8 @@ ath5k_copy_channels(struct ath5k_hw *ah,return 0 ; } -for (i =0 , count =0 ; i < size && max >0 ; i++) { - ch = i +1 ; + count =0 ; +for (ch =1 ; ch < size && count <= max; ch++) { freq =ieee80211_channel_to_frequency (ch, band);if (freq ==0 )/* mapping failed - not a standard channel */
@@ -312,7 +312,6 @@ ath5k_copy_channels(struct ath5k_hw *ah, } count++; - max--; }return count;
Re: [PATCH 2/8] ath5k: Simplify loop when setting up channels
drivers/net/wireless/ath/ath5k/base.c ath5k_copy_channels(struct ath5k_hw *ah, · line 289
Quoted 13 lines · Bruno Randolf
Simplify confusing code and get rid of an unnecessary variable.
Signed-off-by Bruno Randolf <[email protected]>drivers/net/wireless/ath/ath5k/base.c +2
-2@@ -285,8 +285,8 @@ ath5k_copy_channels(struct ath5k_hw *ah, return 0; } - for (i = 0, count = 0; i < size && max > 0; i++) { - ch = i + 1 ; + count = 0; + for (ch = 1; ch < size && count <= max; ch++) {
Should be <= size now, right? And maybe rename size to max_channel or something like that.
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Re: [PATCH 2/8] ath5k: Simplify loop when setting up channels
Quoted 10 lines · On Wed January 19 2011 20:07:28 you wrote:
Quoted 9 lines · Bruno Randolf
Simplify confusing code and get rid of an unnecessary variable.
Signed-off-by Bruno Randolf <[email protected]>drivers/net/wireless/ath/ath5k/base.c +0
-0@@ -285,8 +285,8 @@ ath5k_copy_channels(struct ath5k_hw *ah,return 0 ; }
Quoted 7 lines
drivers/net/wireless/ath/ath5k/base.c ath5k_copy_channels(struct ath5k_hw *ah, · line 289
Quoted 4 lines
drivers/net/wireless/ath/ath5k/base.c +2
-2-for (i =0 , count =0 ; i < size && max >0 ; i++) { - ch = i +1 ; + count =0 ; +for (ch =1 ; ch < size && count <= max; ch++) {Should be <= size now, right? And maybe rename size to
max_channelor something like that.
Oh, yeah. Will fix.
bruno
PATCH 3/8 ath5k: Rename ath5k_copy_channels
In reply to Bruno RandolfRename ath5k_copy_channels() to ath5k_setup_channels() - nothing is copied here.
--- drivers/net/wireless/ath/ath5k/base.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +4 -4
@@ -256,7 +256,7 @@ static bool ath5k_is_standard_channel(short chan) }static unsigned int -ath5k_copy_channels (struct ath5k_hw *ah, +ath5k_setup_channels (struct ath5k_hw *ah,struct ieee80211_channel *channels,unsigned int mode,unsigned int max)
@@ -356,7 +356,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw) sband->n_bitrates =12 ; sband->channels = sc->channels; - sband->n_channels =ath5k_copy_channels (ah, sband->channels, + sband->n_channels =ath5k_setup_channels (ah, sband->channels,AR5K_MODE_11G , max_c); hw->wiphy->bands[IEEE80211_BAND_2GHZ ] = sband;
@@ -382,7 +382,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw) } sband->channels = sc->channels; - sband->n_channels =ath5k_copy_channels (ah, sband->channels, + sband->n_channels =ath5k_setup_channels (ah, sband->channels,AR5K_MODE_11B , max_c); hw->wiphy->bands[IEEE80211_BAND_2GHZ ] = sband;
@@ -402,7 +402,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw) sband->n_bitrates =8 ; sband->channels = &sc->channels[count_c]; - sband->n_channels =ath5k_copy_channels (ah, sband->channels, + sband->n_channels =ath5k_setup_channels (ah, sband->channels,AR5K_MODE_11A , max_c); hw->wiphy->bands[IEEE80211_BAND_5GHZ ] = sband;
Re: [PATCH 3/8] ath5k: Rename ath5k_copy_channels
Quoted 41 lines · Bruno Randolf
Rename
ath5k_copy_channels()toath5k_setup_channels()- nothing is copied here.Signed-off-by Bruno Randolf <[email protected]>---
drivers/net/wireless/ath/ath5k/base.c | 8 ++++----1 files changed, 4 insertions(+), 4 deletions(-)drivers/net/wireless/ath/ath5k/base.c +0
-0@@ -256,7 +256,7 @@ static bool ath5k_is_standard_channel(short chan) }static unsigned int
drivers/net/wireless/ath/ath5k/base.c +1
-1-ath5k_copy_channels(struct ath5k_hw *ah, +ath5k_setup_channels(struct ath5k_hw *ah,struct
ieee80211_channel*channels, unsigned int mode,
unsigned int max)drivers/net/wireless/ath/ath5k/base.c +2
-2@@ -356,7 +356,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw) sband->n_bitrates = 12; sband->channels = sc->channels; - sband->n_channels = ath5k_copy_channels(ah, sband->channels, + sband->n_channels = ath5k_setup_channels(ah, sband->channels, AR5K_MODE_11G, max_c); hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;@@ -382,7 +382,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw) } sband->channels = sc->channels; - sband->n_channels = ath5k_copy_channels(ah, sband->channels, + sband->n_channels = ath5k_setup_channels(ah, sband->channels, AR5K_MODE_11B, max_c); hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
drivers/net/wireless/ath/ath5k/base.c ath5k_setup_bands(struct ieee80211_hw *hw) · line 408
Quoted 8 lines
drivers/net/wireless/ath/ath5k/base.c +1
-1@@ -402,7 +402,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw) sband->n_bitrates = 8; sband->channels = &sc->channels[count_c]; - sband->n_channels = ath5k_copy_channels(ah, sband->channels, + sband->n_channels = ath5k_setup_channels(ah, sband->channels, AR5K_MODE_11A, max_c); hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband;
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Re: [PATCH 3/8] ath5k: Rename ath5k_copy_channels
In reply to Bruno Randolf2011/1/19 Bruno Randolf <[email protected]>:
Quoted 41 lines
Rename
ath5k_copy_channels()toath5k_setup_channels()- nothing is copied here.Signed-off-by Bruno Randolf <[email protected]>---
drivers/net/wireless/ath/ath5k/base.c | 8 ++++----1 files changed, 4 insertions(+), 4 deletions(-)drivers/net/wireless/ath/ath5k/base.c +0
-0@@ -256,7 +256,7 @@ static bool ath5k_is_standard_channel(short chan) }static unsigned int
drivers/net/wireless/ath/ath5k/base.c +1
-1-ath5k_copy_channels(struct ath5k_hw *ah, +ath5k_setup_channels(struct ath5k_hw *ah,struct
ieee80211_channel*channels, unsigned int mode,
unsigned int max)drivers/net/wireless/ath/ath5k/base.c +2
-2@@ -356,7 +356,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw) sband->n_bitrates = 12; sband->channels = sc->channels; - sband->n_channels = ath5k_copy_channels(ah, sband->channels, + sband->n_channels = ath5k_setup_channels(ah, sband->channels, AR5K_MODE_11G, max_c); hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;@@ -382,7 +382,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw) } sband->channels = sc->channels; - sband->n_channels = ath5k_copy_channels(ah, sband->channels, + sband->n_channels = ath5k_setup_channels(ah, sband->channels, AR5K_MODE_11B, max_c); hw->wiphy->bands[IEEE80211_BAND_2GHZ] = sband;
drivers/net/wireless/ath/ath5k/base.c ath5k_setup_bands(struct ieee80211_hw *hw) · line 408
Quoted 8 lines
drivers/net/wireless/ath/ath5k/base.c +1
-1@@ -402,7 +402,7 @@ ath5k_setup_bands(struct ieee80211_hw *hw) sband->n_bitrates = 8; sband->channels = &sc->channels[count_c]; - sband->n_channels = ath5k_copy_channels(ah, sband->channels, + sband->n_channels = ath5k_setup_channels(ah, sband->channels, AR5K_MODE_11A, max_c); hw->wiphy->bands[IEEE80211_BAND_5GHZ] = sband;
Signature · 3 lines
GPG ID: 0xD21DB2DB As you read this post global entropy rises. Have Fun ;-) Nick
PATCH 4/8 ath5k: ath5k_setup_channels cleanup and whitespace
In reply to Bruno RandolfRemove useless test_bit - it's not going to happen because of the way this function is called only when that bit is set.
And fix some whitespace.
--- drivers/net/wireless/ath/ath5k/base.c | 11 +++-------- 1 files changed, 3 insertions(+), 8 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +3 -8
@@ -256,21 +256,16 @@ static bool ath5k_is_standard_channel(short chan) }static unsigned int -ath5k_setup_channels (struct ath5k_hw *ah, -struct ieee80211_channel *channels, -unsigned int mode, -unsigned int max) +ath5k_setup_channels (struct ath5k_hw *ah,struct ieee80211_channel *channels, +unsigned int mode,unsigned int max) {unsigned int count, size, chfreq, freq, ch;enum ieee80211_band band; -if (!test_bit (mode, ah->ah_modes)) -return 0 ; -switch (mode) {case AR5K_MODE_11A :/* 1..220, but 2GHz frequencies are filtered by check_channel */ - size =220 ; + size =220 ; chfreq =CHANNEL_5GHZ ; band =IEEE80211_BAND_5GHZ ;break ;
Re: [PATCH 4/8] ath5k: ath5k_setup_channels cleanup and whitespace
Quoted 6 lines · Bruno Randolf
Remove useless
test_bit- it's not going to happen because of the way this function is called only when that bit is set.And fix some whitespace.
Signed-off-by Bruno Randolf <[email protected]>
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Re: [PATCH 4/8] ath5k: ath5k_setup_channels cleanup and whitespace
In reply to Bruno Randolf2011/1/19 Bruno Randolf <[email protected]>:
Quoted 28 lines
Remove useless
test_bit- it's not going to happen because of the way this function is called only when that bit is set.And fix some whitespace.
Signed-off-by Bruno Randolf <[email protected]>---
drivers/net/wireless/ath/ath5k/base.c | 11 +++--------1 files changed, 3 insertions(+), 8 deletions(-)drivers/net/wireless/ath/ath5k/base.c +0
-0@@ -256,21 +256,16 @@ static bool ath5k_is_standard_channel(short chan) }static unsigned int
drivers/net/wireless/ath/ath5k/base.c +2
-4-ath5k_setup_channels(struct ath5k_hw *ah, - struct ieee80211_channel *channels, - unsigned int mode, - unsigned int max) +ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels, + unsigned int mode, unsigned int max){
unsigned int count, size, chfreq, freq, ch; enumieee80211_bandband;
Quoted 12 lines
- if (!test_bit(mode,
ah->ah_modes))
- return 0;
-
switch (mode) {
caseAR5K_MODE_11A:
/* 1..220, but 2GHz frequencies are filtered bycheck_channel*/
- size = 220 ;
+ size = 220;
chfreq =CHANNEL_5GHZ;
band =IEEE80211_BAND_5GHZ;
break;
Signature · 3 lines
GPG ID: 0xD21DB2DB As you read this post global entropy rises. Have Fun ;-) Nick
PATCH 5/8 ath5k: Add 802.11j 4.9GHz channels to allowed channels
In reply to Bruno RandolfAdd the 802.11j (20MHz channel width) channels to the allowed channels. This still does not enable 802.11j in ath5k since these frequencies are out of the configured range. A later patch will deal with that.
--- drivers/net/wireless/ath/ath5k/base.c | 19 +++++++++++++------ 1 files changed, 13 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +13 -6
@@ -244,15 +244,21 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re/* * Returns true for the channel numbers used without all_channels modparam. */ -static bool ath5k_is_standard_channel (short chan) +static bool ath5k_is_standard_channel (short chan,enum ieee80211_band band) { -return ((chan <=14 ) || -/* UNII 1,2 */ - ((chan &3 ) ==0 && chan >=36 && chan <=64 ) || +if (band ==IEEE80211_BAND_2GHZ && chan <=14 ) +return true; + +return /* 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 )); + ((chan &3 ) ==1 && chan >=149 && chan <=165 ) || +/* 802.11j 5.030-5.080 GHz (20MHz) */ + (chan ==8 || chan ==12 || chan ==16 ) || +/* 802.11j 4.9GHz (20MHz) */ + (chan ==184 || chan ==188 || chan ==192 || chan ==196 )); } static unsigned int
@@ -291,7 +297,8 @@ ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels,if (!ath5k_channel_ok (ah, freq, chfreq))continue ; -if (!modparam_all_channels && !ath5k_is_standard_channel (ch)) +if (!modparam_all_channels && + !ath5k_is_standard_channel (ch, band))continue ;/* Write channel info and increment counter */
Re: [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels
Quoted 9 lines · Bruno Randolf
Add the 802.11j (20MHz channel width) channels to the allowed channels. This still does not enable 802.11j in ath5k since these frequencies are out of the configured range. A later patch will deal with that.
Signed-off-by Bruno Randolf <[email protected]>---
drivers/net/wireless/ath/ath5k/base.c +1
-1-static bool ath5k_is_standard_channel (short chan) +static bool ath5k_is_standard_channel (short chan,enum ieee80211_band band)
Quoted 6 lines
{
- return ((chan <= 14) ||
- /* UNII 1,2 */
- ((chan & 3) == 0 && chan >= 36 && chan <= 64) ||
+ if (band ==IEEE80211_BAND_2GHZ&& chan <= 14)
+ return true;
This routine is only used to post-filter the channels so I don't think we need to check the band. It's mostly just to weed out all of the 10 mhz-spaced 5 ghz channels we used to export.
Quoted 4 lines
- ((chan & 3) == 1 && chan >= 149 && chan <= 165));
+ ((chan & 3) == 1 && chan >= 149 && chan <= 165) ||
+ /* 802.11j 5.030-5.080 GHz (20MHz) */
+ (chan == 8 || chan == 12 || chan == 16) ||
Ok I was also going to complain that some channel numbers < 14 were valid in the 5 ghz band but you know that :)
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Re: [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels
Quoted 21 lines · On Wed January 19 2011 20:14:41 Bob Copeland wrote:
Quoted 10 lines · Bruno Randolf
Add the 802.11j (20MHz channel width) channels to the allowed channels. This still does not enable 802.11j in ath5k since these frequencies are out of the configured range. A later patch will deal with that.
Signed-off-by Bruno Randolf <[email protected]>---
(quoted diff) +1
-1-static bool ath5k_is_standard_channel(short chan) +static bool ath5k_is_standard_channel(short chan, enum ieee80211_bandband) {
drivers/net/wireless/ath/ath5k/base.c static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re · line 250
Quoted 5 lines
drivers/net/wireless/ath/ath5k/base.c +2
-3- return ((chan <= 14) || - /* UNII 1,2 */ - ((chan & 3) == 0 && chan >= 36 && chan <= 64) || +if (band ==IEEE80211_BAND_2GHZ && chan <=14 ) +return true;This routine is only used to post-filter the channels so I don't think we need to check the band. It's mostly just to weed out all of the 10 mhz-spaced 5 ghz channels we used to export.
Quoted 7 lines
drivers/net/wireless/ath/ath5k/base.c static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re · line 259
Quoted 4 lines
drivers/net/wireless/ath/ath5k/base.c +3
-1- ((chan & 3) == 1 && chan >= 149 && chan <= 165)); + ((chan &3 ) ==1 && chan >=149 && chan <=165 ) || +/* 802.11j 5.030-5.080 GHz (20MHz) */ + (chan == 8 || chan == 12 || chan == 16) ||Ok I was also going to complain that some channel numbers < 14 were valid in the 5 ghz band but you know that :)
That's also the reason why we need to know the band:
in 2GHz all channels < 14 are allowed.
in 5GHz only a few.
Thanks for your review!
bruno
Bob Copeland
Acked-byRe: [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels
On Wed, Jan 19, 2011 at 6:52 AM, Bruno Randolf <[email protected]> > That's also the reason why we need to know the band:
Quoted 5 lines
in 2GHz all channels < 14 are allowed.
in 5GHz only a few.Thanks for your review!
Oh, I get it now, yes, that makes sense :)
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Re: [PATCH 5/8] ath5k: Add 802.11j 4.9GHz channels to allowed channels
In reply to Bruno Randolf2011/1/19 Bruno Randolf <[email protected]>:
Quoted 42 lines
Add the 802.11j (20MHz channel width) channels to the allowed channels. This still does not enable 802.11j in ath5k since these frequencies are out of the configured range. A later patch will deal with that.
Signed-off-by Bruno Randolf <[email protected]>---
drivers/net/wireless/ath/ath5k/base.c | 19 +++++++++++++------1 files changed, 13 insertions(+), 6 deletions(-)drivers/net/wireless/ath/ath5k/base.c +6
-4@@ -244,15 +244,21 @@ static int ath5k_reg_notifier(struct wiphy *wiphy, struct regulatory_request *re /** Returns true for the channel numbers used without all_channels modparam. */ -static bool ath5k_is_standard_channel (short chan) +static bool ath5k_is_standard_channel (short chan,enum ieee80211_band band) { - return ((chan <= 14) || - /* UNII 1,2 */ - ((chan & 3) == 0 && chan >= 36 && chan <= 64) || + if (band == IEEE80211_BAND_2GHZ && chan <= 14) + return true; + + return /* 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));
+ ((chan & 3) == 1 && chan >= 149 && chan <= 165) ||
+ /* 802.11j 5.030-5.080 GHz (20MHz) */
+ (chan == 8 || chan == 12 || chan == 16) ||
+ /* 802.11j 4.9GHz (20MHz) */
+ (chan == 184 || chan == 188 || chan == 192 || chan == 196)); }static unsigned int
drivers/net/wireless/ath/ath5k/base.c ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels, · line 304
Quoted 9 lines
drivers/net/wireless/ath/ath5k/base.c +2
-1@@ -291,7 +297,8 @@ ath5k_setup_channels(struct ath5k_hw *ah, struct ieee80211_channel *channels, if (!ath5k_channel_ok(ah, freq, chfreq)) continue; - if (!modparam_all_channels && !ath5k_is_standard_channel(ch)) + if (!modparam_all_channels && + !ath5k_is_standard_channel(ch, band)) continue; /* Write channel info and increment counter */
Signature · 3 lines
GPG ID: 0xD21DB2DB As you read this post global entropy rises. Have Fun ;-) Nick
PATCH 6/8 ath5: Remove unused CTL definitions
In reply to Bruno RandolfThey are unused in ath5k and a more detailled definition is in ath/regd_common.h.
--- drivers/net/wireless/ath/ath5k/eeprom.h | 23 ----------------------- 1 files changed, 0 insertions(+), 23 deletions(-)
drivers/net/wireless/ath/ath5k/eeprom.h +0 -23
@@ -268,29 +268,6 @@ enum ath5k_ctl_mode { AR5K_CTL_MODE_M = 15, }; -/* Default CTL ids for the 3 main reg domains. -* Atheros only uses these by default but vendors -* can have up to 32 different CTLs for different -* scenarios. Note that theese values are ORed with -* the mode id (above) so we can have up to 24 CTL -* datasets out of these 3 main regdomains. That leaves -* 8 ids that can be used by vendors and since 0x20 is -* missing from HAL sources i guess this is the set of -* custom CTLs vendors can use. */ -#define AR5K_CTL_FCC 0x10 -#define AR5K_CTL_CUSTOM 0x20 -#define AR5K_CTL_ETSI 0x30 -#define AR5K_CTL_MKK 0x40 - -/* Indicates a CTL with only mode set and -* no reg domain mapping, such CTLs are used -* for world roaming domains or simply when -* a reg domain is not set */ -#define AR5K_CTL_NO_REGDOMAIN 0xf0 - -/* Indicates an empty (invalid) CTL */ -#define AR5K_CTL_NO_CTL 0xff -/* Per channel calibration data, used for power table setup */ struct ath5k_chan_pcal_info_rf5111 {/* Power levels in half dbm units
Re: [PATCH 6/8] ath5: Remove unused CTL definitions
Quoted 4 lines · Bruno Randolf
They are unused in ath5k and a more detailled definition is in
ath/regd_common.h.Signed-off-by Bruno Randolf <[email protected]>
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Re: [PATCH 6/8] ath5: Remove unused CTL definitions
In reply to Bruno Randolf2011/1/19 Bruno Randolf <[email protected]>:
Quoted 33 lines
They are unused in ath5k and a more detailled definition is in
ath/regd_common.h.Signed-off-by Bruno Randolf <[email protected]>---
drivers/net/wireless/ath/ath5k/eeprom.h | 23 -----------------------1 files changed, 0 insertions(+), 23 deletions(-)drivers/net/wireless/ath/ath5k/eeprom.h +0
-16@@ -268,29 +268,6 @@ enum ath5k_ctl_mode { AR5K_CTL_MODE_M = 15, }; -/* Default CTL ids for the 3 main reg domains. -* Atheros only uses these by default but vendors -* can have up to 32 different CTLs for different -* scenarios. Note that theese values are ORed with -* the mode id (above) so we can have up to 24 CTL -* datasets out of these 3 main regdomains. That leaves -* 8 ids that can be used by vendors and since 0x20 is -* missing from HAL sources i guess this is the set of -* custom CTLs vendors can use. */ -#define AR5K_CTL_FCC 0x10 -#define AR5K_CTL_CUSTOM 0x20 -#define AR5K_CTL_ETSI 0x30 -#define AR5K_CTL_MKK 0x40 - -/* Indicates a CTL with only mode set and -* no reg domain mapping, such CTLs are used
drivers/net/wireless/ath/ath5k/eeprom.h enum ath5k_ctl_mode { · line 273
Quoted 10 lines
drivers/net/wireless/ath/ath5k/eeprom.h +0
-7-* for world roaming domains or simply when -* a reg domain is not set */ -#define AR5K_CTL_NO_REGDOMAIN 0xf0 - -/* Indicates an empty (invalid) CTL */ -#define AR5K_CTL_NO_CTL 0xff - /* Per channel calibration data, used for power table setup */ struct ath5k_chan_pcal_info_rf5111 { /* Power levels in half dbm units
Signature · 3 lines
GPG ID: 0xD21DB2DB As you read this post global entropy rises. Have Fun ;-) Nick
PATCH 7/8 ath5k: Remove unused sc->curmode
In reply to Bruno Randolfsc->curmode is set but never used. Remove it and the helper function. Also the ath5k_rate_update which is refered to in the comment does not exist (any more?) so we don't need to setup the band in that place.
--- drivers/net/wireless/ath/ath5k/base.c | 18 ------------------ drivers/net/wireless/ath/ath5k/base.h | 1 - 2 files changed, 0 insertions(+), 19 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +0 -18
@@ -439,18 +439,6 @@ ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan)return ath5k_reset (sc, chan, true); } -static void -ath5k_setcurmode (struct ath5k_softc *sc,unsigned int mode) -{ - sc->curmode = mode; - -if (mode ==AR5K_MODE_11A ) { - sc->curband = &sc->sbands[IEEE80211_BAND_5GHZ ]; - }else { - sc->curband = &sc->sbands[IEEE80211_BAND_2GHZ ]; - } -} -struct ath_vif_iter_data {const u8 *hw_macaddr;u8 mask[ETH_ALEN ];
@@ -2776,12 +2764,6 @@ ath5k_init(struct ieee80211_hw *hw) goto err; } -/* NB: setup here so ath5k_rate_update is happy */ -if (test_bit (AR5K_MODE_11A , ah->ah_modes)) -ath5k_setcurmode (sc,AR5K_MODE_11A ); -else -ath5k_setcurmode (sc,AR5K_MODE_11B ); -/* * Allocate tx+rx descriptors and populate the lists. */
drivers/net/wireless/ath/ath5k/base.h +0 -1
@@ -202,7 +202,6 @@ struct ath5k_softc {#define ATH_STAT_STARTED 4/* opened & irqs enabled */ unsigned int filter_flags;/* HW flags, AR5K_RX_FILTER_* */ -unsigned int curmode;/* current phy mode */ struct ieee80211_channel *curchan;/* current h/w channel */ u16 nvifs;
Re: [PATCH 7/8] ath5k: Remove unused sc->curmode
Quoted 5 lines · Bruno Randolf
sc->curmodeis set but never used. Remove it and the helper function. Also theath5k_rate_updatewhich is refered to in the comment does not exist (any more?) so we don't need to setup the band in that place.Signed-off-by Bruno Randolf <[email protected]>
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Re: [PATCH 7/8] ath5k: Remove unused sc->curmode
In reply to Bruno Randolf2011/1/19 Bruno Randolf <[email protected]>:
Quoted 57 lines
sc->curmodeis set but never used. Remove it and the helper function. Also theath5k_rate_updatewhich is refered to in the comment does not exist (any more?) so we don't need to setup the band in that place.Signed-off-by Bruno Randolf <[email protected]>---
drivers/net/wireless/ath/ath5k/base.c | 18 ------------------drivers/net/wireless/ath/ath5k/base.h| 1 -2 files changed, 0 insertions(+), 19 deletions(-)drivers/net/wireless/ath/ath5k/base.c +0
-18@@ -439,18 +439,6 @@ ath5k_chan_set(struct ath5k_softc *sc, struct ieee80211_channel *chan) return ath5k_reset(sc, chan, true); } -static void -ath5k_setcurmode (struct ath5k_softc *sc,unsigned int mode) -{ - sc->curmode = mode; - - if (mode == AR5K_MODE_11A) { - sc->curband = &sc->sbands[IEEE80211_BAND_5GHZ]; - } else { - sc->curband = &sc->sbands[IEEE80211_BAND_2GHZ]; - } -} - struct ath_vif_iter_data { const u8 *hw_macaddr; u8 mask[ETH_ALEN];@@ -2776,12 +2764,6 @@ ath5k_init(struct ieee80211_hw *hw) goto err; } - /* NB: setup here so ath5k_rate_update is happy */ - if (test_bit(AR5K_MODE_11A, ah->ah_modes)) - ath5k_setcurmode(sc, AR5K_MODE_11A); - else - ath5k_setcurmode(sc, AR5K_MODE_11B); - /** Allocate tx+rx descriptors and populate the lists. */ drivers/net/wireless/ath/ath5k/base.h +0
-0@@ -202,7 +202,6 @@ struct ath5k_softc { #define ATH_STAT_STARTED 4 /* opened & irqs enabled */unsigned int filter_flags; /* HW flags, AR5K_RX_FILTER_* */
- unsigned int curmode; /* current phy mode */ structieee80211_channel*curchan; /* current h/w channel */
Quoted 2 lines
u16 nvifs;
Signature · 3 lines
GPG ID: 0xD21DB2DB As you read this post global entropy rises. Have Fun ;-) Nick
PATCH 8/8 ath5k: Remove redundant sc->curband
In reply to Bruno RandolfRemove sc->curband because the band is already stored in the current channel.
--- drivers/net/wireless/ath/ath5k/base.c | 11 ++++------- drivers/net/wireless/ath/ath5k/base.h | 2 -- 2 files changed, 4 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath5k/base.c +4 -7
@@ -551,7 +551,7 @@ ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix) "hw_rix out of bounds: %x\n", hw_rix))return 0 ; - rix = sc->rate_idx[sc->curband->band][hw_rix]; + rix = sc->rate_idx[sc->curchan->band][hw_rix];if (WARN (rix <0 ,"invalid hw_rix: %x\n" , hw_rix)) rix =0 ;
@@ -1361,7 +1361,7 @@ ath5k_receive_frame(struct ath5k_softc *sc, struct sk_buff *skb, rxs->flag |=RX_FLAG_TSFT ; rxs->freq = sc->curchan->center_freq; - rxs->band = sc->curband->band; + rxs->band = sc->curchan->band; rxs->signal = sc->ah->ah_noise_floor + rs->rs_rssi;
@@ -1376,7 +1376,7 @@ ath5k_receive_frame(struct ath5k_softc *sc, struct sk_buff *skb, rxs->flag |=ath5k_rx_decrypted (sc, skb, rs);if (rxs->rate_idx >=0 && rs->rs_rate == - sc->curband->bitrates[rxs->rate_idx].hw_value_short) + sc->sbands[sc->curchan->band].bitrates[rxs->rate_idx].hw_value_short) rxs->flag |=RX_FLAG_SHORTPRE ;ath5k_debug_dump_skb (sc, skb,"RX " ,0 );
@@ -2536,7 +2536,6 @@ ath5k_init_hw(struct ath5k_softc *sc)* and then setup of the interrupt mask. */ sc->curchan = sc->hw->conf.channel; - sc->curband = &sc->sbands[sc->curchan->band]; sc->imask =AR5K_INT_RXOK |AR5K_INT_RXERR |AR5K_INT_RXEOL |AR5K_INT_RXORN |AR5K_INT_TXDESC |AR5K_INT_TXEOL |AR5K_INT_FATAL |AR5K_INT_GLOBAL |AR5K_INT_MIB ;
@@ -2663,10 +2662,8 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,* so we should also free any remaining * tx buffers */ ath5k_drain_tx_buffs (sc); -if (chan) { +if (chan) sc->curchan = chan; - sc->curband = &sc->sbands[chan->band]; - } ret =ath5k_hw_reset (ah, sc->opmode, sc->curchan, chan !=NULL , skip_pcu);if (ret) {
drivers/net/wireless/ath/ath5k/base.h +0 -2
@@ -183,8 +183,6 @@ struct ath5k_softc {enum nl80211_iftype opmode;struct ath5k_hw *ah;/* Atheros HW */ -struct ieee80211_supported_band *curband; -#ifdef CONFIG_ATH5K_DEBUG struct ath5k_dbg_info debug;/* debug info */ #endif /* CONFIG_ATH5K_DEBUG */
Re: [PATCH 8/8] ath5k: Remove redundant sc->curband
Quoted 3 lines · Bruno Randolf
Remove
sc->curbandbecause the band is already stored in the current channel.Signed-off-by Bruno Randolf <[email protected]>
Nice cleanup series!
Signature · 1 line
Bob Copeland %% www.bobcopeland.com
Re: [PATCH 8/8] ath5k: Remove redundant sc->curband
In reply to Bruno Randolf2011/1/19 Bruno Randolf <[email protected]>:
Quoted 67 lines
Remove
sc->curbandbecause the band is already stored in the current channel.Signed-off-by Bruno Randolf <[email protected]>---
drivers/net/wireless/ath/ath5k/base.c | 11 ++++-------drivers/net/wireless/ath/ath5k/base.h| 2 --2 files changed, 4 insertions(+), 9 deletions(-)drivers/net/wireless/ath/ath5k/base.c +2
-2@@ -551,7 +551,7 @@ ath5k_hw_to_driver_rix(struct ath5k_softc *sc, int hw_rix) "hw_rix out of bounds: %x\n", hw_rix)) return 0; - rix = sc->rate_idx[sc->curband->band][hw_rix]; + rix = sc->rate_idx[sc->curchan->band][hw_rix]; if (WARN(rix < 0, "invalid hw_rix: %x\n", hw_rix)) rix = 0;@@ -1361,7 +1361,7 @@ ath5k_receive_frame(struct ath5k_softc *sc, struct sk_buff *skb, rxs->flag |= RX_FLAG_TSFT; rxs->freq = sc->curchan->center_freq; - rxs->band = sc->curband->band; + rxs->band = sc->curchan->band; rxs->signal = sc->ah->ah_noise_floor + rs->rs_rssi;@@ -1376,7 +1376,7 @@ ath5k_receive_frame(struct ath5k_softc *sc, struct sk_buff *skb, rxs->flag |= ath5k_rx_decrypted(sc, skb, rs);if (
rxs->rate_idx>= 0 &&rs->rs_rate==
- sc->curband->bitrates[rxs->rate_idx].hw_value_short)
+ sc->sbands[sc->curchan->band].bitrates[rxs->rate_idx].hw_value_short)rxs->flag|=RX_FLAG_SHORTPRE;ath5k_debug_dump_skb(sc, skb, "RX ", 0);
drivers/net/wireless/ath/ath5k/base.c +0
-1@@ -2536,7 +2536,6 @@ ath5k_init_hw(struct ath5k_softc *sc)* and then setup of the interrupt mask. */ sc->curchan = sc->hw->conf.channel; - sc->curband = &sc->sbands[sc->curchan->band];sc->imask =
AR5K_INT_RXOK|AR5K_INT_RXERR|AR5K_INT_RXEOL|AR5K_INT_RXORN | AR5K_INT_TXDESC | AR5K_INT_TXEOL | AR5K_INT_FATAL | AR5K_INT_GLOBAL | AR5K_INT_MIB;drivers/net/wireless/ath/ath5k/base.c +1
-3@@ -2663,10 +2662,8 @@ ath5k_reset(struct ath5k_softc *sc, struct ieee80211_channel *chan,* so we should also free any remaining * tx buffers */ ath5k_drain_tx_buffs(sc); - if (chan) { + if (chan) sc->curchan = chan; - sc->curband = &sc->sbands[chan->band]; - } ret = ath5k_hw_reset(ah, sc->opmode, sc->curchan, chan != NULL, skip_pcu); if (ret) {drivers/net/wireless/ath/ath5k/base.h +0
-0@@ -183,8 +183,6 @@ struct ath5k_softc { enum nl80211_iftype opmode;struct
ath5k_hw*ah; /* Atheros HW */
Quoted 6 lines
- struct
ieee80211_supported_band*curband; -
#ifdefCONFIG_ATH5K_DEBUG
structath5k_dbg_infodebug; /* debug info */ #endif /*CONFIG_ATH5K_DEBUG*/
Signature · 3 lines
GPG ID: 0xD21DB2DB As you read this post global entropy rises. Have Fun ;-) Nick
Nick Kossifidis
maintainer2011/1/19 Bruno Randolf <[email protected]>:
Quoted 19 lines
This series prepares ath5k for 802.11j (4.9GHz) support but most of the patches are just cleaning up things i found in the process. 802.11j is still not enabled.
bruno
---
Bruno Randolf (8):
ath5k: Use mac80211 channel mapping function
ath5k: Simplify loop when setting up channels
ath5k: Renameath5k_copy_channels
ath5k:ath5k_setup_channelscleanup and whitespace
ath5k: Add 802.11j 4.9GHz channels to allowed channels
ath5: Remove unused CTL definitions
ath5k: Remove unusedsc->curmode
ath5k: Remove redundantsc->curband
Quoted 7 lines
drivers/net/wireless/ath/ath5k/base.c | 95 +++++++++++--------------------
drivers/net/wireless/ath/ath5k/base.h| 3 -drivers/net/wireless/ath/ath5k/eeprom.h| 23 --------3 files changed, 34 insertions(+), 87 deletions(-)--
Signature
Nice clean up !
Signature · 3 lines
GPG ID: 0xD21DB2DB As you read this post global entropy rises. Have Fun ;-) Nick