diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-03-09 17:48:08 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-03-13 19:31:42 -0400 |
commit | aa776721b472e343a8db7f3c0673b1fa24e6c7f7 (patch) | |
tree | b3bb79f05cdd729696877783bb25da7c3a7dd3c0 /drivers/net/wireless | |
parent | fd3c91c5e57eef8db71cf52e2473832c330bf5db (diff) |
rt2x00: Fix basic rate initialization
The basic rate which is configured in the register
should not match all supported rates, but only the _basic_ rates.
Fix this by adding a new flag to the rt2x00_rate structure
and whenever the mode is changed, loop over all available rates
for that band to get the basic rate mask.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00config.c | 19 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 38 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00lib.h | 14 |
4 files changed, 38 insertions, 37 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index a324ff3ed7e7..ea2786ce1cf5 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -441,8 +441,8 @@ struct rt2x00lib_conf { | |||
441 | 441 | ||
442 | enum ieee80211_band band; | 442 | enum ieee80211_band band; |
443 | 443 | ||
444 | int basic_rates; | 444 | u32 basic_rates; |
445 | int slot_time; | 445 | u32 slot_time; |
446 | 446 | ||
447 | short sifs; | 447 | short sifs; |
448 | short pifs; | 448 | short pifs; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c index 72111694154e..5e2d81a9e438 100644 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ b/drivers/net/wireless/rt2x00/rt2x00config.c | |||
@@ -145,12 +145,26 @@ void rt2x00lib_config_antenna(struct rt2x00_dev *rt2x00dev, | |||
145 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK); | 145 | rt2x00lib_toggle_rx(rt2x00dev, STATE_RADIO_RX_ON_LINK); |
146 | } | 146 | } |
147 | 147 | ||
148 | static u32 rt2x00lib_get_basic_rates(struct ieee80211_supported_band *band) | ||
149 | { | ||
150 | const struct rt2x00_rate *rate; | ||
151 | unsigned int i; | ||
152 | u32 mask = 0; | ||
153 | |||
154 | for (i = 0; i < band->n_bitrates; i++) { | ||
155 | rate = rt2x00_get_rate(band->bitrates[i].hw_value); | ||
156 | if (rate->flags & DEV_RATE_BASIC) | ||
157 | mask |= rate->ratemask; | ||
158 | } | ||
159 | |||
160 | return mask; | ||
161 | } | ||
162 | |||
148 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, | 163 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, |
149 | struct ieee80211_conf *conf, const int force_config) | 164 | struct ieee80211_conf *conf, const int force_config) |
150 | { | 165 | { |
151 | struct rt2x00lib_conf libconf; | 166 | struct rt2x00lib_conf libconf; |
152 | struct ieee80211_supported_band *band; | 167 | struct ieee80211_supported_band *band; |
153 | struct ieee80211_rate *rate; | ||
154 | struct antenna_setup *default_ant = &rt2x00dev->default_ant; | 168 | struct antenna_setup *default_ant = &rt2x00dev->default_ant; |
155 | struct antenna_setup *active_ant = &rt2x00dev->link.ant.active; | 169 | struct antenna_setup *active_ant = &rt2x00dev->link.ant.active; |
156 | int flags = 0; | 170 | int flags = 0; |
@@ -227,10 +241,9 @@ config: | |||
227 | 241 | ||
228 | if (flags & CONFIG_UPDATE_PHYMODE) { | 242 | if (flags & CONFIG_UPDATE_PHYMODE) { |
229 | band = &rt2x00dev->bands[conf->channel->band]; | 243 | band = &rt2x00dev->bands[conf->channel->band]; |
230 | rate = &band->bitrates[band->n_bitrates - 1]; | ||
231 | 244 | ||
232 | libconf.band = conf->channel->band; | 245 | libconf.band = conf->channel->band; |
233 | libconf.basic_rates = rt2x00_get_rate(rate->hw_value)->ratemask; | 246 | libconf.basic_rates = rt2x00lib_get_basic_rates(band); |
234 | } | 247 | } |
235 | 248 | ||
236 | if (flags & CONFIG_UPDATE_CHANNEL) { | 249 | if (flags & CONFIG_UPDATE_CHANNEL) { |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index d6b12789ba77..eb2d21c4e8e9 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -766,75 +766,75 @@ EXPORT_SYMBOL_GPL(rt2x00lib_write_tx_desc); | |||
766 | */ | 766 | */ |
767 | const struct rt2x00_rate rt2x00_supported_rates[12] = { | 767 | const struct rt2x00_rate rt2x00_supported_rates[12] = { |
768 | { | 768 | { |
769 | .flags = DEV_RATE_CCK, | 769 | .flags = DEV_RATE_CCK | DEV_RATE_BASIC, |
770 | .bitrate = 10, | 770 | .bitrate = 10, |
771 | .ratemask = DEV_RATEMASK_1MB, | 771 | .ratemask = BIT(0), |
772 | .plcp = 0x00, | 772 | .plcp = 0x00, |
773 | }, | 773 | }, |
774 | { | 774 | { |
775 | .flags = DEV_RATE_CCK | DEV_RATE_SHORT_PREAMBLE, | 775 | .flags = DEV_RATE_CCK | DEV_RATE_SHORT_PREAMBLE | DEV_RATE_BASIC, |
776 | .bitrate = 20, | 776 | .bitrate = 20, |
777 | .ratemask = DEV_RATEMASK_2MB, | 777 | .ratemask = BIT(1), |
778 | .plcp = 0x01, | 778 | .plcp = 0x01, |
779 | }, | 779 | }, |
780 | { | 780 | { |
781 | .flags = DEV_RATE_CCK | DEV_RATE_SHORT_PREAMBLE, | 781 | .flags = DEV_RATE_CCK | DEV_RATE_SHORT_PREAMBLE | DEV_RATE_BASIC, |
782 | .bitrate = 55, | 782 | .bitrate = 55, |
783 | .ratemask = DEV_RATEMASK_5_5MB, | 783 | .ratemask = BIT(2), |
784 | .plcp = 0x02, | 784 | .plcp = 0x02, |
785 | }, | 785 | }, |
786 | { | 786 | { |
787 | .flags = DEV_RATE_CCK | DEV_RATE_SHORT_PREAMBLE, | 787 | .flags = DEV_RATE_CCK | DEV_RATE_SHORT_PREAMBLE | DEV_RATE_BASIC, |
788 | .bitrate = 110, | 788 | .bitrate = 110, |
789 | .ratemask = DEV_RATEMASK_11MB, | 789 | .ratemask = BIT(3), |
790 | .plcp = 0x03, | 790 | .plcp = 0x03, |
791 | }, | 791 | }, |
792 | { | 792 | { |
793 | .flags = DEV_RATE_OFDM, | 793 | .flags = DEV_RATE_OFDM | DEV_RATE_BASIC, |
794 | .bitrate = 60, | 794 | .bitrate = 60, |
795 | .ratemask = DEV_RATEMASK_6MB, | 795 | .ratemask = BIT(4), |
796 | .plcp = 0x0b, | 796 | .plcp = 0x0b, |
797 | }, | 797 | }, |
798 | { | 798 | { |
799 | .flags = DEV_RATE_OFDM, | 799 | .flags = DEV_RATE_OFDM, |
800 | .bitrate = 90, | 800 | .bitrate = 90, |
801 | .ratemask = DEV_RATEMASK_9MB, | 801 | .ratemask = BIT(5), |
802 | .plcp = 0x0f, | 802 | .plcp = 0x0f, |
803 | }, | 803 | }, |
804 | { | 804 | { |
805 | .flags = DEV_RATE_OFDM, | 805 | .flags = DEV_RATE_OFDM | DEV_RATE_BASIC, |
806 | .bitrate = 120, | 806 | .bitrate = 120, |
807 | .ratemask = DEV_RATEMASK_12MB, | 807 | .ratemask = BIT(6), |
808 | .plcp = 0x0a, | 808 | .plcp = 0x0a, |
809 | }, | 809 | }, |
810 | { | 810 | { |
811 | .flags = DEV_RATE_OFDM, | 811 | .flags = DEV_RATE_OFDM, |
812 | .bitrate = 180, | 812 | .bitrate = 180, |
813 | .ratemask = DEV_RATEMASK_18MB, | 813 | .ratemask = BIT(7), |
814 | .plcp = 0x0e, | 814 | .plcp = 0x0e, |
815 | }, | 815 | }, |
816 | { | 816 | { |
817 | .flags = DEV_RATE_OFDM, | 817 | .flags = DEV_RATE_OFDM | DEV_RATE_BASIC, |
818 | .bitrate = 240, | 818 | .bitrate = 240, |
819 | .ratemask = DEV_RATEMASK_24MB, | 819 | .ratemask = BIT(8), |
820 | .plcp = 0x09, | 820 | .plcp = 0x09, |
821 | }, | 821 | }, |
822 | { | 822 | { |
823 | .flags = DEV_RATE_OFDM, | 823 | .flags = DEV_RATE_OFDM, |
824 | .bitrate = 360, | 824 | .bitrate = 360, |
825 | .ratemask = DEV_RATEMASK_36MB, | 825 | .ratemask = BIT(9), |
826 | .plcp = 0x0d, | 826 | .plcp = 0x0d, |
827 | }, | 827 | }, |
828 | { | 828 | { |
829 | .flags = DEV_RATE_OFDM, | 829 | .flags = DEV_RATE_OFDM, |
830 | .bitrate = 480, | 830 | .bitrate = 480, |
831 | .ratemask = DEV_RATEMASK_48MB, | 831 | .ratemask = BIT(10), |
832 | .plcp = 0x08, | 832 | .plcp = 0x08, |
833 | }, | 833 | }, |
834 | { | 834 | { |
835 | .flags = DEV_RATE_OFDM, | 835 | .flags = DEV_RATE_OFDM, |
836 | .bitrate = 540, | 836 | .bitrate = 540, |
837 | .ratemask = DEV_RATEMASK_54MB, | 837 | .ratemask = BIT(11), |
838 | .plcp = 0x0c, | 838 | .plcp = 0x0c, |
839 | }, | 839 | }, |
840 | }; | 840 | }; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index a15227d2fe40..e4b4dd23d611 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -41,22 +41,10 @@ struct rt2x00_rate { | |||
41 | #define DEV_RATE_CCK 0x0001 | 41 | #define DEV_RATE_CCK 0x0001 |
42 | #define DEV_RATE_OFDM 0x0002 | 42 | #define DEV_RATE_OFDM 0x0002 |
43 | #define DEV_RATE_SHORT_PREAMBLE 0x0004 | 43 | #define DEV_RATE_SHORT_PREAMBLE 0x0004 |
44 | #define DEV_RATE_BASIC 0x0008 | ||
44 | 45 | ||
45 | unsigned short bitrate; /* In 100kbit/s */ | 46 | unsigned short bitrate; /* In 100kbit/s */ |
46 | |||
47 | unsigned short ratemask; | 47 | unsigned short ratemask; |
48 | #define DEV_RATEMASK_1MB ( (1 << 1) - 1 ) | ||
49 | #define DEV_RATEMASK_2MB ( (1 << 2) - 1 ) | ||
50 | #define DEV_RATEMASK_5_5MB ( (1 << 3) - 1 ) | ||
51 | #define DEV_RATEMASK_11MB ( (1 << 4) - 1 ) | ||
52 | #define DEV_RATEMASK_6MB ( (1 << 5) - 1 ) | ||
53 | #define DEV_RATEMASK_9MB ( (1 << 6) - 1 ) | ||
54 | #define DEV_RATEMASK_12MB ( (1 << 7) - 1 ) | ||
55 | #define DEV_RATEMASK_18MB ( (1 << 8) - 1 ) | ||
56 | #define DEV_RATEMASK_24MB ( (1 << 9) - 1 ) | ||
57 | #define DEV_RATEMASK_36MB ( (1 << 10) - 1 ) | ||
58 | #define DEV_RATEMASK_48MB ( (1 << 11) - 1 ) | ||
59 | #define DEV_RATEMASK_54MB ( (1 << 12) - 1 ) | ||
60 | 48 | ||
61 | unsigned short plcp; | 49 | unsigned short plcp; |
62 | }; | 50 | }; |