| From 866361727bba904aca38def371072130ec72a4da Mon Sep 17 00:00:00 2001 |
| From: Youghandhar Chintala <quic_youghand@quicinc.com> |
| Date: Fri, 21 Jan 2022 12:14:26 +0530 |
| Subject: [PATCH] BACKPORT: FROMLIST: ath10k: Set tx credit to one for wcn3990 |
| snoc based devices |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| Currently for WCN3990, the host driver can send two wmi commands at once, |
| now it is limiting to one because if HOST wants to initiate 2 DMA transfers, |
| it is possible when copy complete interrupt for first DMA reaches HOST, |
| CE has already updated SRRI for both DMA transfers and is in the middle |
| of 2nd DMA.HOST uses SRRI to interpret how many DMA’s have been completed |
| and tries to unmap/free both the DMA entries, but CE is still in the middle |
| of 2nd DMA which can cause SMMU issues or corruption. |
| |
| Tested-on: WLAN.HL.3.2.2.c10-00757-QCAHLSWMTPL-1 |
| Signed-off-by: Youghandhar Chintala <quic_youghand@quicinc.com> |
| (am from https://patchwork.kernel.org/patch/12719339/) |
| (also found at https://lore.kernel.org/r/20220121064427.32059-2-quic_youghand@quicinc.com) |
| |
| Conflicts: |
| drivers/net/wireless/ath/ath10k/core.c |
| drivers/net/wireless/ath/ath10k/hw.h |
| Context conflicts since those patches are 4 months old. |
| |
| BUG=b:202564690, b:215757035 |
| TEST=Reboot tests; S2R tests |
| |
| Cq-Depend: chromium:3673023 |
| Signed-off-by: Douglas Anderson <dianders@chromium.org> |
| Change-Id: Icba7a86ae1bb41857acfb7c4a93a27625751f765 |
| Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3673022 |
| Reviewed-by: Abhishek Kumar <kuabhs@chromium.org> |
| --- |
| drivers/net/wireless/ath/ath10k/core.c | 15 +++++++++++++++ |
| drivers/net/wireless/ath/ath10k/htc.c | 13 ++++++++++--- |
| drivers/net/wireless/ath/ath10k/htc.h | 1 + |
| drivers/net/wireless/ath/ath10k/hw.h | 3 +++ |
| 4 files changed, 29 insertions(+), 3 deletions(-) |
| |
| diff --git a/drivers/net/wireless/ath/ath10k/core.c b/drivers/net/wireless/ath/ath10k/core.c |
| index 2e22d3e4e0d2..dde16d032537 100644 |
| --- a/drivers/net/wireless/ath/ath10k/core.c |
| +++ b/drivers/net/wireless/ath/ath10k/core.c |
| @@ -95,6 +95,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = true, |
| .dynamic_sar_support = false, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA988X_HW_2_0_VERSION, |
| @@ -133,6 +134,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = true, |
| .dynamic_sar_support = false, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA9887_HW_1_0_VERSION, |
| @@ -172,6 +174,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = false, |
| .dynamic_sar_support = false, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA6174_HW_3_2_VERSION, |
| @@ -207,6 +210,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .dynamic_sar_support = true, |
| .hw_restart_disconnect = false, |
| .start_retry = ATH10K_START_RETRY, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA6174_HW_2_1_VERSION, |
| @@ -245,6 +249,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = false, |
| .dynamic_sar_support = false, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA6174_HW_2_1_VERSION, |
| @@ -283,6 +288,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = false, |
| .dynamic_sar_support = false, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA6174_HW_3_0_VERSION, |
| @@ -321,6 +327,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = false, |
| .dynamic_sar_support = false, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA6174_HW_3_2_VERSION, |
| @@ -363,6 +370,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .supports_peer_stats_info = true, |
| .dynamic_sar_support = true, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA99X0_HW_2_0_DEV_VERSION, |
| @@ -407,6 +415,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = false, |
| .dynamic_sar_support = false, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA9984_HW_1_0_DEV_VERSION, |
| @@ -458,6 +467,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = false, |
| .dynamic_sar_support = false, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA9888_HW_2_0_DEV_VERSION, |
| @@ -506,6 +516,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = false, |
| .dynamic_sar_support = false, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA9377_HW_1_0_DEV_VERSION, |
| @@ -544,6 +555,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = false, |
| .dynamic_sar_support = false, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA9377_HW_1_1_DEV_VERSION, |
| @@ -584,6 +596,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = false, |
| .dynamic_sar_support = false, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = QCA9377_HW_1_1_DEV_VERSION, |
| @@ -660,6 +673,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = false, |
| .dynamic_sar_support = false, |
| .hw_restart_disconnect = false, |
| + .tx_credit_limit = false, |
| }, |
| { |
| .id = WCN3990_HW_1_0_DEV_VERSION, |
| @@ -691,6 +705,7 @@ static const struct ath10k_hw_params ath10k_hw_params_list[] = { |
| .tx_stats_over_pktlog = false, |
| .dynamic_sar_support = true, |
| .hw_restart_disconnect = true, |
| + .tx_credit_limit = true, |
| }, |
| }; |
| |
| diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c |
| index fab398046a3f..733207f37646 100644 |
| --- a/drivers/net/wireless/ath/ath10k/htc.c |
| +++ b/drivers/net/wireless/ath/ath10k/htc.c |
| @@ -947,13 +947,20 @@ int ath10k_htc_wait_target(struct ath10k_htc *htc) |
| return -ECOMM; |
| } |
| |
| - htc->total_transmit_credits = __le16_to_cpu(msg->ready.credit_count); |
| + if (ar->hw_params.tx_credit_limit) |
| + htc->total_transmit_credits = |
| + __le16_to_cpu(HTC_HOST_MAX_CREDIT_COUNT); |
| + else |
| + htc->total_transmit_credits = |
| + __le16_to_cpu(msg->ready.credit_count); |
| + |
| htc->target_credit_size = __le16_to_cpu(msg->ready.credit_size); |
| |
| ath10k_dbg(ar, ATH10K_DBG_HTC, |
| - "Target ready! transmit resources: %d size:%d\n", |
| + "Target ready! transmit resources: %d size:%d actual credits:%d\n", |
| htc->total_transmit_credits, |
| - htc->target_credit_size); |
| + htc->target_credit_size, |
| + msg->ready.credit_count); |
| |
| if ((htc->total_transmit_credits == 0) || |
| (htc->target_credit_size == 0)) { |
| diff --git a/drivers/net/wireless/ath/ath10k/htc.h b/drivers/net/wireless/ath/ath10k/htc.h |
| index 0d180faf3b77..856297b74636 100644 |
| --- a/drivers/net/wireless/ath/ath10k/htc.h |
| +++ b/drivers/net/wireless/ath/ath10k/htc.h |
| @@ -41,6 +41,7 @@ struct ath10k; |
| */ |
| |
| #define HTC_HOST_MAX_MSG_PER_RX_BUNDLE 32 |
| +#define HTC_HOST_MAX_CREDIT_COUNT 1 |
| |
| enum ath10k_htc_tx_flags { |
| ATH10K_HTC_FLAG_NEED_CREDIT_UPDATE = 0x01, |
| diff --git a/drivers/net/wireless/ath/ath10k/hw.h b/drivers/net/wireless/ath/ath10k/hw.h |
| index 5a9f6a9a82b9..1cbb65589125 100644 |
| --- a/drivers/net/wireless/ath/ath10k/hw.h |
| +++ b/drivers/net/wireless/ath/ath10k/hw.h |
| @@ -637,6 +637,9 @@ struct ath10k_hw_params { |
| bool hw_restart_disconnect; |
| |
| u32 start_retry; |
| + |
| + /* limit tx credit */ |
| + bool tx_credit_limit; |
| }; |
| |
| struct htt_resp; |
| -- |
| 2.36.1.255.ge46751e96f-goog |
| |