aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/rt2x00/rt2x00config.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2008-01-24 13:38:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-29 15:19:32 -0500
commit8318d78a44d49ac1edf2bdec7299de3617c4232e (patch)
treed434634418edd7399737801615d247be06616fdd /drivers/net/wireless/rt2x00/rt2x00config.c
parent10b6b80145cc93887dd8aab99bfffa375e9add31 (diff)
cfg80211 API for channels/bitrates, mac80211 and driver conversion
This patch creates new cfg80211 wiphy API for channel and bitrate registration and converts mac80211 and drivers to the new API. The old mac80211 API is completely ripped out. All drivers (except ath5k) are updated to the new API, in many cases I expect that optimisations can be done. Along with the regulatory code I've also ripped out the IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED flag, I believe it to be unnecessary if the hardware simply gives us whatever channels it wants to support and we then enable/disable them as required, which is pretty much required for travelling. Additionally, the patch adds proper "basic" rate handling for STA mode interface, AP mode interface will have to have new API added to allow userspace to set the basic rate set, currently it'll be empty... However, the basic rate handling will need to be moved to the BSS conf stuff. I do expect there to be bugs in this, especially wrt. transmit power handling where I'm basically clueless about how it should work. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> 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.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c
index 20231e0c53fa..9fba485a40ac 100644
--- a/drivers/net/wireless/rt2x00/rt2x00config.c
+++ b/drivers/net/wireless/rt2x00/rt2x00config.c
@@ -152,7 +152,7 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
152 struct ieee80211_conf *conf, const int force_config) 152 struct ieee80211_conf *conf, const int force_config)
153{ 153{
154 struct rt2x00lib_conf libconf; 154 struct rt2x00lib_conf libconf;
155 struct ieee80211_hw_mode *mode; 155 struct ieee80211_supported_band *band;
156 struct ieee80211_rate *rate; 156 struct ieee80211_rate *rate;
157 struct antenna_setup *default_ant = &rt2x00dev->default_ant; 157 struct antenna_setup *default_ant = &rt2x00dev->default_ant;
158 struct antenna_setup *active_ant = &rt2x00dev->link.ant.active; 158 struct antenna_setup *active_ant = &rt2x00dev->link.ant.active;
@@ -172,9 +172,9 @@ void rt2x00lib_config(struct rt2x00_dev *rt2x00dev,
172 * Check which configuration options have been 172 * Check which configuration options have been
173 * updated and should be send to the device. 173 * updated and should be send to the device.
174 */ 174 */
175 if (rt2x00dev->rx_status.phymode != conf->phymode) 175 if (rt2x00dev->rx_status.band != conf->channel->band)
176 flags |= CONFIG_UPDATE_PHYMODE; 176 flags |= CONFIG_UPDATE_PHYMODE;
177 if (rt2x00dev->rx_status.channel != conf->channel) 177 if (rt2x00dev->rx_status.freq != conf->channel->center_freq)
178 flags |= CONFIG_UPDATE_CHANNEL; 178 flags |= CONFIG_UPDATE_CHANNEL;
179 if (rt2x00dev->tx_power != conf->power_level) 179 if (rt2x00dev->tx_power != conf->power_level)
180 flags |= CONFIG_UPDATE_TXPOWER; 180 flags |= CONFIG_UPDATE_TXPOWER;
@@ -229,33 +229,31 @@ config:
229 memset(&libconf, 0, sizeof(libconf)); 229 memset(&libconf, 0, sizeof(libconf));
230 230
231 if (flags & CONFIG_UPDATE_PHYMODE) { 231 if (flags & CONFIG_UPDATE_PHYMODE) {
232 switch (conf->phymode) { 232 switch (conf->channel->band) {
233 case MODE_IEEE80211A: 233 case IEEE80211_BAND_5GHZ:
234 libconf.phymode = HWMODE_A; 234 libconf.phymode = HWMODE_A;
235 break; 235 break;
236 case MODE_IEEE80211B: 236 case IEEE80211_BAND_2GHZ:
237 libconf.phymode = HWMODE_B; 237 /* Uh oh. what about B? */
238 break;
239 case MODE_IEEE80211G:
240 libconf.phymode = HWMODE_G; 238 libconf.phymode = HWMODE_G;
241 break; 239 break;
242 default: 240 default:
243 ERROR(rt2x00dev, 241 ERROR(rt2x00dev,
244 "Attempt to configure unsupported mode (%d)" 242 "Attempt to configure unsupported mode (%d)"
245 "Defaulting to 802.11b", conf->phymode); 243 "Defaulting to 802.11b", conf->channel->band);
246 libconf.phymode = HWMODE_B; 244 libconf.phymode = HWMODE_B;
247 } 245 }
248 246
249 mode = &rt2x00dev->hwmodes[libconf.phymode]; 247 band = &rt2x00dev->bands[conf->channel->band];
250 rate = &mode->rates[mode->num_rates - 1]; 248 rate = &band->bitrates[band->n_bitrates - 1];
251 249
252 libconf.basic_rates = 250 libconf.basic_rates =
253 DEVICE_GET_RATE_FIELD(rate->val, RATEMASK) & DEV_BASIC_RATEMASK; 251 DEVICE_GET_RATE_FIELD(rate->hw_value, RATEMASK) & DEV_BASIC_RATEMASK;
254 } 252 }
255 253
256 if (flags & CONFIG_UPDATE_CHANNEL) { 254 if (flags & CONFIG_UPDATE_CHANNEL) {
257 memcpy(&libconf.rf, 255 memcpy(&libconf.rf,
258 &rt2x00dev->spec.channels[conf->channel_val], 256 &rt2x00dev->spec.channels[conf->channel->hw_value],
259 sizeof(libconf.rf)); 257 sizeof(libconf.rf));
260 } 258 }
261 259
@@ -301,12 +299,11 @@ config:
301 rt2x00lib_reset_link_tuner(rt2x00dev); 299 rt2x00lib_reset_link_tuner(rt2x00dev);
302 300
303 if (flags & CONFIG_UPDATE_PHYMODE) { 301 if (flags & CONFIG_UPDATE_PHYMODE) {
304 rt2x00dev->curr_hwmode = libconf.phymode; 302 rt2x00dev->curr_band = conf->channel->band;
305 rt2x00dev->rx_status.phymode = conf->phymode; 303 rt2x00dev->rx_status.band = conf->channel->band;
306 } 304 }
307 305
308 rt2x00dev->rx_status.freq = conf->freq; 306 rt2x00dev->rx_status.freq = conf->channel->center_freq;
309 rt2x00dev->rx_status.channel = conf->channel;
310 rt2x00dev->tx_power = conf->power_level; 307 rt2x00dev->tx_power = conf->power_level;
311 308
312 if (flags & CONFIG_UPDATE_ANTENNA) { 309 if (flags & CONFIG_UPDATE_ANTENNA) {