aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
diff options
context:
space:
mode:
authorLuca Coelho <luciano.coelho@intel.com>2018-06-24 04:59:54 -0400
committerLuca Coelho <luciano.coelho@intel.com>2018-07-26 06:16:11 -0400
commit514c30696fbc2598a088f8c5e201d305d157b99a (patch)
tree02a3313d235638da1c7c979110c01a4179e86e4c /drivers/net/wireless/intel/iwlwifi/mvm/rs.c
parent8a6171a7b601e37596d543efadae1d3913ac084e (diff)
iwlwifi: add support for IEEE802.11ax
Add support for the HE in the iwlwifi driver conforming with P802.11ax_D2.0. Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/mvm/rs.c')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/rs.c39
1 files changed, 34 insertions, 5 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
index 642da10b0b7f..30cfd7d50bc9 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/rs.c
@@ -363,7 +363,8 @@ static int iwl_hwrate_to_plcp_idx(u32 rate_n_flags)
363 idx += 1; 363 idx += 1;
364 if ((idx >= IWL_FIRST_HT_RATE) && (idx <= IWL_LAST_HT_RATE)) 364 if ((idx >= IWL_FIRST_HT_RATE) && (idx <= IWL_LAST_HT_RATE))
365 return idx; 365 return idx;
366 } else if (rate_n_flags & RATE_MCS_VHT_MSK) { 366 } else if (rate_n_flags & RATE_MCS_VHT_MSK ||
367 rate_n_flags & RATE_MCS_HE_MSK) {
367 idx = rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK; 368 idx = rate_n_flags & RATE_VHT_MCS_RATE_CODE_MSK;
368 idx += IWL_RATE_MCS_0_INDEX; 369 idx += IWL_RATE_MCS_0_INDEX;
369 370
@@ -372,6 +373,9 @@ static int iwl_hwrate_to_plcp_idx(u32 rate_n_flags)
372 idx++; 373 idx++;
373 if ((idx >= IWL_FIRST_VHT_RATE) && (idx <= IWL_LAST_VHT_RATE)) 374 if ((idx >= IWL_FIRST_VHT_RATE) && (idx <= IWL_LAST_VHT_RATE))
374 return idx; 375 return idx;
376 if ((rate_n_flags & RATE_MCS_HE_MSK) &&
377 (idx <= IWL_LAST_HE_RATE))
378 return idx;
375 } else { 379 } else {
376 /* legacy rate format, search for match in table */ 380 /* legacy rate format, search for match in table */
377 381
@@ -516,6 +520,8 @@ static const char *rs_pretty_lq_type(enum iwl_table_type type)
516 [LQ_HT_MIMO2] = "HT MIMO", 520 [LQ_HT_MIMO2] = "HT MIMO",
517 [LQ_VHT_SISO] = "VHT SISO", 521 [LQ_VHT_SISO] = "VHT SISO",
518 [LQ_VHT_MIMO2] = "VHT MIMO", 522 [LQ_VHT_MIMO2] = "VHT MIMO",
523 [LQ_HE_SISO] = "HE SISO",
524 [LQ_HE_MIMO2] = "HE MIMO",
519 }; 525 };
520 526
521 if (type < LQ_NONE || type >= LQ_MAX) 527 if (type < LQ_NONE || type >= LQ_MAX)
@@ -900,7 +906,8 @@ static int rs_rate_from_ucode_rate(const u32 ucode_rate,
900 906
901 /* Legacy */ 907 /* Legacy */
902 if (!(ucode_rate & RATE_MCS_HT_MSK) && 908 if (!(ucode_rate & RATE_MCS_HT_MSK) &&
903 !(ucode_rate & RATE_MCS_VHT_MSK)) { 909 !(ucode_rate & RATE_MCS_VHT_MSK) &&
910 !(ucode_rate & RATE_MCS_HE_MSK)) {
904 if (num_of_ant == 1) { 911 if (num_of_ant == 1) {
905 if (band == NL80211_BAND_5GHZ) 912 if (band == NL80211_BAND_5GHZ)
906 rate->type = LQ_LEGACY_A; 913 rate->type = LQ_LEGACY_A;
@@ -911,7 +918,7 @@ static int rs_rate_from_ucode_rate(const u32 ucode_rate,
911 return 0; 918 return 0;
912 } 919 }
913 920
914 /* HT or VHT */ 921 /* HT, VHT or HE */
915 if (ucode_rate & RATE_MCS_SGI_MSK) 922 if (ucode_rate & RATE_MCS_SGI_MSK)
916 rate->sgi = true; 923 rate->sgi = true;
917 if (ucode_rate & RATE_MCS_LDPC_MSK) 924 if (ucode_rate & RATE_MCS_LDPC_MSK)
@@ -953,10 +960,24 @@ static int rs_rate_from_ucode_rate(const u32 ucode_rate,
953 } else { 960 } else {
954 WARN_ON_ONCE(1); 961 WARN_ON_ONCE(1);
955 } 962 }
963 } else if (ucode_rate & RATE_MCS_HE_MSK) {
964 nss = ((ucode_rate & RATE_VHT_MCS_NSS_MSK) >>
965 RATE_VHT_MCS_NSS_POS) + 1;
966
967 if (nss == 1) {
968 rate->type = LQ_HE_SISO;
969 WARN_ONCE(!rate->stbc && !rate->bfer && num_of_ant != 1,
970 "stbc %d bfer %d", rate->stbc, rate->bfer);
971 } else if (nss == 2) {
972 rate->type = LQ_HE_MIMO2;
973 WARN_ON_ONCE(num_of_ant != 2);
974 } else {
975 WARN_ON_ONCE(1);
976 }
956 } 977 }
957 978
958 WARN_ON_ONCE(rate->bw == RATE_MCS_CHAN_WIDTH_80 && 979 WARN_ON_ONCE(rate->bw == RATE_MCS_CHAN_WIDTH_80 &&
959 !is_vht(rate)); 980 !is_he(rate) && !is_vht(rate));
960 981
961 return 0; 982 return 0;
962} 983}
@@ -3606,7 +3627,8 @@ int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate)
3606 u8 ant = (rate & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS; 3627 u8 ant = (rate & RATE_MCS_ANT_ABC_MSK) >> RATE_MCS_ANT_POS;
3607 3628
3608 if (!(rate & RATE_MCS_HT_MSK) && 3629 if (!(rate & RATE_MCS_HT_MSK) &&
3609 !(rate & RATE_MCS_VHT_MSK)) { 3630 !(rate & RATE_MCS_VHT_MSK) &&
3631 !(rate & RATE_MCS_HE_MSK)) {
3610 int index = iwl_hwrate_to_plcp_idx(rate); 3632 int index = iwl_hwrate_to_plcp_idx(rate);
3611 3633
3612 return scnprintf(buf, bufsz, "Legacy | ANT: %s Rate: %s Mbps\n", 3634 return scnprintf(buf, bufsz, "Legacy | ANT: %s Rate: %s Mbps\n",
@@ -3625,6 +3647,11 @@ int rs_pretty_print_rate(char *buf, int bufsz, const u32 rate)
3625 mcs = rate & RATE_HT_MCS_INDEX_MSK; 3647 mcs = rate & RATE_HT_MCS_INDEX_MSK;
3626 nss = ((rate & RATE_HT_MCS_NSS_MSK) 3648 nss = ((rate & RATE_HT_MCS_NSS_MSK)
3627 >> RATE_HT_MCS_NSS_POS) + 1; 3649 >> RATE_HT_MCS_NSS_POS) + 1;
3650 } else if (rate & RATE_MCS_HE_MSK) {
3651 type = "HE";
3652 mcs = rate & RATE_VHT_MCS_RATE_CODE_MSK;
3653 nss = ((rate & RATE_VHT_MCS_NSS_MSK)
3654 >> RATE_VHT_MCS_NSS_POS) + 1;
3628 } else { 3655 } else {
3629 type = "Unknown"; /* shouldn't happen */ 3656 type = "Unknown"; /* shouldn't happen */
3630 } 3657 }
@@ -3886,6 +3913,8 @@ static ssize_t rs_sta_dbgfs_drv_tx_stats_read(struct file *file,
3886 [IWL_RATE_MCS_7_INDEX] = "MCS7", 3913 [IWL_RATE_MCS_7_INDEX] = "MCS7",
3887 [IWL_RATE_MCS_8_INDEX] = "MCS8", 3914 [IWL_RATE_MCS_8_INDEX] = "MCS8",
3888 [IWL_RATE_MCS_9_INDEX] = "MCS9", 3915 [IWL_RATE_MCS_9_INDEX] = "MCS9",
3916 [IWL_RATE_MCS_10_INDEX] = "MCS10",
3917 [IWL_RATE_MCS_11_INDEX] = "MCS11",
3889 }; 3918 };
3890 3919
3891 char *buff, *pos, *endpos; 3920 char *buff, *pos, *endpos;