aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/mwifiex/11ac.c
diff options
context:
space:
mode:
authorBing Zhao <bzhao@marvell.com>2014-02-07 19:21:00 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-02-12 15:36:10 -0500
commit406d702b47a23506b944d8377647352e25f68ea1 (patch)
tree78694610d8744236fa6f0d58e69d86c15ccdfb7b /drivers/net/wireless/mwifiex/11ac.c
parent89467d8ca21b4c62ab1acbadd09e725d2cd410be (diff)
mwifiex: improve readability in 11ac mcsmap to maxrate conversion
1) rename max_mcs to mcs; 2) initialize 'i' and 'nss' as 1 instead of 0 in nss lookup; 3) use GET_VHTNSSMCS(mcs_map, nss) macro; 4) use IEEE80211_VHT_MCS_* definitions instead of hard coding Reported-by: Paul Stewart <pstew@chromium.org> Signed-off-by: Bing Zhao <bzhao@marvell.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/11ac.c')
-rw-r--r--drivers/net/wireless/mwifiex/11ac.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/net/wireless/mwifiex/11ac.c b/drivers/net/wireless/mwifiex/11ac.c
index f07a5005455d..47383920eb12 100644
--- a/drivers/net/wireless/mwifiex/11ac.c
+++ b/drivers/net/wireless/mwifiex/11ac.c
@@ -55,7 +55,7 @@ static u16
55mwifiex_convert_mcsmap_to_maxrate(struct mwifiex_private *priv, 55mwifiex_convert_mcsmap_to_maxrate(struct mwifiex_private *priv,
56 u8 bands, u16 mcs_map) 56 u8 bands, u16 mcs_map)
57{ 57{
58 u8 i, nss, max_mcs; 58 u8 i, nss, mcs;
59 u16 max_rate = 0; 59 u16 max_rate = 0;
60 u32 usr_vht_cap_info = 0; 60 u32 usr_vht_cap_info = 0;
61 struct mwifiex_adapter *adapter = priv->adapter; 61 struct mwifiex_adapter *adapter = priv->adapter;
@@ -66,29 +66,29 @@ mwifiex_convert_mcsmap_to_maxrate(struct mwifiex_private *priv,
66 usr_vht_cap_info = adapter->usr_dot_11ac_dev_cap_bg; 66 usr_vht_cap_info = adapter->usr_dot_11ac_dev_cap_bg;
67 67
68 /* find the max NSS supported */ 68 /* find the max NSS supported */
69 nss = 0; 69 nss = 1;
70 for (i = 0; i < 8; i++) { 70 for (i = 1; i <= 8; i++) {
71 max_mcs = (mcs_map >> (2 * i)) & 0x3; 71 mcs = GET_VHTNSSMCS(mcs_map, i);
72 if (max_mcs < 3) 72 if (mcs < IEEE80211_VHT_MCS_NOT_SUPPORTED)
73 nss = i; 73 nss = i;
74 } 74 }
75 max_mcs = (mcs_map >> (2 * nss)) & 0x3; 75 mcs = GET_VHTNSSMCS(mcs_map, nss);
76 76
77 /* if max_mcs is 3, nss must be 0 (SS = 1). Thus, max mcs is MCS 9 */ 77 /* if mcs is 3, nss must be 1 (NSS = 1). Default mcs to MCS 0~9 */
78 if (max_mcs >= 3) 78 if (mcs == IEEE80211_VHT_MCS_NOT_SUPPORTED)
79 max_mcs = 2; 79 mcs = IEEE80211_VHT_MCS_SUPPORT_0_9;
80 80
81 if (GET_VHTCAP_CHWDSET(usr_vht_cap_info)) { 81 if (GET_VHTCAP_CHWDSET(usr_vht_cap_info)) {
82 /* support 160 MHz */ 82 /* support 160 MHz */
83 max_rate = max_rate_lgi_160MHZ[nss][max_mcs]; 83 max_rate = max_rate_lgi_160MHZ[nss - 1][mcs];
84 if (!max_rate) 84 if (!max_rate)
85 /* MCS9 is not supported in NSS6 */ 85 /* MCS9 is not supported in NSS6 */
86 max_rate = max_rate_lgi_160MHZ[nss][max_mcs - 1]; 86 max_rate = max_rate_lgi_160MHZ[nss - 1][mcs - 1];
87 } else { 87 } else {
88 max_rate = max_rate_lgi_80MHZ[nss][max_mcs]; 88 max_rate = max_rate_lgi_80MHZ[nss - 1][mcs];
89 if (!max_rate) 89 if (!max_rate)
90 /* MCS9 is not supported in NSS3 */ 90 /* MCS9 is not supported in NSS3 */
91 max_rate = max_rate_lgi_80MHZ[nss][max_mcs - 1]; 91 max_rate = max_rate_lgi_80MHZ[nss - 1][mcs - 1];
92 } 92 }
93 93
94 return max_rate; 94 return max_rate;