diff options
Diffstat (limited to 'drivers/net/wireless/mwifiex/cfp.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfp.c | 159 |
1 files changed, 157 insertions, 2 deletions
diff --git a/drivers/net/wireless/mwifiex/cfp.c b/drivers/net/wireless/mwifiex/cfp.c index f69300f93f42..988552dece75 100644 --- a/drivers/net/wireless/mwifiex/cfp.c +++ b/drivers/net/wireless/mwifiex/cfp.c | |||
@@ -106,8 +106,8 @@ u8 *mwifiex_11d_code_2_region(u8 code) | |||
106 | * This function maps an index in supported rates table into | 106 | * This function maps an index in supported rates table into |
107 | * the corresponding data rate. | 107 | * the corresponding data rate. |
108 | */ | 108 | */ |
109 | u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv, u8 index, | 109 | u32 mwifiex_index_to_acs_data_rate(struct mwifiex_private *priv, |
110 | u8 ht_info) | 110 | u8 index, u8 ht_info) |
111 | { | 111 | { |
112 | /* | 112 | /* |
113 | * For every mcs_rate line, the first 8 bytes are for stream 1x1, | 113 | * For every mcs_rate line, the first 8 bytes are for stream 1x1, |
@@ -130,10 +130,155 @@ u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv, u8 index, | |||
130 | { 0x0e, 0x1c, 0x2b, 0x39, 0x56, 0x73, 0x82, 0x90, | 130 | { 0x0e, 0x1c, 0x2b, 0x39, 0x56, 0x73, 0x82, 0x90, |
131 | 0x1c, 0x39, 0x56, 0x73, 0xad, 0xe7, 0x104, 0x120 } | 131 | 0x1c, 0x39, 0x56, 0x73, 0xad, 0xe7, 0x104, 0x120 } |
132 | }; | 132 | }; |
133 | /* AC rates */ | ||
134 | u16 ac_mcs_rate_nss1[8][10] = { | ||
135 | /* LG 160M */ | ||
136 | { 0x75, 0xEA, 0x15F, 0x1D4, 0x2BE, 0x3A8, 0x41D, | ||
137 | 0x492, 0x57C, 0x618 }, | ||
138 | |||
139 | /* SG 160M */ | ||
140 | { 0x82, 0x104, 0x186, 0x208, 0x30C, 0x410, 0x492, | ||
141 | 0x514, 0x618, 0x6C6 }, | ||
142 | |||
143 | /* LG 80M */ | ||
144 | { 0x3B, 0x75, 0xB0, 0xEA, 0x15F, 0x1D4, 0x20F, | ||
145 | 0x249, 0x2BE, 0x30C }, | ||
146 | |||
147 | /* SG 80M */ | ||
148 | { 0x41, 0x82, 0xC3, 0x104, 0x186, 0x208, 0x249, | ||
149 | 0x28A, 0x30C, 0x363 }, | ||
150 | |||
151 | /* LG 40M */ | ||
152 | { 0x1B, 0x36, 0x51, 0x6C, 0xA2, 0xD8, 0xF3, | ||
153 | 0x10E, 0x144, 0x168 }, | ||
154 | |||
155 | /* SG 40M */ | ||
156 | { 0x1E, 0x3C, 0x5A, 0x78, 0xB4, 0xF0, 0x10E, | ||
157 | 0x12C, 0x168, 0x190 }, | ||
158 | |||
159 | /* LG 20M */ | ||
160 | { 0xD, 0x1A, 0x27, 0x34, 0x4E, 0x68, 0x75, 0x82, 0x9C, 0x00 }, | ||
161 | |||
162 | /* SG 20M */ | ||
163 | { 0xF, 0x1D, 0x2C, 0x3A, 0x57, 0x74, 0x82, 0x91, 0xAE, 0x00 }, | ||
164 | }; | ||
165 | /* NSS2 note: the value in the table is 2 multiplier of the actual | ||
166 | * rate | ||
167 | */ | ||
168 | u16 ac_mcs_rate_nss2[8][10] = { | ||
169 | /* LG 160M */ | ||
170 | { 0xEA, 0x1D4, 0x2BE, 0x3A8, 0x57C, 0x750, 0x83A, | ||
171 | 0x924, 0xAF8, 0xC30 }, | ||
172 | |||
173 | /* SG 160M */ | ||
174 | { 0x104, 0x208, 0x30C, 0x410, 0x618, 0x820, 0x924, | ||
175 | 0xA28, 0xC30, 0xD8B }, | ||
176 | |||
177 | /* LG 80M */ | ||
178 | { 0x75, 0xEA, 0x15F, 0x1D4, 0x2BE, 0x3A8, 0x41D, | ||
179 | 0x492, 0x57C, 0x618 }, | ||
180 | |||
181 | /* SG 80M */ | ||
182 | { 0x82, 0x104, 0x186, 0x208, 0x30C, 0x410, 0x492, | ||
183 | 0x514, 0x618, 0x6C6 }, | ||
184 | |||
185 | /* LG 40M */ | ||
186 | { 0x36, 0x6C, 0xA2, 0xD8, 0x144, 0x1B0, 0x1E6, | ||
187 | 0x21C, 0x288, 0x2D0 }, | ||
188 | |||
189 | /* SG 40M */ | ||
190 | { 0x3C, 0x78, 0xB4, 0xF0, 0x168, 0x1E0, 0x21C, | ||
191 | 0x258, 0x2D0, 0x320 }, | ||
192 | |||
193 | /* LG 20M */ | ||
194 | { 0x1A, 0x34, 0x4A, 0x68, 0x9C, 0xD0, 0xEA, 0x104, | ||
195 | 0x138, 0x00 }, | ||
196 | |||
197 | /* SG 20M */ | ||
198 | { 0x1D, 0x3A, 0x57, 0x74, 0xAE, 0xE6, 0x104, 0x121, | ||
199 | 0x15B, 0x00 }, | ||
200 | }; | ||
201 | u32 rate = 0; | ||
202 | u8 mcs_index = 0; | ||
203 | u8 bw = 0; | ||
204 | u8 gi = 0; | ||
205 | |||
206 | if ((ht_info & 0x3) == MWIFIEX_RATE_FORMAT_VHT) { | ||
207 | mcs_index = min(index & 0xF, 9); | ||
208 | |||
209 | /* 20M: bw=0, 40M: bw=1, 80M: bw=2, 160M: bw=3 */ | ||
210 | bw = (ht_info & 0xC) >> 2; | ||
211 | |||
212 | /* LGI: gi =0, SGI: gi = 1 */ | ||
213 | gi = (ht_info & 0x10) >> 4; | ||
214 | |||
215 | if ((index >> 4) == 1) /* NSS = 2 */ | ||
216 | rate = ac_mcs_rate_nss2[2 * (3 - bw) + gi][mcs_index]; | ||
217 | else /* NSS = 1 */ | ||
218 | rate = ac_mcs_rate_nss1[2 * (3 - bw) + gi][mcs_index]; | ||
219 | } else if ((ht_info & 0x3) == MWIFIEX_RATE_FORMAT_HT) { | ||
220 | /* 20M: bw=0, 40M: bw=1 */ | ||
221 | bw = (ht_info & 0xC) >> 2; | ||
222 | |||
223 | /* LGI: gi =0, SGI: gi = 1 */ | ||
224 | gi = (ht_info & 0x10) >> 4; | ||
225 | |||
226 | if (index == MWIFIEX_RATE_BITMAP_MCS0) { | ||
227 | if (gi == 1) | ||
228 | rate = 0x0D; /* MCS 32 SGI rate */ | ||
229 | else | ||
230 | rate = 0x0C; /* MCS 32 LGI rate */ | ||
231 | } else if (index < 16) { | ||
232 | if ((bw == 1) || (bw == 0)) | ||
233 | rate = mcs_rate[2 * (1 - bw) + gi][index]; | ||
234 | else | ||
235 | rate = mwifiex_data_rates[0]; | ||
236 | } else { | ||
237 | rate = mwifiex_data_rates[0]; | ||
238 | } | ||
239 | } else { | ||
240 | /* 11n non-HT rates */ | ||
241 | if (index >= MWIFIEX_SUPPORTED_RATES_EXT) | ||
242 | index = 0; | ||
243 | rate = mwifiex_data_rates[index]; | ||
244 | } | ||
245 | |||
246 | return rate; | ||
247 | } | ||
248 | |||
249 | /* This function maps an index in supported rates table into | ||
250 | * the corresponding data rate. | ||
251 | */ | ||
252 | u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv, | ||
253 | u8 index, u8 ht_info) | ||
254 | { | ||
255 | /* For every mcs_rate line, the first 8 bytes are for stream 1x1, | ||
256 | * and all 16 bytes are for stream 2x2. | ||
257 | */ | ||
258 | u16 mcs_rate[4][16] = { | ||
259 | /* LGI 40M */ | ||
260 | { 0x1b, 0x36, 0x51, 0x6c, 0xa2, 0xd8, 0xf3, 0x10e, | ||
261 | 0x36, 0x6c, 0xa2, 0xd8, 0x144, 0x1b0, 0x1e6, 0x21c }, | ||
262 | |||
263 | /* SGI 40M */ | ||
264 | { 0x1e, 0x3c, 0x5a, 0x78, 0xb4, 0xf0, 0x10e, 0x12c, | ||
265 | 0x3c, 0x78, 0xb4, 0xf0, 0x168, 0x1e0, 0x21c, 0x258 }, | ||
266 | |||
267 | /* LGI 20M */ | ||
268 | { 0x0d, 0x1a, 0x27, 0x34, 0x4e, 0x68, 0x75, 0x82, | ||
269 | 0x1a, 0x34, 0x4e, 0x68, 0x9c, 0xd0, 0xea, 0x104 }, | ||
270 | |||
271 | /* SGI 20M */ | ||
272 | { 0x0e, 0x1c, 0x2b, 0x39, 0x56, 0x73, 0x82, 0x90, | ||
273 | 0x1c, 0x39, 0x56, 0x73, 0xad, 0xe7, 0x104, 0x120 } | ||
274 | }; | ||
133 | u32 mcs_num_supp = | 275 | u32 mcs_num_supp = |
134 | (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2) ? 16 : 8; | 276 | (priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2) ? 16 : 8; |
135 | u32 rate; | 277 | u32 rate; |
136 | 278 | ||
279 | if (priv->adapter->is_hw_11ac_capable) | ||
280 | return mwifiex_index_to_acs_data_rate(priv, index, ht_info); | ||
281 | |||
137 | if (ht_info & BIT(0)) { | 282 | if (ht_info & BIT(0)) { |
138 | if (index == MWIFIEX_RATE_BITMAP_MCS0) { | 283 | if (index == MWIFIEX_RATE_BITMAP_MCS0) { |
139 | if (ht_info & BIT(2)) | 284 | if (ht_info & BIT(2)) |
@@ -269,6 +414,7 @@ u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates) | |||
269 | { | 414 | { |
270 | u32 k = 0; | 415 | u32 k = 0; |
271 | struct mwifiex_adapter *adapter = priv->adapter; | 416 | struct mwifiex_adapter *adapter = priv->adapter; |
417 | |||
272 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { | 418 | if (priv->bss_mode == NL80211_IFTYPE_STATION) { |
273 | switch (adapter->config_bands) { | 419 | switch (adapter->config_bands) { |
274 | case BAND_B: | 420 | case BAND_B: |
@@ -279,6 +425,7 @@ u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates) | |||
279 | break; | 425 | break; |
280 | case BAND_G: | 426 | case BAND_G: |
281 | case BAND_G | BAND_GN: | 427 | case BAND_G | BAND_GN: |
428 | case BAND_G | BAND_GN | BAND_GAC: | ||
282 | dev_dbg(adapter->dev, "info: infra band=%d " | 429 | dev_dbg(adapter->dev, "info: infra band=%d " |
283 | "supported_rates_g\n", adapter->config_bands); | 430 | "supported_rates_g\n", adapter->config_bands); |
284 | k = mwifiex_copy_rates(rates, k, supported_rates_g, | 431 | k = mwifiex_copy_rates(rates, k, supported_rates_g, |
@@ -288,7 +435,11 @@ u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates) | |||
288 | case BAND_A | BAND_B | BAND_G: | 435 | case BAND_A | BAND_B | BAND_G: |
289 | case BAND_A | BAND_B: | 436 | case BAND_A | BAND_B: |
290 | case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN: | 437 | case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN: |
438 | case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN | BAND_AAC: | ||
439 | case BAND_A | BAND_B | BAND_G | BAND_GN | BAND_AN | | ||
440 | BAND_AAC | BAND_GAC: | ||
291 | case BAND_B | BAND_G | BAND_GN: | 441 | case BAND_B | BAND_G | BAND_GN: |
442 | case BAND_B | BAND_G | BAND_GN | BAND_GAC: | ||
292 | dev_dbg(adapter->dev, "info: infra band=%d " | 443 | dev_dbg(adapter->dev, "info: infra band=%d " |
293 | "supported_rates_bg\n", adapter->config_bands); | 444 | "supported_rates_bg\n", adapter->config_bands); |
294 | k = mwifiex_copy_rates(rates, k, supported_rates_bg, | 445 | k = mwifiex_copy_rates(rates, k, supported_rates_bg, |
@@ -301,14 +452,18 @@ u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates) | |||
301 | k = mwifiex_copy_rates(rates, k, supported_rates_a, | 452 | k = mwifiex_copy_rates(rates, k, supported_rates_a, |
302 | sizeof(supported_rates_a)); | 453 | sizeof(supported_rates_a)); |
303 | break; | 454 | break; |
455 | case BAND_AN: | ||
304 | case BAND_A | BAND_AN: | 456 | case BAND_A | BAND_AN: |
457 | case BAND_A | BAND_AN | BAND_AAC: | ||
305 | case BAND_A | BAND_G | BAND_AN | BAND_GN: | 458 | case BAND_A | BAND_G | BAND_AN | BAND_GN: |
459 | case BAND_A | BAND_G | BAND_AN | BAND_GN | BAND_AAC: | ||
306 | dev_dbg(adapter->dev, "info: infra band=%d " | 460 | dev_dbg(adapter->dev, "info: infra band=%d " |
307 | "supported_rates_a\n", adapter->config_bands); | 461 | "supported_rates_a\n", adapter->config_bands); |
308 | k = mwifiex_copy_rates(rates, k, supported_rates_a, | 462 | k = mwifiex_copy_rates(rates, k, supported_rates_a, |
309 | sizeof(supported_rates_a)); | 463 | sizeof(supported_rates_a)); |
310 | break; | 464 | break; |
311 | case BAND_GN: | 465 | case BAND_GN: |
466 | case BAND_GN | BAND_GAC: | ||
312 | dev_dbg(adapter->dev, "info: infra band=%d " | 467 | dev_dbg(adapter->dev, "info: infra band=%d " |
313 | "supported_rates_n\n", adapter->config_bands); | 468 | "supported_rates_n\n", adapter->config_bands); |
314 | k = mwifiex_copy_rates(rates, k, supported_rates_n, | 469 | k = mwifiex_copy_rates(rates, k, supported_rates_n, |