mwifiex: make 11ac mcs rate tables global and const

Remove these local array variables and define them as static
const array in global space.
The duplicated mcs_rate table is removed automatically with this
change.

Reported-by: Paul Stewart <pstew@chromium.org>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Bing Zhao 2014-02-07 16:20:59 -08:00 committed by John W. Linville
parent 7abf4129e6
commit 89467d8ca2
2 changed files with 114 additions and 132 deletions

View File

@ -23,6 +23,31 @@
#include "main.h"
#include "11ac.h"
/* Tables of the MCS map to the highest data rate (in Mbps) supported
* for long GI.
*/
static const u16 max_rate_lgi_80MHZ[8][3] = {
{0x124, 0x15F, 0x186}, /* NSS = 1 */
{0x249, 0x2BE, 0x30C}, /* NSS = 2 */
{0x36D, 0x41D, 0x492}, /* NSS = 3 */
{0x492, 0x57C, 0x618}, /* NSS = 4 */
{0x5B6, 0x6DB, 0x79E}, /* NSS = 5 */
{0x6DB, 0x83A, 0x0}, /* NSS = 6 */
{0x7FF, 0x999, 0xAAA}, /* NSS = 7 */
{0x924, 0xAF8, 0xC30} /* NSS = 8 */
};
static const u16 max_rate_lgi_160MHZ[8][3] = {
{0x249, 0x2BE, 0x30C}, /* NSS = 1 */
{0x492, 0x57C, 0x618}, /* NSS = 2 */
{0x6DB, 0x83A, 0x0}, /* NSS = 3 */
{0x924, 0xAF8, 0xC30}, /* NSS = 4 */
{0xB6D, 0xDB6, 0xF3C}, /* NSS = 5 */
{0xDB6, 0x1074, 0x1248}, /* NSS = 6 */
{0xFFF, 0x1332, 0x1554}, /* NSS = 7 */
{0x1248, 0x15F0, 0x1860} /* NSS = 8 */
};
/* This function converts the 2-bit MCS map to the highest long GI
* VHT data rate.
*/
@ -34,29 +59,6 @@ mwifiex_convert_mcsmap_to_maxrate(struct mwifiex_private *priv,
u16 max_rate = 0;
u32 usr_vht_cap_info = 0;
struct mwifiex_adapter *adapter = priv->adapter;
/* tables of the MCS map to the highest data rate (in Mbps)
* supported for long GI
*/
u16 max_rate_lgi_80MHZ[8][3] = {
{0x124, 0x15F, 0x186}, /* NSS = 1 */
{0x249, 0x2BE, 0x30C}, /* NSS = 2 */
{0x36D, 0x41D, 0x492}, /* NSS = 3 */
{0x492, 0x57C, 0x618}, /* NSS = 4 */
{0x5B6, 0x6DB, 0x79E}, /* NSS = 5 */
{0x6DB, 0x83A, 0x0}, /* NSS = 6 */
{0x7FF, 0x999, 0xAAA}, /* NSS = 7 */
{0x924, 0xAF8, 0xC30} /* NSS = 8 */
};
u16 max_rate_lgi_160MHZ[8][3] = {
{0x249, 0x2BE, 0x30C}, /* NSS = 1 */
{0x492, 0x57C, 0x618}, /* NSS = 2 */
{0x6DB, 0x83A, 0x0}, /* NSS = 3 */
{0x924, 0xAF8, 0xC30}, /* NSS = 4 */
{0xB6D, 0xDB6, 0xF3C}, /* NSS = 5 */
{0xDB6, 0x1074, 0x1248}, /* NSS = 6 */
{0xFFF, 0x1332, 0x1554}, /* NSS = 7 */
{0x1248, 0x15F0, 0x1860} /* NSS = 8 */
};
if (bands & BAND_AAC)
usr_vht_cap_info = adapter->usr_dot_11ac_dev_cap_a;

View File

@ -71,6 +71,95 @@ u16 region_code_index[MWIFIEX_MAX_REGION_CODE] = { 0x10, 0x20, 0x30,
static u8 supported_rates_n[N_SUPPORTED_RATES] = { 0x02, 0x04, 0 };
/* For every mcs_rate line, the first 8 bytes are for stream 1x1,
* and all 16 bytes are for stream 2x2.
*/
static const u16 mcs_rate[4][16] = {
/* LGI 40M */
{ 0x1b, 0x36, 0x51, 0x6c, 0xa2, 0xd8, 0xf3, 0x10e,
0x36, 0x6c, 0xa2, 0xd8, 0x144, 0x1b0, 0x1e6, 0x21c },
/* SGI 40M */
{ 0x1e, 0x3c, 0x5a, 0x78, 0xb4, 0xf0, 0x10e, 0x12c,
0x3c, 0x78, 0xb4, 0xf0, 0x168, 0x1e0, 0x21c, 0x258 },
/* LGI 20M */
{ 0x0d, 0x1a, 0x27, 0x34, 0x4e, 0x68, 0x75, 0x82,
0x1a, 0x34, 0x4e, 0x68, 0x9c, 0xd0, 0xea, 0x104 },
/* SGI 20M */
{ 0x0e, 0x1c, 0x2b, 0x39, 0x56, 0x73, 0x82, 0x90,
0x1c, 0x39, 0x56, 0x73, 0xad, 0xe7, 0x104, 0x120 }
};
/* AC rates */
static const u16 ac_mcs_rate_nss1[8][10] = {
/* LG 160M */
{ 0x75, 0xEA, 0x15F, 0x1D4, 0x2BE, 0x3A8, 0x41D,
0x492, 0x57C, 0x618 },
/* SG 160M */
{ 0x82, 0x104, 0x186, 0x208, 0x30C, 0x410, 0x492,
0x514, 0x618, 0x6C6 },
/* LG 80M */
{ 0x3B, 0x75, 0xB0, 0xEA, 0x15F, 0x1D4, 0x20F,
0x249, 0x2BE, 0x30C },
/* SG 80M */
{ 0x41, 0x82, 0xC3, 0x104, 0x186, 0x208, 0x249,
0x28A, 0x30C, 0x363 },
/* LG 40M */
{ 0x1B, 0x36, 0x51, 0x6C, 0xA2, 0xD8, 0xF3,
0x10E, 0x144, 0x168 },
/* SG 40M */
{ 0x1E, 0x3C, 0x5A, 0x78, 0xB4, 0xF0, 0x10E,
0x12C, 0x168, 0x190 },
/* LG 20M */
{ 0xD, 0x1A, 0x27, 0x34, 0x4E, 0x68, 0x75, 0x82, 0x9C, 0x00 },
/* SG 20M */
{ 0xF, 0x1D, 0x2C, 0x3A, 0x57, 0x74, 0x82, 0x91, 0xAE, 0x00 },
};
/* NSS2 note: the value in the table is 2 multiplier of the actual rate */
static const u16 ac_mcs_rate_nss2[8][10] = {
/* LG 160M */
{ 0xEA, 0x1D4, 0x2BE, 0x3A8, 0x57C, 0x750, 0x83A,
0x924, 0xAF8, 0xC30 },
/* SG 160M */
{ 0x104, 0x208, 0x30C, 0x410, 0x618, 0x820, 0x924,
0xA28, 0xC30, 0xD8B },
/* LG 80M */
{ 0x75, 0xEA, 0x15F, 0x1D4, 0x2BE, 0x3A8, 0x41D,
0x492, 0x57C, 0x618 },
/* SG 80M */
{ 0x82, 0x104, 0x186, 0x208, 0x30C, 0x410, 0x492,
0x514, 0x618, 0x6C6 },
/* LG 40M */
{ 0x36, 0x6C, 0xA2, 0xD8, 0x144, 0x1B0, 0x1E6,
0x21C, 0x288, 0x2D0 },
/* SG 40M */
{ 0x3C, 0x78, 0xB4, 0xF0, 0x168, 0x1E0, 0x21C,
0x258, 0x2D0, 0x320 },
/* LG 20M */
{ 0x1A, 0x34, 0x4A, 0x68, 0x9C, 0xD0, 0xEA, 0x104,
0x138, 0x00 },
/* SG 20M */
{ 0x1D, 0x3A, 0x57, 0x74, 0xAE, 0xE6, 0x104, 0x121,
0x15B, 0x00 },
};
struct region_code_mapping {
u8 code;
u8 region[IEEE80211_COUNTRY_STRING_LEN];
@ -109,95 +198,6 @@ u8 *mwifiex_11d_code_2_region(u8 code)
u32 mwifiex_index_to_acs_data_rate(struct mwifiex_private *priv,
u8 index, u8 ht_info)
{
/*
* For every mcs_rate line, the first 8 bytes are for stream 1x1,
* and all 16 bytes are for stream 2x2.
*/
u16 mcs_rate[4][16] = {
/* LGI 40M */
{ 0x1b, 0x36, 0x51, 0x6c, 0xa2, 0xd8, 0xf3, 0x10e,
0x36, 0x6c, 0xa2, 0xd8, 0x144, 0x1b0, 0x1e6, 0x21c },
/* SGI 40M */
{ 0x1e, 0x3c, 0x5a, 0x78, 0xb4, 0xf0, 0x10e, 0x12c,
0x3c, 0x78, 0xb4, 0xf0, 0x168, 0x1e0, 0x21c, 0x258 },
/* LGI 20M */
{ 0x0d, 0x1a, 0x27, 0x34, 0x4e, 0x68, 0x75, 0x82,
0x1a, 0x34, 0x4e, 0x68, 0x9c, 0xd0, 0xea, 0x104 },
/* SGI 20M */
{ 0x0e, 0x1c, 0x2b, 0x39, 0x56, 0x73, 0x82, 0x90,
0x1c, 0x39, 0x56, 0x73, 0xad, 0xe7, 0x104, 0x120 }
};
/* AC rates */
u16 ac_mcs_rate_nss1[8][10] = {
/* LG 160M */
{ 0x75, 0xEA, 0x15F, 0x1D4, 0x2BE, 0x3A8, 0x41D,
0x492, 0x57C, 0x618 },
/* SG 160M */
{ 0x82, 0x104, 0x186, 0x208, 0x30C, 0x410, 0x492,
0x514, 0x618, 0x6C6 },
/* LG 80M */
{ 0x3B, 0x75, 0xB0, 0xEA, 0x15F, 0x1D4, 0x20F,
0x249, 0x2BE, 0x30C },
/* SG 80M */
{ 0x41, 0x82, 0xC3, 0x104, 0x186, 0x208, 0x249,
0x28A, 0x30C, 0x363 },
/* LG 40M */
{ 0x1B, 0x36, 0x51, 0x6C, 0xA2, 0xD8, 0xF3,
0x10E, 0x144, 0x168 },
/* SG 40M */
{ 0x1E, 0x3C, 0x5A, 0x78, 0xB4, 0xF0, 0x10E,
0x12C, 0x168, 0x190 },
/* LG 20M */
{ 0xD, 0x1A, 0x27, 0x34, 0x4E, 0x68, 0x75, 0x82, 0x9C, 0x00 },
/* SG 20M */
{ 0xF, 0x1D, 0x2C, 0x3A, 0x57, 0x74, 0x82, 0x91, 0xAE, 0x00 },
};
/* NSS2 note: the value in the table is 2 multiplier of the actual
* rate
*/
u16 ac_mcs_rate_nss2[8][10] = {
/* LG 160M */
{ 0xEA, 0x1D4, 0x2BE, 0x3A8, 0x57C, 0x750, 0x83A,
0x924, 0xAF8, 0xC30 },
/* SG 160M */
{ 0x104, 0x208, 0x30C, 0x410, 0x618, 0x820, 0x924,
0xA28, 0xC30, 0xD8B },
/* LG 80M */
{ 0x75, 0xEA, 0x15F, 0x1D4, 0x2BE, 0x3A8, 0x41D,
0x492, 0x57C, 0x618 },
/* SG 80M */
{ 0x82, 0x104, 0x186, 0x208, 0x30C, 0x410, 0x492,
0x514, 0x618, 0x6C6 },
/* LG 40M */
{ 0x36, 0x6C, 0xA2, 0xD8, 0x144, 0x1B0, 0x1E6,
0x21C, 0x288, 0x2D0 },
/* SG 40M */
{ 0x3C, 0x78, 0xB4, 0xF0, 0x168, 0x1E0, 0x21C,
0x258, 0x2D0, 0x320 },
/* LG 20M */
{ 0x1A, 0x34, 0x4A, 0x68, 0x9C, 0xD0, 0xEA, 0x104,
0x138, 0x00 },
/* SG 20M */
{ 0x1D, 0x3A, 0x57, 0x74, 0xAE, 0xE6, 0x104, 0x121,
0x15B, 0x00 },
};
u32 rate = 0;
u8 mcs_index = 0;
u8 bw = 0;
@ -252,26 +252,6 @@ u32 mwifiex_index_to_acs_data_rate(struct mwifiex_private *priv,
u32 mwifiex_index_to_data_rate(struct mwifiex_private *priv,
u8 index, u8 ht_info)
{
/* For every mcs_rate line, the first 8 bytes are for stream 1x1,
* and all 16 bytes are for stream 2x2.
*/
u16 mcs_rate[4][16] = {
/* LGI 40M */
{ 0x1b, 0x36, 0x51, 0x6c, 0xa2, 0xd8, 0xf3, 0x10e,
0x36, 0x6c, 0xa2, 0xd8, 0x144, 0x1b0, 0x1e6, 0x21c },
/* SGI 40M */
{ 0x1e, 0x3c, 0x5a, 0x78, 0xb4, 0xf0, 0x10e, 0x12c,
0x3c, 0x78, 0xb4, 0xf0, 0x168, 0x1e0, 0x21c, 0x258 },
/* LGI 20M */
{ 0x0d, 0x1a, 0x27, 0x34, 0x4e, 0x68, 0x75, 0x82,
0x1a, 0x34, 0x4e, 0x68, 0x9c, 0xd0, 0xea, 0x104 },
/* SGI 20M */
{ 0x0e, 0x1c, 0x2b, 0x39, 0x56, 0x73, 0x82, 0x90,
0x1c, 0x39, 0x56, 0x73, 0xad, 0xe7, 0x104, 0x120 }
};
u32 mcs_num_supp =
(priv->adapter->hw_dev_mcs_support == HT_STREAM_2X2) ? 16 : 8;
u32 rate;