From 2dcd955aea1ab715d048910322b05d1af0b69748 Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Sun, 8 Jul 2018 16:04:15 +0200 Subject: mac80211: backport and update patches for ath10k This commit refreshes and updates the VHT160 ath10k support fix patches and adds a number of backports from ath-next: * 8ed05ed06fca ath10k: handle tdls peer events * 229329ff345f ath10k: wmi: modify svc bitmap parsing for wcn3990 * 14d65775687c ath10k: advertise TDLS wider bandwidth support for 5GHz * bc64d05220f3 ath10k: debugfs support to get final TPC stats for 10.4 variants * 8b2d93dd2261 ath10k: Fix kernel panic while using worker (ath10k_sta_rc_update_wk) * 4b190675ad06 ath10k: fix kernel panic while reading tpc_stats * be8cce96f14d ath10k: add support to configure channel dwell time * f40105e67478 ath: add support to get the detected radar specifications * 6f6eb1bcbeff ath10k: DFS Host Confirmation * 260e629bbf44 ath10k: fix memory leak of tpc_stats * 38441fb6fcbb ath10k: support use of channel 173 * 2e9bcd0d7324 ath10k: fix spectral scan for QCA9984 and QCA9888 chipsets Signed-off-by: Ansuel Smith [move backported patches in the 3xx number space, bring in upstream order, replace incomplete patch files with git format-patch ones, rewrite commit message, fix subject] Signed-off-by: Jo-Philipp Wich --- ...dling-of-peer_bw_rxnss_override-parameter.patch | 94 ++++++++++++---------- 1 file changed, 53 insertions(+), 41 deletions(-) (limited to 'package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch') diff --git a/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch b/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch index 9dceea8f41..a7eb0a0d84 100644 --- a/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch +++ b/package/kernel/mac80211/patches/972-ath10k_fix-crash-due-to-wrong-handling-of-peer_bw_rxnss_override-parameter.patch @@ -1,31 +1,26 @@ -From: Sebastian Gottschall +From: Sebastian Gottschall -current handling of peer_bw_rxnss_override parameter is based on guessing the -VHT160/8080 capability by rx rate. this is wrong and may lead -to a non initialized peer_bw_rxnss_override parameter which is required since -VHT160 operation mode only supports 2x2 chainmasks in addition the original code +current handling of peer_bw_rxnss_override parameter is based on guessing the VHT160/8080 capability by rx rate. this is wrong and may lead +to a non initialized peer_bw_rxnss_override parameter which is required since VHT160 operation mode only supports 2x2 chainmasks in addition the original code initialized the parameter with wrong masked values. -This patch uses the peer phymode and peer nss information for correct -initialisation of the peer_bw_rxnss_override parameter. -if this peer information is not available, we initialize the parameter by -minimum nss which is suggested by QCA as temporary workaround according +This patch uses the peer phymode and peer nss information for correct initialisation of the peer_bw_rxnss_override parameter. +if this peer information is not available, we initialize the parameter by minimum nss which is suggested by QCA as temporary workaround according to the QCA sourcecodes. -Signed-off-by: Sebastian Gottschall +Signed-off-by: Sebastian Gottschall v2: remove debug messages v3: apply some cosmetics, update documentation -v4: fix compile warning and truncate nss to maximum of 2x2 since current -chipsets only support 2x2 at vht160 +v4: fix compile warning and truncate nss to maximum of 2x2 since current chipsets only support 2x2 at vht160 v5: handle maximum nss for chipsets supportig vht160 with 1x1 only -v7: use more simple code variant and take care about hw/sw chainmask -configuration +v7: use more simple code variant and take care about hw/sw chainmask configuration +v8: fix some code style issues +v9: use SM/MS macros from code.h to simplify shift/mask handling --- - drivers/net/wireless/ath/ath10k/mac.c | 40 +++++++++++++++------------ - drivers/net/wireless/ath/ath10k/wmi.c | 7 +---- - drivers/net/wireless/ath/ath10k/wmi.h | 14 +++++++++- - 3 files changed, 36 insertions(+), 25 deletions(-) - + drivers/net/wireless/ath/ath10k/mac.c | 54 +++++++++++++++++++-------- + drivers/net/wireless/ath/ath10k/wmi.c | 7 +--- + drivers/net/wireless/ath/ath10k/wmi.h | 14 ++++++- + 3 files changed, 52 insertions(+), 23 deletions(-) --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -2466,7 +2466,7 @@ static void ath10k_peer_assoc_h_vht(stru @@ -37,7 +32,7 @@ configuration if (WARN_ON(ath10k_mac_vif_chan(vif, &def))) return; -@@ -2526,23 +2526,27 @@ static void ath10k_peer_assoc_h_vht(stru +@@ -2526,23 +2526,45 @@ static void ath10k_peer_assoc_h_vht(stru __le16_to_cpu(vht_cap->vht_mcs.tx_highest); arg->peer_vht_rates.tx_mcs_set = ath10k_peer_assoc_h_vht_limit( __le16_to_cpu(vht_cap->vht_mcs.tx_mcs_map), vht_mcs_mask); @@ -46,7 +41,10 @@ configuration - ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x\n", - sta->addr, arg->peer_max_mpdu, arg->peer_flags); -- ++ /* only local 4x4 configuration do support 2x2 for VHT160, ++ * everything else must use 1x1 ++ */ + - if (arg->peer_vht_rates.rx_max_rate && - (sta->vht_cap.cap & IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK)) { - switch (arg->peer_vht_rates.rx_max_rate) { @@ -59,28 +57,42 @@ configuration - arg->peer_bw_rxnss_override = 1; - break; - } -+ /* only 4x4 configuration do support 2x2 for VHT160, everything else must use 1x1 */ + if (ar->cfg_rx_chainmask == 15) -+ nss160 = arg->peer_num_spatial_streams <= 2 ? arg->peer_num_spatial_streams : 2; ++ nss160 = arg->peer_num_spatial_streams <= 2 ? 1 : 2; ++ ++ /* if peer provides 1x1 nss160 information using max rate ++ * vht information, we reduce local nss160 to 1x1. ++ * consider that it has been observed that some client ++ * devices provide zero here, no matter which transmission ++ * rate is possible. in that case the local nss configuration ++ * will be used at maxmimum configuration possible. (see above) ++ */ ++ ++ if (arg->peer_vht_rates.rx_max_rate == 780) ++ nss160 = 1; + -+ /* in case if peer is connected with vht160 or vht80+80, we need to properly adjust rxnss parameters otherwise firmware will raise a assert */ -+ switch(arg->peer_phymode) { ++ /* in case if peer is connected with vht160 or vht80+80, ++ * we need to properly adjust rxnss parameters otherwise ++ * firmware will raise a assert ++ */ ++ switch (arg->peer_phymode) { + case MODE_11AC_VHT80_80: + arg->peer_bw_rxnss_override = BW_NSS_FWCONF_80_80(nss160); + /* fall through */ + case MODE_11AC_VHT160: + arg->peer_bw_rxnss_override |= BW_NSS_FWCONF_160(nss160); -+ break; ++ break; + default: -+ break; ++ break; } + + ath10k_dbg(ar, ATH10K_DBG_MAC, "mac vht peer %pM max_mpdu %d flags 0x%x peer_bw_rxnss_override 0x%x\n", -+ sta->addr, arg->peer_max_mpdu, arg->peer_flags, arg->peer_bw_rxnss_override); ++ sta->addr, arg->peer_max_mpdu, arg->peer_flags, ++ arg->peer_bw_rxnss_override); } static void ath10k_peer_assoc_h_qos(struct ath10k *ar, -@@ -2694,9 +2698,9 @@ static int ath10k_peer_assoc_prepare(str +@@ -2694,9 +2716,9 @@ static int ath10k_peer_assoc_prepare(str ath10k_peer_assoc_h_crypto(ar, vif, sta, arg); ath10k_peer_assoc_h_rates(ar, vif, sta, arg); ath10k_peer_assoc_h_ht(ar, vif, sta, arg); @@ -93,7 +105,7 @@ configuration } --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c -@@ -6760,12 +6760,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a +@@ -7231,12 +7231,7 @@ ath10k_wmi_peer_assoc_fill_10_4(struct a struct wmi_10_4_peer_assoc_complete_cmd *cmd = buf; ath10k_wmi_peer_assoc_fill_10_2(ar, buf, arg); @@ -109,24 +121,24 @@ configuration static int --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h -@@ -6209,7 +6209,19 @@ struct wmi_10_2_peer_assoc_complete_cmd +@@ -6306,7 +6306,19 @@ struct wmi_10_2_peer_assoc_complete_cmd __le32 info0; /* WMI_PEER_ASSOC_INFO0_ */ } __packed; -#define PEER_BW_RXNSS_OVERRIDE_OFFSET 31 -+#define BW_NSS_FWCONF_MAP_ENABLE (1 << 31) -+#define BW_NSS_FWCONF_MAP_160MHZ_S (0) -+#define BW_NSS_FWCONF_MAP_160MHZ_M (0x00000007) -+#define BW_NSS_FWCONF_MAP_80_80MHZ_S (3) -+#define BW_NSS_FWCONF_MAP_80_80MHZ_M (0x00000038) -+#define BW_NSS_FWCONF_MAP_M (0x0000003F) ++#define BW_NSS_FWCONF_MAP_ENABLE BIT(31) ++#define BW_NSS_FWCONF_MAP_160MHZ_LSB (0) ++#define BW_NSS_FWCONF_MAP_160MHZ_MASK (0x00000007) ++#define BW_NSS_FWCONF_MAP_80_80MHZ_LSB (3) ++#define BW_NSS_FWCONF_MAP_80_80MHZ_MASK (0x00000038) ++#define BW_NSS_FWCONF_MAP_MASK (0x0000003F) + -+#define GET_BW_NSS_FWCONF_160(x) ((((x) & BW_NSS_FWCONF_MAP_160MHZ_M) >> BW_NSS_FWCONF_MAP_160MHZ_S) + 1) -+#define GET_BW_NSS_FWCONF_80_80(x) ((((x) & BW_NSS_FWCONF_MAP_80_80MHZ_M) >> BW_NSS_FWCONF_MAP_80_80MHZ_S) + 1) ++#define GET_BW_NSS_FWCONF_160(x) (MS(x, BW_NSS_FWCONF_MAP_160MHZ) + 1) ++#define GET_BW_NSS_FWCONF_80_80(x) (MS(x, BW_NSS_FWCONF_MAP_80_80MHZ) + 1) + +/* Values defined to set 160 MHz Bandwidth NSS Mapping into FW*/ -+#define BW_NSS_FWCONF_160(x) (BW_NSS_FWCONF_MAP_ENABLE | (((x - 1) << BW_NSS_FWCONF_MAP_160MHZ_S) & BW_NSS_FWCONF_MAP_160MHZ_M)) -+#define BW_NSS_FWCONF_80_80(x) (BW_NSS_FWCONF_MAP_ENABLE | (((x - 1) << BW_NSS_FWCONF_MAP_80_80MHZ_S) & BW_NSS_FWCONF_MAP_80_80MHZ_M)) ++#define BW_NSS_FWCONF_160(x) (BW_NSS_FWCONF_MAP_ENABLE | SM(x - 1, BW_NSS_FWCONF_MAP_160MHZ)) ++#define BW_NSS_FWCONF_80_80(x) (BW_NSS_FWCONF_MAP_ENABLE | SM(x - 1, BW_NSS_FWCONF_MAP_80_80MHZ)) struct wmi_10_4_peer_assoc_complete_cmd { struct wmi_10_2_peer_assoc_complete_cmd cmd; -- cgit v1.2.3