diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00.h')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 345 |
1 files changed, 256 insertions, 89 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index c21af38cc5af..c446db69bd3c 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> | 2 | Copyright (C) 2010 Willow Garage <http://www.willowgarage.com> |
3 | Copyright (C) 2004 - 2010 Ivo van Doorn <IvDoorn@gmail.com> | ||
3 | Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com> | 4 | Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com> |
4 | <http://rt2x00.serialmonkey.com> | 5 | <http://rt2x00.serialmonkey.com> |
5 | 6 | ||
@@ -35,6 +36,8 @@ | |||
35 | #include <linux/mutex.h> | 36 | #include <linux/mutex.h> |
36 | #include <linux/etherdevice.h> | 37 | #include <linux/etherdevice.h> |
37 | #include <linux/input-polldev.h> | 38 | #include <linux/input-polldev.h> |
39 | #include <linux/kfifo.h> | ||
40 | #include <linux/timer.h> | ||
38 | 41 | ||
39 | #include <net/mac80211.h> | 42 | #include <net/mac80211.h> |
40 | 43 | ||
@@ -64,7 +67,7 @@ | |||
64 | 67 | ||
65 | #ifdef CONFIG_RT2X00_DEBUG | 68 | #ifdef CONFIG_RT2X00_DEBUG |
66 | #define DEBUG_PRINTK(__dev, __kernlvl, __lvl, __msg, __args...) \ | 69 | #define DEBUG_PRINTK(__dev, __kernlvl, __lvl, __msg, __args...) \ |
67 | DEBUG_PRINTK_MSG(__dev, __kernlvl, __lvl, __msg, ##__args); | 70 | DEBUG_PRINTK_MSG(__dev, __kernlvl, __lvl, __msg, ##__args) |
68 | #else | 71 | #else |
69 | #define DEBUG_PRINTK(__dev, __kernlvl, __lvl, __msg, __args...) \ | 72 | #define DEBUG_PRINTK(__dev, __kernlvl, __lvl, __msg, __args...) \ |
70 | do { } while (0) | 73 | do { } while (0) |
@@ -187,6 +190,7 @@ struct rt2x00_chip { | |||
187 | #define RT3572 0x3572 | 190 | #define RT3572 0x3572 |
188 | #define RT3593 0x3593 /* PCIe */ | 191 | #define RT3593 0x3593 /* PCIe */ |
189 | #define RT3883 0x3883 /* WSOC */ | 192 | #define RT3883 0x3883 /* WSOC */ |
193 | #define RT5390 0x5390 /* 2.4GHz */ | ||
190 | 194 | ||
191 | u16 rf; | 195 | u16 rf; |
192 | u16 rev; | 196 | u16 rev; |
@@ -212,8 +216,9 @@ struct channel_info { | |||
212 | unsigned int flags; | 216 | unsigned int flags; |
213 | #define GEOGRAPHY_ALLOWED 0x00000001 | 217 | #define GEOGRAPHY_ALLOWED 0x00000001 |
214 | 218 | ||
215 | short tx_power1; | 219 | short max_power; |
216 | short tx_power2; | 220 | short default_power1; |
221 | short default_power2; | ||
217 | }; | 222 | }; |
218 | 223 | ||
219 | /* | 224 | /* |
@@ -222,6 +227,8 @@ struct channel_info { | |||
222 | struct antenna_setup { | 227 | struct antenna_setup { |
223 | enum antenna rx; | 228 | enum antenna rx; |
224 | enum antenna tx; | 229 | enum antenna tx; |
230 | u8 rx_chain_num; | ||
231 | u8 tx_chain_num; | ||
225 | }; | 232 | }; |
226 | 233 | ||
227 | /* | 234 | /* |
@@ -335,8 +342,22 @@ struct link { | |||
335 | 342 | ||
336 | /* | 343 | /* |
337 | * Work structure for scheduling periodic watchdog monitoring. | 344 | * Work structure for scheduling periodic watchdog monitoring. |
345 | * This work must be scheduled on the kernel workqueue, while | ||
346 | * all other work structures must be queued on the mac80211 | ||
347 | * workqueue. This guarantees that the watchdog can schedule | ||
348 | * other work structures and wait for their completion in order | ||
349 | * to bring the device/driver back into the desired state. | ||
338 | */ | 350 | */ |
339 | struct delayed_work watchdog_work; | 351 | struct delayed_work watchdog_work; |
352 | |||
353 | /* | ||
354 | * Work structure for scheduling periodic AGC adjustments. | ||
355 | */ | ||
356 | struct delayed_work agc_work; | ||
357 | }; | ||
358 | |||
359 | enum rt2x00_delayed_flags { | ||
360 | DELAYED_UPDATE_BEACON, | ||
340 | }; | 361 | }; |
341 | 362 | ||
342 | /* | 363 | /* |
@@ -346,22 +367,6 @@ struct link { | |||
346 | */ | 367 | */ |
347 | struct rt2x00_intf { | 368 | struct rt2x00_intf { |
348 | /* | 369 | /* |
349 | * All fields within the rt2x00_intf structure | ||
350 | * must be protected with a spinlock. | ||
351 | */ | ||
352 | spinlock_t lock; | ||
353 | |||
354 | /* | ||
355 | * MAC of the device. | ||
356 | */ | ||
357 | u8 mac[ETH_ALEN]; | ||
358 | |||
359 | /* | ||
360 | * BBSID of the AP to associate with. | ||
361 | */ | ||
362 | u8 bssid[ETH_ALEN]; | ||
363 | |||
364 | /* | ||
365 | * beacon->skb must be protected with the mutex. | 370 | * beacon->skb must be protected with the mutex. |
366 | */ | 371 | */ |
367 | struct mutex beacon_skb_mutex; | 372 | struct mutex beacon_skb_mutex; |
@@ -372,12 +377,12 @@ struct rt2x00_intf { | |||
372 | * dedicated beacon entry. | 377 | * dedicated beacon entry. |
373 | */ | 378 | */ |
374 | struct queue_entry *beacon; | 379 | struct queue_entry *beacon; |
380 | bool enable_beacon; | ||
375 | 381 | ||
376 | /* | 382 | /* |
377 | * Actions that needed rescheduling. | 383 | * Actions that needed rescheduling. |
378 | */ | 384 | */ |
379 | unsigned int delayed_flags; | 385 | unsigned long delayed_flags; |
380 | #define DELAYED_UPDATE_BEACON 0x00000001 | ||
381 | 386 | ||
382 | /* | 387 | /* |
383 | * Software sequence counter, this is only required | 388 | * Software sequence counter, this is only required |
@@ -455,6 +460,7 @@ struct rt2x00lib_erp { | |||
455 | short eifs; | 460 | short eifs; |
456 | 461 | ||
457 | u16 beacon_int; | 462 | u16 beacon_int; |
463 | u16 ht_opmode; | ||
458 | }; | 464 | }; |
459 | 465 | ||
460 | /* | 466 | /* |
@@ -467,7 +473,6 @@ struct rt2x00lib_crypto { | |||
467 | const u8 *address; | 473 | const u8 *address; |
468 | 474 | ||
469 | u32 bssidx; | 475 | u32 bssidx; |
470 | u32 aid; | ||
471 | 476 | ||
472 | u8 key[16]; | 477 | u8 key[16]; |
473 | u8 tx_mic[8]; | 478 | u8 tx_mic[8]; |
@@ -485,13 +490,13 @@ struct rt2x00intf_conf { | |||
485 | enum nl80211_iftype type; | 490 | enum nl80211_iftype type; |
486 | 491 | ||
487 | /* | 492 | /* |
488 | * TSF sync value, this is dependant on the operation type. | 493 | * TSF sync value, this is dependent on the operation type. |
489 | */ | 494 | */ |
490 | enum tsf_sync sync; | 495 | enum tsf_sync sync; |
491 | 496 | ||
492 | /* | 497 | /* |
493 | * The MAC and BSSID addressess are simple array of bytes, | 498 | * The MAC and BSSID addresses are simple array of bytes, |
494 | * these arrays are little endian, so when sending the addressess | 499 | * these arrays are little endian, so when sending the addresses |
495 | * to the drivers, copy the it into a endian-signed variable. | 500 | * to the drivers, copy the it into a endian-signed variable. |
496 | * | 501 | * |
497 | * Note that all devices (except rt2500usb) have 32 bits | 502 | * Note that all devices (except rt2500usb) have 32 bits |
@@ -515,9 +520,13 @@ struct rt2x00lib_ops { | |||
515 | irq_handler_t irq_handler; | 520 | irq_handler_t irq_handler; |
516 | 521 | ||
517 | /* | 522 | /* |
518 | * Threaded Interrupt handlers. | 523 | * TX status tasklet handler. |
519 | */ | 524 | */ |
520 | irq_handler_t irq_handler_thread; | 525 | void (*txstatus_tasklet) (unsigned long data); |
526 | void (*pretbtt_tasklet) (unsigned long data); | ||
527 | void (*tbtt_tasklet) (unsigned long data); | ||
528 | void (*rxdone_tasklet) (unsigned long data); | ||
529 | void (*autowake_tasklet) (unsigned long data); | ||
521 | 530 | ||
522 | /* | 531 | /* |
523 | * Device init handlers. | 532 | * Device init handlers. |
@@ -553,23 +562,29 @@ struct rt2x00lib_ops { | |||
553 | struct link_qual *qual); | 562 | struct link_qual *qual); |
554 | void (*link_tuner) (struct rt2x00_dev *rt2x00dev, | 563 | void (*link_tuner) (struct rt2x00_dev *rt2x00dev, |
555 | struct link_qual *qual, const u32 count); | 564 | struct link_qual *qual, const u32 count); |
565 | void (*gain_calibration) (struct rt2x00_dev *rt2x00dev); | ||
566 | |||
567 | /* | ||
568 | * Data queue handlers. | ||
569 | */ | ||
556 | void (*watchdog) (struct rt2x00_dev *rt2x00dev); | 570 | void (*watchdog) (struct rt2x00_dev *rt2x00dev); |
571 | void (*start_queue) (struct data_queue *queue); | ||
572 | void (*kick_queue) (struct data_queue *queue); | ||
573 | void (*stop_queue) (struct data_queue *queue); | ||
574 | void (*flush_queue) (struct data_queue *queue, bool drop); | ||
575 | void (*tx_dma_done) (struct queue_entry *entry); | ||
557 | 576 | ||
558 | /* | 577 | /* |
559 | * TX control handlers | 578 | * TX control handlers |
560 | */ | 579 | */ |
561 | void (*write_tx_desc) (struct rt2x00_dev *rt2x00dev, | 580 | void (*write_tx_desc) (struct queue_entry *entry, |
562 | struct sk_buff *skb, | ||
563 | struct txentry_desc *txdesc); | 581 | struct txentry_desc *txdesc); |
564 | void (*write_tx_data) (struct queue_entry *entry, | 582 | void (*write_tx_data) (struct queue_entry *entry, |
565 | struct txentry_desc *txdesc); | 583 | struct txentry_desc *txdesc); |
566 | void (*write_beacon) (struct queue_entry *entry, | 584 | void (*write_beacon) (struct queue_entry *entry, |
567 | struct txentry_desc *txdesc); | 585 | struct txentry_desc *txdesc); |
586 | void (*clear_beacon) (struct queue_entry *entry); | ||
568 | int (*get_tx_data_len) (struct queue_entry *entry); | 587 | int (*get_tx_data_len) (struct queue_entry *entry); |
569 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, | ||
570 | const enum data_queue_qid queue); | ||
571 | void (*kill_tx_queue) (struct rt2x00_dev *rt2x00dev, | ||
572 | const enum data_queue_qid queue); | ||
573 | 588 | ||
574 | /* | 589 | /* |
575 | * RX control handlers | 590 | * RX control handlers |
@@ -597,7 +612,8 @@ struct rt2x00lib_ops { | |||
597 | #define CONFIG_UPDATE_BSSID ( 1 << 3 ) | 612 | #define CONFIG_UPDATE_BSSID ( 1 << 3 ) |
598 | 613 | ||
599 | void (*config_erp) (struct rt2x00_dev *rt2x00dev, | 614 | void (*config_erp) (struct rt2x00_dev *rt2x00dev, |
600 | struct rt2x00lib_erp *erp); | 615 | struct rt2x00lib_erp *erp, |
616 | u32 changed); | ||
601 | void (*config_ant) (struct rt2x00_dev *rt2x00dev, | 617 | void (*config_ant) (struct rt2x00_dev *rt2x00dev, |
602 | struct antenna_setup *ant); | 618 | struct antenna_setup *ant); |
603 | void (*config) (struct rt2x00_dev *rt2x00dev, | 619 | void (*config) (struct rt2x00_dev *rt2x00dev, |
@@ -629,11 +645,11 @@ struct rt2x00_ops { | |||
629 | }; | 645 | }; |
630 | 646 | ||
631 | /* | 647 | /* |
632 | * rt2x00 device flags | 648 | * rt2x00 state flags |
633 | */ | 649 | */ |
634 | enum rt2x00_flags { | 650 | enum rt2x00_state_flags { |
635 | /* | 651 | /* |
636 | * Device state flags | 652 | * Device flags |
637 | */ | 653 | */ |
638 | DEVICE_STATE_PRESENT, | 654 | DEVICE_STATE_PRESENT, |
639 | DEVICE_STATE_REGISTERED_HW, | 655 | DEVICE_STATE_REGISTERED_HW, |
@@ -643,35 +659,47 @@ enum rt2x00_flags { | |||
643 | DEVICE_STATE_SCANNING, | 659 | DEVICE_STATE_SCANNING, |
644 | 660 | ||
645 | /* | 661 | /* |
646 | * Driver requirements | ||
647 | */ | ||
648 | DRIVER_REQUIRE_FIRMWARE, | ||
649 | DRIVER_REQUIRE_BEACON_GUARD, | ||
650 | DRIVER_REQUIRE_ATIM_QUEUE, | ||
651 | DRIVER_REQUIRE_DMA, | ||
652 | DRIVER_REQUIRE_COPY_IV, | ||
653 | DRIVER_REQUIRE_L2PAD, | ||
654 | |||
655 | /* | ||
656 | * Driver features | ||
657 | */ | ||
658 | CONFIG_SUPPORT_HW_BUTTON, | ||
659 | CONFIG_SUPPORT_HW_CRYPTO, | ||
660 | DRIVER_SUPPORT_CONTROL_FILTERS, | ||
661 | DRIVER_SUPPORT_CONTROL_FILTER_PSPOLL, | ||
662 | DRIVER_SUPPORT_PRE_TBTT_INTERRUPT, | ||
663 | DRIVER_SUPPORT_LINK_TUNING, | ||
664 | DRIVER_SUPPORT_WATCHDOG, | ||
665 | |||
666 | /* | ||
667 | * Driver configuration | 662 | * Driver configuration |
668 | */ | 663 | */ |
669 | CONFIG_FRAME_TYPE, | ||
670 | CONFIG_RF_SEQUENCE, | ||
671 | CONFIG_EXTERNAL_LNA_A, | ||
672 | CONFIG_EXTERNAL_LNA_BG, | ||
673 | CONFIG_DOUBLE_ANTENNA, | ||
674 | CONFIG_CHANNEL_HT40, | 664 | CONFIG_CHANNEL_HT40, |
665 | CONFIG_POWERSAVING, | ||
666 | }; | ||
667 | |||
668 | /* | ||
669 | * rt2x00 capability flags | ||
670 | */ | ||
671 | enum rt2x00_capability_flags { | ||
672 | /* | ||
673 | * Requirements | ||
674 | */ | ||
675 | REQUIRE_FIRMWARE, | ||
676 | REQUIRE_BEACON_GUARD, | ||
677 | REQUIRE_ATIM_QUEUE, | ||
678 | REQUIRE_DMA, | ||
679 | REQUIRE_COPY_IV, | ||
680 | REQUIRE_L2PAD, | ||
681 | REQUIRE_TXSTATUS_FIFO, | ||
682 | REQUIRE_TASKLET_CONTEXT, | ||
683 | REQUIRE_SW_SEQNO, | ||
684 | REQUIRE_HT_TX_DESC, | ||
685 | REQUIRE_PS_AUTOWAKE, | ||
686 | |||
687 | /* | ||
688 | * Capabilities | ||
689 | */ | ||
690 | CAPABILITY_HW_BUTTON, | ||
691 | CAPABILITY_HW_CRYPTO, | ||
692 | CAPABILITY_POWER_LIMIT, | ||
693 | CAPABILITY_CONTROL_FILTERS, | ||
694 | CAPABILITY_CONTROL_FILTER_PSPOLL, | ||
695 | CAPABILITY_PRE_TBTT_INTERRUPT, | ||
696 | CAPABILITY_LINK_TUNING, | ||
697 | CAPABILITY_FRAME_TYPE, | ||
698 | CAPABILITY_RF_SEQUENCE, | ||
699 | CAPABILITY_EXTERNAL_LNA_A, | ||
700 | CAPABILITY_EXTERNAL_LNA_BG, | ||
701 | CAPABILITY_DOUBLE_ANTENNA, | ||
702 | CAPABILITY_BT_COEXIST, | ||
675 | }; | 703 | }; |
676 | 704 | ||
677 | /* | 705 | /* |
@@ -698,6 +726,7 @@ struct rt2x00_dev { | |||
698 | struct ieee80211_hw *hw; | 726 | struct ieee80211_hw *hw; |
699 | struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; | 727 | struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS]; |
700 | enum ieee80211_band curr_band; | 728 | enum ieee80211_band curr_band; |
729 | int curr_freq; | ||
701 | 730 | ||
702 | /* | 731 | /* |
703 | * If enabled, the debugfs interface structures | 732 | * If enabled, the debugfs interface structures |
@@ -719,13 +748,20 @@ struct rt2x00_dev { | |||
719 | #endif /* CONFIG_RT2X00_LIB_LEDS */ | 748 | #endif /* CONFIG_RT2X00_LIB_LEDS */ |
720 | 749 | ||
721 | /* | 750 | /* |
722 | * Device flags. | 751 | * Device state flags. |
723 | * In these flags the current status and some | 752 | * In these flags the current status is stored. |
724 | * of the device capabilities are stored. | 753 | * Access to these flags should occur atomically. |
725 | */ | 754 | */ |
726 | unsigned long flags; | 755 | unsigned long flags; |
727 | 756 | ||
728 | /* | 757 | /* |
758 | * Device capabiltiy flags. | ||
759 | * In these flags the device/driver capabilities are stored. | ||
760 | * Access to these flags should occur non-atomically. | ||
761 | */ | ||
762 | unsigned long cap_flags; | ||
763 | |||
764 | /* | ||
729 | * Device information, Bus IRQ and name (PCI, SoC) | 765 | * Device information, Bus IRQ and name (PCI, SoC) |
730 | */ | 766 | */ |
731 | int irq; | 767 | int irq; |
@@ -780,10 +816,12 @@ struct rt2x00_dev { | |||
780 | * - Open ap interface count. | 816 | * - Open ap interface count. |
781 | * - Open sta interface count. | 817 | * - Open sta interface count. |
782 | * - Association count. | 818 | * - Association count. |
819 | * - Beaconing enabled count. | ||
783 | */ | 820 | */ |
784 | unsigned int intf_ap_count; | 821 | unsigned int intf_ap_count; |
785 | unsigned int intf_sta_count; | 822 | unsigned int intf_sta_count; |
786 | unsigned int intf_associated; | 823 | unsigned int intf_associated; |
824 | unsigned int intf_beaconing; | ||
787 | 825 | ||
788 | /* | 826 | /* |
789 | * Link quality | 827 | * Link quality |
@@ -839,20 +877,32 @@ struct rt2x00_dev { | |||
839 | u8 calibration[2]; | 877 | u8 calibration[2]; |
840 | 878 | ||
841 | /* | 879 | /* |
880 | * Association id. | ||
881 | */ | ||
882 | u16 aid; | ||
883 | |||
884 | /* | ||
842 | * Beacon interval. | 885 | * Beacon interval. |
843 | */ | 886 | */ |
844 | u16 beacon_int; | 887 | u16 beacon_int; |
845 | 888 | ||
889 | /** | ||
890 | * Timestamp of last received beacon | ||
891 | */ | ||
892 | unsigned long last_beacon; | ||
893 | |||
846 | /* | 894 | /* |
847 | * Low level statistics which will have | 895 | * Low level statistics which will have |
848 | * to be kept up to date while device is running. | 896 | * to be kept up to date while device is running. |
849 | */ | 897 | */ |
850 | struct ieee80211_low_level_stats low_level_stats; | 898 | struct ieee80211_low_level_stats low_level_stats; |
851 | 899 | ||
852 | /* | 900 | /** |
853 | * RX configuration information. | 901 | * Work queue for all work which should not be placed |
902 | * on the mac80211 workqueue (because of dependencies | ||
903 | * between various work structures). | ||
854 | */ | 904 | */ |
855 | struct ieee80211_rx_status rx_status; | 905 | struct workqueue_struct *workqueue; |
856 | 906 | ||
857 | /* | 907 | /* |
858 | * Scheduled work. | 908 | * Scheduled work. |
@@ -862,15 +912,25 @@ struct rt2x00_dev { | |||
862 | */ | 912 | */ |
863 | struct work_struct intf_work; | 913 | struct work_struct intf_work; |
864 | 914 | ||
915 | /** | ||
916 | * Scheduled work for TX/RX done handling (USB devices) | ||
917 | */ | ||
918 | struct work_struct rxdone_work; | ||
919 | struct work_struct txdone_work; | ||
920 | |||
921 | /* | ||
922 | * Powersaving work | ||
923 | */ | ||
924 | struct delayed_work autowakeup_work; | ||
925 | |||
865 | /* | 926 | /* |
866 | * Data queue arrays for RX, TX and Beacon. | 927 | * Data queue arrays for RX, TX, Beacon and ATIM. |
867 | * The Beacon array also contains the Atim queue | ||
868 | * if that is supported by the device. | ||
869 | */ | 928 | */ |
870 | unsigned int data_queues; | 929 | unsigned int data_queues; |
871 | struct data_queue *rx; | 930 | struct data_queue *rx; |
872 | struct data_queue *tx; | 931 | struct data_queue *tx; |
873 | struct data_queue *bcn; | 932 | struct data_queue *bcn; |
933 | struct data_queue *atim; | ||
874 | 934 | ||
875 | /* | 935 | /* |
876 | * Firmware image. | 936 | * Firmware image. |
@@ -878,10 +938,28 @@ struct rt2x00_dev { | |||
878 | const struct firmware *fw; | 938 | const struct firmware *fw; |
879 | 939 | ||
880 | /* | 940 | /* |
881 | * Interrupt values, stored between interrupt service routine | 941 | * FIFO for storing tx status reports between isr and tasklet. |
882 | * and interrupt thread routine. | 942 | */ |
943 | DECLARE_KFIFO_PTR(txstatus_fifo, u32); | ||
944 | |||
945 | /* | ||
946 | * Timer to ensure tx status reports are read (rt2800usb). | ||
947 | */ | ||
948 | struct timer_list txstatus_timer; | ||
949 | |||
950 | /* | ||
951 | * Tasklet for processing tx status reports (rt2800pci). | ||
952 | */ | ||
953 | struct tasklet_struct txstatus_tasklet; | ||
954 | struct tasklet_struct pretbtt_tasklet; | ||
955 | struct tasklet_struct tbtt_tasklet; | ||
956 | struct tasklet_struct rxdone_tasklet; | ||
957 | struct tasklet_struct autowake_tasklet; | ||
958 | |||
959 | /* | ||
960 | * Protect the interrupt mask register. | ||
883 | */ | 961 | */ |
884 | u32 irqvalue[2]; | 962 | spinlock_t irqmask_lock; |
885 | }; | 963 | }; |
886 | 964 | ||
887 | /* | 965 | /* |
@@ -890,7 +968,7 @@ struct rt2x00_dev { | |||
890 | * in those cases REGISTER_BUSY_COUNT attempts should be | 968 | * in those cases REGISTER_BUSY_COUNT attempts should be |
891 | * taken with a REGISTER_BUSY_DELAY interval. | 969 | * taken with a REGISTER_BUSY_DELAY interval. |
892 | */ | 970 | */ |
893 | #define REGISTER_BUSY_COUNT 5 | 971 | #define REGISTER_BUSY_COUNT 100 |
894 | #define REGISTER_BUSY_DELAY 100 | 972 | #define REGISTER_BUSY_DELAY 100 |
895 | 973 | ||
896 | /* | 974 | /* |
@@ -1016,25 +1094,35 @@ static inline bool rt2x00_is_soc(struct rt2x00_dev *rt2x00dev) | |||
1016 | 1094 | ||
1017 | /** | 1095 | /** |
1018 | * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes. | 1096 | * rt2x00queue_map_txskb - Map a skb into DMA for TX purposes. |
1019 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | 1097 | * @entry: Pointer to &struct queue_entry |
1020 | * @skb: The skb to map. | ||
1021 | */ | 1098 | */ |
1022 | void rt2x00queue_map_txskb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); | 1099 | void rt2x00queue_map_txskb(struct queue_entry *entry); |
1023 | 1100 | ||
1024 | /** | 1101 | /** |
1025 | * rt2x00queue_unmap_skb - Unmap a skb from DMA. | 1102 | * rt2x00queue_unmap_skb - Unmap a skb from DMA. |
1026 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | 1103 | * @entry: Pointer to &struct queue_entry |
1027 | * @skb: The skb to unmap. | ||
1028 | */ | 1104 | */ |
1029 | void rt2x00queue_unmap_skb(struct rt2x00_dev *rt2x00dev, struct sk_buff *skb); | 1105 | void rt2x00queue_unmap_skb(struct queue_entry *entry); |
1030 | 1106 | ||
1031 | /** | 1107 | /** |
1032 | * rt2x00queue_get_queue - Convert queue index to queue pointer | 1108 | * rt2x00queue_get_tx_queue - Convert tx queue index to queue pointer |
1033 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | 1109 | * @rt2x00dev: Pointer to &struct rt2x00_dev. |
1034 | * @queue: rt2x00 queue index (see &enum data_queue_qid). | 1110 | * @queue: rt2x00 queue index (see &enum data_queue_qid). |
1111 | * | ||
1112 | * Returns NULL for non tx queues. | ||
1035 | */ | 1113 | */ |
1036 | struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, | 1114 | static inline struct data_queue * |
1037 | const enum data_queue_qid queue); | 1115 | rt2x00queue_get_tx_queue(struct rt2x00_dev *rt2x00dev, |
1116 | const enum data_queue_qid queue) | ||
1117 | { | ||
1118 | if (queue < rt2x00dev->ops->tx_queues && rt2x00dev->tx) | ||
1119 | return &rt2x00dev->tx[queue]; | ||
1120 | |||
1121 | if (queue == QID_ATIM) | ||
1122 | return rt2x00dev->atim; | ||
1123 | |||
1124 | return NULL; | ||
1125 | } | ||
1038 | 1126 | ||
1039 | /** | 1127 | /** |
1040 | * rt2x00queue_get_entry - Get queue entry where the given index points to. | 1128 | * rt2x00queue_get_entry - Get queue entry where the given index points to. |
@@ -1044,6 +1132,78 @@ struct data_queue *rt2x00queue_get_queue(struct rt2x00_dev *rt2x00dev, | |||
1044 | struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, | 1132 | struct queue_entry *rt2x00queue_get_entry(struct data_queue *queue, |
1045 | enum queue_index index); | 1133 | enum queue_index index); |
1046 | 1134 | ||
1135 | /** | ||
1136 | * rt2x00queue_pause_queue - Pause a data queue | ||
1137 | * @queue: Pointer to &struct data_queue. | ||
1138 | * | ||
1139 | * This function will pause the data queue locally, preventing | ||
1140 | * new frames to be added to the queue (while the hardware is | ||
1141 | * still allowed to run). | ||
1142 | */ | ||
1143 | void rt2x00queue_pause_queue(struct data_queue *queue); | ||
1144 | |||
1145 | /** | ||
1146 | * rt2x00queue_unpause_queue - unpause a data queue | ||
1147 | * @queue: Pointer to &struct data_queue. | ||
1148 | * | ||
1149 | * This function will unpause the data queue locally, allowing | ||
1150 | * new frames to be added to the queue again. | ||
1151 | */ | ||
1152 | void rt2x00queue_unpause_queue(struct data_queue *queue); | ||
1153 | |||
1154 | /** | ||
1155 | * rt2x00queue_start_queue - Start a data queue | ||
1156 | * @queue: Pointer to &struct data_queue. | ||
1157 | * | ||
1158 | * This function will start handling all pending frames in the queue. | ||
1159 | */ | ||
1160 | void rt2x00queue_start_queue(struct data_queue *queue); | ||
1161 | |||
1162 | /** | ||
1163 | * rt2x00queue_stop_queue - Halt a data queue | ||
1164 | * @queue: Pointer to &struct data_queue. | ||
1165 | * | ||
1166 | * This function will stop all pending frames in the queue. | ||
1167 | */ | ||
1168 | void rt2x00queue_stop_queue(struct data_queue *queue); | ||
1169 | |||
1170 | /** | ||
1171 | * rt2x00queue_flush_queue - Flush a data queue | ||
1172 | * @queue: Pointer to &struct data_queue. | ||
1173 | * @drop: True to drop all pending frames. | ||
1174 | * | ||
1175 | * This function will flush the queue. After this call | ||
1176 | * the queue is guaranteed to be empty. | ||
1177 | */ | ||
1178 | void rt2x00queue_flush_queue(struct data_queue *queue, bool drop); | ||
1179 | |||
1180 | /** | ||
1181 | * rt2x00queue_start_queues - Start all data queues | ||
1182 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
1183 | * | ||
1184 | * This function will loop through all available queues to start them | ||
1185 | */ | ||
1186 | void rt2x00queue_start_queues(struct rt2x00_dev *rt2x00dev); | ||
1187 | |||
1188 | /** | ||
1189 | * rt2x00queue_stop_queues - Halt all data queues | ||
1190 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
1191 | * | ||
1192 | * This function will loop through all available queues to stop | ||
1193 | * any pending frames. | ||
1194 | */ | ||
1195 | void rt2x00queue_stop_queues(struct rt2x00_dev *rt2x00dev); | ||
1196 | |||
1197 | /** | ||
1198 | * rt2x00queue_flush_queues - Flush all data queues | ||
1199 | * @rt2x00dev: Pointer to &struct rt2x00_dev. | ||
1200 | * @drop: True to drop all pending frames. | ||
1201 | * | ||
1202 | * This function will loop through all available queues to flush | ||
1203 | * any pending frames. | ||
1204 | */ | ||
1205 | void rt2x00queue_flush_queues(struct rt2x00_dev *rt2x00dev, bool drop); | ||
1206 | |||
1047 | /* | 1207 | /* |
1048 | * Debugfs handlers. | 1208 | * Debugfs handlers. |
1049 | */ | 1209 | */ |
@@ -1069,15 +1229,17 @@ static inline void rt2x00debug_dump_frame(struct rt2x00_dev *rt2x00dev, | |||
1069 | */ | 1229 | */ |
1070 | void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev); | 1230 | void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev); |
1071 | void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev); | 1231 | void rt2x00lib_pretbtt(struct rt2x00_dev *rt2x00dev); |
1232 | void rt2x00lib_dmastart(struct queue_entry *entry); | ||
1233 | void rt2x00lib_dmadone(struct queue_entry *entry); | ||
1072 | void rt2x00lib_txdone(struct queue_entry *entry, | 1234 | void rt2x00lib_txdone(struct queue_entry *entry, |
1073 | struct txdone_entry_desc *txdesc); | 1235 | struct txdone_entry_desc *txdesc); |
1074 | void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev, | 1236 | void rt2x00lib_txdone_noinfo(struct queue_entry *entry, u32 status); |
1075 | struct queue_entry *entry); | 1237 | void rt2x00lib_rxdone(struct queue_entry *entry); |
1076 | 1238 | ||
1077 | /* | 1239 | /* |
1078 | * mac80211 handlers. | 1240 | * mac80211 handlers. |
1079 | */ | 1241 | */ |
1080 | int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); | 1242 | void rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); |
1081 | int rt2x00mac_start(struct ieee80211_hw *hw); | 1243 | int rt2x00mac_start(struct ieee80211_hw *hw); |
1082 | void rt2x00mac_stop(struct ieee80211_hw *hw); | 1244 | void rt2x00mac_stop(struct ieee80211_hw *hw); |
1083 | int rt2x00mac_add_interface(struct ieee80211_hw *hw, | 1245 | int rt2x00mac_add_interface(struct ieee80211_hw *hw, |
@@ -1109,6 +1271,11 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, | |||
1109 | int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue, | 1271 | int rt2x00mac_conf_tx(struct ieee80211_hw *hw, u16 queue, |
1110 | const struct ieee80211_tx_queue_params *params); | 1272 | const struct ieee80211_tx_queue_params *params); |
1111 | void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); | 1273 | void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw); |
1274 | void rt2x00mac_flush(struct ieee80211_hw *hw, bool drop); | ||
1275 | int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant); | ||
1276 | int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant); | ||
1277 | void rt2x00mac_get_ringparam(struct ieee80211_hw *hw, | ||
1278 | u32 *tx, u32 *tx_max, u32 *rx, u32 *rx_max); | ||
1112 | 1279 | ||
1113 | /* | 1280 | /* |
1114 | * Driver allocation handlers. | 1281 | * Driver allocation handlers. |