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/rt2500pci.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/rt2500pci.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 98 |
1 files changed, 52 insertions, 46 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 0a54b6512207..6a558bf74f11 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -246,53 +246,53 @@ static int rt2500pci_rfkill_poll(struct rt2x00_dev *rt2x00dev) | |||
246 | /* | 246 | /* |
247 | * Configuration handlers. | 247 | * Configuration handlers. |
248 | */ | 248 | */ |
249 | static void rt2500pci_config_mac_addr(struct rt2x00_dev *rt2x00dev, | 249 | static void rt2500pci_config_intf(struct rt2x00_dev *rt2x00dev, |
250 | __le32 *mac) | 250 | struct rt2x00_intf *intf, |
251 | { | 251 | struct rt2x00intf_conf *conf, |
252 | rt2x00pci_register_multiwrite(rt2x00dev, CSR3, mac, | 252 | const unsigned int flags) |
253 | (2 * sizeof(__le32))); | ||
254 | } | ||
255 | |||
256 | static void rt2500pci_config_bssid(struct rt2x00_dev *rt2x00dev, | ||
257 | __le32 *bssid) | ||
258 | { | ||
259 | rt2x00pci_register_multiwrite(rt2x00dev, CSR5, bssid, | ||
260 | (2 * sizeof(__le32))); | ||
261 | } | ||
262 | |||
263 | static void rt2500pci_config_type(struct rt2x00_dev *rt2x00dev, const int type, | ||
264 | const int tsf_sync) | ||
265 | { | 253 | { |
266 | struct data_queue *queue = | 254 | struct data_queue *queue = |
267 | rt2x00queue_get_queue(rt2x00dev, IEEE80211_TX_QUEUE_BEACON); | 255 | rt2x00queue_get_queue(rt2x00dev, IEEE80211_TX_QUEUE_BEACON); |
256 | unsigned int bcn_preload; | ||
268 | u32 reg; | 257 | u32 reg; |
269 | 258 | ||
270 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); | 259 | if (flags & CONFIG_UPDATE_TYPE) { |
260 | rt2x00pci_register_write(rt2x00dev, CSR14, 0); | ||
271 | 261 | ||
272 | /* | 262 | /* |
273 | * Enable beacon config | 263 | * Enable beacon config |
274 | */ | 264 | */ |
275 | rt2x00pci_register_read(rt2x00dev, BCNCSR1, ®); | 265 | bcn_preload = PREAMBLE + get_duration(IEEE80211_HEADER, 20); |
276 | rt2x00_set_field32(®, BCNCSR1_PRELOAD, | 266 | rt2x00pci_register_read(rt2x00dev, BCNCSR1, ®); |
277 | PREAMBLE + get_duration(IEEE80211_HEADER, 20)); | 267 | rt2x00_set_field32(®, BCNCSR1_PRELOAD, bcn_preload); |
278 | rt2x00_set_field32(®, BCNCSR1_BEACON_CWMIN, queue->cw_min); | 268 | rt2x00_set_field32(®, BCNCSR1_BEACON_CWMIN, queue->cw_min); |
279 | rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg); | 269 | rt2x00pci_register_write(rt2x00dev, BCNCSR1, reg); |
280 | 270 | ||
281 | /* | 271 | /* |
282 | * Enable synchronisation. | 272 | * Enable synchronisation. |
283 | */ | 273 | */ |
284 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); | 274 | rt2x00pci_register_read(rt2x00dev, CSR14, ®); |
285 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); | 275 | rt2x00_set_field32(®, CSR14_TSF_COUNT, 1); |
286 | rt2x00_set_field32(®, CSR14_TBCN, (tsf_sync == TSF_SYNC_BEACON)); | 276 | rt2x00_set_field32(®, CSR14_TBCN, |
287 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); | 277 | (conf->sync == TSF_SYNC_BEACON)); |
288 | rt2x00_set_field32(®, CSR14_TSF_SYNC, tsf_sync); | 278 | rt2x00_set_field32(®, CSR14_BEACON_GEN, 0); |
289 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | 279 | rt2x00_set_field32(®, CSR14_TSF_SYNC, conf->sync); |
280 | rt2x00pci_register_write(rt2x00dev, CSR14, reg); | ||
281 | } | ||
282 | |||
283 | if (flags & CONFIG_UPDATE_MAC) | ||
284 | rt2x00pci_register_multiwrite(rt2x00dev, CSR3, | ||
285 | conf->mac, sizeof(conf->mac)); | ||
286 | |||
287 | if (flags & CONFIG_UPDATE_BSSID) | ||
288 | rt2x00pci_register_multiwrite(rt2x00dev, CSR5, | ||
289 | conf->bssid, sizeof(conf->bssid)); | ||
290 | } | 290 | } |
291 | 291 | ||
292 | static void rt2500pci_config_preamble(struct rt2x00_dev *rt2x00dev, | 292 | static int rt2500pci_config_preamble(struct rt2x00_dev *rt2x00dev, |
293 | const int short_preamble, | 293 | const int short_preamble, |
294 | const int ack_timeout, | 294 | const int ack_timeout, |
295 | const int ack_consume_time) | 295 | const int ack_consume_time) |
296 | { | 296 | { |
297 | int preamble_mask; | 297 | int preamble_mask; |
298 | u32 reg; | 298 | u32 reg; |
@@ -330,6 +330,8 @@ static void rt2500pci_config_preamble(struct rt2x00_dev *rt2x00dev, | |||
330 | rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84); | 330 | rt2x00_set_field32(®, ARCSR5_SERVICE, 0x84); |
331 | rt2x00_set_field32(®, ARCSR2_LENGTH, get_duration(ACK_SIZE, 110)); | 331 | rt2x00_set_field32(®, ARCSR2_LENGTH, get_duration(ACK_SIZE, 110)); |
332 | rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); | 332 | rt2x00pci_register_write(rt2x00dev, ARCSR5, reg); |
333 | |||
334 | return 0; | ||
333 | } | 335 | } |
334 | 336 | ||
335 | static void rt2500pci_config_phymode(struct rt2x00_dev *rt2x00dev, | 337 | static void rt2500pci_config_phymode(struct rt2x00_dev *rt2x00dev, |
@@ -529,8 +531,8 @@ static void rt2500pci_config_duration(struct rt2x00_dev *rt2x00dev, | |||
529 | } | 531 | } |
530 | 532 | ||
531 | static void rt2500pci_config(struct rt2x00_dev *rt2x00dev, | 533 | static void rt2500pci_config(struct rt2x00_dev *rt2x00dev, |
532 | const unsigned int flags, | 534 | struct rt2x00lib_conf *libconf, |
533 | struct rt2x00lib_conf *libconf) | 535 | const unsigned int flags) |
534 | { | 536 | { |
535 | if (flags & CONFIG_UPDATE_PHYMODE) | 537 | if (flags & CONFIG_UPDATE_PHYMODE) |
536 | rt2500pci_config_phymode(rt2x00dev, libconf->basic_rates); | 538 | rt2500pci_config_phymode(rt2x00dev, libconf->basic_rates); |
@@ -609,9 +611,10 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev) | |||
609 | /* | 611 | /* |
610 | * To prevent collisions with MAC ASIC on chipsets | 612 | * To prevent collisions with MAC ASIC on chipsets |
611 | * up to version C the link tuning should halt after 20 | 613 | * up to version C the link tuning should halt after 20 |
612 | * seconds. | 614 | * seconds while being associated. |
613 | */ | 615 | */ |
614 | if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D && | 616 | if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D && |
617 | rt2x00dev->intf_associated && | ||
615 | rt2x00dev->link.count > 20) | 618 | rt2x00dev->link.count > 20) |
616 | return; | 619 | return; |
617 | 620 | ||
@@ -619,9 +622,12 @@ static void rt2500pci_link_tuner(struct rt2x00_dev *rt2x00dev) | |||
619 | 622 | ||
620 | /* | 623 | /* |
621 | * Chipset versions C and lower should directly continue | 624 | * Chipset versions C and lower should directly continue |
622 | * to the dynamic CCA tuning. | 625 | * to the dynamic CCA tuning. Chipset version D and higher |
626 | * should go straight to dynamic CCA tuning when they | ||
627 | * are not associated. | ||
623 | */ | 628 | */ |
624 | if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D) | 629 | if (rt2x00_rev(&rt2x00dev->chip) < RT2560_VERSION_D || |
630 | !rt2x00dev->intf_associated) | ||
625 | goto dynamic_cca_tune; | 631 | goto dynamic_cca_tune; |
626 | 632 | ||
627 | /* | 633 | /* |
@@ -1861,9 +1867,7 @@ static const struct rt2x00lib_ops rt2500pci_rt2x00_ops = { | |||
1861 | .write_tx_data = rt2x00pci_write_tx_data, | 1867 | .write_tx_data = rt2x00pci_write_tx_data, |
1862 | .kick_tx_queue = rt2500pci_kick_tx_queue, | 1868 | .kick_tx_queue = rt2500pci_kick_tx_queue, |
1863 | .fill_rxdone = rt2500pci_fill_rxdone, | 1869 | .fill_rxdone = rt2500pci_fill_rxdone, |
1864 | .config_mac_addr = rt2500pci_config_mac_addr, | 1870 | .config_intf = rt2500pci_config_intf, |
1865 | .config_bssid = rt2500pci_config_bssid, | ||
1866 | .config_type = rt2500pci_config_type, | ||
1867 | .config_preamble = rt2500pci_config_preamble, | 1871 | .config_preamble = rt2500pci_config_preamble, |
1868 | .config = rt2500pci_config, | 1872 | .config = rt2500pci_config, |
1869 | }; | 1873 | }; |
@@ -1898,6 +1902,8 @@ static const struct data_queue_desc rt2500pci_queue_atim = { | |||
1898 | 1902 | ||
1899 | static const struct rt2x00_ops rt2500pci_ops = { | 1903 | static const struct rt2x00_ops rt2500pci_ops = { |
1900 | .name = KBUILD_MODNAME, | 1904 | .name = KBUILD_MODNAME, |
1905 | .max_sta_intf = 1, | ||
1906 | .max_ap_intf = 1, | ||
1901 | .eeprom_size = EEPROM_SIZE, | 1907 | .eeprom_size = EEPROM_SIZE, |
1902 | .rf_size = RF_SIZE, | 1908 | .rf_size = RF_SIZE, |
1903 | .rx = &rt2500pci_queue_rx, | 1909 | .rx = &rt2500pci_queue_rx, |