diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00.h')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 356 |
1 files changed, 206 insertions, 150 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 6c725422af5a..57bdc153952f 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2004 - 2007 rt2x00 SourceForge Project | 2 | Copyright (C) 2004 - 2008 rt2x00 SourceForge Project |
3 | <http://rt2x00.serialmonkey.com> | 3 | <http://rt2x00.serialmonkey.com> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
@@ -27,23 +27,24 @@ | |||
27 | #define RT2X00_H | 27 | #define RT2X00_H |
28 | 28 | ||
29 | #include <linux/bitops.h> | 29 | #include <linux/bitops.h> |
30 | #include <linux/prefetch.h> | ||
31 | #include <linux/skbuff.h> | 30 | #include <linux/skbuff.h> |
32 | #include <linux/workqueue.h> | 31 | #include <linux/workqueue.h> |
33 | #include <linux/firmware.h> | 32 | #include <linux/firmware.h> |
33 | #include <linux/leds.h> | ||
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | #include <linux/etherdevice.h> | 35 | #include <linux/etherdevice.h> |
36 | 36 | ||
37 | #include <net/mac80211.h> | 37 | #include <net/mac80211.h> |
38 | 38 | ||
39 | #include "rt2x00debug.h" | 39 | #include "rt2x00debug.h" |
40 | #include "rt2x00leds.h" | ||
40 | #include "rt2x00reg.h" | 41 | #include "rt2x00reg.h" |
41 | #include "rt2x00ring.h" | 42 | #include "rt2x00queue.h" |
42 | 43 | ||
43 | /* | 44 | /* |
44 | * Module information. | 45 | * Module information. |
45 | */ | 46 | */ |
46 | #define DRV_VERSION "2.0.14" | 47 | #define DRV_VERSION "2.1.4" |
47 | #define DRV_PROJECT "http://rt2x00.serialmonkey.com" | 48 | #define DRV_PROJECT "http://rt2x00.serialmonkey.com" |
48 | 49 | ||
49 | /* | 50 | /* |
@@ -91,26 +92,6 @@ | |||
91 | DEBUG_PRINTK(__dev, KERN_DEBUG, "EEPROM recovery", __msg, ##__args) | 92 | DEBUG_PRINTK(__dev, KERN_DEBUG, "EEPROM recovery", __msg, ##__args) |
92 | 93 | ||
93 | /* | 94 | /* |
94 | * Ring sizes. | ||
95 | * Ralink PCI devices demand the Frame size to be a multiple of 128 bytes. | ||
96 | * DATA_FRAME_SIZE is used for TX, RX, ATIM and PRIO rings. | ||
97 | * MGMT_FRAME_SIZE is used for the BEACON ring. | ||
98 | */ | ||
99 | #define DATA_FRAME_SIZE 2432 | ||
100 | #define MGMT_FRAME_SIZE 256 | ||
101 | |||
102 | /* | ||
103 | * Number of entries in a packet ring. | ||
104 | * PCI devices only need 1 Beacon entry, | ||
105 | * but USB devices require a second because they | ||
106 | * have to send a Guardian byte first. | ||
107 | */ | ||
108 | #define RX_ENTRIES 12 | ||
109 | #define TX_ENTRIES 12 | ||
110 | #define ATIM_ENTRIES 1 | ||
111 | #define BEACON_ENTRIES 2 | ||
112 | |||
113 | /* | ||
114 | * Standard timing and size defines. | 95 | * Standard timing and size defines. |
115 | * These values should follow the ieee80211 specifications. | 96 | * These values should follow the ieee80211 specifications. |
116 | */ | 97 | */ |
@@ -364,20 +345,22 @@ static inline int rt2x00_update_ant_rssi(struct link *link, int rssi) | |||
364 | 345 | ||
365 | /* | 346 | /* |
366 | * Interface structure | 347 | * Interface structure |
367 | * Configuration details about the current interface. | 348 | * Per interface configuration details, this structure |
349 | * is allocated as the private data for ieee80211_vif. | ||
368 | */ | 350 | */ |
369 | struct interface { | 351 | struct rt2x00_intf { |
370 | /* | 352 | /* |
371 | * Interface identification. The value is assigned | 353 | * All fields within the rt2x00_intf structure |
372 | * to us by the 80211 stack, and is used to request | 354 | * must be protected with a spinlock. |
373 | * new beacons. | ||
374 | */ | 355 | */ |
375 | struct ieee80211_vif *id; | 356 | spinlock_t lock; |
376 | 357 | ||
377 | /* | 358 | /* |
378 | * Current working type (IEEE80211_IF_TYPE_*). | 359 | * BSS configuration. Copied from the structure |
360 | * passed to us through the bss_info_changed() | ||
361 | * callback funtion. | ||
379 | */ | 362 | */ |
380 | int type; | 363 | struct ieee80211_bss_conf conf; |
381 | 364 | ||
382 | /* | 365 | /* |
383 | * MAC of the device. | 366 | * MAC of the device. |
@@ -388,42 +371,60 @@ struct interface { | |||
388 | * BBSID of the AP to associate with. | 371 | * BBSID of the AP to associate with. |
389 | */ | 372 | */ |
390 | u8 bssid[ETH_ALEN]; | 373 | u8 bssid[ETH_ALEN]; |
391 | }; | ||
392 | 374 | ||
393 | static inline int is_interface_present(struct interface *intf) | 375 | /* |
394 | { | 376 | * Entry in the beacon queue which belongs to |
395 | return !!intf->id; | 377 | * this interface. Each interface has its own |
396 | } | 378 | * dedicated beacon entry. |
379 | */ | ||
380 | struct queue_entry *beacon; | ||
381 | |||
382 | /* | ||
383 | * Actions that needed rescheduling. | ||
384 | */ | ||
385 | unsigned int delayed_flags; | ||
386 | #define DELAYED_UPDATE_BEACON 0x00000001 | ||
387 | #define DELAYED_CONFIG_ERP 0x00000002 | ||
388 | #define DELAYED_LED_ASSOC 0x00000004 | ||
389 | }; | ||
397 | 390 | ||
398 | static inline int is_interface_type(struct interface *intf, int type) | 391 | static inline struct rt2x00_intf* vif_to_intf(struct ieee80211_vif *vif) |
399 | { | 392 | { |
400 | return intf->type == type; | 393 | return (struct rt2x00_intf *)vif->drv_priv; |
401 | } | 394 | } |
402 | 395 | ||
403 | /* | 396 | /** |
397 | * struct hw_mode_spec: Hardware specifications structure | ||
398 | * | ||
404 | * Details about the supported modes, rates and channels | 399 | * Details about the supported modes, rates and channels |
405 | * of a particular chipset. This is used by rt2x00lib | 400 | * of a particular chipset. This is used by rt2x00lib |
406 | * to build the ieee80211_hw_mode array for mac80211. | 401 | * to build the ieee80211_hw_mode array for mac80211. |
402 | * | ||
403 | * @supported_bands: Bitmask contained the supported bands (2.4GHz, 5.2GHz). | ||
404 | * @supported_rates: Rate types which are supported (CCK, OFDM). | ||
405 | * @num_channels: Number of supported channels. This is used as array size | ||
406 | * for @tx_power_a, @tx_power_bg and @channels. | ||
407 | * channels: Device/chipset specific channel values (See &struct rf_channel). | ||
408 | * @tx_power_a: TX power values for all 5.2GHz channels (may be NULL). | ||
409 | * @tx_power_bg: TX power values for all 2.4GHz channels (may be NULL). | ||
410 | * @tx_power_default: Default TX power value to use when either | ||
411 | * @tx_power_a or @tx_power_bg is missing. | ||
407 | */ | 412 | */ |
408 | struct hw_mode_spec { | 413 | struct hw_mode_spec { |
409 | /* | 414 | unsigned int supported_bands; |
410 | * Number of modes, rates and channels. | 415 | #define SUPPORT_BAND_2GHZ 0x00000001 |
411 | */ | 416 | #define SUPPORT_BAND_5GHZ 0x00000002 |
412 | int num_modes; | 417 | |
413 | int num_rates; | 418 | unsigned int supported_rates; |
414 | int num_channels; | 419 | #define SUPPORT_RATE_CCK 0x00000001 |
420 | #define SUPPORT_RATE_OFDM 0x00000002 | ||
421 | |||
422 | unsigned int num_channels; | ||
423 | const struct rf_channel *channels; | ||
415 | 424 | ||
416 | /* | ||
417 | * txpower values. | ||
418 | */ | ||
419 | const u8 *tx_power_a; | 425 | const u8 *tx_power_a; |
420 | const u8 *tx_power_bg; | 426 | const u8 *tx_power_bg; |
421 | u8 tx_power_default; | 427 | u8 tx_power_default; |
422 | |||
423 | /* | ||
424 | * Device/chipset specific value. | ||
425 | */ | ||
426 | const struct rf_channel *channels; | ||
427 | }; | 428 | }; |
428 | 429 | ||
429 | /* | 430 | /* |
@@ -439,10 +440,10 @@ struct rt2x00lib_conf { | |||
439 | 440 | ||
440 | struct antenna_setup ant; | 441 | struct antenna_setup ant; |
441 | 442 | ||
442 | int phymode; | 443 | enum ieee80211_band band; |
443 | 444 | ||
444 | int basic_rates; | 445 | u32 basic_rates; |
445 | int slot_time; | 446 | u32 slot_time; |
446 | 447 | ||
447 | short sifs; | 448 | short sifs; |
448 | short pifs; | 449 | short pifs; |
@@ -451,6 +452,47 @@ struct rt2x00lib_conf { | |||
451 | }; | 452 | }; |
452 | 453 | ||
453 | /* | 454 | /* |
455 | * Configuration structure for erp settings. | ||
456 | */ | ||
457 | struct rt2x00lib_erp { | ||
458 | int short_preamble; | ||
459 | |||
460 | int ack_timeout; | ||
461 | int ack_consume_time; | ||
462 | }; | ||
463 | |||
464 | /* | ||
465 | * Configuration structure wrapper around the | ||
466 | * rt2x00 interface configuration handler. | ||
467 | */ | ||
468 | struct rt2x00intf_conf { | ||
469 | /* | ||
470 | * Interface type | ||
471 | */ | ||
472 | enum ieee80211_if_types type; | ||
473 | |||
474 | /* | ||
475 | * TSF sync value, this is dependant on the operation type. | ||
476 | */ | ||
477 | enum tsf_sync sync; | ||
478 | |||
479 | /* | ||
480 | * The MAC and BSSID addressess are simple array of bytes, | ||
481 | * these arrays are little endian, so when sending the addressess | ||
482 | * to the drivers, copy the it into a endian-signed variable. | ||
483 | * | ||
484 | * Note that all devices (except rt2500usb) have 32 bits | ||
485 | * register word sizes. This means that whatever variable we | ||
486 | * pass _must_ be a multiple of 32 bits. Otherwise the device | ||
487 | * might not accept what we are sending to it. | ||
488 | * This will also make it easier for the driver to write | ||
489 | * the data to the device. | ||
490 | */ | ||
491 | __le32 mac[2]; | ||
492 | __le32 bssid[2]; | ||
493 | }; | ||
494 | |||
495 | /* | ||
454 | * rt2x00lib callback functions. | 496 | * rt2x00lib callback functions. |
455 | */ | 497 | */ |
456 | struct rt2x00lib_ops { | 498 | struct rt2x00lib_ops { |
@@ -464,6 +506,7 @@ struct rt2x00lib_ops { | |||
464 | */ | 506 | */ |
465 | int (*probe_hw) (struct rt2x00_dev *rt2x00dev); | 507 | int (*probe_hw) (struct rt2x00_dev *rt2x00dev); |
466 | char *(*get_firmware_name) (struct rt2x00_dev *rt2x00dev); | 508 | char *(*get_firmware_name) (struct rt2x00_dev *rt2x00dev); |
509 | u16 (*get_firmware_crc) (void *data, const size_t len); | ||
467 | int (*load_firmware) (struct rt2x00_dev *rt2x00dev, void *data, | 510 | int (*load_firmware) (struct rt2x00_dev *rt2x00dev, void *data, |
468 | const size_t len); | 511 | const size_t len); |
469 | 512 | ||
@@ -474,12 +517,12 @@ struct rt2x00lib_ops { | |||
474 | void (*uninitialize) (struct rt2x00_dev *rt2x00dev); | 517 | void (*uninitialize) (struct rt2x00_dev *rt2x00dev); |
475 | 518 | ||
476 | /* | 519 | /* |
477 | * Ring initialization handlers | 520 | * queue initialization handlers |
478 | */ | 521 | */ |
479 | void (*init_rxentry) (struct rt2x00_dev *rt2x00dev, | 522 | void (*init_rxentry) (struct rt2x00_dev *rt2x00dev, |
480 | struct data_entry *entry); | 523 | struct queue_entry *entry); |
481 | void (*init_txentry) (struct rt2x00_dev *rt2x00dev, | 524 | void (*init_txentry) (struct rt2x00_dev *rt2x00dev, |
482 | struct data_entry *entry); | 525 | struct queue_entry *entry); |
483 | 526 | ||
484 | /* | 527 | /* |
485 | * Radio control handlers. | 528 | * Radio control handlers. |
@@ -497,35 +540,40 @@ struct rt2x00lib_ops { | |||
497 | */ | 540 | */ |
498 | void (*write_tx_desc) (struct rt2x00_dev *rt2x00dev, | 541 | void (*write_tx_desc) (struct rt2x00_dev *rt2x00dev, |
499 | struct sk_buff *skb, | 542 | struct sk_buff *skb, |
500 | struct txdata_entry_desc *desc, | 543 | struct txentry_desc *txdesc, |
501 | struct ieee80211_tx_control *control); | 544 | struct ieee80211_tx_control *control); |
502 | int (*write_tx_data) (struct rt2x00_dev *rt2x00dev, | 545 | int (*write_tx_data) (struct rt2x00_dev *rt2x00dev, |
503 | struct data_ring *ring, struct sk_buff *skb, | 546 | struct data_queue *queue, struct sk_buff *skb, |
504 | struct ieee80211_tx_control *control); | 547 | struct ieee80211_tx_control *control); |
505 | int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, | 548 | int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, |
506 | struct sk_buff *skb); | 549 | struct sk_buff *skb); |
507 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, | 550 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, |
508 | unsigned int queue); | 551 | const unsigned int queue); |
509 | 552 | ||
510 | /* | 553 | /* |
511 | * RX control handlers | 554 | * RX control handlers |
512 | */ | 555 | */ |
513 | void (*fill_rxdone) (struct data_entry *entry, | 556 | void (*fill_rxdone) (struct queue_entry *entry, |
514 | struct rxdata_entry_desc *desc); | 557 | struct rxdone_entry_desc *rxdesc); |
515 | 558 | ||
516 | /* | 559 | /* |
517 | * Configuration handlers. | 560 | * Configuration handlers. |
518 | */ | 561 | */ |
519 | void (*config_mac_addr) (struct rt2x00_dev *rt2x00dev, __le32 *mac); | 562 | void (*config_filter) (struct rt2x00_dev *rt2x00dev, |
520 | void (*config_bssid) (struct rt2x00_dev *rt2x00dev, __le32 *bssid); | 563 | const unsigned int filter_flags); |
521 | void (*config_type) (struct rt2x00_dev *rt2x00dev, const int type, | 564 | void (*config_intf) (struct rt2x00_dev *rt2x00dev, |
522 | const int tsf_sync); | 565 | struct rt2x00_intf *intf, |
523 | void (*config_preamble) (struct rt2x00_dev *rt2x00dev, | 566 | struct rt2x00intf_conf *conf, |
524 | const int short_preamble, | 567 | const unsigned int flags); |
525 | const int ack_timeout, | 568 | #define CONFIG_UPDATE_TYPE ( 1 << 1 ) |
526 | const int ack_consume_time); | 569 | #define CONFIG_UPDATE_MAC ( 1 << 2 ) |
527 | void (*config) (struct rt2x00_dev *rt2x00dev, const unsigned int flags, | 570 | #define CONFIG_UPDATE_BSSID ( 1 << 3 ) |
528 | struct rt2x00lib_conf *libconf); | 571 | |
572 | void (*config_erp) (struct rt2x00_dev *rt2x00dev, | ||
573 | struct rt2x00lib_erp *erp); | ||
574 | void (*config) (struct rt2x00_dev *rt2x00dev, | ||
575 | struct rt2x00lib_conf *libconf, | ||
576 | const unsigned int flags); | ||
529 | #define CONFIG_UPDATE_PHYMODE ( 1 << 1 ) | 577 | #define CONFIG_UPDATE_PHYMODE ( 1 << 1 ) |
530 | #define CONFIG_UPDATE_CHANNEL ( 1 << 2 ) | 578 | #define CONFIG_UPDATE_CHANNEL ( 1 << 2 ) |
531 | #define CONFIG_UPDATE_TXPOWER ( 1 << 3 ) | 579 | #define CONFIG_UPDATE_TXPOWER ( 1 << 3 ) |
@@ -540,10 +588,14 @@ struct rt2x00lib_ops { | |||
540 | */ | 588 | */ |
541 | struct rt2x00_ops { | 589 | struct rt2x00_ops { |
542 | const char *name; | 590 | const char *name; |
543 | const unsigned int rxd_size; | 591 | const unsigned int max_sta_intf; |
544 | const unsigned int txd_size; | 592 | const unsigned int max_ap_intf; |
545 | const unsigned int eeprom_size; | 593 | const unsigned int eeprom_size; |
546 | const unsigned int rf_size; | 594 | const unsigned int rf_size; |
595 | const struct data_queue_desc *rx; | ||
596 | const struct data_queue_desc *tx; | ||
597 | const struct data_queue_desc *bcn; | ||
598 | const struct data_queue_desc *atim; | ||
547 | const struct rt2x00lib_ops *lib; | 599 | const struct rt2x00lib_ops *lib; |
548 | const struct ieee80211_ops *hw; | 600 | const struct ieee80211_ops *hw; |
549 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS | 601 | #ifdef CONFIG_RT2X00_LIB_DEBUGFS |
@@ -569,8 +621,11 @@ enum rt2x00_flags { | |||
569 | /* | 621 | /* |
570 | * Driver features | 622 | * Driver features |
571 | */ | 623 | */ |
624 | DRIVER_SUPPORT_MIXED_INTERFACES, | ||
572 | DRIVER_REQUIRE_FIRMWARE, | 625 | DRIVER_REQUIRE_FIRMWARE, |
573 | DRIVER_REQUIRE_BEACON_RING, | 626 | DRIVER_REQUIRE_BEACON_GUARD, |
627 | DRIVER_REQUIRE_ATIM_QUEUE, | ||
628 | DRIVER_REQUIRE_SCHEDULED, | ||
574 | 629 | ||
575 | /* | 630 | /* |
576 | * Driver configuration | 631 | * Driver configuration |
@@ -582,7 +637,6 @@ enum rt2x00_flags { | |||
582 | CONFIG_EXTERNAL_LNA_BG, | 637 | CONFIG_EXTERNAL_LNA_BG, |
583 | CONFIG_DOUBLE_ANTENNA, | 638 | CONFIG_DOUBLE_ANTENNA, |
584 | CONFIG_DISABLE_LINK_TUNING, | 639 | CONFIG_DISABLE_LINK_TUNING, |
585 | CONFIG_SHORT_PREAMBLE, | ||
586 | }; | 640 | }; |
587 | 641 | ||
588 | /* | 642 | /* |
@@ -597,8 +651,10 @@ struct rt2x00_dev { | |||
597 | * macro's should be used for correct typecasting. | 651 | * macro's should be used for correct typecasting. |
598 | */ | 652 | */ |
599 | void *dev; | 653 | void *dev; |
600 | #define rt2x00dev_pci(__dev) ( (struct pci_dev*)(__dev)->dev ) | 654 | #define rt2x00dev_pci(__dev) ( (struct pci_dev *)(__dev)->dev ) |
601 | #define rt2x00dev_usb(__dev) ( (struct usb_interface*)(__dev)->dev ) | 655 | #define rt2x00dev_usb(__dev) ( (struct usb_interface *)(__dev)->dev ) |
656 | #define rt2x00dev_usb_dev(__dev)\ | ||
657 | ( (struct usb_device *)interface_to_usbdev(rt2x00dev_usb(__dev)) ) | ||
602 | 658 | ||
603 | /* | 659 | /* |
604 | * Callback functions. | 660 | * Callback functions. |
@@ -609,18 +665,15 @@ struct rt2x00_dev { | |||
609 | * IEEE80211 control structure. | 665 | * IEEE80211 control structure. |
610 | */ | 666 | */ |
611 | struct ieee80211_hw *hw; | 667 | struct ieee80211_hw *hw; |
612 | struct ieee80211_hw_mode *hwmodes; | 668 | struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; |
613 | unsigned int curr_hwmode; | 669 | enum ieee80211_band curr_band; |
614 | #define HWMODE_B 0 | ||
615 | #define HWMODE_G 1 | ||
616 | #define HWMODE_A 2 | ||
617 | 670 | ||
618 | /* | 671 | /* |
619 | * rfkill structure for RF state switching support. | 672 | * rfkill structure for RF state switching support. |
620 | * This will only be compiled in when required. | 673 | * This will only be compiled in when required. |
621 | */ | 674 | */ |
622 | #ifdef CONFIG_RT2X00_LIB_RFKILL | 675 | #ifdef CONFIG_RT2X00_LIB_RFKILL |
623 | unsigned long rfkill_state; | 676 | unsigned long rfkill_state; |
624 | #define RFKILL_STATE_ALLOCATED 1 | 677 | #define RFKILL_STATE_ALLOCATED 1 |
625 | #define RFKILL_STATE_REGISTERED 2 | 678 | #define RFKILL_STATE_REGISTERED 2 |
626 | struct rfkill *rfkill; | 679 | struct rfkill *rfkill; |
@@ -636,6 +689,17 @@ unsigned long rfkill_state; | |||
636 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ | 689 | #endif /* CONFIG_RT2X00_LIB_DEBUGFS */ |
637 | 690 | ||
638 | /* | 691 | /* |
692 | * LED structure for changing the LED status | ||
693 | * by mac8011 or the kernel. | ||
694 | */ | ||
695 | #ifdef CONFIG_RT2X00_LIB_LEDS | ||
696 | struct rt2x00_led led_radio; | ||
697 | struct rt2x00_led led_assoc; | ||
698 | struct rt2x00_led led_qual; | ||
699 | u16 led_mcu_reg; | ||
700 | #endif /* CONFIG_RT2X00_LIB_LEDS */ | ||
701 | |||
702 | /* | ||
639 | * Device flags. | 703 | * Device flags. |
640 | * In these flags the current status and some | 704 | * In these flags the current status and some |
641 | * of the device capabilities are stored. | 705 | * of the device capabilities are stored. |
@@ -661,11 +725,13 @@ unsigned long rfkill_state; | |||
661 | 725 | ||
662 | /* | 726 | /* |
663 | * Register pointers | 727 | * Register pointers |
664 | * csr_addr: Base register address. (PCI) | 728 | * csr.base: CSR base register address. (PCI) |
665 | * csr_cache: CSR cache for usb_control_msg. (USB) | 729 | * csr.cache: CSR cache for usb_control_msg. (USB) |
666 | */ | 730 | */ |
667 | void __iomem *csr_addr; | 731 | union csr { |
668 | void *csr_cache; | 732 | void __iomem *base; |
733 | void *cache; | ||
734 | } csr; | ||
669 | 735 | ||
670 | /* | 736 | /* |
671 | * Mutex to protect register accesses on USB devices. | 737 | * Mutex to protect register accesses on USB devices. |
@@ -687,9 +753,14 @@ unsigned long rfkill_state; | |||
687 | unsigned int packet_filter; | 753 | unsigned int packet_filter; |
688 | 754 | ||
689 | /* | 755 | /* |
690 | * Interface configuration. | 756 | * Interface details: |
757 | * - Open ap interface count. | ||
758 | * - Open sta interface count. | ||
759 | * - Association count. | ||
691 | */ | 760 | */ |
692 | struct interface interface; | 761 | unsigned int intf_ap_count; |
762 | unsigned int intf_sta_count; | ||
763 | unsigned int intf_associated; | ||
693 | 764 | ||
694 | /* | 765 | /* |
695 | * Link quality | 766 | * Link quality |
@@ -722,16 +793,6 @@ unsigned long rfkill_state; | |||
722 | u16 tx_power; | 793 | u16 tx_power; |
723 | 794 | ||
724 | /* | 795 | /* |
725 | * LED register (for rt61pci & rt73usb). | ||
726 | */ | ||
727 | u16 led_reg; | ||
728 | |||
729 | /* | ||
730 | * Led mode (LED_MODE_*) | ||
731 | */ | ||
732 | u8 led_mode; | ||
733 | |||
734 | /* | ||
735 | * Rssi <-> Dbm offset | 796 | * Rssi <-> Dbm offset |
736 | */ | 797 | */ |
737 | u8 rssi_offset; | 798 | u8 rssi_offset; |
@@ -755,19 +816,18 @@ unsigned long rfkill_state; | |||
755 | /* | 816 | /* |
756 | * Scheduled work. | 817 | * Scheduled work. |
757 | */ | 818 | */ |
758 | struct work_struct beacon_work; | 819 | struct work_struct intf_work; |
759 | struct work_struct filter_work; | 820 | struct work_struct filter_work; |
760 | struct work_struct config_work; | ||
761 | 821 | ||
762 | /* | 822 | /* |
763 | * Data ring arrays for RX, TX and Beacon. | 823 | * Data queue arrays for RX, TX and Beacon. |
764 | * The Beacon array also contains the Atim ring | 824 | * The Beacon array also contains the Atim queue |
765 | * if that is supported by the device. | 825 | * if that is supported by the device. |
766 | */ | 826 | */ |
767 | int data_rings; | 827 | int data_queues; |
768 | struct data_ring *rx; | 828 | struct data_queue *rx; |
769 | struct data_ring *tx; | 829 | struct data_queue *tx; |
770 | struct data_ring *bcn; | 830 | struct data_queue *bcn; |
771 | 831 | ||
772 | /* | 832 | /* |
773 | * Firmware image. | 833 | * Firmware image. |
@@ -776,37 +836,6 @@ unsigned long rfkill_state; | |||
776 | }; | 836 | }; |
777 | 837 | ||
778 | /* | 838 | /* |
779 | * For-each loop for the ring array. | ||
780 | * All rings have been allocated as a single array, | ||
781 | * this means we can create a very simply loop macro | ||
782 | * that is capable of looping through all rings. | ||
783 | * ring_end(), txring_end() and ring_loop() are helper macro's which | ||
784 | * should not be used directly. Instead the following should be used: | ||
785 | * ring_for_each() - Loops through all rings (RX, TX, Beacon & Atim) | ||
786 | * txring_for_each() - Loops through TX data rings (TX only) | ||
787 | * txringall_for_each() - Loops through all TX rings (TX, Beacon & Atim) | ||
788 | */ | ||
789 | #define ring_end(__dev) \ | ||
790 | &(__dev)->rx[(__dev)->data_rings] | ||
791 | |||
792 | #define txring_end(__dev) \ | ||
793 | &(__dev)->tx[(__dev)->hw->queues] | ||
794 | |||
795 | #define ring_loop(__entry, __start, __end) \ | ||
796 | for ((__entry) = (__start); \ | ||
797 | prefetch(&(__entry)[1]), (__entry) != (__end); \ | ||
798 | (__entry) = &(__entry)[1]) | ||
799 | |||
800 | #define ring_for_each(__dev, __entry) \ | ||
801 | ring_loop(__entry, (__dev)->rx, ring_end(__dev)) | ||
802 | |||
803 | #define txring_for_each(__dev, __entry) \ | ||
804 | ring_loop(__entry, (__dev)->tx, txring_end(__dev)) | ||
805 | |||
806 | #define txringall_for_each(__dev, __entry) \ | ||
807 | ring_loop(__entry, (__dev)->tx, ring_end(__dev)) | ||
808 | |||
809 | /* | ||
810 | * Generic RF access. | 839 | * Generic RF access. |
811 | * The RF is being accessed by word index. | 840 | * The RF is being accessed by word index. |
812 | */ | 841 | */ |
@@ -898,20 +927,43 @@ static inline u16 get_duration_res(const unsigned int size, const u8 rate) | |||
898 | return ((size * 8 * 10) % rate); | 927 | return ((size * 8 * 10) % rate); |
899 | } | 928 | } |
900 | 929 | ||
901 | /* | 930 | /** |
902 | * Library functions. | 931 | * rt2x00queue_get_queue - Convert mac80211 queue index to rt2x00 queue |
932 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
933 | * @queue: mac80211/rt2x00 queue index | ||
934 | * (see &enum ieee80211_tx_queue and &enum rt2x00_bcn_queue). | ||
935 | */ | ||
936 | struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, | ||
937 | const unsigned int queue); | ||
938 | |||
939 | /** | ||
940 | * rt2x00queue_get_entry - Get queue entry where the given index points to. | ||
941 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
942 | * @index: Index identifier for obtaining the correct index. | ||
943 | */ | ||
944 | struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, | ||
945 | enum queue_index index); | ||
946 | |||
947 | /** | ||
948 | * rt2x00queue_index_inc - Index incrementation function | ||
949 | * @queue: Queue (&struct data_queue) to perform the action on. | ||
950 | * @action: Index type (&enum queue_index) to perform the action on. | ||
951 | * | ||
952 | * This function will increase the requested index on the queue, | ||
953 | * it will grab the appropriate locks and handle queue overflow events by | ||
954 | * resetting the index to the start of the queue. | ||
903 | */ | 955 | */ |
904 | struct data_ring *rt2x00lib_get_ring(struct rt2x00_dev *rt2x00dev, | 956 | void rt2x00queue_index_inc(struct data_queue *queue, enum queue_index index); |
905 | const unsigned int queue); | 957 | |
906 | 958 | ||
907 | /* | 959 | /* |
908 | * Interrupt context handlers. | 960 | * Interrupt context handlers. |
909 | */ | 961 | */ |
910 | void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev); | 962 | void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev); |
911 | void rt2x00lib_txdone(struct data_entry *entry, | 963 | void rt2x00lib_txdone(struct queue_entry *entry, |
912 | const int status, const int retry); | 964 | struct txdone_entry_desc *txdesc); |
913 | void rt2x00lib_rxdone(struct data_entry *entry, struct sk_buff *skb, | 965 | void rt2x00lib_rxdone(struct queue_entry *entry, |
914 | struct rxdata_entry_desc *desc); | 966 | struct rxdone_entry_desc *rxdesc); |
915 | 967 | ||
916 | /* | 968 | /* |
917 | * TX descriptor initializer | 969 | * TX descriptor initializer |
@@ -935,6 +987,10 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf); | |||
935 | int rt2x00mac_config_interface(struct ieee80211_hw *hw, | 987 | int rt2x00mac_config_interface(struct ieee80211_hw *hw, |
936 | struct ieee80211_vif *vif, | 988 | struct ieee80211_vif *vif, |
937 | struct ieee80211_if_conf *conf); | 989 | struct ieee80211_if_conf *conf); |
990 | void rt2x00mac_configure_filter(struct ieee80211_hw *hw, | ||
991 | unsigned int changed_flags, | ||
992 | unsigned int *total_flags, | ||
993 | int mc_count, struct dev_addr_list *mc_list); | ||
938 | int rt2x00mac_get_stats(struct ieee80211_hw *hw, | 994 | int rt2x00mac_get_stats(struct ieee80211_hw *hw, |
939 | struct ieee80211_low_level_stats *stats); | 995 | struct ieee80211_low_level_stats *stats); |
940 | int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw, | 996 | int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw, |