From patchwork Sun Sep 17 19:40:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 9955013 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B146B6028A for ; Sun, 17 Sep 2017 19:40:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A528428A89 for ; Sun, 17 Sep 2017 19:40:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9A0B628AB5; Sun, 17 Sep 2017 19:40:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3486128A89 for ; Sun, 17 Sep 2017 19:40:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751611AbdIQTkf (ORCPT ); Sun, 17 Sep 2017 15:40:35 -0400 Received: from mail-lf0-f65.google.com ([209.85.215.65]:35873 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751470AbdIQTkb (ORCPT ); Sun, 17 Sep 2017 15:40:31 -0400 Received: by mail-lf0-f65.google.com with SMTP id l196so3535715lfl.3 for ; Sun, 17 Sep 2017 12:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=i0IDnGvnc7ueEW/nmM9IVwxUFMf6sueUbVs37dyvIRg=; b=JRIHqjSG1iMws/ekQjIth9qTJF/LToMzG5xakZHzazueix1RwEQ0rmhT38FOleJGQ+ DydycdjvA/Czh3v4qsEY62fbZRzvB1nrJ3ljNhFkwKTTAi4rgwckJTnrBQ19FUGlRH5b Bp6rSut1kL9uER3X7D6Y86TFsudMW+rvevIR8ULLnfeRZqjEpMXHfXPfF8If/rcCPhdD wqgsEJq+krURcJTSq2Km1dWnC01IilUWSndPmPtuIW0D8LrJMILqW9FSsGt25yxBMsZG 6NkziMRHWRo6s/2Csx4/pykwUiUPS22Cw84LRwTBU5LxjrQuRw1gFzheBxD4Rrl0pbgB S7JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=i0IDnGvnc7ueEW/nmM9IVwxUFMf6sueUbVs37dyvIRg=; b=j/JKxyuVZkOWxBSc3UMQnamUewrQOBiRIp7JEHnN6yLF0u4PPoWMj1H4RYirlOvuCq 2OyYw2Hb4st+VshiReaP8cfwPWyxA5I0ptAN6Wg5f0qZViZvvnGZAWoQ8wFZylcnLznZ HXeyz1HzZwFNUV5rySBxMYCgNylDomeSpg3EqFysstVvHXU7qeI0IRxema6rK10Bx60O chGZKRUo5JwVGKV3juP0MbyJoZQHMy7zqyZtm65djCDegpU4IywZ2PJHfGdessz6GipG Fzj6NKYkGl0yoE7PSYzq5EOS4ErVlmKtbWqpAyRDkjohnGpOupmUxuc7auSmuB8aDYLc Efkw== X-Gm-Message-State: AHPjjUijcDzTX8qMLEQFPTquaAtBqV+QJn/BJTIzbk4a/ZtUxRVnr9iv Db3jdNW7J+f+tQ== X-Google-Smtp-Source: AOwi7QBVWRUXxFq0a3h6DKzIVUpMJp/v6TIQGNgClLiiTvove8Z3OcX0dvz2+wu8A+fGoxU6i1DA/g== X-Received: by 10.46.5.88 with SMTP id 85mr5468844ljf.63.1505677229680; Sun, 17 Sep 2017 12:40:29 -0700 (PDT) Received: from erik-arch-i5-6600.lan (90-227-62-61-no75.tbcn.telia.com. [90.227.62.61]) by smtp.gmail.com with ESMTPSA id 1sm1452879ljo.13.2017.09.17.12.40.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Sep 2017 12:40:29 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Cc: Erik Stromdahl Subject: [RFC v3 07/11] ath10k: various fixes for high latency devices Date: Sun, 17 Sep 2017 21:40:09 +0200 Message-Id: <20170917194013.8658-8-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170917194013.8658-1-erik.stromdahl@gmail.com> References: <20170917194013.8658-1-erik.stromdahl@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Several DMA related functions (such as the dma_map_xxx functions) are not used with high latency devices and don't need to be invoked in this case. A few other execution paths are not applicable for high latency devices and can be skipped. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/htc.c | 19 ++++++++++++------- drivers/net/wireless/ath/ath10k/htt_rx.c | 3 ++- drivers/net/wireless/ath/ath10k/htt_tx.c | 9 +++++++-- drivers/net/wireless/ath/ath10k/txrx.c | 5 +++-- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htc.c b/drivers/net/wireless/ath/ath10k/htc.c index e5c80f582ff5..75c2a3ea7ec9 100644 --- a/drivers/net/wireless/ath/ath10k/htc.c +++ b/drivers/net/wireless/ath/ath10k/htc.c @@ -53,7 +53,8 @@ static inline void ath10k_htc_restore_tx_skb(struct ath10k_htc *htc, { struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(skb); - dma_unmap_single(htc->ar->dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE); + if (!htc->ar->is_high_latency) + dma_unmap_single(htc->ar->dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE); skb_pull(skb, sizeof(struct ath10k_htc_hdr)); } @@ -137,11 +138,14 @@ int ath10k_htc_send(struct ath10k_htc *htc, ath10k_htc_prepare_tx_skb(ep, skb); skb_cb->eid = eid; - skb_cb->paddr = dma_map_single(dev, skb->data, skb->len, DMA_TO_DEVICE); - ret = dma_mapping_error(dev, skb_cb->paddr); - if (ret) { - ret = -EIO; - goto err_credits; + if (!ar->is_high_latency) { + skb_cb->paddr = dma_map_single(dev, skb->data, skb->len, + DMA_TO_DEVICE); + ret = dma_mapping_error(dev, skb_cb->paddr); + if (ret) { + ret = -EIO; + goto err_credits; + } } sg_item.transfer_id = ep->eid; @@ -157,7 +161,8 @@ int ath10k_htc_send(struct ath10k_htc *htc, return 0; err_unmap: - dma_unmap_single(dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE); + if (!ar->is_high_latency) + dma_unmap_single(dev, skb_cb->paddr, skb->len, DMA_TO_DEVICE); err_credits: if (ep->tx_credit_flow_enabled) { spin_lock_bh(&htc->tx_lock); diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 7461555ccad5..569edd0720c6 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -2541,7 +2541,8 @@ bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb) break; } case HTT_T2H_MSG_TYPE_TX_COMPL_IND: - ath10k_htt_rx_tx_compl_ind(htt->ar, skb); + if (!ar->is_high_latency) + ath10k_htt_rx_tx_compl_ind(htt->ar, skb); break; case HTT_T2H_MSG_TYPE_SEC_IND: { struct ath10k *ar = htt->ar; diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index a3d69f852e38..82d01139ff92 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -409,6 +409,9 @@ int ath10k_htt_tx_start(struct ath10k_htt *htt) if (htt->tx_mem_allocated) return 0; + if (ar->is_high_latency) + return 0; + ret = ath10k_htt_tx_alloc_buf(htt); if (ret) goto free_idr_pending_tx; @@ -445,7 +448,8 @@ void ath10k_htt_tx_destroy(struct ath10k_htt *htt) return; ath10k_htt_tx_free_cont_txbuf(htt); - ath10k_htt_tx_free_txq(htt); + if (!htt->ar->is_high_latency) + ath10k_htt_tx_free_txq(htt); ath10k_htt_tx_free_cont_frag_desc(htt); ath10k_htt_tx_free_txdone_fifo(htt); htt->tx_mem_allocated = false; @@ -935,7 +939,8 @@ int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu) return 0; err_unmap_msdu: - dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); + if (!ar->is_high_latency) + dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); err_free_txdesc: dev_kfree_skb_any(txdesc); err_free_msdu_id: diff --git a/drivers/net/wireless/ath/ath10k/txrx.c b/drivers/net/wireless/ath/ath10k/txrx.c index d4986f626c35..fae143e4dcfa 100644 --- a/drivers/net/wireless/ath/ath10k/txrx.c +++ b/drivers/net/wireless/ath/ath10k/txrx.c @@ -90,11 +90,12 @@ int ath10k_txrx_tx_unref(struct ath10k_htt *htt, ath10k_htt_tx_free_msdu_id(htt, tx_done->msdu_id); ath10k_htt_tx_dec_pending(htt); - if (htt->num_pending_tx == 0) + if (!ar->is_high_latency && (htt->num_pending_tx == 0)) wake_up(&htt->empty_tx_wq); spin_unlock_bh(&htt->tx_lock); - dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); + if (!ar->is_high_latency) + dma_unmap_single(dev, skb_cb->paddr, msdu->len, DMA_TO_DEVICE); ath10k_report_offchan_tx(htt->ar, msdu);