aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSenthil Balasubramanian <senthilkumar@atheros.com>2010-07-27 09:46:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2010-07-27 14:59:58 -0400
commitf63b340d1bab58aac07ae1b528d58a73b76b0970 (patch)
tree98cee83abc348f3f21f64c204e52291239f97aa6
parent32162a4dab0e6a4ca7f886a01173b5f9b80843be (diff)
ath9k: Introduce bit masks for valid and valid_single_stream.
replace valid and valid_single_stream in rate table with bit masks and reorganize the code so adding 3x3 rate control would be easier. Signed-off-by: Senthil Balasubramanian <senthilkumar@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c251
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.h47
2 files changed, 153 insertions, 145 deletions
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index 600ee0ba2880..f8a4c39e5a0c 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -23,91 +23,91 @@ static const struct ath_rate_table ar5416_11na_ratetable = {
23 43, 23 43,
24 8, /* MCS start */ 24 8, /* MCS start */
25 { 25 {
26 { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ 26 { RC_L_SD, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */
27 5400, 0, 12, 0, 0, 0, 0, 0 }, 27 5400, 0, 12, 0, 0, 0, 0, 0 },
28 { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ 28 { RC_L_SD, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */
29 7800, 1, 18, 0, 1, 1, 1, 1 }, 29 7800, 1, 18, 0, 1, 1, 1, 1 },
30 { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ 30 { RC_L_SD, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */
31 10000, 2, 24, 2, 2, 2, 2, 2 }, 31 10000, 2, 24, 2, 2, 2, 2, 2 },
32 { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ 32 { RC_L_SD, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */
33 13900, 3, 36, 2, 3, 3, 3, 3 }, 33 13900, 3, 36, 2, 3, 3, 3, 3 },
34 { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ 34 { RC_L_SD, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */
35 17300, 4, 48, 4, 4, 4, 4, 4 }, 35 17300, 4, 48, 4, 4, 4, 4, 4 },
36 { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ 36 { RC_L_SD, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */
37 23000, 5, 72, 4, 5, 5, 5, 5 }, 37 23000, 5, 72, 4, 5, 5, 5, 5 },
38 { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ 38 { RC_L_SD, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */
39 27400, 6, 96, 4, 6, 6, 6, 6 }, 39 27400, 6, 96, 4, 6, 6, 6, 6 },
40 { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ 40 { RC_L_SD, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */
41 29300, 7, 108, 4, 7, 7, 7, 7 }, 41 29300, 7, 108, 4, 7, 7, 7, 7 },
42 { VALID_2040, VALID_2040, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ 42 { RC_HT_SD_2040, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */
43 6400, 0, 0, 0, 8, 25, 8, 25 }, 43 6400, 0, 0, 0, 8, 25, 8, 25 },
44 { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ 44 { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */
45 12700, 1, 1, 2, 9, 26, 9, 26 }, 45 12700, 1, 1, 2, 9, 26, 9, 26 },
46 { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ 46 { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */
47 18800, 2, 2, 2, 10, 27, 10, 27 }, 47 18800, 2, 2, 2, 10, 27, 10, 27 },
48 { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ 48 { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */
49 25000, 3, 3, 4, 11, 28, 11, 28 }, 49 25000, 3, 3, 4, 11, 28, 11, 28 },
50 { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ 50 { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */
51 36700, 4, 4, 4, 12, 29, 12, 29 }, 51 36700, 4, 4, 4, 12, 29, 12, 29 },
52 { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ 52 { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */
53 48100, 5, 5, 4, 13, 30, 13, 30 }, 53 48100, 5, 5, 4, 13, 30, 13, 30 },
54 { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ 54 { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */
55 53500, 6, 6, 4, 14, 31, 14, 31 }, 55 53500, 6, 6, 4, 14, 31, 14, 31 },
56 { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ 56 { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */
57 59000, 7, 7, 4, 15, 32, 15, 33 }, 57 59000, 7, 7, 4, 15, 32, 15, 33 },
58 { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ 58 { RC_INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */
59 12700, 8, 8, 3, 16, 34, 16, 34 }, 59 12700, 8, 8, 3, 16, 34, 16, 34 },
60 { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ 60 { RC_INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */
61 24800, 9, 9, 2, 17, 35, 17, 35 }, 61 24800, 9, 9, 2, 17, 35, 17, 35 },
62 { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ 62 { RC_INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */
63 36600, 10, 10, 2, 18, 36, 18, 36 }, 63 36600, 10, 10, 2, 18, 36, 18, 36 },
64 { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ 64 { RC_HT_D_20, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */
65 48100, 11, 11, 4, 19, 37, 19, 37 }, 65 48100, 11, 11, 4, 19, 37, 19, 37 },
66 { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ 66 { RC_HT_D_20, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */
67 69500, 12, 12, 4, 20, 38, 20, 38 }, 67 69500, 12, 12, 4, 20, 38, 20, 38 },
68 { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ 68 { RC_HT_D_20, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */
69 89500, 13, 13, 4, 21, 39, 21, 39 }, 69 89500, 13, 13, 4, 21, 39, 21, 39 },
70 { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ 70 { RC_HT_D_20, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */
71 98900, 14, 14, 4, 22, 40, 22, 40 }, 71 98900, 14, 14, 4, 22, 40, 22, 40 },
72 { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ 72 { RC_HT_D_20, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */
73 108300, 15, 15, 4, 23, 41, 24, 42 }, 73 108300, 15, 15, 4, 23, 41, 24, 42 },
74 { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS_HGI, 144400, /* 144.4 Mb */ 74 { RC_HT_D_20, WLAN_RC_PHY_HT_20_DS_HGI, 144400, /* 144.4 Mb */
75 12000, 15, 15, 4, 23, 41, 24, 42 }, 75 12000, 15, 15, 4, 23, 41, 24, 42 },
76 { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ 76 { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */
77 13200, 0, 0, 0, 8, 25, 25, 25 }, 77 13200, 0, 0, 0, 8, 25, 25, 25 },
78 { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ 78 { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */
79 25900, 1, 1, 2, 9, 26, 26, 26 }, 79 25900, 1, 1, 2, 9, 26, 26, 26 },
80 { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ 80 { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */
81 38600, 2, 2, 2, 10, 27, 27, 27 }, 81 38600, 2, 2, 2, 10, 27, 27, 27 },
82 { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ 82 { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */
83 49800, 3, 3, 4, 11, 28, 28, 28 }, 83 49800, 3, 3, 4, 11, 28, 28, 28 },
84 { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ 84 { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */
85 72200, 4, 4, 4, 12, 29, 29, 29 }, 85 72200, 4, 4, 4, 12, 29, 29, 29 },
86 { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ 86 { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */
87 92900, 5, 5, 4, 13, 30, 30, 30 }, 87 92900, 5, 5, 4, 13, 30, 30, 30 },
88 { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ 88 { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */
89 102700, 6, 6, 4, 14, 31, 31, 31 }, 89 102700, 6, 6, 4, 14, 31, 31, 31 },
90 { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ 90 { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */
91 112000, 7, 7, 4, 15, 32, 33, 33 }, 91 112000, 7, 7, 4, 15, 32, 33, 33 },
92 { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ 92 { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */
93 122000, 7, 7, 4, 15, 32, 33, 33 }, 93 122000, 7, 7, 4, 15, 32, 33, 33 },
94 { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ 94 { RC_INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */
95 25800, 8, 8, 0, 16, 34, 34, 34 }, 95 25800, 8, 8, 0, 16, 34, 34, 34 },
96 { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ 96 { RC_INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */
97 49800, 9, 9, 2, 17, 35, 35, 35 }, 97 49800, 9, 9, 2, 17, 35, 35, 35 },
98 { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ 98 { RC_INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */
99 71900, 10, 10, 2, 18, 36, 36, 36 }, 99 71900, 10, 10, 2, 18, 36, 36, 36 },
100 { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ 100 { RC_HT_D_40, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */
101 92500, 11, 11, 4, 19, 37, 37, 37 }, 101 92500, 11, 11, 4, 19, 37, 37, 37 },
102 { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ 102 { RC_HT_D_40, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */
103 130300, 12, 12, 4, 20, 38, 38, 38 }, 103 130300, 12, 12, 4, 20, 38, 38, 38 },
104 { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ 104 { RC_HT_D_40, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */
105 162800, 13, 13, 4, 21, 39, 39, 39 }, 105 162800, 13, 13, 4, 21, 39, 39, 39 },
106 { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ 106 { RC_HT_D_40, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */
107 178200, 14, 14, 4, 22, 40, 40, 40 }, 107 178200, 14, 14, 4, 22, 40, 40, 40 },
108 { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ 108 { RC_HT_D_40, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */
109 192100, 15, 15, 4, 23, 41, 42, 42 }, 109 192100, 15, 15, 4, 23, 41, 42, 42 },
110 { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ 110 { RC_HT_D_40, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */
111 207000, 15, 15, 4, 23, 41, 42, 42 }, 111 207000, 15, 15, 4, 23, 41, 42, 42 },
112 }, 112 },
113 50, /* probe interval */ 113 50, /* probe interval */
@@ -121,99 +121,99 @@ static const struct ath_rate_table ar5416_11ng_ratetable = {
121 47, 121 47,
122 12, /* MCS start */ 122 12, /* MCS start */
123 { 123 {
124 { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ 124 { RC_ALL, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */
125 900, 0, 2, 0, 0, 0, 0, 0 }, 125 900, 0, 2, 0, 0, 0, 0, 0 },
126 { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ 126 { RC_ALL, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */
127 1900, 1, 4, 1, 1, 1, 1, 1 }, 127 1900, 1, 4, 1, 1, 1, 1, 1 },
128 { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ 128 { RC_ALL, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */
129 4900, 2, 11, 2, 2, 2, 2, 2 }, 129 4900, 2, 11, 2, 2, 2, 2, 2 },
130 { VALID_ALL, VALID_ALL, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ 130 { RC_ALL, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */
131 8100, 3, 22, 3, 3, 3, 3, 3 }, 131 8100, 3, 22, 3, 3, 3, 3, 3 },
132 { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ 132 { RC_INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */
133 5400, 4, 12, 4, 4, 4, 4, 4 }, 133 5400, 4, 12, 4, 4, 4, 4, 4 },
134 { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ 134 { RC_INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */
135 7800, 5, 18, 4, 5, 5, 5, 5 }, 135 7800, 5, 18, 4, 5, 5, 5, 5 },
136 { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ 136 { RC_L_SD, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */
137 10100, 6, 24, 6, 6, 6, 6, 6 }, 137 10100, 6, 24, 6, 6, 6, 6, 6 },
138 { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ 138 { RC_L_SD, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */
139 14100, 7, 36, 6, 7, 7, 7, 7 }, 139 14100, 7, 36, 6, 7, 7, 7, 7 },
140 { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ 140 { RC_L_SD, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */
141 17700, 8, 48, 8, 8, 8, 8, 8 }, 141 17700, 8, 48, 8, 8, 8, 8, 8 },
142 { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ 142 { RC_L_SD, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */
143 23700, 9, 72, 8, 9, 9, 9, 9 }, 143 23700, 9, 72, 8, 9, 9, 9, 9 },
144 { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ 144 { RC_L_SD, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */
145 27400, 10, 96, 8, 10, 10, 10, 10 }, 145 27400, 10, 96, 8, 10, 10, 10, 10 },
146 { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ 146 { RC_L_SD, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */
147 30900, 11, 108, 8, 11, 11, 11, 11 }, 147 30900, 11, 108, 8, 11, 11, 11, 11 },
148 { INVALID, INVALID, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */ 148 { RC_INVALID, WLAN_RC_PHY_HT_20_SS, 6500, /* 6.5 Mb */
149 6400, 0, 0, 4, 12, 29, 12, 29 }, 149 6400, 0, 0, 4, 12, 29, 12, 29 },
150 { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */ 150 { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 13000, /* 13 Mb */
151 12700, 1, 1, 6, 13, 30, 13, 30 }, 151 12700, 1, 1, 6, 13, 30, 13, 30 },
152 { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */ 152 { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 19500, /* 19.5 Mb */
153 18800, 2, 2, 6, 14, 31, 14, 31 }, 153 18800, 2, 2, 6, 14, 31, 14, 31 },
154 { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */ 154 { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 26000, /* 26 Mb */
155 25000, 3, 3, 8, 15, 32, 15, 32 }, 155 25000, 3, 3, 8, 15, 32, 15, 32 },
156 { VALID_20, VALID_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */ 156 { RC_HT_SD_20, WLAN_RC_PHY_HT_20_SS, 39000, /* 39 Mb */
157 36700, 4, 4, 8, 16, 33, 16, 33 }, 157 36700, 4, 4, 8, 16, 33, 16, 33 },
158 { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */ 158 { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 52000, /* 52 Mb */
159 48100, 5, 5, 8, 17, 34, 17, 34 }, 159 48100, 5, 5, 8, 17, 34, 17, 34 },
160 { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */ 160 { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 58500, /* 58.5 Mb */
161 53500, 6, 6, 8, 18, 35, 18, 35 }, 161 53500, 6, 6, 8, 18, 35, 18, 35 },
162 { INVALID, VALID_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */ 162 { RC_HT_S_20, WLAN_RC_PHY_HT_20_SS, 65000, /* 65 Mb */
163 59000, 7, 7, 8, 19, 36, 19, 37 }, 163 59000, 7, 7, 8, 19, 36, 19, 37 },
164 { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */ 164 { RC_INVALID, WLAN_RC_PHY_HT_20_DS, 13000, /* 13 Mb */
165 12700, 8, 8, 4, 20, 38, 20, 38 }, 165 12700, 8, 8, 4, 20, 38, 20, 38 },
166 { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */ 166 { RC_INVALID, WLAN_RC_PHY_HT_20_DS, 26000, /* 26 Mb */
167 24800, 9, 9, 6, 21, 39, 21, 39 }, 167 24800, 9, 9, 6, 21, 39, 21, 39 },
168 { INVALID, INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */ 168 { RC_INVALID, WLAN_RC_PHY_HT_20_DS, 39000, /* 39 Mb */
169 36600, 10, 10, 6, 22, 40, 22, 40 }, 169 36600, 10, 10, 6, 22, 40, 22, 40 },
170 { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */ 170 { RC_HT_D_20, WLAN_RC_PHY_HT_20_DS, 52000, /* 52 Mb */
171 48100, 11, 11, 8, 23, 41, 23, 41 }, 171 48100, 11, 11, 8, 23, 41, 23, 41 },
172 { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */ 172 { RC_HT_D_20, WLAN_RC_PHY_HT_20_DS, 78000, /* 78 Mb */
173 69500, 12, 12, 8, 24, 42, 24, 42 }, 173 69500, 12, 12, 8, 24, 42, 24, 42 },
174 { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */ 174 { RC_HT_D_20, WLAN_RC_PHY_HT_20_DS, 104000, /* 104 Mb */
175 89500, 13, 13, 8, 25, 43, 25, 43 }, 175 89500, 13, 13, 8, 25, 43, 25, 43 },
176 { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */ 176 { RC_HT_D_20, WLAN_RC_PHY_HT_20_DS, 117000, /* 117 Mb */
177 98900, 14, 14, 8, 26, 44, 26, 44 }, 177 98900, 14, 14, 8, 26, 44, 26, 44 },
178 { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */ 178 { RC_HT_D_20, WLAN_RC_PHY_HT_20_DS, 130000, /* 130 Mb */
179 108300, 15, 15, 8, 27, 45, 28, 46 }, 179 108300, 15, 15, 8, 27, 45, 28, 46 },
180 { VALID_20, INVALID, WLAN_RC_PHY_HT_20_DS_HGI, 144400, /* 130 Mb */ 180 { RC_HT_D_20, WLAN_RC_PHY_HT_20_DS_HGI, 144400, /* 130 Mb */
181 120000, 15, 15, 8, 27, 45, 28, 46 }, 181 120000, 15, 15, 8, 27, 45, 28, 46 },
182 { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */ 182 { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 13500, /* 13.5 Mb */
183 13200, 0, 0, 8, 12, 29, 29, 29 }, 183 13200, 0, 0, 8, 12, 29, 29, 29 },
184 { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */ 184 { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 27500, /* 27.0 Mb */
185 25900, 1, 1, 8, 13, 30, 30, 30 }, 185 25900, 1, 1, 8, 13, 30, 30, 30 },
186 { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */ 186 { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 40500, /* 40.5 Mb */
187 38600, 2, 2, 8, 14, 31, 31, 31 }, 187 38600, 2, 2, 8, 14, 31, 31, 31 },
188 { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */ 188 { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 54000, /* 54 Mb */
189 49800, 3, 3, 8, 15, 32, 32, 32 }, 189 49800, 3, 3, 8, 15, 32, 32, 32 },
190 { VALID_40, VALID_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */ 190 { RC_HT_SD_40, WLAN_RC_PHY_HT_40_SS, 81500, /* 81 Mb */
191 72200, 4, 4, 8, 16, 33, 33, 33 }, 191 72200, 4, 4, 8, 16, 33, 33, 33 },
192 { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */ 192 { RC_HT_S_40 , WLAN_RC_PHY_HT_40_SS, 108000, /* 108 Mb */
193 92900, 5, 5, 8, 17, 34, 34, 34 }, 193 92900, 5, 5, 8, 17, 34, 34, 34 },
194 { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */ 194 { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 121500, /* 121.5 Mb */
195 102700, 6, 6, 8, 18, 35, 35, 35 }, 195 102700, 6, 6, 8, 18, 35, 35, 35 },
196 { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */ 196 { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS, 135000, /* 135 Mb */
197 112000, 7, 7, 8, 19, 36, 37, 37 }, 197 112000, 7, 7, 8, 19, 36, 37, 37 },
198 { INVALID, VALID_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */ 198 { RC_HT_S_40, WLAN_RC_PHY_HT_40_SS_HGI, 150000, /* 150 Mb */
199 122000, 7, 7, 8, 19, 36, 37, 37 }, 199 122000, 7, 7, 8, 19, 36, 37, 37 },
200 { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */ 200 { RC_INVALID, WLAN_RC_PHY_HT_40_DS, 27000, /* 27 Mb */
201 25800, 8, 8, 8, 20, 38, 38, 38 }, 201 25800, 8, 8, 8, 20, 38, 38, 38 },
202 { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */ 202 { RC_INVALID, WLAN_RC_PHY_HT_40_DS, 54000, /* 54 Mb */
203 49800, 9, 9, 8, 21, 39, 39, 39 }, 203 49800, 9, 9, 8, 21, 39, 39, 39 },
204 { INVALID, INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */ 204 { RC_INVALID, WLAN_RC_PHY_HT_40_DS, 81000, /* 81 Mb */
205 71900, 10, 10, 8, 22, 40, 40, 40 }, 205 71900, 10, 10, 8, 22, 40, 40, 40 },
206 { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */ 206 { RC_HT_D_40, WLAN_RC_PHY_HT_40_DS, 108000, /* 108 Mb */
207 92500, 11, 11, 8, 23, 41, 41, 41 }, 207 92500, 11, 11, 8, 23, 41, 41, 41 },
208 { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */ 208 { RC_HT_D_40, WLAN_RC_PHY_HT_40_DS, 162000, /* 162 Mb */
209 130300, 12, 12, 8, 24, 42, 42, 42 }, 209 130300, 12, 12, 8, 24, 42, 42, 42 },
210 { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */ 210 { RC_HT_D_40, WLAN_RC_PHY_HT_40_DS, 216000, /* 216 Mb */
211 162800, 13, 13, 8, 25, 43, 43, 43 }, 211 162800, 13, 13, 8, 25, 43, 43, 43 },
212 { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */ 212 { RC_HT_D_40, WLAN_RC_PHY_HT_40_DS, 243000, /* 243 Mb */
213 178200, 14, 14, 8, 26, 44, 44, 44 }, 213 178200, 14, 14, 8, 26, 44, 44, 44 },
214 { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */ 214 { RC_HT_D_40, WLAN_RC_PHY_HT_40_DS, 270000, /* 270 Mb */
215 192100, 15, 15, 8, 27, 45, 46, 46 }, 215 192100, 15, 15, 8, 27, 45, 46, 46 },
216 { VALID_40, INVALID, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */ 216 { RC_HT_D_40, WLAN_RC_PHY_HT_40_DS_HGI, 300000, /* 300 Mb */
217 207000, 15, 15, 8, 27, 45, 46, 46 }, 217 207000, 15, 15, 8, 27, 45, 46, 46 },
218 }, 218 },
219 50, /* probe interval */ 219 50, /* probe interval */
@@ -224,21 +224,21 @@ static const struct ath_rate_table ar5416_11a_ratetable = {
224 8, 224 8,
225 0, 225 0,
226 { 226 {
227 { VALID, VALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ 227 { RC_L_SD, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */
228 5400, 0, 12, 0, 0, 0 }, 228 5400, 0, 12, 0, 0, 0 },
229 { VALID, VALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ 229 { RC_L_SD, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */
230 7800, 1, 18, 0, 1, 0 }, 230 7800, 1, 18, 0, 1, 0 },
231 { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ 231 { RC_L_SD, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */
232 10000, 2, 24, 2, 2, 0 }, 232 10000, 2, 24, 2, 2, 0 },
233 { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ 233 { RC_L_SD, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */
234 13900, 3, 36, 2, 3, 0 }, 234 13900, 3, 36, 2, 3, 0 },
235 { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ 235 { RC_L_SD, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */
236 17300, 4, 48, 4, 4, 0 }, 236 17300, 4, 48, 4, 4, 0 },
237 { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ 237 { RC_L_SD, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */
238 23000, 5, 72, 4, 5, 0 }, 238 23000, 5, 72, 4, 5, 0 },
239 { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ 239 { RC_L_SD, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */
240 27400, 6, 96, 4, 6, 0 }, 240 27400, 6, 96, 4, 6, 0 },
241 { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ 241 { RC_L_SD, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */
242 29300, 7, 108, 4, 7, 0 }, 242 29300, 7, 108, 4, 7, 0 },
243 }, 243 },
244 50, /* probe interval */ 244 50, /* probe interval */
@@ -249,29 +249,29 @@ static const struct ath_rate_table ar5416_11g_ratetable = {
249 12, 249 12,
250 0, 250 0,
251 { 251 {
252 { VALID, VALID, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */ 252 { RC_L_SD, WLAN_RC_PHY_CCK, 1000, /* 1 Mb */
253 900, 0, 2, 0, 0, 0 }, 253 900, 0, 2, 0, 0, 0 },
254 { VALID, VALID, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */ 254 { RC_L_SD, WLAN_RC_PHY_CCK, 2000, /* 2 Mb */
255 1900, 1, 4, 1, 1, 0 }, 255 1900, 1, 4, 1, 1, 0 },
256 { VALID, VALID, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */ 256 { RC_L_SD, WLAN_RC_PHY_CCK, 5500, /* 5.5 Mb */
257 4900, 2, 11, 2, 2, 0 }, 257 4900, 2, 11, 2, 2, 0 },
258 { VALID, VALID, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */ 258 { RC_L_SD, WLAN_RC_PHY_CCK, 11000, /* 11 Mb */
259 8100, 3, 22, 3, 3, 0 }, 259 8100, 3, 22, 3, 3, 0 },
260 { INVALID, INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */ 260 { RC_INVALID, WLAN_RC_PHY_OFDM, 6000, /* 6 Mb */
261 5400, 4, 12, 4, 4, 0 }, 261 5400, 4, 12, 4, 4, 0 },
262 { INVALID, INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */ 262 { RC_INVALID, WLAN_RC_PHY_OFDM, 9000, /* 9 Mb */
263 7800, 5, 18, 4, 5, 0 }, 263 7800, 5, 18, 4, 5, 0 },
264 { VALID, VALID, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */ 264 { RC_L_SD, WLAN_RC_PHY_OFDM, 12000, /* 12 Mb */
265 10000, 6, 24, 6, 6, 0 }, 265 10000, 6, 24, 6, 6, 0 },
266 { VALID, VALID, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */ 266 { RC_L_SD, WLAN_RC_PHY_OFDM, 18000, /* 18 Mb */
267 13900, 7, 36, 6, 7, 0 }, 267 13900, 7, 36, 6, 7, 0 },
268 { VALID, VALID, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */ 268 { RC_L_SD, WLAN_RC_PHY_OFDM, 24000, /* 24 Mb */
269 17300, 8, 48, 8, 8, 0 }, 269 17300, 8, 48, 8, 8, 0 },
270 { VALID, VALID, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */ 270 { RC_L_SD, WLAN_RC_PHY_OFDM, 36000, /* 36 Mb */
271 23000, 9, 72, 8, 9, 0 }, 271 23000, 9, 72, 8, 9, 0 },
272 { VALID, VALID, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */ 272 { RC_L_SD, WLAN_RC_PHY_OFDM, 48000, /* 48 Mb */
273 27400, 10, 96, 8, 10, 0 }, 273 27400, 10, 96, 8, 10, 0 },
274 { VALID, VALID, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */ 274 { RC_L_SD, WLAN_RC_PHY_OFDM, 54000, /* 54 Mb */
275 29300, 11, 108, 8, 11, 0 }, 275 29300, 11, 108, 8, 11, 0 },
276 }, 276 },
277 50, /* probe interval */ 277 50, /* probe interval */
@@ -342,7 +342,7 @@ static inline void ath_rc_set_valid_txmask(struct ath_rate_priv *ath_rc_priv,
342 u8 index, int valid_tx_rate) 342 u8 index, int valid_tx_rate)
343{ 343{
344 BUG_ON(index > ath_rc_priv->rate_table_size); 344 BUG_ON(index > ath_rc_priv->rate_table_size);
345 ath_rc_priv->valid_rate_index[index] = valid_tx_rate ? 1 : 0; 345 ath_rc_priv->valid_rate_index[index] = !!valid_tx_rate;
346} 346}
347 347
348static inline 348static inline
@@ -404,13 +404,9 @@ static u8 ath_rc_init_validrates(struct ath_rate_priv *ath_rc_priv,
404 u32 capflag) 404 u32 capflag)
405{ 405{
406 u8 i, hi = 0; 406 u8 i, hi = 0;
407 u32 valid;
408 407
409 for (i = 0; i < rate_table->rate_cnt; i++) { 408 for (i = 0; i < rate_table->rate_cnt; i++) {
410 valid = (!(ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG) ? 409 if (rate_table->info[i].rate_flags & RC_LEGACY) {
411 rate_table->info[i].valid_single_stream :
412 rate_table->info[i].valid);
413 if (valid == 1) {
414 u32 phy = rate_table->info[i].phy; 410 u32 phy = rate_table->info[i].phy;
415 u8 valid_rate_count = 0; 411 u8 valid_rate_count = 0;
416 412
@@ -422,7 +418,7 @@ static u8 ath_rc_init_validrates(struct ath_rate_priv *ath_rc_priv,
422 ath_rc_priv->valid_phy_rateidx[phy][valid_rate_count] = i; 418 ath_rc_priv->valid_phy_rateidx[phy][valid_rate_count] = i;
423 ath_rc_priv->valid_phy_ratecnt[phy] += 1; 419 ath_rc_priv->valid_phy_ratecnt[phy] += 1;
424 ath_rc_set_valid_txmask(ath_rc_priv, i, 1); 420 ath_rc_set_valid_txmask(ath_rc_priv, i, 1);
425 hi = A_MAX(hi, i); 421 hi = i;
426 } 422 }
427 } 423 }
428 424
@@ -440,9 +436,7 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv,
440 for (i = 0; i < rateset->rs_nrates; i++) { 436 for (i = 0; i < rateset->rs_nrates; i++) {
441 for (j = 0; j < rate_table->rate_cnt; j++) { 437 for (j = 0; j < rate_table->rate_cnt; j++) {
442 u32 phy = rate_table->info[j].phy; 438 u32 phy = rate_table->info[j].phy;
443 u32 valid = (!(ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG) ? 439 u16 rate_flags = rate_table->info[i].rate_flags;
444 rate_table->info[j].valid_single_stream :
445 rate_table->info[j].valid);
446 u8 rate = rateset->rs_rates[i]; 440 u8 rate = rateset->rs_rates[i];
447 u8 dot11rate = rate_table->info[j].dot11rate; 441 u8 dot11rate = rate_table->info[j].dot11rate;
448 442
@@ -451,8 +445,9 @@ static u8 ath_rc_setvalid_rates(struct ath_rate_priv *ath_rc_priv,
451 * (VALID/VALID_20/VALID_40) flags */ 445 * (VALID/VALID_20/VALID_40) flags */
452 446
453 if ((rate == dot11rate) && 447 if ((rate == dot11rate) &&
454 ((valid & WLAN_RC_CAP_MODE(capflag)) == 448 (rate_flags & WLAN_RC_CAP_MODE(capflag)) ==
455 WLAN_RC_CAP_MODE(capflag)) && 449 WLAN_RC_CAP_MODE(capflag) &&
450 (rate_flags & WLAN_RC_CAP_STREAM(capflag)) &&
456 !WLAN_RC_PHY_HT(phy)) { 451 !WLAN_RC_PHY_HT(phy)) {
457 u8 valid_rate_count = 0; 452 u8 valid_rate_count = 0;
458 453
@@ -486,14 +481,13 @@ static u8 ath_rc_setvalid_htrates(struct ath_rate_priv *ath_rc_priv,
486 for (i = 0; i < rateset->rs_nrates; i++) { 481 for (i = 0; i < rateset->rs_nrates; i++) {
487 for (j = 0; j < rate_table->rate_cnt; j++) { 482 for (j = 0; j < rate_table->rate_cnt; j++) {
488 u32 phy = rate_table->info[j].phy; 483 u32 phy = rate_table->info[j].phy;
489 u32 valid = (!(ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG) ? 484 u16 rate_flags = rate_table->info[j].rate_flags;
490 rate_table->info[j].valid_single_stream :
491 rate_table->info[j].valid);
492 u8 rate = rateset->rs_rates[i]; 485 u8 rate = rateset->rs_rates[i];
493 u8 dot11rate = rate_table->info[j].dot11rate; 486 u8 dot11rate = rate_table->info[j].dot11rate;
494 487
495 if ((rate != dot11rate) || !WLAN_RC_PHY_HT(phy) || 488 if ((rate != dot11rate) || !WLAN_RC_PHY_HT(phy) ||
496 !WLAN_RC_PHY_HT_VALID(valid, capflag)) 489 !(rate_flags & WLAN_RC_CAP_STREAM(capflag)) ||
490 !WLAN_RC_PHY_HT_VALID(rate_flags, capflag))
497 continue; 491 continue;
498 492
499 if (!ath_rc_valid_phyrate(phy, capflag, 0)) 493 if (!ath_rc_valid_phyrate(phy, capflag, 0))
@@ -589,12 +583,11 @@ static u8 ath_rc_get_highest_rix(struct ath_softc *sc,
589 if (rate > (ath_rc_priv->rate_table_size - 1)) 583 if (rate > (ath_rc_priv->rate_table_size - 1))
590 rate = ath_rc_priv->rate_table_size - 1; 584 rate = ath_rc_priv->rate_table_size - 1;
591 585
592 if (rate_table->info[rate].valid && 586 if (rate_table->info[rate].rate_flags & RC_DS &&
593 (ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG)) 587 (ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG))
594 return rate; 588 return rate;
595 589
596 if (rate_table->info[rate].valid_single_stream && 590 if (RC_SS_OR_LEGACY(rate_table->info[rate].rate_flags))
597 !(ath_rc_priv->ht_cap & WLAN_RC_DS_FLAG))
598 return rate; 591 return rate;
599 592
600 /* This should not happen */ 593 /* This should not happen */
diff --git a/drivers/net/wireless/ath/ath9k/rc.h b/drivers/net/wireless/ath/ath9k/rc.h
index 3d8d40cdc99e..601803aa06ff 100644
--- a/drivers/net/wireless/ath/ath9k/rc.h
+++ b/drivers/net/wireless/ath/ath9k/rc.h
@@ -27,17 +27,29 @@ struct ath_softc;
27#define RATE_TABLE_SIZE 64 27#define RATE_TABLE_SIZE 64
28#define MAX_TX_RATE_PHY 48 28#define MAX_TX_RATE_PHY 48
29 29
30/* VALID_ALL - valid for 20/40/Legacy, 30
31 * VALID - Legacy only, 31#define RC_INVALID 0x0000
32 * VALID_20 - HT 20 only, 32#define RC_LEGACY 0x0001
33 * VALID_40 - HT 40 only */ 33#define RC_SS 0x0002
34 34#define RC_DS 0x0004
35#define INVALID 0x0 35#define RC_TS 0x0008
36#define VALID 0x1 36#define RC_HT_20 0x0010
37#define VALID_20 0x2 37#define RC_HT_40 0x0020
38#define VALID_40 0x4 38
39#define VALID_2040 (VALID_20|VALID_40) 39#define RC_SS_OR_LEGACY(f) ((f) & (RC_SS | RC_LEGACY))
40#define VALID_ALL (VALID_2040|VALID) 40
41#define RC_HT_2040 (RC_HT_20 | RC_HT_40)
42#define RC_ALL_STREAM (RC_SS | RC_DS)
43#define RC_L_SD (RC_LEGACY | RC_SS | RC_DS)
44#define RC_HT_SD_2040 (RC_HT_2040 | RC_SS | RC_DS)
45#define RC_HT_S_20 (RC_HT_20 | RC_SS)
46#define RC_HT_SD_20 (RC_HT_20 | RC_SS | RC_DS)
47#define RC_HT_SD_40 (RC_HT_40 | RC_SS | RC_DS)
48#define RC_HT_S_20 (RC_HT_20 | RC_SS)
49#define RC_HT_S_40 (RC_HT_40 | RC_SS)
50#define RC_HT_D_20 (RC_HT_20 | RC_DS)
51#define RC_HT_D_40 (RC_HT_40 | RC_DS)
52#define RC_ALL (RC_LEGACY | RC_HT_2040 | RC_ALL_STREAM)
41 53
42enum { 54enum {
43 WLAN_RC_PHY_OFDM, 55 WLAN_RC_PHY_OFDM,
@@ -73,15 +85,19 @@ enum {
73#define WLAN_RC_PHY_HT(_phy) (_phy >= WLAN_RC_PHY_HT_20_SS) 85#define WLAN_RC_PHY_HT(_phy) (_phy >= WLAN_RC_PHY_HT_20_SS)
74 86
75#define WLAN_RC_CAP_MODE(capflag) (((capflag & WLAN_RC_HT_FLAG) ? \ 87#define WLAN_RC_CAP_MODE(capflag) (((capflag & WLAN_RC_HT_FLAG) ? \
76 (capflag & WLAN_RC_40_FLAG) ? VALID_40 : VALID_20 : VALID)) 88 ((capflag & WLAN_RC_40_FLAG) ? RC_HT_40 : RC_HT_20) : RC_LEGACY))
89
90#define WLAN_RC_CAP_STREAM(capflag) \
91 (((capflag) & WLAN_RC_DS_FLAG) ? RC_DS : RC_SS)
92
77 93
78/* Return TRUE if flag supports HT20 && client supports HT20 or 94/* Return TRUE if flag supports HT20 && client supports HT20 or
79 * return TRUE if flag supports HT40 && client supports HT40. 95 * return TRUE if flag supports HT40 && client supports HT40.
80 * This is used becos some rates overlap between HT20/HT40. 96 * This is used becos some rates overlap between HT20/HT40.
81 */ 97 */
82#define WLAN_RC_PHY_HT_VALID(flag, capflag) \ 98#define WLAN_RC_PHY_HT_VALID(flag, capflag) \
83 (((flag & VALID_20) && !(capflag & WLAN_RC_40_FLAG)) || \ 99 (((flag & RC_HT_20) && !(capflag & WLAN_RC_40_FLAG)) || \
84 ((flag & VALID_40) && (capflag & WLAN_RC_40_FLAG))) 100 ((flag & RC_HT_40) && (capflag & WLAN_RC_40_FLAG)))
85 101
86#define WLAN_RC_DS_FLAG (0x01) 102#define WLAN_RC_DS_FLAG (0x01)
87#define WLAN_RC_40_FLAG (0x02) 103#define WLAN_RC_40_FLAG (0x02)
@@ -110,8 +126,7 @@ struct ath_rate_table {
110 int rate_cnt; 126 int rate_cnt;
111 int mcs_start; 127 int mcs_start;
112 struct { 128 struct {
113 u8 valid; 129 u16 rate_flags;
114 u8 valid_single_stream;
115 u8 phy; 130 u8 phy;
116 u32 ratekbps; 131 u32 ratekbps;
117 u32 user_ratekbps; 132 u32 user_ratekbps;