diff options
author | Ivo van Doorn <IvDoorn@gmail.com> | 2007-10-06 07:34:52 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:55:15 -0400 |
commit | 5c58ee51ff8c0aca74c225e0263bc5dd2b917781 (patch) | |
tree | a08e875dade8a6f55d45419b728b2b077cec6dc0 /drivers/net/wireless/rt2x00/rt2x00config.c | |
parent | 4f5af6eb3d17f8e343597ea99d97eb2f2905b2fb (diff) |
[PATCH] rt2x00: Reorganize configuration handler
Reorganize configuration handling by creating a extra
structure which contains precalculated values based
on the mac80211 values which are usefull for all
individual drivers.
This also fixes the preamble configuration problem,
up untill now preamble was never configured since
by default the rate->val value was used when changing
the mode.
Now rate->val will only be used to set the basic rate mask.
The preamble configuration will now be done correctly
through the erp_ie_changed callback function.
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00config.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00config.c | 61 |
1 files changed, 60 insertions, 1 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c index f8e87aa86335..12914cf7156c 100644 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ b/drivers/net/wireless/rt2x00/rt2x00config.c | |||
@@ -97,7 +97,11 @@ void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, const int type) | |||
97 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, | 97 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, |
98 | struct ieee80211_conf *conf, const int force_config) | 98 | struct ieee80211_conf *conf, const int force_config) |
99 | { | 99 | { |
100 | struct rt2x00lib_conf libconf; | ||
101 | struct ieee80211_hw_mode *mode; | ||
102 | struct ieee80211_rate *rate; | ||
100 | int flags = 0; | 103 | int flags = 0; |
104 | int short_slot_time; | ||
101 | 105 | ||
102 | /* | 106 | /* |
103 | * In some situations we want to force all configurations | 107 | * In some situations we want to force all configurations |
@@ -128,8 +132,62 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, | |||
128 | flags |= CONFIG_UPDATE_SLOT_TIME; | 132 | flags |= CONFIG_UPDATE_SLOT_TIME; |
129 | flags |= CONFIG_UPDATE_BEACON_INT; | 133 | flags |= CONFIG_UPDATE_BEACON_INT; |
130 | 134 | ||
135 | /* | ||
136 | * We have determined what options should be updated, | ||
137 | * now precalculate device configuration values depending | ||
138 | * on what configuration options need to be updated. | ||
139 | */ | ||
131 | config: | 140 | config: |
132 | rt2x00dev->ops->lib->config(rt2x00dev, flags, conf); | 141 | memset(&libconf, 0, sizeof(libconf)); |
142 | |||
143 | if (flags & CONFIG_UPDATE_PHYMODE) { | ||
144 | switch (conf->phymode) { | ||
145 | case MODE_IEEE80211A: | ||
146 | libconf.phymode = HWMODE_A; | ||
147 | break; | ||
148 | case MODE_IEEE80211B: | ||
149 | libconf.phymode = HWMODE_B; | ||
150 | break; | ||
151 | case MODE_IEEE80211G: | ||
152 | libconf.phymode = HWMODE_G; | ||
153 | break; | ||
154 | default: | ||
155 | ERROR(rt2x00dev, | ||
156 | "Attempt to configure unsupported mode (%d)" | ||
157 | "Defaulting to 802.11b", conf->phymode); | ||
158 | libconf.phymode = HWMODE_B; | ||
159 | } | ||
160 | |||
161 | mode = &rt2x00dev->hwmodes[libconf.phymode]; | ||
162 | rate = &mode->rates[mode->num_rates - 1]; | ||
163 | |||
164 | libconf.basic_rates = | ||
165 | DEVICE_GET_RATE_FIELD(rate->val, RATEMASK) & DEV_BASIC_RATEMASK; | ||
166 | } | ||
167 | |||
168 | if (flags & CONFIG_UPDATE_CHANNEL) { | ||
169 | memcpy(&libconf.rf, | ||
170 | &rt2x00dev->spec.channels[conf->channel_val], | ||
171 | sizeof(libconf.rf)); | ||
172 | } | ||
173 | |||
174 | if (flags & CONFIG_UPDATE_SLOT_TIME) { | ||
175 | short_slot_time = conf->flags & IEEE80211_CONF_SHORT_SLOT_TIME; | ||
176 | |||
177 | libconf.slot_time = | ||
178 | short_slot_time ? SHORT_SLOT_TIME : SLOT_TIME; | ||
179 | libconf.sifs = SIFS; | ||
180 | libconf.pifs = short_slot_time ? SHORT_PIFS : PIFS; | ||
181 | libconf.difs = short_slot_time ? SHORT_DIFS : DIFS; | ||
182 | libconf.eifs = EIFS; | ||
183 | } | ||
184 | |||
185 | libconf.conf = conf; | ||
186 | |||
187 | /* | ||
188 | * Start configuration. | ||
189 | */ | ||
190 | rt2x00dev->ops->lib->config(rt2x00dev, flags, &libconf); | ||
133 | 191 | ||
134 | /* | 192 | /* |
135 | * Some configuration changes affect the link quality | 193 | * Some configuration changes affect the link quality |
@@ -138,6 +196,7 @@ config: | |||
138 | if (flags & (CONFIG_UPDATE_CHANNEL | CONFIG_UPDATE_ANTENNA)) | 196 | if (flags & (CONFIG_UPDATE_CHANNEL | CONFIG_UPDATE_ANTENNA)) |
139 | rt2x00lib_reset_link_tuner(rt2x00dev); | 197 | rt2x00lib_reset_link_tuner(rt2x00dev); |
140 | 198 | ||
199 | rt2x00dev->curr_hwmode = libconf.phymode; | ||
141 | rt2x00dev->rx_status.phymode = conf->phymode; | 200 | rt2x00dev->rx_status.phymode = conf->phymode; |
142 | rt2x00dev->rx_status.freq = conf->freq; | 201 | rt2x00dev->rx_status.freq = conf->freq; |
143 | rt2x00dev->rx_status.channel = conf->channel; | 202 | rt2x00dev->rx_status.channel = conf->channel; |