diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-02-03 09:49:59 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-02-29 15:19:28 -0500 |
commit | 6bb40dd13b458beb55f5c60dba1cb28e814bd640 (patch) | |
tree | 9b2aaa0de4a4d72a7afc3550b08572083b111c57 /drivers/net/wireless/rt2x00/rt2400pci.c | |
parent | 9404ef34e4747228717d6e22ce3827ed366ccf41 (diff) |
rt2x00: Add per-interface structure
Rework the interface handling. Delete the interface structure
and replace it with a per-interface structure. This changes the
way rt2x00 handles the active interface drastically.
Copy ieee80211_bss_conf to the this rt2x00_intf structure during
the bss_info_changed() callback function. This will allow us to
reference it later, and removes the requirement for the device flag
SHORT_PREAMBLE flag which is interface specific.
Drivers receive the option to give the maximum number of virtual
interfaces the device can handle. Virtual interface support:
rt2400pci: 1 sta or 1 ap, * monitor interfaces
rt2500pci: 1 sta or 1 ap, * monitor interfaces
rt2500usb: 1 sta or 1 ap, * monitor interfaces
rt61pci: 1 sta or 4 ap, * monitor interfaces
rt73usb: 1 sta or 4 ap, * monitor interfaces
At the moment none of the drivers support AP and STA interfaces
simultaneously, this is a hardware limitation so future support
will be very unlikely.
Each interface structure receives its dedicated beacon entry,
with this we can easily work with beaconing while multiple master
mode interfaces are currently active.
The configuration handlers for the MAC, BSSID and type are
often called together since they all belong to the interface
configuration. Merge the 3 configuration calls and cleanup
the API between rt2x00lib and the drivers. While we are cleaning
up the interface configuration anyway, we might as well clean up
the configuration handler as well.
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/rt2400pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 84 |
1 files changed, 43 insertions, 41 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index fc161084a8d3..61766ed800e3 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -246,50 +246,50 @@ static int rt2400pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) | |||
246 | /* | 246 | /* |
247 | * Configuration handlers. | 247 | * Configuration handlers. |
248 | */ | 248 | */ |
249 | static void rt2400pci_config_mac_addr(struct rt2x00_dev *rt2x00dev, | 249 | static void rt2400pci_config_intf(struct rt2x00_dev *rt2x00dev, |
250 | __le32 *mac) | 250 | struct rt2x00_intf *intf, |
251 | struct rt2x00intf_conf *conf, | ||
252 | const unsigned int flags) | ||
251 | { | 253 | { |
252 | rt2x00pci_register_multiwrite(rt2x00dev, CSR3, mac, | 254 | unsigned int bcn_preload; |
253 | (2 * sizeof(__le32))); | 255 | u32 reg; |
254 | } | ||
255 | 256 | ||
256 | static void rt2400pci_config_bssid(struct rt2x00_dev *rt2x00dev, | 257 | if (flags & CONFIG_UPDATE_TYPE) { |
257 | __le32 *bssid) | 258 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); |
258 | { | ||
259 | rt2x00pci_register_multiwrite(rt2x00dev, CSR5, bssid, | ||
260 | (2 * sizeof(__le32))); | ||
261 | } | ||
262 | 259 | ||
263 | static void rt2400pci_config_type(struct rt2x00_dev *rt2x00dev, const int type, | 260 | /* |
264 | const int tsf_sync) | 261 | * Enable beacon config |
265 | { | 262 | */ |
266 | u32 reg; | 263 | bcn_preload = PREAMBLE + get_duration(IEEE80211_HEADER, 20); |
264 | rt2x00pci_register_read(rt2x00dev, BCNCSR1, ®); | ||
265 | rt2x00_set_field32(®, BCNCSR1_PRELOAD, bcn_preload); | ||
266 | rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg); | ||
267 | 267 | ||
268 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); | 268 | /* |
269 | * Enable synchronisation. | ||
270 | */ | ||
271 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | ||
272 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
273 | rt2x00_set_field32(®, CSR14_TBCN, | ||
274 | (conf->sync == TSF_SYNC_BEACON)); | ||
275 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); | ||
276 | rt2x00_set_field32(®, CSR14_TSF_SYNC, conf->sync); | ||
277 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
278 | } | ||
269 | 279 | ||
270 | /* | 280 | if (flags & CONFIG_UPDATE_MAC) |
271 | * Enable beacon config | 281 | rt2x00pci_register_multiwrite(rt2x00dev, CSR3, |
272 | */ | 282 | conf->mac, sizeof(conf->mac)); |
273 | rt2x00pci_register_read(rt2x00dev, BCNCSR1, ®); | ||
274 | rt2x00_set_field32(®, BCNCSR1_PRELOAD, | ||
275 | PREAMBLE + get_duration(IEEE80211_HEADER, 20)); | ||
276 | rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg); | ||
277 | 283 | ||
278 | /* | 284 | if (flags & CONFIG_UPDATE_BSSID) |
279 | * Enable synchronisation. | 285 | rt2x00pci_register_multiwrite(rt2x00dev, CSR5, |
280 | */ | 286 | conf->bssid, sizeof(conf->bssid)); |
281 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | ||
282 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | ||
283 | rt2x00_set_field32(®, CSR14_TBCN, (tsf_sync == TSF_SYNC_BEACON)); | ||
284 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); | ||
285 | rt2x00_set_field32(®, CSR14_TSF_SYNC, tsf_sync); | ||
286 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
287 | } | 287 | } |
288 | 288 | ||
289 | static void rt2400pci_config_preamble(struct rt2x00_dev *rt2x00dev, | 289 | static int rt2400pci_config_preamble(struct rt2x00_dev *rt2x00dev, |
290 | const int short_preamble, | 290 | const int short_preamble, |
291 | const int ack_timeout, | 291 | const int ack_timeout, |
292 | const int ack_consume_time) | 292 | const int ack_consume_time) |
293 | { | 293 | { |
294 | int preamble_mask; | 294 | int preamble_mask; |
295 | u32 reg; | 295 | u32 reg; |
@@ -327,6 +327,8 @@ static void rt2400pci_config_preamble(struct rt2x00_dev *rt2x00dev, | |||
327 | rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84); | 327 | rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84); |
328 | rt2x00_set_field32(®, ARCSR2_LENGTH, get_duration(ACK_SIZE, 110)); | 328 | rt2x00_set_field32(®, ARCSR2_LENGTH, get_duration(ACK_SIZE, 110)); |
329 | rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); | 329 | rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); |
330 | |||
331 | return 0; | ||
330 | } | 332 | } |
331 | 333 | ||
332 | static void rt2400pci_config_phymode(struct rt2x00_dev *rt2x00dev, | 334 | static void rt2400pci_config_phymode(struct rt2x00_dev *rt2x00dev, |
@@ -481,8 +483,8 @@ static void rt2400pci_config_duration(struct rt2x00_dev *rt2x00dev, | |||
481 | } | 483 | } |
482 | 484 | ||
483 | static void rt2400pci_config(struct rt2x00_dev *rt2x00dev, | 485 | static void rt2400pci_config(struct rt2x00_dev *rt2x00dev, |
484 | const unsigned int flags, | 486 | struct rt2x00lib_conf *libconf, |
485 | struct rt2x00lib_conf *libconf) | 487 | const unsigned int flags) |
486 | { | 488 | { |
487 | if (flags & CONFIG_UPDATE_PHYMODE) | 489 | if (flags & CONFIG_UPDATE_PHYMODE) |
488 | rt2400pci_config_phymode(rt2x00dev, libconf->basic_rates); | 490 | rt2400pci_config_phymode(rt2x00dev, libconf->basic_rates); |
@@ -1553,9 +1555,7 @@ static const struct rt2x00lib_ops rt2400pci_rt2x00_ops = { | |||
1553 | .write_tx_data = rt2x00pci_write_tx_data, | 1555 | .write_tx_data = rt2x00pci_write_tx_data, |
1554 | .kick_tx_queue = rt2400pci_kick_tx_queue, | 1556 | .kick_tx_queue = rt2400pci_kick_tx_queue, |
1555 | .fill_rxdone = rt2400pci_fill_rxdone, | 1557 | .fill_rxdone = rt2400pci_fill_rxdone, |
1556 | .config_mac_addr = rt2400pci_config_mac_addr, | 1558 | .config_intf = rt2400pci_config_intf, |
1557 | .config_bssid = rt2400pci_config_bssid, | ||
1558 | .config_type = rt2400pci_config_type, | ||
1559 | .config_preamble = rt2400pci_config_preamble, | 1559 | .config_preamble = rt2400pci_config_preamble, |
1560 | .config = rt2400pci_config, | 1560 | .config = rt2400pci_config, |
1561 | }; | 1561 | }; |
@@ -1590,6 +1590,8 @@ static const struct data_queue_desc rt2400pci_queue_atim = { | |||
1590 | 1590 | ||
1591 | static const struct rt2x00_ops rt2400pci_ops = { | 1591 | static const struct rt2x00_ops rt2400pci_ops = { |
1592 | .name = KBUILD_MODNAME, | 1592 | .name = KBUILD_MODNAME, |
1593 | .max_sta_intf = 1, | ||
1594 | .max_ap_intf = 1, | ||
1593 | .eeprom_size = EEPROM_SIZE, | 1595 | .eeprom_size = EEPROM_SIZE, |
1594 | .rf_size = RF_SIZE, | 1596 | .rf_size = RF_SIZE, |
1595 | .rx = &rt2400pci_queue_rx, | 1597 | .rx = &rt2400pci_queue_rx, |