diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00.h')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 127 |
1 files changed, 86 insertions, 41 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 27bc6b7fbfde..d9daa9c406fa 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 rt2x00 SourceForge Project | 2 | Copyright (C) 2004 - 2009 Ivo van Doorn <IvDoorn@gmail.com> |
3 | Copyright (C) 2004 - 2009 Gertjan van Wingerde <gwingerde@gmail.com> | ||
3 | <http://rt2x00.serialmonkey.com> | 4 | <http://rt2x00.serialmonkey.com> |
4 | 5 | ||
5 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
@@ -103,6 +104,12 @@ | |||
103 | #define GET_DURATION_RES(__size, __rate)(((__size) * 8 * 10) % (__rate)) | 104 | #define GET_DURATION_RES(__size, __rate)(((__size) * 8 * 10) % (__rate)) |
104 | 105 | ||
105 | /* | 106 | /* |
107 | * Determine the number of L2 padding bytes required between the header and | ||
108 | * the payload. | ||
109 | */ | ||
110 | #define L2PAD_SIZE(__hdrlen) (-(__hdrlen) & 3) | ||
111 | |||
112 | /* | ||
106 | * Determine the alignment requirement, | 113 | * Determine the alignment requirement, |
107 | * to make sure the 802.11 payload is padded to a 4-byte boundrary | 114 | * to make sure the 802.11 payload is padded to a 4-byte boundrary |
108 | * we must determine the address of the payload and calculate the | 115 | * we must determine the address of the payload and calculate the |
@@ -112,6 +119,12 @@ | |||
112 | ( ((unsigned long)((__skb)->data + (__header))) & 3 ) | 119 | ( ((unsigned long)((__skb)->data + (__header))) & 3 ) |
113 | 120 | ||
114 | /* | 121 | /* |
122 | * Constants for extra TX headroom for alignment purposes. | ||
123 | */ | ||
124 | #define RT2X00_ALIGN_SIZE 4 /* Only whole frame needs alignment */ | ||
125 | #define RT2X00_L2PAD_SIZE 8 /* Both header & payload need alignment */ | ||
126 | |||
127 | /* | ||
115 | * Standard timing and size defines. | 128 | * Standard timing and size defines. |
116 | * These values should follow the ieee80211 specifications. | 129 | * These values should follow the ieee80211 specifications. |
117 | */ | 130 | */ |
@@ -144,6 +157,12 @@ struct avg_val { | |||
144 | int avg_weight; | 157 | int avg_weight; |
145 | }; | 158 | }; |
146 | 159 | ||
160 | enum rt2x00_chip_intf { | ||
161 | RT2X00_CHIP_INTF_PCI, | ||
162 | RT2X00_CHIP_INTF_USB, | ||
163 | RT2X00_CHIP_INTF_SOC, | ||
164 | }; | ||
165 | |||
147 | /* | 166 | /* |
148 | * Chipset identification | 167 | * Chipset identification |
149 | * The chipset on the device is composed of a RT and RF chip. | 168 | * The chipset on the device is composed of a RT and RF chip. |
@@ -151,17 +170,28 @@ struct avg_val { | |||
151 | */ | 170 | */ |
152 | struct rt2x00_chip { | 171 | struct rt2x00_chip { |
153 | u16 rt; | 172 | u16 rt; |
154 | #define RT2460 0x0101 | 173 | #define RT2460 0x2460 |
155 | #define RT2560 0x0201 | 174 | #define RT2560 0x2560 |
156 | #define RT2570 0x1201 | 175 | #define RT2570 0x2570 |
157 | #define RT2561s 0x0301 /* Turbo */ | 176 | #define RT2661 0x2661 |
158 | #define RT2561 0x0302 | 177 | #define RT2573 0x2573 |
159 | #define RT2661 0x0401 | 178 | #define RT2860 0x2860 /* 2.4GHz PCI/CB */ |
160 | #define RT2571 0x1300 | 179 | #define RT2870 0x2870 |
161 | #define RT2870 0x1600 | 180 | #define RT2872 0x2872 |
181 | #define RT2880 0x2880 /* WSOC */ | ||
182 | #define RT2883 0x2883 /* WSOC */ | ||
183 | #define RT2890 0x2890 /* 2.4GHz PCIe */ | ||
184 | #define RT3052 0x3052 /* WSOC */ | ||
185 | #define RT3070 0x3070 | ||
186 | #define RT3071 0x3071 | ||
187 | #define RT3090 0x3090 /* 2.4GHz PCIe */ | ||
188 | #define RT3390 0x3390 | ||
189 | #define RT3572 0x3572 | ||
162 | 190 | ||
163 | u16 rf; | 191 | u16 rf; |
164 | u32 rev; | 192 | u16 rev; |
193 | |||
194 | enum rt2x00_chip_intf intf; | ||
165 | }; | 195 | }; |
166 | 196 | ||
167 | /* | 197 | /* |
@@ -299,13 +329,6 @@ struct link { | |||
299 | struct avg_val avg_rssi; | 329 | struct avg_val avg_rssi; |
300 | 330 | ||
301 | /* | 331 | /* |
302 | * Currently precalculated percentages of successful | ||
303 | * TX and RX frames. | ||
304 | */ | ||
305 | int rx_percentage; | ||
306 | int tx_percentage; | ||
307 | |||
308 | /* | ||
309 | * Work structure for scheduling periodic link tuning. | 332 | * Work structure for scheduling periodic link tuning. |
310 | */ | 333 | */ |
311 | struct delayed_work work; | 334 | struct delayed_work work; |
@@ -579,6 +602,7 @@ struct rt2x00_ops { | |||
579 | const unsigned int eeprom_size; | 602 | const unsigned int eeprom_size; |
580 | const unsigned int rf_size; | 603 | const unsigned int rf_size; |
581 | const unsigned int tx_queues; | 604 | const unsigned int tx_queues; |
605 | const unsigned int extra_tx_headroom; | ||
582 | const struct data_queue_desc *rx; | 606 | const struct data_queue_desc *rx; |
583 | const struct data_queue_desc *tx; | 607 | const struct data_queue_desc *tx; |
584 | const struct data_queue_desc *bcn; | 608 | const struct data_queue_desc *bcn; |
@@ -835,9 +859,23 @@ struct rt2x00_dev { | |||
835 | * Firmware image. | 859 | * Firmware image. |
836 | */ | 860 | */ |
837 | const struct firmware *fw; | 861 | const struct firmware *fw; |
862 | |||
863 | /* | ||
864 | * Driver specific data. | ||
865 | */ | ||
866 | void *priv; | ||
838 | }; | 867 | }; |
839 | 868 | ||
840 | /* | 869 | /* |
870 | * Register defines. | ||
871 | * Some registers require multiple attempts before success, | ||
872 | * in those cases REGISTER_BUSY_COUNT attempts should be | ||
873 | * taken with a REGISTER_BUSY_DELAY interval. | ||
874 | */ | ||
875 | #define REGISTER_BUSY_COUNT 5 | ||
876 | #define REGISTER_BUSY_DELAY 100 | ||
877 | |||
878 | /* | ||
841 | * Generic RF access. | 879 | * Generic RF access. |
842 | * The RF is being accessed by word index. | 880 | * The RF is being accessed by word index. |
843 | */ | 881 | */ |
@@ -881,48 +919,57 @@ static inline void rt2x00_eeprom_write(struct rt2x00_dev *rt2x00dev, | |||
881 | * Chipset handlers | 919 | * Chipset handlers |
882 | */ | 920 | */ |
883 | static inline void rt2x00_set_chip(struct rt2x00_dev *rt2x00dev, | 921 | static inline void rt2x00_set_chip(struct rt2x00_dev *rt2x00dev, |
884 | const u16 rt, const u16 rf, const u32 rev) | 922 | const u16 rt, const u16 rf, const u16 rev) |
885 | { | 923 | { |
886 | INFO(rt2x00dev, | ||
887 | "Chipset detected - rt: %04x, rf: %04x, rev: %08x.\n", | ||
888 | rt, rf, rev); | ||
889 | |||
890 | rt2x00dev->chip.rt = rt; | 924 | rt2x00dev->chip.rt = rt; |
891 | rt2x00dev->chip.rf = rf; | 925 | rt2x00dev->chip.rf = rf; |
892 | rt2x00dev->chip.rev = rev; | 926 | rt2x00dev->chip.rev = rev; |
927 | |||
928 | INFO(rt2x00dev, | ||
929 | "Chipset detected - rt: %04x, rf: %04x, rev: %04x.\n", | ||
930 | rt2x00dev->chip.rt, rt2x00dev->chip.rf, rt2x00dev->chip.rev); | ||
893 | } | 931 | } |
894 | 932 | ||
895 | static inline void rt2x00_set_chip_rt(struct rt2x00_dev *rt2x00dev, | 933 | static inline char rt2x00_rt(struct rt2x00_dev *rt2x00dev, const u16 rt) |
896 | const u16 rt) | ||
897 | { | 934 | { |
898 | rt2x00dev->chip.rt = rt; | 935 | return (rt2x00dev->chip.rt == rt); |
936 | } | ||
937 | |||
938 | static inline char rt2x00_rf(struct rt2x00_dev *rt2x00dev, const u16 rf) | ||
939 | { | ||
940 | return (rt2x00dev->chip.rf == rf); | ||
941 | } | ||
942 | |||
943 | static inline u16 rt2x00_rev(struct rt2x00_dev *rt2x00dev) | ||
944 | { | ||
945 | return rt2x00dev->chip.rev; | ||
899 | } | 946 | } |
900 | 947 | ||
901 | static inline void rt2x00_set_chip_rf(struct rt2x00_dev *rt2x00dev, | 948 | static inline void rt2x00_set_chip_intf(struct rt2x00_dev *rt2x00dev, |
902 | const u16 rf, const u32 rev) | 949 | enum rt2x00_chip_intf intf) |
903 | { | 950 | { |
904 | rt2x00_set_chip(rt2x00dev, rt2x00dev->chip.rt, rf, rev); | 951 | rt2x00dev->chip.intf = intf; |
905 | } | 952 | } |
906 | 953 | ||
907 | static inline char rt2x00_rt(const struct rt2x00_chip *chipset, const u16 chip) | 954 | static inline bool rt2x00_intf(struct rt2x00_dev *rt2x00dev, |
955 | enum rt2x00_chip_intf intf) | ||
908 | { | 956 | { |
909 | return (chipset->rt == chip); | 957 | return (rt2x00dev->chip.intf == intf); |
910 | } | 958 | } |
911 | 959 | ||
912 | static inline char rt2x00_rf(const struct rt2x00_chip *chipset, const u16 chip) | 960 | static inline bool rt2x00_is_pci(struct rt2x00_dev *rt2x00dev) |
913 | { | 961 | { |
914 | return (chipset->rf == chip); | 962 | return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_PCI); |
915 | } | 963 | } |
916 | 964 | ||
917 | static inline u32 rt2x00_rev(const struct rt2x00_chip *chipset) | 965 | static inline bool rt2x00_is_usb(struct rt2x00_dev *rt2x00dev) |
918 | { | 966 | { |
919 | return chipset->rev; | 967 | return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_USB); |
920 | } | 968 | } |
921 | 969 | ||
922 | static inline bool rt2x00_check_rev(const struct rt2x00_chip *chipset, | 970 | static inline bool rt2x00_is_soc(struct rt2x00_dev *rt2x00dev) |
923 | const u32 mask, const u32 rev) | ||
924 | { | 971 | { |
925 | return ((chipset->rev & mask) == rev); | 972 | return rt2x00_intf(rt2x00dev, RT2X00_CHIP_INTF_SOC); |
926 | } | 973 | } |
927 | 974 | ||
928 | /** | 975 | /** |
@@ -964,9 +1011,9 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb); | |||
964 | int rt2x00mac_start(struct ieee80211_hw *hw); | 1011 | int rt2x00mac_start(struct ieee80211_hw *hw); |
965 | void rt2x00mac_stop(struct ieee80211_hw *hw); | 1012 | void rt2x00mac_stop(struct ieee80211_hw *hw); |
966 | int rt2x00mac_add_interface(struct ieee80211_hw *hw, | 1013 | int rt2x00mac_add_interface(struct ieee80211_hw *hw, |
967 | struct ieee80211_if_init_conf *conf); | 1014 | struct ieee80211_vif *vif); |
968 | void rt2x00mac_remove_interface(struct ieee80211_hw *hw, | 1015 | void rt2x00mac_remove_interface(struct ieee80211_hw *hw, |
969 | struct ieee80211_if_init_conf *conf); | 1016 | struct ieee80211_vif *vif); |
970 | int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed); | 1017 | int rt2x00mac_config(struct ieee80211_hw *hw, u32 changed); |
971 | void rt2x00mac_configure_filter(struct ieee80211_hw *hw, | 1018 | void rt2x00mac_configure_filter(struct ieee80211_hw *hw, |
972 | unsigned int changed_flags, | 1019 | unsigned int changed_flags, |
@@ -983,8 +1030,6 @@ int rt2x00mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, | |||
983 | #endif /* CONFIG_RT2X00_LIB_CRYPTO */ | 1030 | #endif /* CONFIG_RT2X00_LIB_CRYPTO */ |
984 | int rt2x00mac_get_stats(struct ieee80211_hw *hw, | 1031 | int rt2x00mac_get_stats(struct ieee80211_hw *hw, |
985 | struct ieee80211_low_level_stats *stats); | 1032 | struct ieee80211_low_level_stats *stats); |
986 | int rt2x00mac_get_tx_stats(struct ieee80211_hw *hw, | ||
987 | struct ieee80211_tx_queue_stats *stats); | ||
988 | void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, | 1033 | void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw, |
989 | struct ieee80211_vif *vif, | 1034 | struct ieee80211_vif *vif, |
990 | struct ieee80211_bss_conf *bss_conf, | 1035 | struct ieee80211_bss_conf *bss_conf, |