mwifiex: make use of IEEE80211_VHT_MCS_NOT_SUPPORTED
PATCH v2 1/30 mwifiex: make use of IEEE80211_VHT_MCS_NOT_SUPPORTED
Remove driver's macro and use ieee80211's definition instead
--- drivers/net/wireless/mwifiex/11ac.c | 14 ++++++++------ drivers/net/wireless/mwifiex/fw.h | 2 -- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/net/wireless/mwifiex/11ac.c +8 -6
@@ -126,9 +126,10 @@ mwifiex_fill_vht_cap_tlv(struct mwifiex_private *priv, mcs_user =GET_VHTNSSMCS (mcs_map_user, nss); mcs_resp =GET_VHTNSSMCS (mcs_map_resp, nss); -if ((mcs_user ==NO_NSS_SUPPORT ) || - (mcs_resp ==NO_NSS_SUPPORT )) -SET_VHTNSSMCS (mcs_map_result, nss,NO_NSS_SUPPORT ); +if ((mcs_user ==IEEE80211_VHT_MCS_NOT_SUPPORTED ) || + (mcs_resp ==IEEE80211_VHT_MCS_NOT_SUPPORTED )) +SET_VHTNSSMCS (mcs_map_result, nss, +IEEE80211_VHT_MCS_NOT_SUPPORTED );else SET_VHTNSSMCS (mcs_map_result, nss,min (mcs_user, mcs_resp));
@@ -147,9 +148,10 @@ mwifiex_fill_vht_cap_tlv(struct mwifiex_private *priv,for (nss =1 ; nss <=8 ; nss++) { mcs_user =GET_VHTNSSMCS (mcs_map_user, nss); mcs_resp =GET_VHTNSSMCS (mcs_map_resp, nss); -if ((mcs_user ==NO_NSS_SUPPORT ) || - (mcs_resp ==NO_NSS_SUPPORT )) -SET_VHTNSSMCS (mcs_map_result, nss,NO_NSS_SUPPORT ); +if ((mcs_user ==IEEE80211_VHT_MCS_NOT_SUPPORTED ) || + (mcs_resp ==IEEE80211_VHT_MCS_NOT_SUPPORTED )) +SET_VHTNSSMCS (mcs_map_result, nss, +IEEE80211_VHT_MCS_NOT_SUPPORTED );else SET_VHTNSSMCS (mcs_map_result, nss,min (mcs_user, mcs_resp));
drivers/net/wireless/mwifiex/fw.h +0 -2
@@ -232,8 +232,6 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {#define GET_VHTNSSMCS (mcs_mapset, nss) ((mcs_mapset >> (2 * (nss - 1))) & 0x3)#define SET_VHTNSSMCS (mcs_mapset, nss, value) (mcs_mapset |= (value & 0x3) << \ (2 * (nss - 1))) -#define NO_NSS_SUPPORT 0x3 -#define GET_DEVTXMCSMAP (dev_mcs_map) (dev_mcs_map >> 16)#define GET_DEVRXMCSMAP (dev_mcs_map) (dev_mcs_map & 0xFFFF)
Signature · 1 line
1.8.2.3
PATCH v2 2/30 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.
--- drivers/net/wireless/mwifiex/11ac.c | 48 ++++----- drivers/net/wireless/mwifiex/cfp.c | 198 ++++++++++++++++-------------------- 2 files changed, 114 insertions(+), 132 deletions(-)
drivers/net/wireless/mwifiex/11ac.c +25 -23
@@ -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;
drivers/net/wireless/mwifiex/cfp.c +89 -109
216 lines not on this page · raw message
Signature · 1 line
1.8.2.3
PATCH v2 3/30 mwifiex: improve readability in 11ac mcsmap to maxrate conversion
In reply to Bing Zhao1) 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
--- drivers/net/wireless/mwifiex/11ac.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/net/wireless/mwifiex/11ac.c +13 -13
@@ -55,7 +55,7 @@ static u16 mwifiex_convert_mcsmap_to_maxrate(struct mwifiex_private *priv, u8 bands, u16 mcs_map) { - u8 i, nss, max_mcs; + u8 i, nss, mcs;u16 max_rate =0 ;u32 usr_vht_cap_info =0 ;struct mwifiex_adapter *adapter = priv->adapter;
@@ -66,29 +66,29 @@ mwifiex_convert_mcsmap_to_maxrate(struct mwifiex_private *priv, usr_vht_cap_info = adapter->usr_dot_11ac_dev_cap_bg;/* find the max NSS supported */ - nss =0 ; -for (i =0 ; i <8 ; i++) { - max_mcs = (mcs_map >> (2 * i)) &0x3 ; -if (max_mcs <3 ) + nss =1 ; +for (i =1 ; i <=8 ; i++) { + mcs =GET_VHTNSSMCS (mcs_map, i); +if (mcs <IEEE80211_VHT_MCS_NOT_SUPPORTED ) nss = i; } - max_mcs = (mcs_map >> (2 * nss)) &0x3 ; + mcs =GET_VHTNSSMCS (mcs_map, nss); -/* if max_mcs is 3, nss must be 0 (SS = 1). Thus, max mcs is MCS 9 */ -if (max_mcs >=3 ) - max_mcs =2 ; +/* if mcs is 3, nss must be 1 (NSS = 1). Default mcs to MCS 0~9 */ +if (mcs ==IEEE80211_VHT_MCS_NOT_SUPPORTED ) + mcs =IEEE80211_VHT_MCS_SUPPORT_0_9 ;if (GET_VHTCAP_CHWDSET (usr_vht_cap_info)) {/* support 160 MHz */ - max_rate = max_rate_lgi_160MHZ[nss][max_mcs]; + max_rate = max_rate_lgi_160MHZ[nss -1 ][mcs];if (!max_rate)/* MCS9 is not supported in NSS6 */ - max_rate = max_rate_lgi_160MHZ[nss][max_mcs -1 ]; + max_rate = max_rate_lgi_160MHZ[nss -1 ][mcs -1 ]; }else { - max_rate = max_rate_lgi_80MHZ[nss][max_mcs]; + max_rate = max_rate_lgi_80MHZ[nss -1 ][mcs];if (!max_rate)/* MCS9 is not supported in NSS3 */ - max_rate = max_rate_lgi_80MHZ[nss][max_mcs -1 ]; + max_rate = max_rate_lgi_80MHZ[nss -1 ][mcs -1 ]; }return max_rate;
Signature · 1 line
1.8.2.3
PATCH v2 4/30 mwifiex: remove unsupported code in 11ac
In reply to Bing Zhaobit12 in fw_cap_info is for testing only.
Remove all related code.
--- drivers/net/wireless/mwifiex/cfg80211.c | 3 --- drivers/net/wireless/mwifiex/cfp.c | 5 ----- drivers/net/wireless/mwifiex/fw.h | 20 +++++++++++--------- drivers/net/wireless/mwifiex/ioctl.h | 3 +-- drivers/net/wireless/mwifiex/join.c | 12 ++++-------- drivers/net/wireless/mwifiex/sta_ioctl.c | 2 +- 6 files changed, 17 insertions(+), 28 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +0 -3
@@ -1416,9 +1416,6 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy,if (params->chandef.width >NL80211_CHAN_WIDTH_20_NOHT ) config_bands |=BAND_GN ; - -if (params->chandef.width >NL80211_CHAN_WIDTH_40 ) - config_bands |=BAND_GAC ; }else { bss_cfg->band_cfg =BAND_CONFIG_A ; config_bands =BAND_A ;
drivers/net/wireless/mwifiex/cfp.c +0 -5
@@ -438,7 +438,6 @@ u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates)break ;case BAND_G :case BAND_G |BAND_GN : -case BAND_G |BAND_GN |BAND_GAC :dev_dbg (adapter->dev,"info: infra band=%d " "supported_rates_g\n" , adapter->config_bands); k = mwifiex_copy_rates(rates, k, supported_rates_g,
@@ -449,10 +448,7 @@ u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates)case BAND_A |BAND_B :case BAND_A |BAND_B |BAND_G |BAND_GN |BAND_AN :case BAND_A |BAND_B |BAND_G |BAND_GN |BAND_AN |BAND_AAC : -case BAND_A |BAND_B |BAND_G |BAND_GN |BAND_AN | -BAND_AAC |BAND_GAC :case BAND_B |BAND_G |BAND_GN : -case BAND_B |BAND_G |BAND_GN |BAND_GAC :dev_dbg (adapter->dev,"info: infra band=%d " "supported_rates_bg\n" , adapter->config_bands); k = mwifiex_copy_rates(rates, k, supported_rates_bg,
@@ -476,7 +472,6 @@ u32 mwifiex_get_supported_rates(struct mwifiex_private *priv, u8 *rates) sizeof(supported_rates_a));break ;case BAND_GN : -case BAND_GN |BAND_GAC :dev_dbg (adapter->dev,"info: infra band=%d " "supported_rates_n\n" , adapter->config_bands); k = mwifiex_copy_rates(rates, k, supported_rates_n,
drivers/net/wireless/mwifiex/fw.h +11 -9
@@ -50,21 +50,23 @@ struct tx_packet_hdr {#define HOSTCMD_SUPPORTED_RATES 14#define N_SUPPORTED_RATES 3#define ALL_802_11_BANDS (BAND_A | BAND_B | BAND_G | BAND_GN | \ - BAND_AN | BAND_GAC | BAND_AAC) + BAND_AN | BAND_AAC)#define FW_MULTI_BANDS_SUPPORT (BIT(8) | BIT(9) | BIT(10) | BIT(11) | \ - BIT(12) | BIT(13)) + BIT(13))#define IS_SUPPORT_MULTI_BANDS (adapter) \ (adapter->fw_cap_info & FW_MULTI_BANDS_SUPPORT) -/* shift bit 12 and bit 13 in fw_cap_info from the firmware to bit 13 and 14 -* for 11ac so that bit 11 is for GN, bit 12 for AN, bit 13 for GAC, and bit -* bit 14 for AAC, in order to be compatible with the band capability -* defined in the driver after right shift of 8 bits. +/* bit 13: 11ac BAND_AAC +* bit 12: reserved for lab testing, will be reused for BAND_AN +* bit 11: 11n BAND_GN +* bit 10: 11a BAND_A +* bit 9: 11g BAND_G +* bit 8: 11b BAND_B +* Map these bits to band capability by right shifting 8 bits. */ #define GET_FW_DEFAULT_BANDS (adapter) \ - (((((adapter->fw_cap_info & 0x3000) << 1) | \ - (adapter->fw_cap_info & ~0xF000)) >> 8) & \ + (((adapter->fw_cap_info & 0x2f00) >> 8) & \ ALL_802_11_BANDS)#define HostCmd_WEP_KEY_INDEX_MASK 0x3fff
@@ -226,7 +228,7 @@ enum MWIFIEX_802_11_PRIVACY_FILTER {/* HW_SPEC fw_cap_info */ -#define ISSUPP_11ACENABLED (fw_cap_info) (fw_cap_info & (BIT(12)|BIT(13))) +#define ISSUPP_11ACENABLED (fw_cap_info) (fw_cap_info & BIT(13))#define GET_VHTCAP_CHWDSET (vht_cap_info) ((vht_cap_info >> 2) & 0x3)#define GET_VHTNSSMCS (mcs_mapset, nss) ((mcs_mapset >> (2 * (nss - 1))) & 0x3)
drivers/net/wireless/mwifiex/ioctl.h +1 -2
@@ -60,8 +60,7 @@ enum {BAND_A =4 ,BAND_GN =8 ,BAND_AN =16 , -BAND_GAC =32 , - BAND_AAC = 64, + BAND_AAC = 32, };#define MWIFIEX_WPA_PASSHPHRASE_LEN 64
drivers/net/wireless/mwifiex/join.c +4 -8
@@ -515,8 +515,7 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,if (ISSUPP_11ACENABLED (priv->adapter->fw_cap_info) && !bss_desc->disable_11n && !bss_desc->disable_11ac && - (priv->adapter->config_bands &BAND_GAC || - priv->adapter->config_bands &BAND_AAC )) + priv->adapter->config_bands &BAND_AAC )mwifiex_cmd_append_11ac_tlv (priv, bss_desc, &pos);/* Append vendor specific IE TLV */
@@ -1300,8 +1299,7 @@ int mwifiex_associate(struct mwifiex_private *priv,if (ISSUPP_11ACENABLED (priv->adapter->fw_cap_info) && !bss_desc->disable_11n && !bss_desc->disable_11ac && - (priv->adapter->config_bands &BAND_GAC || - priv->adapter->config_bands &BAND_AAC )) + priv->adapter->config_bands &BAND_AAC )mwifiex_set_11ac_ba_params (priv);else mwifiex_set_ba_params (priv);
@@ -1335,8 +1333,7 @@ mwifiex_adhoc_start(struct mwifiex_private *priv, priv->curr_bss_params.band);if (ISSUPP_11ACENABLED (priv->adapter->fw_cap_info) && - (priv->adapter->config_bands &BAND_GAC || - priv->adapter->config_bands &BAND_AAC )) + priv->adapter->config_bands &BAND_AAC )mwifiex_set_11ac_ba_params (priv);else mwifiex_set_ba_params (priv);
@@ -1376,8 +1373,7 @@ int mwifiex_adhoc_join(struct mwifiex_private *priv,if (ISSUPP_11ACENABLED (priv->adapter->fw_cap_info) && !bss_desc->disable_11n && !bss_desc->disable_11ac && - (priv->adapter->config_bands &BAND_GAC || - priv->adapter->config_bands &BAND_AAC )) + priv->adapter->config_bands &BAND_AAC )mwifiex_set_11ac_ba_params (priv);else mwifiex_set_ba_params (priv);
drivers/net/wireless/mwifiex/sta_ioctl.c +1 -1
@@ -290,7 +290,7 @@ int mwifiex_bss_start(struct mwifiex_private *priv, struct cfg80211_bss *bss,if (mwifiex_band_to_radio_type (bss_desc->bss_band) == HostCmd_SCAN_RADIO_TYPE_BG) - config_bands =BAND_B |BAND_G |BAND_GN |BAND_GAC ; + config_bands =BAND_B |BAND_G |BAND_GN ;else config_bands =BAND_A |BAND_AN |BAND_AAC ;
Signature · 1 line
1.8.2.3