diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2008-11-17 22:38:13 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-11-26 09:47:31 -0500 |
commit | 46d14a58ffb42702e4c1b8bb88cfa05414617f4c (patch) | |
tree | be81f5cf58d58e584828de6699445c499332f06a /drivers/net/wireless/ath9k/rc.c | |
parent | e63835b0f4d8545942fd41b3ca32bbf71bd73e4b (diff) |
ath9k: General code scrub
Replace TRUE/FALSE macros with VALID/INVALID macros.
Follow a consistent variable convention.
Remove unnecessary comments.
Add all RC phy macros into a single enum.
Merge functions into reasonably sized entities.
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/rc.c')
-rw-r--r-- | drivers/net/wireless/ath9k/rc.c | 546 |
1 files changed, 236 insertions, 310 deletions
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c index bf637aa7ddab..51f51afa6da9 100644 --- a/drivers/net/wireless/ath9k/rc.c +++ b/drivers/net/wireless/ath9k/rc.c | |||
@@ -15,142 +15,136 @@ | |||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | /* | ||
19 | * Atheros rate control algorithm | ||
20 | */ | ||
21 | |||
22 | #include "core.h" | 18 | #include "core.h" |
23 | /* FIXME: remove this include! */ | ||
24 | #include "../net/mac80211/rate.h" | ||
25 | 19 | ||
26 | static struct ath_rate_table ar5416_11na_ratetable = { | 20 | static struct ath_rate_table ar5416_11na_ratetable = { |
27 | 42, | 21 | 42, |
28 | {0}, | 22 | {0}, |
29 | { | 23 | { |
30 | { TRUE, TRUE, WLAN_PHY_OFDM, 6000, /* 6 Mb */ | 24 | { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ |
31 | 5400, 0x0b, 0x00, 12, | 25 | 5400, 0x0b, 0x00, 12, |
32 | 0, 2, 1, 0, 0, 0, 0, 0 }, | 26 | 0, 2, 1, 0, 0, 0, 0, 0 }, |
33 | { TRUE, TRUE, WLAN_PHY_OFDM, 9000, /* 9 Mb */ | 27 | { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ |
34 | 7800, 0x0f, 0x00, 18, | 28 | 7800, 0x0f, 0x00, 18, |
35 | 0, 3, 1, 1, 1, 1, 1, 0 }, | 29 | 0, 3, 1, 1, 1, 1, 1, 0 }, |
36 | { TRUE, TRUE, WLAN_PHY_OFDM, 12000, /* 12 Mb */ | 30 | { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ |
37 | 10000, 0x0a, 0x00, 24, | 31 | 10000, 0x0a, 0x00, 24, |
38 | 2, 4, 2, 2, 2, 2, 2, 0 }, | 32 | 2, 4, 2, 2, 2, 2, 2, 0 }, |
39 | { TRUE, TRUE, WLAN_PHY_OFDM, 18000, /* 18 Mb */ | 33 | { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ |
40 | 13900, 0x0e, 0x00, 36, | 34 | 13900, 0x0e, 0x00, 36, |
41 | 2, 6, 2, 3, 3, 3, 3, 0 }, | 35 | 2, 6, 2, 3, 3, 3, 3, 0 }, |
42 | { TRUE, TRUE, WLAN_PHY_OFDM, 24000, /* 24 Mb */ | 36 | { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ |
43 | 17300, 0x09, 0x00, 48, | 37 | 17300, 0x09, 0x00, 48, |
44 | 4, 10, 3, 4, 4, 4, 4, 0 }, | 38 | 4, 10, 3, 4, 4, 4, 4, 0 }, |
45 | { TRUE, TRUE, WLAN_PHY_OFDM, 36000, /* 36 Mb */ | 39 | { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ |
46 | 23000, 0x0d, 0x00, 72, | 40 | 23000, 0x0d, 0x00, 72, |
47 | 4, 14, 3, 5, 5, 5, 5, 0 }, | 41 | 4, 14, 3, 5, 5, 5, 5, 0 }, |
48 | { TRUE, TRUE, WLAN_PHY_OFDM, 48000, /* 48 Mb */ | 42 | { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ |
49 | 27400, 0x08, 0x00, 96, | 43 | 27400, 0x08, 0x00, 96, |
50 | 4, 20, 3, 6, 6, 6, 6, 0 }, | 44 | 4, 20, 3, 6, 6, 6, 6, 0 }, |
51 | { TRUE, TRUE, WLAN_PHY_OFDM, 54000, /* 54 Mb */ | 45 | { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ |
52 | 29300, 0x0c, 0x00, 108, | 46 | 29300, 0x0c, 0x00, 108, |
53 | 4, 23, 3, 7, 7, 7, 7, 0 }, | 47 | 4, 23, 3, 7, 7, 7, 7, 0 }, |
54 | { TRUE_20, TRUE_20, WLAN_PHY_HT_20_SS, 6500, /* 6.5 Mb */ | 48 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ |
55 | 6400, 0x80, 0x00, 0, | 49 | 6400, 0x80, 0x00, 0, |
56 | 0, 2, 3, 8, 24, 8, 24, 3216 }, | 50 | 0, 2, 3, 8, 24, 8, 24, 3216 }, |
57 | { TRUE_20, TRUE_20, WLAN_PHY_HT_20_SS, 13000, /* 13 Mb */ | 51 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ |
58 | 12700, 0x81, 0x00, 1, | 52 | 12700, 0x81, 0x00, 1, |
59 | 2, 4, 3, 9, 25, 9, 25, 6434 }, | 53 | 2, 4, 3, 9, 25, 9, 25, 6434 }, |
60 | { TRUE_20, TRUE_20, WLAN_PHY_HT_20_SS, 19500, /* 19.5 Mb */ | 54 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ |
61 | 18800, 0x82, 0x00, 2, | 55 | 18800, 0x82, 0x00, 2, |
62 | 2, 6, 3, 10, 26, 10, 26, 9650 }, | 56 | 2, 6, 3, 10, 26, 10, 26, 9650 }, |
63 | { TRUE_20, TRUE_20, WLAN_PHY_HT_20_SS, 26000, /* 26 Mb */ | 57 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ |
64 | 25000, 0x83, 0x00, 3, | 58 | 25000, 0x83, 0x00, 3, |
65 | 4, 10, 3, 11, 27, 11, 27, 12868 }, | 59 | 4, 10, 3, 11, 27, 11, 27, 12868 }, |
66 | { TRUE_20, TRUE_20, WLAN_PHY_HT_20_SS, 39000, /* 39 Mb */ | 60 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ |
67 | 36700, 0x84, 0x00, 4, | 61 | 36700, 0x84, 0x00, 4, |
68 | 4, 14, 3, 12, 28, 12, 28, 19304 }, | 62 | 4, 14, 3, 12, 28, 12, 28, 19304 }, |
69 | { FALSE, TRUE_20, WLAN_PHY_HT_20_SS, 52000, /* 52 Mb */ | 63 | { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ |
70 | 48100, 0x85, 0x00, 5, | 64 | 48100, 0x85, 0x00, 5, |
71 | 4, 20, 3, 13, 29, 13, 29, 25740 }, | 65 | 4, 20, 3, 13, 29, 13, 29, 25740 }, |
72 | { FALSE, TRUE_20, WLAN_PHY_HT_20_SS, 58500, /* 58.5 Mb */ | 66 | { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ |
73 | 53500, 0x86, 0x00, 6, | 67 | 53500, 0x86, 0x00, 6, |
74 | 4, 23, 3, 14, 30, 14, 30, 28956 }, | 68 | 4, 23, 3, 14, 30, 14, 30, 28956 }, |
75 | { FALSE, TRUE_20, WLAN_PHY_HT_20_SS, 65000, /* 65 Mb */ | 69 | { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ |
76 | 59000, 0x87, 0x00, 7, | 70 | 59000, 0x87, 0x00, 7, |
77 | 4, 25, 3, 15, 31, 15, 32, 32180 }, | 71 | 4, 25, 3, 15, 31, 15, 32, 32180 }, |
78 | { FALSE, FALSE, WLAN_PHY_HT_20_DS, 13000, /* 13 Mb */ | 72 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ |
79 | 12700, 0x88, 0x00, | 73 | 12700, 0x88, 0x00, |
80 | 8, 0, 2, 3, 16, 33, 16, 33, 6430 }, | 74 | 8, 0, 2, 3, 16, 33, 16, 33, 6430 }, |
81 | { FALSE, FALSE, WLAN_PHY_HT_20_DS, 26000, /* 26 Mb */ | 75 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ |
82 | 24800, 0x89, 0x00, 9, | 76 | 24800, 0x89, 0x00, 9, |
83 | 2, 4, 3, 17, 34, 17, 34, 12860 }, | 77 | 2, 4, 3, 17, 34, 17, 34, 12860 }, |
84 | { FALSE, FALSE, WLAN_PHY_HT_20_DS, 39000, /* 39 Mb */ | 78 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ |
85 | 36600, 0x8a, 0x00, 10, | 79 | 36600, 0x8a, 0x00, 10, |
86 | 2, 6, 3, 18, 35, 18, 35, 19300 }, | 80 | 2, 6, 3, 18, 35, 18, 35, 19300 }, |
87 | { TRUE_20, FALSE, WLAN_PHY_HT_20_DS, 52000, /* 52 Mb */ | 81 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ |
88 | 48100, 0x8b, 0x00, 11, | 82 | 48100, 0x8b, 0x00, 11, |
89 | 4, 10, 3, 19, 36, 19, 36, 25736 }, | 83 | 4, 10, 3, 19, 36, 19, 36, 25736 }, |
90 | { TRUE_20, FALSE, WLAN_PHY_HT_20_DS, 78000, /* 78 Mb */ | 84 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ |
91 | 69500, 0x8c, 0x00, 12, | 85 | 69500, 0x8c, 0x00, 12, |
92 | 4, 14, 3, 20, 37, 20, 37, 38600 }, | 86 | 4, 14, 3, 20, 37, 20, 37, 38600 }, |
93 | { TRUE_20, FALSE, WLAN_PHY_HT_20_DS, 104000, /* 104 Mb */ | 87 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ |
94 | 89500, 0x8d, 0x00, 13, | 88 | 89500, 0x8d, 0x00, 13, |
95 | 4, 20, 3, 21, 38, 21, 38, 51472 }, | 89 | 4, 20, 3, 21, 38, 21, 38, 51472 }, |
96 | { TRUE_20, FALSE, WLAN_PHY_HT_20_DS, 117000, /* 117 Mb */ | 90 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ |
97 | 98900, 0x8e, 0x00, 14, | 91 | 98900, 0x8e, 0x00, 14, |
98 | 4, 23, 3, 22, 39, 22, 39, 57890 }, | 92 | 4, 23, 3, 22, 39, 22, 39, 57890 }, |
99 | { TRUE_20, FALSE, WLAN_PHY_HT_20_DS, 130000, /* 130 Mb */ | 93 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ |
100 | 108300, 0x8f, 0x00, 15, | 94 | 108300, 0x8f, 0x00, 15, |
101 | 4, 25, 3, 23, 40, 23, 41, 64320 }, | 95 | 4, 25, 3, 23, 40, 23, 41, 64320 }, |
102 | { TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS, 13500, /* 13.5 Mb */ | 96 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ |
103 | 13200, 0x80, 0x00, 0, | 97 | 13200, 0x80, 0x00, 0, |
104 | 0, 2, 3, 8, 24, 24, 24, 6684 }, | 98 | 0, 2, 3, 8, 24, 24, 24, 6684 }, |
105 | { TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS, 27500, /* 27.0 Mb */ | 99 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ |
106 | 25900, 0x81, 0x00, 1, | 100 | 25900, 0x81, 0x00, 1, |
107 | 2, 4, 3, 9, 25, 25, 25, 13368 }, | 101 | 2, 4, 3, 9, 25, 25, 25, 13368 }, |
108 | { TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS, 40500, /* 40.5 Mb */ | 102 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ |
109 | 38600, 0x82, 0x00, 2, | 103 | 38600, 0x82, 0x00, 2, |
110 | 2, 6, 3, 10, 26, 26, 26, 20052 }, | 104 | 2, 6, 3, 10, 26, 26, 26, 20052 }, |
111 | { TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS, 54000, /* 54 Mb */ | 105 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ |
112 | 49800, 0x83, 0x00, 3, | 106 | 49800, 0x83, 0x00, 3, |
113 | 4, 10, 3, 11, 27, 27, 27, 26738 }, | 107 | 4, 10, 3, 11, 27, 27, 27, 26738 }, |
114 | { TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS, 81500, /* 81 Mb */ | 108 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ |
115 | 72200, 0x84, 0x00, 4, | 109 | 72200, 0x84, 0x00, 4, |
116 | 4, 14, 3, 12, 28, 28, 28, 40104 }, | 110 | 4, 14, 3, 12, 28, 28, 28, 40104 }, |
117 | { FALSE, TRUE_40, WLAN_PHY_HT_40_SS, 108000, /* 108 Mb */ | 111 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ |
118 | 92900, 0x85, 0x00, 5, | 112 | 92900, 0x85, 0x00, 5, |
119 | 4, 20, 3, 13, 29, 29, 29, 53476 }, | 113 | 4, 20, 3, 13, 29, 29, 29, 53476 }, |
120 | { FALSE, TRUE_40, WLAN_PHY_HT_40_SS, 121500, /* 121.5 Mb */ | 114 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ |
121 | 102700, 0x86, 0x00, 6, | 115 | 102700, 0x86, 0x00, 6, |
122 | 4, 23, 3, 14, 30, 30, 30, 60156 }, | 116 | 4, 23, 3, 14, 30, 30, 30, 60156 }, |
123 | { FALSE, TRUE_40, WLAN_PHY_HT_40_SS, 135000, /* 135 Mb */ | 117 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ |
124 | 112000, 0x87, 0x00, 7, | 118 | 112000, 0x87, 0x00, 7, |
125 | 4, 25, 3, 15, 31, 32, 32, 66840 }, | 119 | 4, 25, 3, 15, 31, 32, 32, 66840 }, |
126 | { FALSE, TRUE_40, WLAN_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ | 120 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ |
127 | 122000, 0x87, 0x00, 7, | 121 | 122000, 0x87, 0x00, 7, |
128 | 4, 25, 3, 15, 31, 32, 32, 74200 }, | 122 | 4, 25, 3, 15, 31, 32, 32, 74200 }, |
129 | { FALSE, FALSE, WLAN_PHY_HT_40_DS, 27000, /* 27 Mb */ | 123 | { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ |
130 | 25800, 0x88, 0x00, 8, | 124 | 25800, 0x88, 0x00, 8, |
131 | 0, 2, 3, 16, 33, 33, 33, 13360 }, | 125 | 0, 2, 3, 16, 33, 33, 33, 13360 }, |
132 | { FALSE, FALSE, WLAN_PHY_HT_40_DS, 54000, /* 54 Mb */ | 126 | { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ |
133 | 49800, 0x89, 0x00, 9, | 127 | 49800, 0x89, 0x00, 9, |
134 | 2, 4, 3, 17, 34, 34, 34, 26720 }, | 128 | 2, 4, 3, 17, 34, 34, 34, 26720 }, |
135 | { FALSE, FALSE, WLAN_PHY_HT_40_DS, 81000, /* 81 Mb */ | 129 | { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ |
136 | 71900, 0x8a, 0x00, 10, | 130 | 71900, 0x8a, 0x00, 10, |
137 | 2, 6, 3, 18, 35, 35, 35, 40080 }, | 131 | 2, 6, 3, 18, 35, 35, 35, 40080 }, |
138 | { TRUE_40, FALSE, WLAN_PHY_HT_40_DS, 108000, /* 108 Mb */ | 132 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ |
139 | 92500, 0x8b, 0x00, 11, | 133 | 92500, 0x8b, 0x00, 11, |
140 | 4, 10, 3, 19, 36, 36, 36, 53440 }, | 134 | 4, 10, 3, 19, 36, 36, 36, 53440 }, |
141 | { TRUE_40, FALSE, WLAN_PHY_HT_40_DS, 162000, /* 162 Mb */ | 135 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ |
142 | 130300, 0x8c, 0x00, 12, | 136 | 130300, 0x8c, 0x00, 12, |
143 | 4, 14, 3, 20, 37, 37, 37, 80160 }, | 137 | 4, 14, 3, 20, 37, 37, 37, 80160 }, |
144 | { TRUE_40, FALSE, WLAN_PHY_HT_40_DS, 216000, /* 216 Mb */ | 138 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ |
145 | 162800, 0x8d, 0x00, 13, | 139 | 162800, 0x8d, 0x00, 13, |
146 | 4, 20, 3, 21, 38, 38, 38, 106880 }, | 140 | 4, 20, 3, 21, 38, 38, 38, 106880 }, |
147 | { TRUE_40, FALSE, WLAN_PHY_HT_40_DS, 243000, /* 243 Mb */ | 141 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ |
148 | 178200, 0x8e, 0x00, 14, | 142 | 178200, 0x8e, 0x00, 14, |
149 | 4, 23, 3, 22, 39, 39, 39, 120240 }, | 143 | 4, 23, 3, 22, 39, 39, 39, 120240 }, |
150 | { TRUE_40, FALSE, WLAN_PHY_HT_40_DS, 270000, /* 270 Mb */ | 144 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ |
151 | 192100, 0x8f, 0x00, 15, | 145 | 192100, 0x8f, 0x00, 15, |
152 | 4, 25, 3, 23, 40, 41, 41, 133600 }, | 146 | 4, 25, 3, 23, 40, 41, 41, 133600 }, |
153 | { TRUE_40, FALSE, WLAN_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ | 147 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ |
154 | 207000, 0x8f, 0x00, 15, | 148 | 207000, 0x8f, 0x00, 15, |
155 | 4, 25, 3, 23, 40, 41, 41, 148400 }, | 149 | 4, 25, 3, 23, 40, 41, 41, 148400 }, |
156 | }, | 150 | }, |
@@ -159,10 +153,10 @@ static struct ath_rate_table ar5416_11na_ratetable = { | |||
159 | WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ | 153 | WLAN_RC_HT_FLAG, /* Phy rates allowed initially */ |
160 | }; | 154 | }; |
161 | 155 | ||
162 | /* TRUE_ALL - valid for 20/40/Legacy, | 156 | /* VALID_ALL - valid for 20/40/Legacy, |
163 | * TRUE - Legacy only, | 157 | * VALID - Legacy only, |
164 | * TRUE_20 - HT 20 only, | 158 | * VALID_20 - HT 20 only, |
165 | * TRUE_40 - HT 40 only */ | 159 | * VALID_40 - HT 40 only */ |
166 | 160 | ||
167 | /* 4ms frame limit not used for NG mode. The values filled | 161 | /* 4ms frame limit not used for NG mode. The values filled |
168 | * for HT are the 64K max aggregate limit */ | 162 | * for HT are the 64K max aggregate limit */ |
@@ -171,142 +165,142 @@ static struct ath_rate_table ar5416_11ng_ratetable = { | |||
171 | 46, | 165 | 46, |
172 | {0}, | 166 | {0}, |
173 | { | 167 | { |
174 | { TRUE_ALL, TRUE_ALL, WLAN_PHY_CCK, 1000, /* 1 Mb */ | 168 | { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ |
175 | 900, 0x1b, 0x00, 2, | 169 | 900, 0x1b, 0x00, 2, |
176 | 0, 0, 1, 0, 0, 0, 0, 0 }, | 170 | 0, 0, 1, 0, 0, 0, 0, 0 }, |
177 | { TRUE_ALL, TRUE_ALL, WLAN_PHY_CCK, 2000, /* 2 Mb */ | 171 | { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ |
178 | 1900, 0x1a, 0x04, 4, | 172 | 1900, 0x1a, 0x04, 4, |
179 | 1, 1, 1, 1, 1, 1, 1, 0 }, | 173 | 1, 1, 1, 1, 1, 1, 1, 0 }, |
180 | { TRUE_ALL, TRUE_ALL, WLAN_PHY_CCK, 5500, /* 5.5 Mb */ | 174 | { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ |
181 | 4900, 0x19, 0x04, 11, | 175 | 4900, 0x19, 0x04, 11, |
182 | 2, 2, 2, 2, 2, 2, 2, 0 }, | 176 | 2, 2, 2, 2, 2, 2, 2, 0 }, |
183 | { TRUE_ALL, TRUE_ALL, WLAN_PHY_CCK, 11000, /* 11 Mb */ | 177 | { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ |
184 | 8100, 0x18, 0x04, 22, | 178 | 8100, 0x18, 0x04, 22, |
185 | 3, 3, 2, 3, 3, 3, 3, 0 }, | 179 | 3, 3, 2, 3, 3, 3, 3, 0 }, |
186 | { FALSE, FALSE, WLAN_PHY_OFDM, 6000, /* 6 Mb */ | 180 | { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ |
187 | 5400, 0x0b, 0x00, 12, | 181 | 5400, 0x0b, 0x00, 12, |
188 | 4, 2, 1, 4, 4, 4, 4, 0 }, | 182 | 4, 2, 1, 4, 4, 4, 4, 0 }, |
189 | { FALSE, FALSE, WLAN_PHY_OFDM, 9000, /* 9 Mb */ | 183 | { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ |
190 | 7800, 0x0f, 0x00, 18, | 184 | 7800, 0x0f, 0x00, 18, |
191 | 4, 3, 1, 5, 5, 5, 5, 0 }, | 185 | 4, 3, 1, 5, 5, 5, 5, 0 }, |
192 | { TRUE, TRUE, WLAN_PHY_OFDM, 12000, /* 12 Mb */ | 186 | { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ |
193 | 10100, 0x0a, 0x00, 24, | 187 | 10100, 0x0a, 0x00, 24, |
194 | 6, 4, 1, 6, 6, 6, 6, 0 }, | 188 | 6, 4, 1, 6, 6, 6, 6, 0 }, |
195 | { TRUE, TRUE, WLAN_PHY_OFDM, 18000, /* 18 Mb */ | 189 | { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ |
196 | 14100, 0x0e, 0x00, 36, | 190 | 14100, 0x0e, 0x00, 36, |
197 | 6, 6, 2, 7, 7, 7, 7, 0 }, | 191 | 6, 6, 2, 7, 7, 7, 7, 0 }, |
198 | { TRUE, TRUE, WLAN_PHY_OFDM, 24000, /* 24 Mb */ | 192 | { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ |
199 | 17700, 0x09, 0x00, 48, | 193 | 17700, 0x09, 0x00, 48, |
200 | 8, 10, 3, 8, 8, 8, 8, 0 }, | 194 | 8, 10, 3, 8, 8, 8, 8, 0 }, |
201 | { TRUE, TRUE, WLAN_PHY_OFDM, 36000, /* 36 Mb */ | 195 | { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ |
202 | 23700, 0x0d, 0x00, 72, | 196 | 23700, 0x0d, 0x00, 72, |
203 | 8, 14, 3, 9, 9, 9, 9, 0 }, | 197 | 8, 14, 3, 9, 9, 9, 9, 0 }, |
204 | { TRUE, TRUE, WLAN_PHY_OFDM, 48000, /* 48 Mb */ | 198 | { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ |
205 | 27400, 0x08, 0x00, 96, | 199 | 27400, 0x08, 0x00, 96, |
206 | 8, 20, 3, 10, 10, 10, 10, 0 }, | 200 | 8, 20, 3, 10, 10, 10, 10, 0 }, |
207 | { TRUE, TRUE, WLAN_PHY_OFDM, 54000, /* 54 Mb */ | 201 | { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ |
208 | 30900, 0x0c, 0x00, 108, | 202 | 30900, 0x0c, 0x00, 108, |
209 | 8, 23, 3, 11, 11, 11, 11, 0 }, | 203 | 8, 23, 3, 11, 11, 11, 11, 0 }, |
210 | { FALSE, FALSE, WLAN_PHY_HT_20_SS, 6500, /* 6.5 Mb */ | 204 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ |
211 | 6400, 0x80, 0x00, 0, | 205 | 6400, 0x80, 0x00, 0, |
212 | 4, 2, 3, 12, 28, 12, 28, 3216 }, | 206 | 4, 2, 3, 12, 28, 12, 28, 3216 }, |
213 | { TRUE_20, TRUE_20, WLAN_PHY_HT_20_SS, 13000, /* 13 Mb */ | 207 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ |
214 | 12700, 0x81, 0x00, 1, | 208 | 12700, 0x81, 0x00, 1, |
215 | 6, 4, 3, 13, 29, 13, 29, 6434 }, | 209 | 6, 4, 3, 13, 29, 13, 29, 6434 }, |
216 | { TRUE_20, TRUE_20, WLAN_PHY_HT_20_SS, 19500, /* 19.5 Mb */ | 210 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ |
217 | 18800, 0x82, 0x00, 2, | 211 | 18800, 0x82, 0x00, 2, |
218 | 6, 6, 3, 14, 30, 14, 30, 9650 }, | 212 | 6, 6, 3, 14, 30, 14, 30, 9650 }, |
219 | { TRUE_20, TRUE_20, WLAN_PHY_HT_20_SS, 26000, /* 26 Mb */ | 213 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ |
220 | 25000, 0x83, 0x00, 3, | 214 | 25000, 0x83, 0x00, 3, |
221 | 8, 10, 3, 15, 31, 15, 31, 12868 }, | 215 | 8, 10, 3, 15, 31, 15, 31, 12868 }, |
222 | { TRUE_20, TRUE_20, WLAN_PHY_HT_20_SS, 39000, /* 39 Mb */ | 216 | { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ |
223 | 36700, 0x84, 0x00, 4, | 217 | 36700, 0x84, 0x00, 4, |
224 | 8, 14, 3, 16, 32, 16, 32, 19304 }, | 218 | 8, 14, 3, 16, 32, 16, 32, 19304 }, |
225 | { FALSE, TRUE_20, WLAN_PHY_HT_20_SS, 52000, /* 52 Mb */ | 219 | { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ |
226 | 48100, 0x85, 0x00, 5, | 220 | 48100, 0x85, 0x00, 5, |
227 | 8, 20, 3, 17, 33, 17, 33, 25740 }, | 221 | 8, 20, 3, 17, 33, 17, 33, 25740 }, |
228 | { FALSE, TRUE_20, WLAN_PHY_HT_20_SS, 58500, /* 58.5 Mb */ | 222 | { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ |
229 | 53500, 0x86, 0x00, 6, | 223 | 53500, 0x86, 0x00, 6, |
230 | 8, 23, 3, 18, 34, 18, 34, 28956 }, | 224 | 8, 23, 3, 18, 34, 18, 34, 28956 }, |
231 | { FALSE, TRUE_20, WLAN_PHY_HT_20_SS, 65000, /* 65 Mb */ | 225 | { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ |
232 | 59000, 0x87, 0x00, 7, | 226 | 59000, 0x87, 0x00, 7, |
233 | 8, 25, 3, 19, 35, 19, 36, 32180 }, | 227 | 8, 25, 3, 19, 35, 19, 36, 32180 }, |
234 | { FALSE, FALSE, WLAN_PHY_HT_20_DS, 13000, /* 13 Mb */ | 228 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ |
235 | 12700, 0x88, 0x00, 8, | 229 | 12700, 0x88, 0x00, 8, |
236 | 4, 2, 3, 20, 37, 20, 37, 6430 }, | 230 | 4, 2, 3, 20, 37, 20, 37, 6430 }, |
237 | { FALSE, FALSE, WLAN_PHY_HT_20_DS, 26000, /* 26 Mb */ | 231 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ |
238 | 24800, 0x89, 0x00, 9, | 232 | 24800, 0x89, 0x00, 9, |
239 | 6, 4, 3, 21, 38, 21, 38, 12860 }, | 233 | 6, 4, 3, 21, 38, 21, 38, 12860 }, |
240 | { FALSE, FALSE, WLAN_PHY_HT_20_DS, 39000, /* 39 Mb */ | 234 | { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ |
241 | 36600, 0x8a, 0x00, 10, | 235 | 36600, 0x8a, 0x00, 10, |
242 | 6, 6, 3, 22, 39, 22, 39, 19300 }, | 236 | 6, 6, 3, 22, 39, 22, 39, 19300 }, |
243 | { TRUE_20, FALSE, WLAN_PHY_HT_20_DS, 52000, /* 52 Mb */ | 237 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ |
244 | 48100, 0x8b, 0x00, 11, | 238 | 48100, 0x8b, 0x00, 11, |
245 | 8, 10, 3, 23, 40, 23, 40, 25736 }, | 239 | 8, 10, 3, 23, 40, 23, 40, 25736 }, |
246 | { TRUE_20, FALSE, WLAN_PHY_HT_20_DS, 78000, /* 78 Mb */ | 240 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ |
247 | 69500, 0x8c, 0x00, 12, | 241 | 69500, 0x8c, 0x00, 12, |
248 | 8, 14, 3, 24, 41, 24, 41, 38600 }, | 242 | 8, 14, 3, 24, 41, 24, 41, 38600 }, |
249 | { TRUE_20, FALSE, WLAN_PHY_HT_20_DS, 104000, /* 104 Mb */ | 243 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ |
250 | 89500, 0x8d, 0x00, 13, | 244 | 89500, 0x8d, 0x00, 13, |
251 | 8, 20, 3, 25, 42, 25, 42, 51472 }, | 245 | 8, 20, 3, 25, 42, 25, 42, 51472 }, |
252 | { TRUE_20, FALSE, WLAN_PHY_HT_20_DS, 117000, /* 117 Mb */ | 246 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ |
253 | 98900, 0x8e, 0x00, 14, | 247 | 98900, 0x8e, 0x00, 14, |
254 | 8, 23, 3, 26, 43, 26, 44, 57890 }, | 248 | 8, 23, 3, 26, 43, 26, 44, 57890 }, |
255 | { TRUE_20, FALSE, WLAN_PHY_HT_20_DS, 130000, /* 130 Mb */ | 249 | { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ |
256 | 108300, 0x8f, 0x00, 15, | 250 | 108300, 0x8f, 0x00, 15, |
257 | 8, 25, 3, 27, 44, 27, 45, 64320 }, | 251 | 8, 25, 3, 27, 44, 27, 45, 64320 }, |
258 | { TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS, 13500, /* 13.5 Mb */ | 252 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ |
259 | 13200, 0x80, 0x00, 0, | 253 | 13200, 0x80, 0x00, 0, |
260 | 8, 2, 3, 12, 28, 28, 28, 6684 }, | 254 | 8, 2, 3, 12, 28, 28, 28, 6684 }, |
261 | { TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS, 27500, /* 27.0 Mb */ | 255 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ |
262 | 25900, 0x81, 0x00, 1, | 256 | 25900, 0x81, 0x00, 1, |
263 | 8, 4, 3, 13, 29, 29, 29, 13368 }, | 257 | 8, 4, 3, 13, 29, 29, 29, 13368 }, |
264 | { TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS, 40500, /* 40.5 Mb */ | 258 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ |
265 | 38600, 0x82, 0x00, 2, | 259 | 38600, 0x82, 0x00, 2, |
266 | 8, 6, 3, 14, 30, 30, 30, 20052 }, | 260 | 8, 6, 3, 14, 30, 30, 30, 20052 }, |
267 | { TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS, 54000, /* 54 Mb */ | 261 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ |
268 | 49800, 0x83, 0x00, 3, | 262 | 49800, 0x83, 0x00, 3, |
269 | 8, 10, 3, 15, 31, 31, 31, 26738 }, | 263 | 8, 10, 3, 15, 31, 31, 31, 26738 }, |
270 | { TRUE_40, TRUE_40, WLAN_PHY_HT_40_SS, 81500, /* 81 Mb */ | 264 | { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ |
271 | 72200, 0x84, 0x00, 4, | 265 | 72200, 0x84, 0x00, 4, |
272 | 8, 14, 3, 16, 32, 32, 32, 40104 }, | 266 | 8, 14, 3, 16, 32, 32, 32, 40104 }, |
273 | { FALSE, TRUE_40, WLAN_PHY_HT_40_SS, 108000, /* 108 Mb */ | 267 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ |
274 | 92900, 0x85, 0x00, 5, | 268 | 92900, 0x85, 0x00, 5, |
275 | 8, 20, 3, 17, 33, 33, 33, 53476 }, | 269 | 8, 20, 3, 17, 33, 33, 33, 53476 }, |
276 | { FALSE, TRUE_40, WLAN_PHY_HT_40_SS, 121500, /* 121.5 Mb */ | 270 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ |
277 | 102700, 0x86, 0x00, 6, | 271 | 102700, 0x86, 0x00, 6, |
278 | 8, 23, 3, 18, 34, 34, 34, 60156 }, | 272 | 8, 23, 3, 18, 34, 34, 34, 60156 }, |
279 | { FALSE, TRUE_40, WLAN_PHY_HT_40_SS, 135000, /* 135 Mb */ | 273 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ |
280 | 112000, 0x87, 0x00, 7, | 274 | 112000, 0x87, 0x00, 7, |
281 | 8, 23, 3, 19, 35, 36, 36, 66840 }, | 275 | 8, 23, 3, 19, 35, 36, 36, 66840 }, |
282 | { FALSE, TRUE_40, WLAN_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ | 276 | { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ |
283 | 122000, 0x87, 0x00, 7, | 277 | 122000, 0x87, 0x00, 7, |
284 | 8, 25, 3, 19, 35, 36, 36, 74200 }, | 278 | 8, 25, 3, 19, 35, 36, 36, 74200 }, |
285 | { FALSE, FALSE, WLAN_PHY_HT_40_DS, 27000, /* 27 Mb */ | 279 | { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ |
286 | 25800, 0x88, 0x00, 8, | 280 | 25800, 0x88, 0x00, 8, |
287 | 8, 2, 3, 20, 37, 37, 37, 13360 }, | 281 | 8, 2, 3, 20, 37, 37, 37, 13360 }, |
288 | { FALSE, FALSE, WLAN_PHY_HT_40_DS, 54000, /* 54 Mb */ | 282 | { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ |
289 | 49800, 0x89, 0x00, 9, | 283 | 49800, 0x89, 0x00, 9, |
290 | 8, 4, 3, 21, 38, 38, 38, 26720 }, | 284 | 8, 4, 3, 21, 38, 38, 38, 26720 }, |
291 | { FALSE, FALSE, WLAN_PHY_HT_40_DS, 81000, /* 81 Mb */ | 285 | { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ |
292 | 71900, 0x8a, 0x00, 10, | 286 | 71900, 0x8a, 0x00, 10, |
293 | 8, 6, 3, 22, 39, 39, 39, 40080 }, | 287 | 8, 6, 3, 22, 39, 39, 39, 40080 }, |
294 | { TRUE_40, FALSE, WLAN_PHY_HT_40_DS, 108000, /* 108 Mb */ | 288 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ |
295 | 92500, 0x8b, 0x00, 11, | 289 | 92500, 0x8b, 0x00, 11, |
296 | 8, 10, 3, 23, 40, 40, 40, 53440 }, | 290 | 8, 10, 3, 23, 40, 40, 40, 53440 }, |
297 | { TRUE_40, FALSE, WLAN_PHY_HT_40_DS, 162000, /* 162 Mb */ | 291 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ |
298 | 130300, 0x8c, 0x00, 12, | 292 | 130300, 0x8c, 0x00, 12, |
299 | 8, 14, 3, 24, 41, 41, 41, 80160 }, | 293 | 8, 14, 3, 24, 41, 41, 41, 80160 }, |
300 | { TRUE_40, FALSE, WLAN_PHY_HT_40_DS, 216000, /* 216 Mb */ | 294 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ |
301 | 162800, 0x8d, 0x00, 13, | 295 | 162800, 0x8d, 0x00, 13, |
302 | 8, 20, 3, 25, 42, 42, 42, 106880 }, | 296 | 8, 20, 3, 25, 42, 42, 42, 106880 }, |
303 | { TRUE_40, FALSE, WLAN_PHY_HT_40_DS, 243000, /* 243 Mb */ | 297 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ |
304 | 178200, 0x8e, 0x00, 14, | 298 | 178200, 0x8e, 0x00, 14, |
305 | 8, 23, 3, 26, 43, 43, 43, 120240 }, | 299 | 8, 23, 3, 26, 43, 43, 43, 120240 }, |
306 | { TRUE_40, FALSE, WLAN_PHY_HT_40_DS, 270000, /* 270 Mb */ | 300 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ |
307 | 192100, 0x8f, 0x00, 15, | 301 | 192100, 0x8f, 0x00, 15, |
308 | 8, 23, 3, 27, 44, 45, 45, 133600 }, | 302 | 8, 23, 3, 27, 44, 45, 45, 133600 }, |
309 | { TRUE_40, FALSE, WLAN_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ | 303 | { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ |
310 | 207000, 0x8f, 0x00, 15, | 304 | 207000, 0x8f, 0x00, 15, |
311 | 8, 25, 3, 27, 44, 45, 45, 148400 }, | 305 | 8, 25, 3, 27, 44, 45, 45, 148400 }, |
312 | }, | 306 | }, |
@@ -319,28 +313,28 @@ static struct ath_rate_table ar5416_11a_ratetable = { | |||
319 | 8, | 313 | 8, |
320 | {0}, | 314 | {0}, |
321 | { | 315 | { |
322 | { TRUE, TRUE, WLAN_PHY_OFDM, 6000, /* 6 Mb */ | 316 | { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ |
323 | 5400, 0x0b, 0x00, (0x80|12), | 317 | 5400, 0x0b, 0x00, (0x80|12), |
324 | 0, 2, 1, 0, 0 }, | 318 | 0, 2, 1, 0, 0 }, |
325 | { TRUE, TRUE, WLAN_PHY_OFDM, 9000, /* 9 Mb */ | 319 | { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ |
326 | 7800, 0x0f, 0x00, 18, | 320 | 7800, 0x0f, 0x00, 18, |
327 | 0, 3, 1, 1, 0 }, | 321 | 0, 3, 1, 1, 0 }, |
328 | { TRUE, TRUE, WLAN_PHY_OFDM, 12000, /* 12 Mb */ | 322 | { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ |
329 | 10000, 0x0a, 0x00, (0x80|24), | 323 | 10000, 0x0a, 0x00, (0x80|24), |
330 | 2, 4, 2, 2, 0 }, | 324 | 2, 4, 2, 2, 0 }, |
331 | { TRUE, TRUE, WLAN_PHY_OFDM, 18000, /* 18 Mb */ | 325 | { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ |
332 | 13900, 0x0e, 0x00, 36, | 326 | 13900, 0x0e, 0x00, 36, |
333 | 2, 6, 2, 3, 0 }, | 327 | 2, 6, 2, 3, 0 }, |
334 | { TRUE, TRUE, WLAN_PHY_OFDM, 24000, /* 24 Mb */ | 328 | { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ |
335 | 17300, 0x09, 0x00, (0x80|48), | 329 | 17300, 0x09, 0x00, (0x80|48), |
336 | 4, 10, 3, 4, 0 }, | 330 | 4, 10, 3, 4, 0 }, |
337 | { TRUE, TRUE, WLAN_PHY_OFDM, 36000, /* 36 Mb */ | 331 | { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ |
338 | 23000, 0x0d, 0x00, 72, | 332 | 23000, 0x0d, 0x00, 72, |
339 | 4, 14, 3, 5, 0 }, | 333 | 4, 14, 3, 5, 0 }, |
340 | { TRUE, TRUE, WLAN_PHY_OFDM, 48000, /* 48 Mb */ | 334 | { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ |
341 | 27400, 0x08, 0x00, 96, | 335 | 27400, 0x08, 0x00, 96, |
342 | 4, 19, 3, 6, 0 }, | 336 | 4, 19, 3, 6, 0 }, |
343 | { TRUE, TRUE, WLAN_PHY_OFDM, 54000, /* 54 Mb */ | 337 | { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ |
344 | 29300, 0x0c, 0x00, 108, | 338 | 29300, 0x0c, 0x00, 108, |
345 | 4, 23, 3, 7, 0 }, | 339 | 4, 23, 3, 7, 0 }, |
346 | }, | 340 | }, |
@@ -353,40 +347,40 @@ static struct ath_rate_table ar5416_11g_ratetable = { | |||
353 | 12, | 347 | 12, |
354 | {0}, | 348 | {0}, |
355 | { | 349 | { |
356 | { TRUE, TRUE, WLAN_PHY_CCK, 1000, /* 1 Mb */ | 350 | { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ |
357 | 900, 0x1b, 0x00, 2, | 351 | 900, 0x1b, 0x00, 2, |
358 | 0, 0, 1, 0, 0 }, | 352 | 0, 0, 1, 0, 0 }, |
359 | { TRUE, TRUE, WLAN_PHY_CCK, 2000, /* 2 Mb */ | 353 | { VALID, VALID, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ |
360 | 1900, 0x1a, 0x04, 4, | 354 | 1900, 0x1a, 0x04, 4, |
361 | 1, 1, 1, 1, 0 }, | 355 | 1, 1, 1, 1, 0 }, |
362 | { TRUE, TRUE, WLAN_PHY_CCK, 5500, /* 5.5 Mb */ | 356 | { VALID, VALID, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ |
363 | 4900, 0x19, 0x04, 11, | 357 | 4900, 0x19, 0x04, 11, |
364 | 2, 2, 2, 2, 0 }, | 358 | 2, 2, 2, 2, 0 }, |
365 | { TRUE, TRUE, WLAN_PHY_CCK, 11000, /* 11 Mb */ | 359 | { VALID, VALID, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ |
366 | 8100, 0x18, 0x04, 22, | 360 | 8100, 0x18, 0x04, 22, |
367 | 3, 3, 2, 3, 0 }, | 361 | 3, 3, 2, 3, 0 }, |
368 | { FALSE, FALSE, WLAN_PHY_OFDM, 6000, /* 6 Mb */ | 362 | { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ |
369 | 5400, 0x0b, 0x00, 12, | 363 | 5400, 0x0b, 0x00, 12, |
370 | 4, 2, 1, 4, 0 }, | 364 | 4, 2, 1, 4, 0 }, |
371 | { FALSE, FALSE, WLAN_PHY_OFDM, 9000, /* 9 Mb */ | 365 | { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ |
372 | 7800, 0x0f, 0x00, 18, | 366 | 7800, 0x0f, 0x00, 18, |
373 | 4, 3, 1, 5, 0 }, | 367 | 4, 3, 1, 5, 0 }, |
374 | { TRUE, TRUE, WLAN_PHY_OFDM, 12000, /* 12 Mb */ | 368 | { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ |
375 | 10000, 0x0a, 0x00, 24, | 369 | 10000, 0x0a, 0x00, 24, |
376 | 6, 4, 1, 6, 0 }, | 370 | 6, 4, 1, 6, 0 }, |
377 | { TRUE, TRUE, WLAN_PHY_OFDM, 18000, /* 18 Mb */ | 371 | { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ |
378 | 13900, 0x0e, 0x00, 36, | 372 | 13900, 0x0e, 0x00, 36, |
379 | 6, 6, 2, 7, 0 }, | 373 | 6, 6, 2, 7, 0 }, |
380 | { TRUE, TRUE, WLAN_PHY_OFDM, 24000, /* 24 Mb */ | 374 | { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ |
381 | 17300, 0x09, 0x00, 48, | 375 | 17300, 0x09, 0x00, 48, |
382 | 8, 10, 3, 8, 0 }, | 376 | 8, 10, 3, 8, 0 }, |
383 | { TRUE, TRUE, WLAN_PHY_OFDM, 36000, /* 36 Mb */ | 377 | { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ |
384 | 23000, 0x0d, 0x00, 72, | 378 | 23000, 0x0d, 0x00, 72, |
385 | 8, 14, 3, 9, 0 }, | 379 | 8, 14, 3, 9, 0 }, |
386 | { TRUE, TRUE, WLAN_PHY_OFDM, 48000, /* 48 Mb */ | 380 | { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ |
387 | 27400, 0x08, 0x00, 96, | 381 | 27400, 0x08, 0x00, 96, |
388 | 8, 19, 3, 10, 0 }, | 382 | 8, 19, 3, 10, 0 }, |
389 | { TRUE, TRUE, WLAN_PHY_OFDM, 54000, /* 54 Mb */ | 383 | { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ |
390 | 29300, 0x0c, 0x00, 108, | 384 | 29300, 0x0c, 0x00, 108, |
391 | 8, 23, 3, 11, 0 }, | 385 | 8, 23, 3, 11, 0 }, |
392 | }, | 386 | }, |
@@ -399,16 +393,16 @@ static struct ath_rate_table ar5416_11b_ratetable = { | |||
399 | 4, | 393 | 4, |
400 | {0}, | 394 | {0}, |
401 | { | 395 | { |
402 | { TRUE, TRUE, WLAN_PHY_CCK, 1000, /* 1 Mb */ | 396 | { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ |
403 | 900, 0x1b, 0x00, (0x80|2), | 397 | 900, 0x1b, 0x00, (0x80|2), |
404 | 0, 0, 1, 0, 0 }, | 398 | 0, 0, 1, 0, 0 }, |
405 | { TRUE, TRUE, WLAN_PHY_CCK, 2000, /* 2 Mb */ | 399 | { VALID, VALID, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ |
406 | 1800, 0x1a, 0x04, (0x80|4), | 400 | 1800, 0x1a, 0x04, (0x80|4), |
407 | 1, 1, 1, 1, 0 }, | 401 | 1, 1, 1, 1, 0 }, |
408 | { TRUE, TRUE, WLAN_PHY_CCK, 5500, /* 5.5 Mb */ | 402 | { VALID, VALID, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ |
409 | 4300, 0x19, 0x04, (0x80|11), | 403 | 4300, 0x19, 0x04, (0x80|11), |
410 | 1, 2, 2, 2, 0 }, | 404 | 1, 2, 2, 2, 0 }, |
411 | { TRUE, TRUE, WLAN_PHY_CCK, 11000, /* 11 Mb */ | 405 | { VALID, VALID, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ |
412 | 7100, 0x18, 0x04, (0x80|22), | 406 | 7100, 0x18, 0x04, (0x80|22), |
413 | 1, 4, 100, 3, 0 }, | 407 | 1, 4, 100, 3, 0 }, |
414 | }, | 408 | }, |
@@ -417,9 +411,6 @@ static struct ath_rate_table ar5416_11b_ratetable = { | |||
417 | 0, /* Phy rates allowed initially */ | 411 | 0, /* Phy rates allowed initially */ |
418 | }; | 412 | }; |
419 | 413 | ||
420 | /* | ||
421 | * Return the median of three numbers | ||
422 | */ | ||
423 | static inline int8_t median(int8_t a, int8_t b, int8_t c) | 414 | static inline int8_t median(int8_t a, int8_t b, int8_t c) |
424 | { | 415 | { |
425 | if (a >= b) { | 416 | if (a >= b) { |
@@ -440,7 +431,7 @@ static inline int8_t median(int8_t a, int8_t b, int8_t c) | |||
440 | } | 431 | } |
441 | 432 | ||
442 | static void ath_rc_sort_validrates(struct ath_rate_table *rate_table, | 433 | static void ath_rc_sort_validrates(struct ath_rate_table *rate_table, |
443 | struct ath_rate_node *ath_rc_priv) | 434 | struct ath_rate_priv *ath_rc_priv) |
444 | { | 435 | { |
445 | u8 i, j, idx, idx_next; | 436 | u8 i, j, idx, idx_next; |
446 | 437 | ||
@@ -458,34 +449,31 @@ static void ath_rc_sort_validrates(struct ath_rate_table *rate_table, | |||
458 | } | 449 | } |
459 | } | 450 | } |
460 | 451 | ||
461 | /* Access functions for valid_txrate_mask */ | 452 | static void ath_rc_init_valid_txmask(struct ath_rate_priv *ath_rc_priv) |
462 | |||
463 | static void ath_rc_init_valid_txmask(struct ath_rate_node *ath_rc_priv) | ||
464 | { | 453 | { |
465 | u8 i; | 454 | u8 i; |
466 | 455 | ||
467 | for (i = 0; i < ath_rc_priv->rate_table_size; i++) | 456 | for (i = 0; i < ath_rc_priv->rate_table_size; i++) |
468 | ath_rc_priv->valid_rate_index[i] = FALSE; | 457 | ath_rc_priv->valid_rate_index[i] = 0; |
469 | } | 458 | } |
470 | 459 | ||
471 | static inline void ath_rc_set_valid_txmask(struct ath_rate_node *ath_rc_priv, | 460 | static inline void ath_rc_set_valid_txmask(struct ath_rate_priv *ath_rc_priv, |
472 | u8 index, int valid_tx_rate) | 461 | u8 index, int valid_tx_rate) |
473 | { | 462 | { |
474 | ASSERT(index <= ath_rc_priv->rate_table_size); | 463 | ASSERT(index <= ath_rc_priv->rate_table_size); |
475 | ath_rc_priv->valid_rate_index[index] = valid_tx_rate ? TRUE : FALSE; | 464 | ath_rc_priv->valid_rate_index[index] = valid_tx_rate ? 1 : 0; |
476 | } | 465 | } |
477 | 466 | ||
478 | static inline int ath_rc_isvalid_txmask(struct ath_rate_node *ath_rc_priv, | 467 | static inline int ath_rc_isvalid_txmask(struct ath_rate_priv *ath_rc_priv, |
479 | u8 index) | 468 | u8 index) |
480 | { | 469 | { |
481 | ASSERT(index <= ath_rc_priv->rate_table_size); | 470 | ASSERT(index <= ath_rc_priv->rate_table_size); |
482 | return ath_rc_priv->valid_rate_index[index]; | 471 | return ath_rc_priv->valid_rate_index[index]; |
483 | } | 472 | } |
484 | 473 | ||
485 | /* Iterators for valid_txrate_mask */ | ||
486 | static inline int | 474 | static inline int |
487 | ath_rc_get_nextvalid_txrate(struct ath_rate_table *rate_table, | 475 | ath_rc_get_nextvalid_txrate(struct ath_rate_table *rate_table, |
488 | struct ath_rate_node *ath_rc_priv, | 476 | struct ath_rate_priv *ath_rc_priv, |
489 | u8 cur_valid_txrate, | 477 | u8 cur_valid_txrate, |
490 | u8 *next_idx) | 478 | u8 *next_idx) |
491 | { | 479 | { |
@@ -494,13 +482,13 @@ ath_rc_get_nextvalid_txrate(struct ath_rate_table *rate_table, | |||
494 | for (i = 0; i < ath_rc_priv->max_valid_rate - 1; i++) { | 482 | for (i = 0; i < ath_rc_priv->max_valid_rate - 1; i++) { |
495 | if (ath_rc_priv->valid_rate_index[i] == cur_valid_txrate) { | 483 | if (ath_rc_priv->valid_rate_index[i] == cur_valid_txrate) { |
496 | *next_idx = ath_rc_priv->valid_rate_index[i+1]; | 484 | *next_idx = ath_rc_priv->valid_rate_index[i+1]; |
497 | return TRUE; | 485 | return 1; |
498 | } | 486 | } |
499 | } | 487 | } |
500 | 488 | ||
501 | /* No more valid rates */ | 489 | /* No more valid rates */ |
502 | *next_idx = 0; | 490 | *next_idx = 0; |
503 | return FALSE; | 491 | return 0; |
504 | } | 492 | } |
505 | 493 | ||
506 | /* Return true only for single stream */ | 494 | /* Return true only for single stream */ |
@@ -508,22 +496,22 @@ ath_rc_get_nextvalid_txrate(struct ath_rate_table *rate_table, | |||
508 | static int ath_rc_valid_phyrate(u32 phy, u32 capflag, int ignore_cw) | 496 | static int ath_rc_valid_phyrate(u32 phy, u32 capflag, int ignore_cw) |
509 | { | 497 | { |
510 | if (WLAN_RC_PHY_HT(phy) & !(capflag & WLAN_RC_HT_FLAG)) | 498 | if (WLAN_RC_PHY_HT(phy) & !(capflag & WLAN_RC_HT_FLAG)) |
511 | return FALSE; | 499 | return 0; |
512 | if (WLAN_RC_PHY_DS(phy) && !(capflag & WLAN_RC_DS_FLAG)) | 500 | if (WLAN_RC_PHY_DS(phy) && !(capflag & WLAN_RC_DS_FLAG)) |
513 | return FALSE; | 501 | return 0; |
514 | if (WLAN_RC_PHY_SGI(phy) && !(capflag & WLAN_RC_SGI_FLAG)) | 502 | if (WLAN_RC_PHY_SGI(phy) && !(capflag & WLAN_RC_SGI_FLAG)) |
515 | return FALSE; | 503 | return 0; |
516 | if (!ignore_cw && WLAN_RC_PHY_HT(phy)) | 504 | if (!ignore_cw && WLAN_RC_PHY_HT(phy)) |
517 | if (WLAN_RC_PHY_40(phy) && !(capflag & WLAN_RC_40_FLAG)) | 505 | if (WLAN_RC_PHY_40(phy) && !(capflag & WLAN_RC_40_FLAG)) |
518 | return FALSE; | 506 | return 0; |
519 | if (!WLAN_RC_PHY_40(phy) && (capflag & WLAN_RC_40_FLAG)) | 507 | if (!WLAN_RC_PHY_40(phy) && (capflag & WLAN_RC_40_FLAG)) |
520 | return FALSE; | 508 | return 0; |
521 | return TRUE; | 509 | return 1; |
522 | } | 510 | } |
523 | 511 | ||
524 | static inline int | 512 | static inline int |
525 | ath_rc_get_nextlowervalid_txrate(struct ath_rate_table *rate_table, | 513 | ath_rc_get_nextlowervalid_txrate(struct ath_rate_table *rate_table, |
526 | struct ath_rate_node *ath_rc_priv, | 514 | struct ath_rate_priv *ath_rc_priv, |
527 | u8 cur_valid_txrate, u8 *next_idx) | 515 | u8 cur_valid_txrate, u8 *next_idx) |
528 | { | 516 | { |
529 | int8_t i; | 517 | int8_t i; |
@@ -531,17 +519,14 @@ ath_rc_get_nextlowervalid_txrate(struct ath_rate_table *rate_table, | |||
531 | for (i = 1; i < ath_rc_priv->max_valid_rate ; i++) { | 519 | for (i = 1; i < ath_rc_priv->max_valid_rate ; i++) { |
532 | if (ath_rc_priv->valid_rate_index[i] == cur_valid_txrate) { | 520 | if (ath_rc_priv->valid_rate_index[i] == cur_valid_txrate) { |
533 | *next_idx = ath_rc_priv->valid_rate_index[i-1]; | 521 | *next_idx = ath_rc_priv->valid_rate_index[i-1]; |
534 | return TRUE; | 522 | return 1; |
535 | } | 523 | } |
536 | } | 524 | } |
537 | return FALSE; | 525 | return 0; |
538 | } | 526 | } |
539 | 527 | ||
540 | /* | ||
541 | * Initialize the Valid Rate Index from valid entries in Rate Table | ||
542 | */ | ||
543 | static u8 | 528 | static u8 |
544 | ath_rc_sib_init_validrates(struct ath_rate_node *ath_rc_priv, | 529 | ath_rc_sib_init_validrates(struct ath_rate_priv *ath_rc_priv, |
545 | struct ath_rate_table *rate_table, | 530 | struct ath_rate_table *rate_table, |
546 | u32 capflag) | 531 | u32 capflag) |
547 | { | 532 | { |
@@ -552,34 +537,30 @@ ath_rc_sib_init_validrates(struct ath_rate_node *ath_rc_priv, | |||
552 | valid = (ath_rc_priv->single_stream ? | 537 | valid = (ath_rc_priv->single_stream ? |
553 | rate_table->info[i].valid_single_stream : | 538 | rate_table->info[i].valid_single_stream : |
554 | rate_table->info[i].valid); | 539 | rate_table->info[i].valid); |
555 | if (valid == TRUE) { | 540 | if (valid == 1) { |
556 | u32 phy = rate_table->info[i].phy; | 541 | u32 phy = rate_table->info[i].phy; |
557 | u8 valid_rate_count = 0; | 542 | u8 valid_rate_count = 0; |
558 | 543 | ||
559 | if (!ath_rc_valid_phyrate(phy, capflag, FALSE)) | 544 | if (!ath_rc_valid_phyrate(phy, capflag, 0)) |
560 | continue; | 545 | continue; |
561 | 546 | ||
562 | valid_rate_count = ath_rc_priv->valid_phy_ratecnt[phy]; | 547 | valid_rate_count = ath_rc_priv->valid_phy_ratecnt[phy]; |
563 | 548 | ||
564 | ath_rc_priv->valid_phy_rateidx[phy][valid_rate_count] = i; | 549 | ath_rc_priv->valid_phy_rateidx[phy][valid_rate_count] = i; |
565 | ath_rc_priv->valid_phy_ratecnt[phy] += 1; | 550 | ath_rc_priv->valid_phy_ratecnt[phy] += 1; |
566 | ath_rc_set_valid_txmask(ath_rc_priv, i, TRUE); | 551 | ath_rc_set_valid_txmask(ath_rc_priv, i, 1); |
567 | hi = A_MAX(hi, i); | 552 | hi = A_MAX(hi, i); |
568 | } | 553 | } |
569 | } | 554 | } |
570 | return hi; | 555 | return hi; |
571 | } | 556 | } |
572 | 557 | ||
573 | /* | ||
574 | * Initialize the Valid Rate Index from Rate Set | ||
575 | */ | ||
576 | static u8 | 558 | static u8 |
577 | ath_rc_sib_setvalid_rates(struct ath_rate_node *ath_rc_priv, | 559 | ath_rc_sib_setvalid_rates(struct ath_rate_priv *ath_rc_priv, |
578 | struct ath_rate_table *rate_table, | 560 | struct ath_rate_table *rate_table, |
579 | struct ath_rateset *rateset, | 561 | struct ath_rateset *rateset, |
580 | u32 capflag) | 562 | u32 capflag) |
581 | { | 563 | { |
582 | /* XXX: Clean me up and make identation friendly */ | ||
583 | u8 i, j, hi = 0; | 564 | u8 i, j, hi = 0; |
584 | 565 | ||
585 | /* Use intersection of working rates and valid rates */ | 566 | /* Use intersection of working rates and valid rates */ |
@@ -592,10 +573,8 @@ ath_rc_sib_setvalid_rates(struct ath_rate_node *ath_rc_priv, | |||
592 | 573 | ||
593 | /* We allow a rate only if its valid and the | 574 | /* We allow a rate only if its valid and the |
594 | * capflag matches one of the validity | 575 | * capflag matches one of the validity |
595 | * (TRUE/TRUE_20/TRUE_40) flags */ | 576 | * (VALID/VALID_20/VALID_40) flags */ |
596 | 577 | ||
597 | /* XXX: catch the negative of this branch | ||
598 | * first and then continue */ | ||
599 | if (((rateset->rs_rates[i] & 0x7F) == | 578 | if (((rateset->rs_rates[i] & 0x7F) == |
600 | (rate_table->info[j].dot11rate & 0x7F)) && | 579 | (rate_table->info[j].dot11rate & 0x7F)) && |
601 | ((valid & WLAN_RC_CAP_MODE(capflag)) == | 580 | ((valid & WLAN_RC_CAP_MODE(capflag)) == |
@@ -604,7 +583,7 @@ ath_rc_sib_setvalid_rates(struct ath_rate_node *ath_rc_priv, | |||
604 | 583 | ||
605 | u8 valid_rate_count = 0; | 584 | u8 valid_rate_count = 0; |
606 | 585 | ||
607 | if (!ath_rc_valid_phyrate(phy, capflag, FALSE)) | 586 | if (!ath_rc_valid_phyrate(phy, capflag, 0)) |
608 | continue; | 587 | continue; |
609 | 588 | ||
610 | valid_rate_count = | 589 | valid_rate_count = |
@@ -613,7 +592,7 @@ ath_rc_sib_setvalid_rates(struct ath_rate_node *ath_rc_priv, | |||
613 | ath_rc_priv->valid_phy_rateidx[phy] | 592 | ath_rc_priv->valid_phy_rateidx[phy] |
614 | [valid_rate_count] = j; | 593 | [valid_rate_count] = j; |
615 | ath_rc_priv->valid_phy_ratecnt[phy] += 1; | 594 | ath_rc_priv->valid_phy_ratecnt[phy] += 1; |
616 | ath_rc_set_valid_txmask(ath_rc_priv, j, TRUE); | 595 | ath_rc_set_valid_txmask(ath_rc_priv, j, 1); |
617 | hi = A_MAX(hi, j); | 596 | hi = A_MAX(hi, j); |
618 | } | 597 | } |
619 | } | 598 | } |
@@ -622,7 +601,7 @@ ath_rc_sib_setvalid_rates(struct ath_rate_node *ath_rc_priv, | |||
622 | } | 601 | } |
623 | 602 | ||
624 | static u8 | 603 | static u8 |
625 | ath_rc_sib_setvalid_htrates(struct ath_rate_node *ath_rc_priv, | 604 | ath_rc_sib_setvalid_htrates(struct ath_rate_priv *ath_rc_priv, |
626 | struct ath_rate_table *rate_table, | 605 | struct ath_rate_table *rate_table, |
627 | u8 *mcs_set, u32 capflag) | 606 | u8 *mcs_set, u32 capflag) |
628 | { | 607 | { |
@@ -643,13 +622,13 @@ ath_rc_sib_setvalid_htrates(struct ath_rate_node *ath_rc_priv, | |||
643 | !WLAN_RC_PHY_HT_VALID(valid, capflag)) | 622 | !WLAN_RC_PHY_HT_VALID(valid, capflag)) |
644 | continue; | 623 | continue; |
645 | 624 | ||
646 | if (!ath_rc_valid_phyrate(phy, capflag, FALSE)) | 625 | if (!ath_rc_valid_phyrate(phy, capflag, 0)) |
647 | continue; | 626 | continue; |
648 | 627 | ||
649 | ath_rc_priv->valid_phy_rateidx[phy] | 628 | ath_rc_priv->valid_phy_rateidx[phy] |
650 | [ath_rc_priv->valid_phy_ratecnt[phy]] = j; | 629 | [ath_rc_priv->valid_phy_ratecnt[phy]] = j; |
651 | ath_rc_priv->valid_phy_ratecnt[phy] += 1; | 630 | ath_rc_priv->valid_phy_ratecnt[phy] += 1; |
652 | ath_rc_set_valid_txmask(ath_rc_priv, j, TRUE); | 631 | ath_rc_set_valid_txmask(ath_rc_priv, j, 1); |
653 | hi = A_MAX(hi, j); | 632 | hi = A_MAX(hi, j); |
654 | } | 633 | } |
655 | } | 634 | } |
@@ -676,7 +655,7 @@ u8 ath_rate_findrateix(struct ath_softc *sc, | |||
676 | } | 655 | } |
677 | 656 | ||
678 | static u8 ath_rc_ratefind_ht(struct ath_softc *sc, | 657 | static u8 ath_rc_ratefind_ht(struct ath_softc *sc, |
679 | struct ath_rate_node *ath_rc_priv, | 658 | struct ath_rate_priv *ath_rc_priv, |
680 | struct ath_rate_table *rate_table, | 659 | struct ath_rate_table *rate_table, |
681 | int probe_allowed, int *is_probing, | 660 | int probe_allowed, int *is_probing, |
682 | int is_retry) | 661 | int is_retry) |
@@ -685,7 +664,7 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc, | |||
685 | u8 rate, next_rate, best_rate, maxindex, minindex; | 664 | u8 rate, next_rate, best_rate, maxindex, minindex; |
686 | int8_t rssi_last, rssi_reduce = 0, index = 0; | 665 | int8_t rssi_last, rssi_reduce = 0, index = 0; |
687 | 666 | ||
688 | *is_probing = FALSE; | 667 | *is_probing = 0; |
689 | 668 | ||
690 | rssi_last = median(ath_rc_priv->rssi_last, | 669 | rssi_last = median(ath_rc_priv->rssi_last, |
691 | ath_rc_priv->rssi_last_prev, | 670 | ath_rc_priv->rssi_last_prev, |
@@ -789,16 +768,10 @@ static u8 ath_rc_ratefind_ht(struct ath_softc *sc, | |||
789 | ath_rc_priv->probe_rate = rate; | 768 | ath_rc_priv->probe_rate = rate; |
790 | ath_rc_priv->probe_time = now_msec; | 769 | ath_rc_priv->probe_time = now_msec; |
791 | ath_rc_priv->hw_maxretry_pktcnt = 0; | 770 | ath_rc_priv->hw_maxretry_pktcnt = 0; |
792 | *is_probing = TRUE; | 771 | *is_probing = 1; |
793 | } | 772 | } |
794 | } | 773 | } |
795 | 774 | ||
796 | /* | ||
797 | * Make sure rate is not higher than the allowed maximum. | ||
798 | * We should also enforce the min, but I suspect the min is | ||
799 | * normally 1 rather than 0 because of the rate 9 vs 6 issue | ||
800 | * in the old code. | ||
801 | */ | ||
802 | if (rate > (ath_rc_priv->rate_table_size - 1)) | 775 | if (rate > (ath_rc_priv->rate_table_size - 1)) |
803 | rate = ath_rc_priv->rate_table_size - 1; | 776 | rate = ath_rc_priv->rate_table_size - 1; |
804 | 777 | ||
@@ -829,7 +802,7 @@ static void ath_rc_rate_set_series(struct ath_rate_table *rate_table , | |||
829 | } | 802 | } |
830 | 803 | ||
831 | static u8 ath_rc_rate_getidx(struct ath_softc *sc, | 804 | static u8 ath_rc_rate_getidx(struct ath_softc *sc, |
832 | struct ath_rate_node *ath_rc_priv, | 805 | struct ath_rate_priv *ath_rc_priv, |
833 | struct ath_rate_table *rate_table, | 806 | struct ath_rate_table *rate_table, |
834 | u8 rix, u16 stepdown, | 807 | u8 rix, u16 stepdown, |
835 | u16 min_rate) | 808 | u16 min_rate) |
@@ -858,8 +831,8 @@ static u8 ath_rc_rate_getidx(struct ath_softc *sc, | |||
858 | } | 831 | } |
859 | 832 | ||
860 | static void ath_rc_ratefind(struct ath_softc *sc, | 833 | static void ath_rc_ratefind(struct ath_softc *sc, |
861 | struct ath_rate_node *ath_rc_priv, | 834 | struct ath_rate_priv *ath_rc_priv, |
862 | int num_tries, int num_rates, unsigned int rcflag, | 835 | int num_tries, int num_rates, |
863 | struct ieee80211_tx_info *tx_info, int *is_probe, | 836 | struct ieee80211_tx_info *tx_info, int *is_probe, |
864 | int is_retry) | 837 | int is_retry) |
865 | { | 838 | { |
@@ -868,30 +841,29 @@ static void ath_rc_ratefind(struct ath_softc *sc, | |||
868 | struct ieee80211_tx_rate *rates = tx_info->control.rates; | 841 | struct ieee80211_tx_rate *rates = tx_info->control.rates; |
869 | 842 | ||
870 | rate_table = sc->hw_rate_table[sc->sc_curmode]; | 843 | rate_table = sc->hw_rate_table[sc->sc_curmode]; |
871 | rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table, | 844 | rix = ath_rc_ratefind_ht(sc, ath_rc_priv, rate_table, 1, |
872 | (rcflag & ATH_RC_PROBE_ALLOWED) ? 1 : 0, | ||
873 | is_probe, is_retry); | 845 | is_probe, is_retry); |
874 | nrix = rix; | 846 | nrix = rix; |
875 | 847 | ||
876 | if ((rcflag & ATH_RC_PROBE_ALLOWED) && (*is_probe)) { | 848 | if (*is_probe) { |
877 | /* set one try for probe rates. For the | 849 | /* set one try for probe rates. For the |
878 | * probes don't enable rts */ | 850 | * probes don't enable rts */ |
879 | ath_rc_rate_set_series(rate_table, | 851 | ath_rc_rate_set_series(rate_table, |
880 | &rates[i++], 1, nrix, FALSE); | 852 | &rates[i++], 1, nrix, 0); |
881 | 853 | ||
882 | try_per_rate = (num_tries/num_rates); | 854 | try_per_rate = (num_tries/num_rates); |
883 | /* Get the next tried/allowed rate. No RTS for the next series | 855 | /* Get the next tried/allowed rate. No RTS for the next series |
884 | * after the probe rate | 856 | * after the probe rate |
885 | */ | 857 | */ |
886 | nrix = ath_rc_rate_getidx(sc, | 858 | nrix = ath_rc_rate_getidx(sc, |
887 | ath_rc_priv, rate_table, nrix, 1, FALSE); | 859 | ath_rc_priv, rate_table, nrix, 1, 0); |
888 | ath_rc_rate_set_series(rate_table, | 860 | ath_rc_rate_set_series(rate_table, |
889 | &rates[i++], try_per_rate, nrix, 0); | 861 | &rates[i++], try_per_rate, nrix, 0); |
890 | } else { | 862 | } else { |
891 | try_per_rate = (num_tries/num_rates); | 863 | try_per_rate = (num_tries/num_rates); |
892 | /* Set the choosen rate. No RTS for first series entry. */ | 864 | /* Set the choosen rate. No RTS for first series entry. */ |
893 | ath_rc_rate_set_series(rate_table, | 865 | ath_rc_rate_set_series(rate_table, |
894 | &rates[i++], try_per_rate, nrix, FALSE); | 866 | &rates[i++], try_per_rate, nrix, 0); |
895 | } | 867 | } |
896 | 868 | ||
897 | /* Fill in the other rates for multirate retry */ | 869 | /* Fill in the other rates for multirate retry */ |
@@ -901,14 +873,13 @@ static void ath_rc_ratefind(struct ath_softc *sc, | |||
901 | 873 | ||
902 | try_num = ((i + 1) == num_rates) ? | 874 | try_num = ((i + 1) == num_rates) ? |
903 | num_tries - (try_per_rate * i) : try_per_rate ; | 875 | num_tries - (try_per_rate * i) : try_per_rate ; |
904 | min_rate = (((i + 1) == num_rates) && | 876 | min_rate = (((i + 1) == num_rates) && 0); |
905 | (rcflag & ATH_RC_MINRATE_LASTRATE)) ? 1 : 0; | ||
906 | 877 | ||
907 | nrix = ath_rc_rate_getidx(sc, ath_rc_priv, | 878 | nrix = ath_rc_rate_getidx(sc, ath_rc_priv, |
908 | rate_table, nrix, 1, min_rate); | 879 | rate_table, nrix, 1, min_rate); |
909 | /* All other rates in the series have RTS enabled */ | 880 | /* All other rates in the series have RTS enabled */ |
910 | ath_rc_rate_set_series(rate_table, | 881 | ath_rc_rate_set_series(rate_table, |
911 | &rates[i], try_num, nrix, TRUE); | 882 | &rates[i], try_num, nrix, 1); |
912 | } | 883 | } |
913 | 884 | ||
914 | /* | 885 | /* |
@@ -940,32 +911,13 @@ static void ath_rc_ratefind(struct ath_softc *sc, | |||
940 | } | 911 | } |
941 | } | 912 | } |
942 | 913 | ||
943 | /* | ||
944 | * Return the Tx rate series. | ||
945 | */ | ||
946 | static void ath_rate_findrate(struct ath_softc *sc, | ||
947 | struct ath_rate_node *ath_rc_priv, | ||
948 | int num_tries, | ||
949 | int num_rates, | ||
950 | unsigned int rcflag, | ||
951 | struct ieee80211_tx_info *tx_info, | ||
952 | int *is_probe, | ||
953 | int is_retry) | ||
954 | { | ||
955 | if (!num_rates || !num_tries) | ||
956 | return; | ||
957 | |||
958 | ath_rc_ratefind(sc, ath_rc_priv, num_tries, num_rates, | ||
959 | rcflag, tx_info, is_probe, is_retry); | ||
960 | } | ||
961 | |||
962 | static void ath_rc_update_ht(struct ath_softc *sc, | 914 | static void ath_rc_update_ht(struct ath_softc *sc, |
963 | struct ath_rate_node *ath_rc_priv, | 915 | struct ath_rate_priv *ath_rc_priv, |
964 | struct ath_tx_info_priv *info_priv, | 916 | struct ath_tx_info_priv *tx_info_priv, |
965 | int tx_rate, int xretries, int retries) | 917 | int tx_rate, int xretries, int retries) |
966 | { | 918 | { |
967 | u32 now_msec = jiffies_to_msecs(jiffies); | 919 | u32 now_msec = jiffies_to_msecs(jiffies); |
968 | int state_change = FALSE, rate, count; | 920 | int state_change = 0, rate, count; |
969 | u8 last_per; | 921 | u8 last_per; |
970 | struct ath_rate_table *rate_table = sc->hw_rate_table[sc->sc_curmode]; | 922 | struct ath_rate_table *rate_table = sc->hw_rate_table[sc->sc_curmode]; |
971 | static u32 nretry_to_per_lookup[10] = { | 923 | static u32 nretry_to_per_lookup[10] = { |
@@ -991,9 +943,9 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
991 | /* To compensate for some imbalance between ctrl and ext. channel */ | 943 | /* To compensate for some imbalance between ctrl and ext. channel */ |
992 | 944 | ||
993 | if (WLAN_RC_PHY_40(rate_table->info[tx_rate].phy)) | 945 | if (WLAN_RC_PHY_40(rate_table->info[tx_rate].phy)) |
994 | info_priv->tx.ts_rssi = | 946 | tx_info_priv->tx.ts_rssi = |
995 | info_priv->tx.ts_rssi < 3 ? 0 : | 947 | tx_info_priv->tx.ts_rssi < 3 ? 0 : |
996 | info_priv->tx.ts_rssi - 3; | 948 | tx_info_priv->tx.ts_rssi - 3; |
997 | 949 | ||
998 | last_per = ath_rc_priv->state[tx_rate].per; | 950 | last_per = ath_rc_priv->state[tx_rate].per; |
999 | 951 | ||
@@ -1026,7 +978,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1026 | count = ARRAY_SIZE(nretry_to_per_lookup); | 978 | count = ARRAY_SIZE(nretry_to_per_lookup); |
1027 | if (retries >= count) | 979 | if (retries >= count) |
1028 | retries = count - 1; | 980 | retries = count - 1; |
1029 | if (info_priv->n_bad_frames) { | 981 | if (tx_info_priv->n_bad_frames) { |
1030 | /* new_PER = 7/8*old_PER + 1/8*(currentPER) | 982 | /* new_PER = 7/8*old_PER + 1/8*(currentPER) |
1031 | * Assuming that n_frames is not 0. The current PER | 983 | * Assuming that n_frames is not 0. The current PER |
1032 | * from the retries is 100 * retries / (retries+1), | 984 | * from the retries is 100 * retries / (retries+1), |
@@ -1039,14 +991,14 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1039 | * the above PER. The expression below is a | 991 | * the above PER. The expression below is a |
1040 | * simplified version of the sum of these two terms. | 992 | * simplified version of the sum of these two terms. |
1041 | */ | 993 | */ |
1042 | if (info_priv->n_frames > 0) | 994 | if (tx_info_priv->n_frames > 0) |
1043 | ath_rc_priv->state[tx_rate].per | 995 | ath_rc_priv->state[tx_rate].per |
1044 | = (u8) | 996 | = (u8) |
1045 | (ath_rc_priv->state[tx_rate].per - | 997 | (ath_rc_priv->state[tx_rate].per - |
1046 | (ath_rc_priv->state[tx_rate].per >> 3) + | 998 | (ath_rc_priv->state[tx_rate].per >> 3) + |
1047 | ((100*(retries*info_priv->n_frames + | 999 | ((100*(retries*tx_info_priv->n_frames + |
1048 | info_priv->n_bad_frames) / | 1000 | tx_info_priv->n_bad_frames) / |
1049 | (info_priv->n_frames * | 1001 | (tx_info_priv->n_frames * |
1050 | (retries+1))) >> 3)); | 1002 | (retries+1))) >> 3)); |
1051 | } else { | 1003 | } else { |
1052 | /* new_PER = 7/8*old_PER + 1/8*(currentPER) */ | 1004 | /* new_PER = 7/8*old_PER + 1/8*(currentPER) */ |
@@ -1059,7 +1011,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1059 | 1011 | ||
1060 | ath_rc_priv->rssi_last_prev2 = ath_rc_priv->rssi_last_prev; | 1012 | ath_rc_priv->rssi_last_prev2 = ath_rc_priv->rssi_last_prev; |
1061 | ath_rc_priv->rssi_last_prev = ath_rc_priv->rssi_last; | 1013 | ath_rc_priv->rssi_last_prev = ath_rc_priv->rssi_last; |
1062 | ath_rc_priv->rssi_last = info_priv->tx.ts_rssi; | 1014 | ath_rc_priv->rssi_last = tx_info_priv->tx.ts_rssi; |
1063 | ath_rc_priv->rssi_time = now_msec; | 1015 | ath_rc_priv->rssi_time = now_msec; |
1064 | 1016 | ||
1065 | /* | 1017 | /* |
@@ -1068,8 +1020,8 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1068 | */ | 1020 | */ |
1069 | 1021 | ||
1070 | if (ath_rc_priv->probe_rate && ath_rc_priv->probe_rate == tx_rate) { | 1022 | if (ath_rc_priv->probe_rate && ath_rc_priv->probe_rate == tx_rate) { |
1071 | if (retries > 0 || 2 * info_priv->n_bad_frames > | 1023 | if (retries > 0 || 2 * tx_info_priv->n_bad_frames > |
1072 | info_priv->n_frames) { | 1024 | tx_info_priv->n_frames) { |
1073 | /* | 1025 | /* |
1074 | * Since we probed with just a single attempt, | 1026 | * Since we probed with just a single attempt, |
1075 | * any retries means the probe failed. Also, | 1027 | * any retries means the probe failed. Also, |
@@ -1121,7 +1073,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1121 | ath_rc_priv->hw_maxretry_pktcnt++; | 1073 | ath_rc_priv->hw_maxretry_pktcnt++; |
1122 | } | 1074 | } |
1123 | 1075 | ||
1124 | if (info_priv->tx.ts_rssi >= | 1076 | if (tx_info_priv->tx.ts_rssi >= |
1125 | rate_table->info[tx_rate].rssi_ack_validmin) { | 1077 | rate_table->info[tx_rate].rssi_ack_validmin) { |
1126 | /* Average the rssi */ | 1078 | /* Average the rssi */ |
1127 | if (tx_rate != ath_rc_priv->rssi_sum_rate) { | 1079 | if (tx_rate != ath_rc_priv->rssi_sum_rate) { |
@@ -1130,7 +1082,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1130 | ath_rc_priv->rssi_sum_cnt = 0; | 1082 | ath_rc_priv->rssi_sum_cnt = 0; |
1131 | } | 1083 | } |
1132 | 1084 | ||
1133 | ath_rc_priv->rssi_sum += info_priv->tx.ts_rssi; | 1085 | ath_rc_priv->rssi_sum += tx_info_priv->tx.ts_rssi; |
1134 | ath_rc_priv->rssi_sum_cnt++; | 1086 | ath_rc_priv->rssi_sum_cnt++; |
1135 | 1087 | ||
1136 | if (ath_rc_priv->rssi_sum_cnt > 4) { | 1088 | if (ath_rc_priv->rssi_sum_cnt > 4) { |
@@ -1154,7 +1106,7 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1154 | rssi_thres--; | 1106 | rssi_thres--; |
1155 | } | 1107 | } |
1156 | 1108 | ||
1157 | state_change = TRUE; | 1109 | state_change = 1; |
1158 | } | 1110 | } |
1159 | } | 1111 | } |
1160 | } | 1112 | } |
@@ -1282,17 +1234,12 @@ static void ath_rc_update_ht(struct ath_softc *sc, | |||
1282 | } | 1234 | } |
1283 | } | 1235 | } |
1284 | 1236 | ||
1285 | /* | 1237 | static void ath_rc_tx_status(struct ath_softc *sc, |
1286 | * This routine is called in rate control callback tx_status() to give | 1238 | struct ath_rate_priv *ath_rc_priv, |
1287 | * the status of previous frames. | 1239 | struct ieee80211_tx_info *tx_info, |
1288 | */ | 1240 | int final_ts_idx, int xretries, int long_retry) |
1289 | static void ath_rc_update(struct ath_softc *sc, | ||
1290 | struct ath_rate_node *ath_rc_priv, | ||
1291 | struct ieee80211_tx_info *tx_info, int final_ts_idx, | ||
1292 | int xretries, int long_retry) | ||
1293 | { | 1241 | { |
1294 | struct ath_tx_info_priv *info_priv = | 1242 | struct ath_tx_info_priv *tx_info_priv = ATH_TX_INFO_PRIV(tx_info); |
1295 | (struct ath_tx_info_priv *)tx_info->rate_driver_data[0]; | ||
1296 | struct ath_rate_table *rate_table; | 1243 | struct ath_rate_table *rate_table; |
1297 | struct ieee80211_tx_rate *rates = tx_info->status.rates; | 1244 | struct ieee80211_tx_rate *rates = tx_info->status.rates; |
1298 | u8 flags; | 1245 | u8 flags; |
@@ -1329,7 +1276,7 @@ static void ath_rc_update(struct ath_softc *sc, | |||
1329 | rix = rate_table->info[ | 1276 | rix = rate_table->info[ |
1330 | rates[series].idx].base_index; | 1277 | rates[series].idx].base_index; |
1331 | ath_rc_update_ht(sc, ath_rc_priv, | 1278 | ath_rc_update_ht(sc, ath_rc_priv, |
1332 | info_priv, rix, | 1279 | tx_info_priv, rix, |
1333 | xretries ? 1 : 2, | 1280 | xretries ? 1 : 2, |
1334 | rates[series].count); | 1281 | rates[series].count); |
1335 | } | 1282 | } |
@@ -1361,55 +1308,12 @@ static void ath_rc_update(struct ath_softc *sc, | |||
1361 | else | 1308 | else |
1362 | rix = rate_table->info[rates[series].idx].base_index; | 1309 | rix = rate_table->info[rates[series].idx].base_index; |
1363 | 1310 | ||
1364 | ath_rc_update_ht(sc, ath_rc_priv, info_priv, rix, | 1311 | ath_rc_update_ht(sc, ath_rc_priv, tx_info_priv, rix, |
1365 | xretries, long_retry); | 1312 | xretries, long_retry); |
1366 | } | 1313 | } |
1367 | 1314 | ||
1368 | /* | ||
1369 | * Process a tx descriptor for a completed transmit (success or failure). | ||
1370 | */ | ||
1371 | static void ath_rate_tx_complete(struct ath_softc *sc, | ||
1372 | struct ath_node *an, | ||
1373 | struct ath_rate_node *rc_priv, | ||
1374 | struct ieee80211_tx_info *tx_info) | ||
1375 | { | ||
1376 | struct ath_tx_info_priv *info_priv = | ||
1377 | (struct ath_tx_info_priv *)tx_info->rate_driver_data[0]; | ||
1378 | int final_ts_idx = info_priv->tx.ts_rateindex; | ||
1379 | int tx_status = 0, is_underrun = 0; | ||
1380 | |||
1381 | if (info_priv->tx.ts_status & ATH9K_TXERR_FILT) | ||
1382 | return; | ||
1383 | |||
1384 | if (info_priv->tx.ts_rssi > 0) { | ||
1385 | ATH_RSSI_LPF(an->an_chainmask_sel.tx_avgrssi, | ||
1386 | info_priv->tx.ts_rssi); | ||
1387 | } | ||
1388 | |||
1389 | /* | ||
1390 | * If underrun error is seen assume it as an excessive retry only | ||
1391 | * if prefetch trigger level have reached the max (0x3f for 5416) | ||
1392 | * Adjust the long retry as if the frame was tried ATH_11N_TXMAXTRY | ||
1393 | * times. This affects how ratectrl updates PER for the failed rate. | ||
1394 | */ | ||
1395 | if (info_priv->tx.ts_flags & | ||
1396 | (ATH9K_TX_DATA_UNDERRUN | ATH9K_TX_DELIM_UNDERRUN) && | ||
1397 | ((sc->sc_ah->ah_txTrigLevel) >= rc_priv->tx_triglevel_max)) { | ||
1398 | tx_status = 1; | ||
1399 | is_underrun = 1; | ||
1400 | } | ||
1401 | |||
1402 | if ((info_priv->tx.ts_status & ATH9K_TXERR_XRETRY) || | ||
1403 | (info_priv->tx.ts_status & ATH9K_TXERR_FIFO)) | ||
1404 | tx_status = 1; | ||
1405 | |||
1406 | ath_rc_update(sc, rc_priv, tx_info, final_ts_idx, tx_status, | ||
1407 | (is_underrun) ? ATH_11N_TXMAXTRY : | ||
1408 | info_priv->tx.ts_longretry); | ||
1409 | } | ||
1410 | |||
1411 | static void ath_rc_init(struct ath_softc *sc, | 1315 | static void ath_rc_init(struct ath_softc *sc, |
1412 | struct ath_rate_node *ath_rc_priv, | 1316 | struct ath_rate_priv *ath_rc_priv, |
1413 | struct ieee80211_supported_band *sband, | 1317 | struct ieee80211_supported_band *sband, |
1414 | struct ieee80211_sta *sta) | 1318 | struct ieee80211_sta *sta) |
1415 | { | 1319 | { |
@@ -1427,13 +1331,14 @@ static void ath_rc_init(struct ath_softc *sc, | |||
1427 | rate_table = sc->hw_rate_table[ATH9K_MODE_11NA_HT20]; | 1331 | rate_table = sc->hw_rate_table[ATH9K_MODE_11NA_HT20]; |
1428 | 1332 | ||
1429 | ath_rc_priv->ht_cap = (WLAN_RC_HT_FLAG | WLAN_RC_DS_FLAG); | 1333 | ath_rc_priv->ht_cap = (WLAN_RC_HT_FLAG | WLAN_RC_DS_FLAG); |
1334 | |||
1430 | if (sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) | 1335 | if (sta->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) |
1431 | ath_rc_priv->ht_cap |= WLAN_RC_40_FLAG; | 1336 | ath_rc_priv->ht_cap |= WLAN_RC_40_FLAG; |
1432 | } | 1337 | } |
1433 | 1338 | ||
1434 | /* Initial rate table size. Will change depending | 1339 | /* Initial rate table size. Will change depending |
1435 | * on the working rate set */ | 1340 | * on the working rate set */ |
1436 | ath_rc_priv->rate_table_size = MAX_TX_RATE_TBL; | 1341 | ath_rc_priv->rate_table_size = RATE_TABLE_SIZE; |
1437 | 1342 | ||
1438 | /* Initialize thresholds according to the global rate table */ | 1343 | /* Initialize thresholds according to the global rate table */ |
1439 | for (i = 0 ; i < ath_rc_priv->rate_table_size; i++) { | 1344 | for (i = 0 ; i < ath_rc_priv->rate_table_size; i++) { |
@@ -1474,7 +1379,7 @@ static void ath_rc_init(struct ath_softc *sc, | |||
1474 | 1379 | ||
1475 | ath_rc_priv->rate_table_size = hi + 1; | 1380 | ath_rc_priv->rate_table_size = hi + 1; |
1476 | ath_rc_priv->rate_max_phy = 0; | 1381 | ath_rc_priv->rate_max_phy = 0; |
1477 | ASSERT(ath_rc_priv->rate_table_size <= MAX_TX_RATE_TBL); | 1382 | ASSERT(ath_rc_priv->rate_table_size <= RATE_TABLE_SIZE); |
1478 | 1383 | ||
1479 | for (i = 0, k = 0; i < WLAN_RC_PHY_MAX; i++) { | 1384 | for (i = 0, k = 0; i < WLAN_RC_PHY_MAX; i++) { |
1480 | for (j = 0; j < ath_rc_priv->valid_phy_ratecnt[i]; j++) { | 1385 | for (j = 0; j < ath_rc_priv->valid_phy_ratecnt[i]; j++) { |
@@ -1482,21 +1387,16 @@ static void ath_rc_init(struct ath_softc *sc, | |||
1482 | ath_rc_priv->valid_phy_rateidx[i][j]; | 1387 | ath_rc_priv->valid_phy_rateidx[i][j]; |
1483 | } | 1388 | } |
1484 | 1389 | ||
1485 | if (!ath_rc_valid_phyrate(i, rate_table->initial_ratemax, TRUE) | 1390 | if (!ath_rc_valid_phyrate(i, rate_table->initial_ratemax, 1) |
1486 | || !ath_rc_priv->valid_phy_ratecnt[i]) | 1391 | || !ath_rc_priv->valid_phy_ratecnt[i]) |
1487 | continue; | 1392 | continue; |
1488 | 1393 | ||
1489 | ath_rc_priv->rate_max_phy = ath_rc_priv->valid_phy_rateidx[i][j-1]; | 1394 | ath_rc_priv->rate_max_phy = ath_rc_priv->valid_phy_rateidx[i][j-1]; |
1490 | } | 1395 | } |
1491 | ASSERT(ath_rc_priv->rate_table_size <= MAX_TX_RATE_TBL); | 1396 | ASSERT(ath_rc_priv->rate_table_size <= RATE_TABLE_SIZE); |
1492 | ASSERT(k <= MAX_TX_RATE_TBL); | 1397 | ASSERT(k <= RATE_TABLE_SIZE); |
1493 | 1398 | ||
1494 | ath_rc_priv->max_valid_rate = k; | 1399 | ath_rc_priv->max_valid_rate = k; |
1495 | /* | ||
1496 | * Some third party vendors don't send the supported rate series in | ||
1497 | * order. So sorting to make sure its in order, otherwise our RateFind | ||
1498 | * Algo will select wrong rates | ||
1499 | */ | ||
1500 | ath_rc_sort_validrates(rate_table, ath_rc_priv); | 1400 | ath_rc_sort_validrates(rate_table, ath_rc_priv); |
1501 | ath_rc_priv->rate_max_phy = ath_rc_priv->valid_rate_index[k-4]; | 1401 | ath_rc_priv->rate_max_phy = ath_rc_priv->valid_rate_index[k-4]; |
1502 | } | 1402 | } |
@@ -1507,24 +1407,53 @@ static void ath_tx_status(void *priv, struct ieee80211_supported_band *sband, | |||
1507 | struct sk_buff *skb) | 1407 | struct sk_buff *skb) |
1508 | { | 1408 | { |
1509 | struct ath_softc *sc = priv; | 1409 | struct ath_softc *sc = priv; |
1510 | struct ath_tx_info_priv *tx_info_priv; | 1410 | struct ath_rate_priv *ath_rc_priv = priv_sta; |
1411 | struct ath_tx_info_priv *tx_info_priv = NULL; | ||
1511 | struct ath_node *an; | 1412 | struct ath_node *an; |
1512 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 1413 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
1513 | struct ieee80211_hdr *hdr; | 1414 | struct ieee80211_hdr *hdr; |
1415 | int final_ts_idx, tx_status = 0, is_underrun = 0; | ||
1514 | __le16 fc; | 1416 | __le16 fc; |
1515 | 1417 | ||
1516 | hdr = (struct ieee80211_hdr *)skb->data; | 1418 | hdr = (struct ieee80211_hdr *)skb->data; |
1517 | fc = hdr->frame_control; | 1419 | fc = hdr->frame_control; |
1518 | tx_info_priv = (struct ath_tx_info_priv *)tx_info->rate_driver_data[0]; | 1420 | tx_info_priv = ATH_TX_INFO_PRIV(tx_info); |
1519 | |||
1520 | an = (struct ath_node *)sta->drv_priv; | 1421 | an = (struct ath_node *)sta->drv_priv; |
1422 | final_ts_idx = tx_info_priv->tx.ts_rateindex; | ||
1521 | 1423 | ||
1522 | if (tx_info_priv == NULL) | 1424 | if (!an || !priv_sta || !ieee80211_is_data(fc)) |
1523 | return; | 1425 | goto exit; |
1524 | 1426 | ||
1525 | if (an && priv_sta && ieee80211_is_data(fc)) | 1427 | if (tx_info_priv->tx.ts_status & ATH9K_TXERR_FILT) |
1526 | ath_rate_tx_complete(sc, an, priv_sta, tx_info); | 1428 | goto exit; |
1527 | 1429 | ||
1430 | if (tx_info_priv->tx.ts_rssi > 0) { | ||
1431 | ATH_RSSI_LPF(an->an_chainmask_sel.tx_avgrssi, | ||
1432 | tx_info_priv->tx.ts_rssi); | ||
1433 | } | ||
1434 | |||
1435 | /* | ||
1436 | * If underrun error is seen assume it as an excessive retry only | ||
1437 | * if prefetch trigger level have reached the max (0x3f for 5416) | ||
1438 | * Adjust the long retry as if the frame was tried ATH_11N_TXMAXTRY | ||
1439 | * times. This affects how ratectrl updates PER for the failed rate. | ||
1440 | */ | ||
1441 | if (tx_info_priv->tx.ts_flags & | ||
1442 | (ATH9K_TX_DATA_UNDERRUN | ATH9K_TX_DELIM_UNDERRUN) && | ||
1443 | ((sc->sc_ah->ah_txTrigLevel) >= ath_rc_priv->tx_triglevel_max)) { | ||
1444 | tx_status = 1; | ||
1445 | is_underrun = 1; | ||
1446 | } | ||
1447 | |||
1448 | if ((tx_info_priv->tx.ts_status & ATH9K_TXERR_XRETRY) || | ||
1449 | (tx_info_priv->tx.ts_status & ATH9K_TXERR_FIFO)) | ||
1450 | tx_status = 1; | ||
1451 | |||
1452 | ath_rc_tx_status(sc, ath_rc_priv, tx_info, final_ts_idx, tx_status, | ||
1453 | (is_underrun) ? ATH_11N_TXMAXTRY : | ||
1454 | tx_info_priv->tx.ts_longretry); | ||
1455 | |||
1456 | exit: | ||
1528 | kfree(tx_info_priv); | 1457 | kfree(tx_info_priv); |
1529 | } | 1458 | } |
1530 | 1459 | ||
@@ -1536,12 +1465,10 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, | |||
1536 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; | 1465 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; |
1537 | struct ath_softc *sc = priv; | 1466 | struct ath_softc *sc = priv; |
1538 | struct ieee80211_hw *hw = sc->hw; | 1467 | struct ieee80211_hw *hw = sc->hw; |
1539 | struct ath_rate_node *ath_rc_priv = priv_sta; | 1468 | struct ath_rate_priv *ath_rc_priv = priv_sta; |
1540 | struct ath_node *an; | ||
1541 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); | 1469 | struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); |
1542 | int is_probe = FALSE; | 1470 | int is_probe = 0; |
1543 | __le16 fc = hdr->frame_control; | 1471 | __le16 fc = hdr->frame_control; |
1544 | u8 *qc, tid; | ||
1545 | 1472 | ||
1546 | /* lowest rate for management and multicast/broadcast frames */ | 1473 | /* lowest rate for management and multicast/broadcast frames */ |
1547 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1)) { | 1474 | if (!ieee80211_is_data(fc) || is_multicast_ether_addr(hdr->addr1)) { |
@@ -1552,16 +1479,15 @@ static void ath_get_rate(void *priv, struct ieee80211_sta *sta, void *priv_sta, | |||
1552 | } | 1479 | } |
1553 | 1480 | ||
1554 | /* Find tx rate for unicast frames */ | 1481 | /* Find tx rate for unicast frames */ |
1555 | ath_rate_findrate(sc, ath_rc_priv, | 1482 | ath_rc_ratefind(sc, ath_rc_priv, ATH_11N_TXMAXTRY, 4, |
1556 | ATH_11N_TXMAXTRY, 4, | 1483 | tx_info, &is_probe, false); |
1557 | ATH_RC_PROBE_ALLOWED, | ||
1558 | tx_info, | ||
1559 | &is_probe, | ||
1560 | false); | ||
1561 | 1484 | ||
1562 | /* Check if aggregation has to be enabled for this tid */ | 1485 | /* Check if aggregation has to be enabled for this tid */ |
1563 | if (hw->conf.ht.enabled) { | 1486 | if (hw->conf.ht.enabled) { |
1564 | if (ieee80211_is_data_qos(fc)) { | 1487 | if (ieee80211_is_data_qos(fc)) { |
1488 | u8 *qc, tid; | ||
1489 | struct ath_node *an; | ||
1490 | |||
1565 | qc = ieee80211_get_qos_ctl(hdr); | 1491 | qc = ieee80211_get_qos_ctl(hdr); |
1566 | tid = qc[0] & 0xf; | 1492 | tid = qc[0] & 0xf; |
1567 | an = (struct ath_node *)sta->drv_priv; | 1493 | an = (struct ath_node *)sta->drv_priv; |
@@ -1576,7 +1502,7 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband, | |||
1576 | struct ieee80211_sta *sta, void *priv_sta) | 1502 | struct ieee80211_sta *sta, void *priv_sta) |
1577 | { | 1503 | { |
1578 | struct ath_softc *sc = priv; | 1504 | struct ath_softc *sc = priv; |
1579 | struct ath_rate_node *ath_rc_priv = priv_sta; | 1505 | struct ath_rate_priv *ath_rc_priv = priv_sta; |
1580 | int i, j = 0; | 1506 | int i, j = 0; |
1581 | 1507 | ||
1582 | for (i = 0; i < sband->n_bitrates; i++) { | 1508 | for (i = 0; i < sband->n_bitrates; i++) { |
@@ -1614,9 +1540,9 @@ static void ath_rate_free(void *priv) | |||
1614 | static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) | 1540 | static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp) |
1615 | { | 1541 | { |
1616 | struct ath_softc *sc = priv; | 1542 | struct ath_softc *sc = priv; |
1617 | struct ath_rate_node *rate_priv; | 1543 | struct ath_rate_priv *rate_priv; |
1618 | 1544 | ||
1619 | rate_priv = kzalloc(sizeof(struct ath_rate_node), gfp); | 1545 | rate_priv = kzalloc(sizeof(struct ath_rate_priv), gfp); |
1620 | if (!rate_priv) { | 1546 | if (!rate_priv) { |
1621 | DPRINTF(sc, ATH_DBG_FATAL, | 1547 | DPRINTF(sc, ATH_DBG_FATAL, |
1622 | "%s: Unable to allocate private rc structure\n", | 1548 | "%s: Unable to allocate private rc structure\n", |
@@ -1633,7 +1559,7 @@ static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp | |||
1633 | static void ath_rate_free_sta(void *priv, struct ieee80211_sta *sta, | 1559 | static void ath_rate_free_sta(void *priv, struct ieee80211_sta *sta, |
1634 | void *priv_sta) | 1560 | void *priv_sta) |
1635 | { | 1561 | { |
1636 | struct ath_rate_node *rate_priv = priv_sta; | 1562 | struct ath_rate_priv *rate_priv = priv_sta; |
1637 | kfree(rate_priv); | 1563 | kfree(rate_priv); |
1638 | } | 1564 | } |
1639 | 1565 | ||