From 2b20ed1abb72f50a8838da7bf6fdcaaeae09ef5b Mon Sep 17 00:00:00 2001 From: Ben Greear Date: Tue, 8 Sep 2020 14:52:28 -0700 Subject: [PATCH] ath10k: Allow tuning dma-burst via fwcfg. Upstream commit: Revert "ath10k: fix DMA related firmware crashes on multiple devices" broke at least one device: https://github.com/greearb/ath10k-ct/issues/153 But, maybe it helped others. Leave that patch as is for now, but offer fwcfg override so users can test and modify their system without having to recompile. Signed-off-by: Ben Greear --- drivers/net/wireless/ath/ath10k/core.c | 6 ++++++ drivers/net/wireless/ath/ath10k/core.h | 6 ++++++ drivers/net/wireless/ath/ath10k/wmi.c | 8 ++++++++ 3 files changed, 20 insertions(+) diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c index e0ba465d8a619..59d7143721924 100644 --- a/drivers/net/wireless/ath/ath10k/core.c +++ b/drivers/net/wireless/ath/ath10k/core.c @@ -1463,6 +1463,12 @@ static int ath10k_fetch_fwcfg_file(struct ath10k *ar) ar->fwcfg.flags |= ATH10K_FWCFG_FWVER; } } + else if (strcasecmp(filename, "dma_burst") == 0) { + if (kstrtol(val, 0, &t) == 0) { + ar->fwcfg.dma_burst = t; + ar->fwcfg.flags |= ATH10K_FWCFG_DMA_BURST; + } + } else if (strcasecmp(filename, "vdevs") == 0) { if (kstrtol(val, 0, &t) == 0) { ar->fwcfg.vdevs = t; diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index ea73edaa56c10..302554107099e 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -1339,6 +1339,7 @@ struct ath10k { #define ATH10K_FWCFG_NOBEAMFORM_SU (1<<15) #define ATH10K_FWCFG_CT_STA (1<<16) #define ATH10K_FWCFG_ALLOW_ALL_MCS (1<<17) +#define ATH10K_FWCFG_DMA_BURST (1<<18) u32 flags; /* let us know which fields have been set */ char calname[100]; @@ -1363,6 +1364,11 @@ struct ath10k { u32 bmiss_vdevs; /* To disable, set to 0 */ u32 max_amsdus; u32 allow_all_mcs; + u32 dma_burst; /* 0: 64b or maybe 128b or maybe 'raw'. 1: 256b. I don't have + * enough docs to know exactly what this means. See 76d164f582150fd0259ec0fcbc485470bcd8033e + * and the thing that reverts that. This fwcfg option allows the user to over-ride this + * since it seems that 0 works best on some systems and 1 works best on others. + */ } fwcfg; struct { diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index 61347b6ed7371..3fd3a1a23e898 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -7308,6 +7308,8 @@ static struct sk_buff *ath10k_wmi_op_gen_init(struct ath10k *ar) config.tx_dbg_log_size = __cpu_to_le32(TARGET_TX_DBG_LOG_SIZE); config.num_wds_entries = __cpu_to_le32(TARGET_NUM_WDS_ENTRIES); config.dma_burst_size = __cpu_to_le32(TARGET_DMA_BURST_SIZE); + if (ar->fwcfg.flags & ATH10K_FWCFG_DMA_BURST) + config.dma_burst_size = cpu_to_le32(ar->fwcfg.dma_burst); config.mac_aggr_delim = __cpu_to_le32(TARGET_MAC_AGGR_DELIM); val = TARGET_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK; @@ -7443,6 +7445,8 @@ static struct sk_buff *ath10k_wmi_10_1_op_gen_init(struct ath10k *ar) config.tx_dbg_log_size = __cpu_to_le32(TARGET_10X_TX_DBG_LOG_SIZE); config.num_wds_entries = __cpu_to_le32(TARGET_10X_NUM_WDS_ENTRIES); config.dma_burst_size = __cpu_to_le32(TARGET_10X_DMA_BURST_SIZE); + if (ar->fwcfg.flags & ATH10K_FWCFG_DMA_BURST) + config.dma_burst_size = cpu_to_le32(ar->fwcfg.dma_burst); config.mac_aggr_delim = __cpu_to_le32(TARGET_10X_MAC_AGGR_DELIM); val = TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK; @@ -7556,6 +7560,8 @@ static struct sk_buff *ath10k_wmi_10_2_op_gen_init(struct ath10k *ar) config.tx_dbg_log_size = __cpu_to_le32(TARGET_10X_TX_DBG_LOG_SIZE); config.num_wds_entries = __cpu_to_le32(TARGET_10X_NUM_WDS_ENTRIES); config.dma_burst_size = __cpu_to_le32(TARGET_10_2_DMA_BURST_SIZE); + if (ar->fwcfg.flags & ATH10K_FWCFG_DMA_BURST) + config.dma_burst_size = cpu_to_le32(ar->fwcfg.dma_burst); config.mac_aggr_delim = __cpu_to_le32(TARGET_10X_MAC_AGGR_DELIM); val = TARGET_10X_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK; @@ -7704,6 +7710,8 @@ static struct sk_buff *ath10k_wmi_10_4_op_gen_init(struct ath10k *ar) config.tx_dbg_log_size = __cpu_to_le32(TARGET_10_4_TX_DBG_LOG_SIZE); config.num_wds_entries = __cpu_to_le32(TARGET_10_4_NUM_WDS_ENTRIES); config.dma_burst_size = __cpu_to_le32(TARGET_10_4_DMA_BURST_SIZE); + if (ar->fwcfg.flags & ATH10K_FWCFG_DMA_BURST) + config.dma_burst_size = cpu_to_le32(ar->fwcfg.dma_burst); config.mac_aggr_delim = __cpu_to_le32(TARGET_10_4_MAC_AGGR_DELIM); config.rx_skip_defrag_timeout_dup_detection_check =