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/rt2x00.h | |
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/rt2x00.h')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 113 |
1 files changed, 83 insertions, 30 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 6a25195816db..2363ca4903cc 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -343,20 +343,22 @@ static inline int rt2x00_update_ant_rssi(struct link *link, int rssi) | |||
343 | 343 | ||
344 | /* | 344 | /* |
345 | * Interface structure | 345 | * Interface structure |
346 | * Configuration details about the current interface. | 346 | * Per interface configuration details, this structure |
347 | * is allocated as the private data for ieee80211_vif. | ||
347 | */ | 348 | */ |
348 | struct interface { | 349 | struct rt2x00_intf { |
349 | /* | 350 | /* |
350 | * Interface identification. The value is assigned | 351 | * All fields within the rt2x00_intf structure |
351 | * to us by the 80211 stack, and is used to request | 352 | * must be protected with a spinlock. |
352 | * new beacons. | ||
353 | */ | 353 | */ |
354 | struct ieee80211_vif *id; | 354 | spinlock_t lock; |
355 | 355 | ||
356 | /* | 356 | /* |
357 | * Current working type (IEEE80211_IF_TYPE_*). | 357 | * BSS configuration. Copied from the structure |
358 | * passed to us through the bss_info_changed() | ||
359 | * callback funtion. | ||
358 | */ | 360 | */ |
359 | int type; | 361 | struct ieee80211_bss_conf conf; |
360 | 362 | ||
361 | /* | 363 | /* |
362 | * MAC of the device. | 364 | * MAC of the device. |
@@ -367,16 +369,25 @@ struct interface { | |||
367 | * BBSID of the AP to associate with. | 369 | * BBSID of the AP to associate with. |
368 | */ | 370 | */ |
369 | u8 bssid[ETH_ALEN]; | 371 | u8 bssid[ETH_ALEN]; |
370 | }; | ||
371 | 372 | ||
372 | static inline int is_interface_present(struct interface *intf) | 373 | /* |
373 | { | 374 | * Entry in the beacon queue which belongs to |
374 | return !!intf->id; | 375 | * this interface. Each interface has its own |
375 | } | 376 | * dedicated beacon entry. |
377 | */ | ||
378 | struct queue_entry *beacon; | ||
376 | 379 | ||
377 | static inline int is_interface_type(struct interface *intf, int type) | 380 | /* |
381 | * Actions that needed rescheduling. | ||
382 | */ | ||
383 | unsigned int delayed_flags; | ||
384 | #define DELAYED_UPDATE_BEACON 0x00000001 | ||
385 | #define DELAYED_CONFIG_PREAMBLE 0x00000002 | ||
386 | }; | ||
387 | |||
388 | static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif) | ||
378 | { | 389 | { |
379 | return intf->type == type; | 390 | return (struct rt2x00_intf *)vif->drv_priv; |
380 | } | 391 | } |
381 | 392 | ||
382 | /* | 393 | /* |
@@ -430,6 +441,37 @@ struct rt2x00lib_conf { | |||
430 | }; | 441 | }; |
431 | 442 | ||
432 | /* | 443 | /* |
444 | * Configuration structure wrapper around the | ||
445 | * rt2x00 interface configuration handler. | ||
446 | */ | ||
447 | struct rt2x00intf_conf { | ||
448 | /* | ||
449 | * Interface type | ||
450 | */ | ||
451 | enum ieee80211_if_types type; | ||
452 | |||
453 | /* | ||
454 | * TSF sync value, this is dependant on the operation type. | ||
455 | */ | ||
456 | enum tsf_sync sync; | ||
457 | |||
458 | /* | ||
459 | * The MAC and BSSID addressess are simple array of bytes, | ||
460 | * these arrays are little endian, so when sending the addressess | ||
461 | * to the drivers, copy the it into a endian-signed variable. | ||
462 | * | ||
463 | * Note that all devices (except rt2500usb) have 32 bits | ||
464 | * register word sizes. This means that whatever variable we | ||
465 | * pass _must_ be a multiple of 32 bits. Otherwise the device | ||
466 | * might not accept what we are sending to it. | ||
467 | * This will also make it easier for the driver to write | ||
468 | * the data to the device. | ||
469 | */ | ||
470 | __le32 mac[2]; | ||
471 | __le32 bssid[2]; | ||
472 | }; | ||
473 | |||
474 | /* | ||
433 | * rt2x00lib callback functions. | 475 | * rt2x00lib callback functions. |
434 | */ | 476 | */ |
435 | struct rt2x00lib_ops { | 477 | struct rt2x00lib_ops { |
@@ -495,16 +537,21 @@ struct rt2x00lib_ops { | |||
495 | /* | 537 | /* |
496 | * Configuration handlers. | 538 | * Configuration handlers. |
497 | */ | 539 | */ |
498 | void (*config_mac_addr) (struct rt2x00_dev *rt2x00dev, __le32 *mac); | 540 | void (*config_intf) (struct rt2x00_dev *rt2x00dev, |
499 | void (*config_bssid) (struct rt2x00_dev *rt2x00dev, __le32 *bssid); | 541 | struct rt2x00_intf *intf, |
500 | void (*config_type) (struct rt2x00_dev *rt2x00dev, const int type, | 542 | struct rt2x00intf_conf *conf, |
501 | const int tsf_sync); | 543 | const unsigned int flags); |
502 | void (*config_preamble) (struct rt2x00_dev *rt2x00dev, | 544 | #define CONFIG_UPDATE_TYPE ( 1 << 1 ) |
503 | const int short_preamble, | 545 | #define CONFIG_UPDATE_MAC ( 1 << 2 ) |
504 | const int ack_timeout, | 546 | #define CONFIG_UPDATE_BSSID ( 1 << 3 ) |
505 | const int ack_consume_time); | 547 | |
506 | void (*config) (struct rt2x00_dev *rt2x00dev, const unsigned int flags, | 548 | int (*config_preamble) (struct rt2x00_dev *rt2x00dev, |
507 | struct rt2x00lib_conf *libconf); | 549 | const int short_preamble, |
550 | const int ack_timeout, | ||
551 | const int ack_consume_time); | ||
552 | void (*config) (struct rt2x00_dev *rt2x00dev, | ||
553 | struct rt2x00lib_conf *libconf, | ||
554 | const unsigned int flags); | ||
508 | #define CONFIG_UPDATE_PHYMODE ( 1 << 1 ) | 555 | #define CONFIG_UPDATE_PHYMODE ( 1 << 1 ) |
509 | #define CONFIG_UPDATE_CHANNEL ( 1 << 2 ) | 556 | #define CONFIG_UPDATE_CHANNEL ( 1 << 2 ) |
510 | #define CONFIG_UPDATE_TXPOWER ( 1 << 3 ) | 557 | #define CONFIG_UPDATE_TXPOWER ( 1 << 3 ) |
@@ -519,6 +566,8 @@ struct rt2x00lib_ops { | |||
519 | */ | 566 | */ |
520 | struct rt2x00_ops { | 567 | struct rt2x00_ops { |
521 | const char *name; | 568 | const char *name; |
569 | const unsigned int max_sta_intf; | ||
570 | const unsigned int max_ap_intf; | ||
522 | const unsigned int eeprom_size; | 571 | const unsigned int eeprom_size; |
523 | const unsigned int rf_size; | 572 | const unsigned int rf_size; |
524 | const struct data_queue_desc *rx; | 573 | const struct data_queue_desc *rx; |
@@ -550,6 +599,7 @@ enum rt2x00_flags { | |||
550 | /* | 599 | /* |
551 | * Driver features | 600 | * Driver features |
552 | */ | 601 | */ |
602 | DRIVER_SUPPORT_MIXED_INTERFACES, | ||
553 | DRIVER_REQUIRE_FIRMWARE, | 603 | DRIVER_REQUIRE_FIRMWARE, |
554 | DRIVER_REQUIRE_FIRMWARE_CRC_ITU_T, | 604 | DRIVER_REQUIRE_FIRMWARE_CRC_ITU_T, |
555 | DRIVER_REQUIRE_FIRMWARE_CCITT, | 605 | DRIVER_REQUIRE_FIRMWARE_CCITT, |
@@ -566,7 +616,6 @@ enum rt2x00_flags { | |||
566 | CONFIG_EXTERNAL_LNA_BG, | 616 | CONFIG_EXTERNAL_LNA_BG, |
567 | CONFIG_DOUBLE_ANTENNA, | 617 | CONFIG_DOUBLE_ANTENNA, |
568 | CONFIG_DISABLE_LINK_TUNING, | 618 | CONFIG_DISABLE_LINK_TUNING, |
569 | CONFIG_SHORT_PREAMBLE, | ||
570 | }; | 619 | }; |
571 | 620 | ||
572 | /* | 621 | /* |
@@ -670,9 +719,14 @@ struct rt2x00_dev { | |||
670 | unsigned int packet_filter; | 719 | unsigned int packet_filter; |
671 | 720 | ||
672 | /* | 721 | /* |
673 | * Interface configuration. | 722 | * Interface details: |
723 | * - Open ap interface count. | ||
724 | * - Open sta interface count. | ||
725 | * - Association count. | ||
674 | */ | 726 | */ |
675 | struct interface interface; | 727 | unsigned int intf_ap_count; |
728 | unsigned int intf_sta_count; | ||
729 | unsigned int intf_associated; | ||
676 | 730 | ||
677 | /* | 731 | /* |
678 | * Link quality | 732 | * Link quality |
@@ -738,9 +792,8 @@ struct rt2x00_dev { | |||
738 | /* | 792 | /* |
739 | * Scheduled work. | 793 | * Scheduled work. |
740 | */ | 794 | */ |
741 | struct work_struct beacon_work; | 795 | struct work_struct intf_work; |
742 | struct work_struct filter_work; | 796 | struct work_struct filter_work; |
743 | struct work_struct config_work; | ||
744 | 797 | ||
745 | /* | 798 | /* |
746 | * Data queue arrays for RX, TX and Beacon. | 799 | * Data queue arrays for RX, TX and Beacon. |