From patchwork Sun Dec 31 17:29: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: 10138265 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 DE07660362 for ; Sun, 31 Dec 2017 17:32:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C54E92886B for ; Sun, 31 Dec 2017 17:32:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BA3A328875; Sun, 31 Dec 2017 17:32:16 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI 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 5AE1A2887A for ; Sun, 31 Dec 2017 17:32:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751189AbdLaRcO (ORCPT ); Sun, 31 Dec 2017 12:32:14 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:38670 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751021AbdLaRbg (ORCPT ); Sun, 31 Dec 2017 12:31:36 -0500 Received: by mail-lf0-f65.google.com with SMTP id w196so34314548lff.5 for ; Sun, 31 Dec 2017 09:31:36 -0800 (PST) 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=Bookpcft8O6L5aofVGRbWOABunW9k0uF0leCiZ6vZEI=; b=MYSl2bcLkoL+CMu15LVHh9Ff+BQabHDwqxrVAUsi2KYfVaZozKp3zaarrvqJS8da96 q2fco9o3xRWyH3GwiX83l2/+HJQQoP0hAJynrHGhkctdZFrsLtkhFDcKjGo652DN7Vwh b9/kwnAMviA7yYokOIlHl7IARkjfMe47D+fvV8l2IcwERj1kzXcPgLNTTSvrYewP1Jej Gnnoflcd1qSYGtcoOmOyZeP9+PcG5B23NEVCxpVTNpn7aV522SYhRR4E4ehmIwQ+xvi+ UHGttGfdO+pvS4zLtI/QwNNIg2ZsK2+JSwCIVzUeXM3Mtou3KIgOiJuabwkjzXtJcsCY g1zg== 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=Bookpcft8O6L5aofVGRbWOABunW9k0uF0leCiZ6vZEI=; b=cmUU/Ep+CtzxTLFMheL0O7ZU8Dyxdq9JI4ar2PsOde5CdATOBS8txw1HJjnTRaiGAq WHk9wBb3iPiTRSDOruIjpS2DzyDkl6QxbQDXEs/xRr/jR9VBc54gze7nHeMjgUQDlcqm l3m4Suo1udP3XUc+HZlv4SaYPzf7rzsvAPEOEJzupDba9UCISfd23c7gx3qLyM95mFuj 3sFkKx9Uoa6lW/ovHPVv7h6646kH4dlpIgkCYZyLd5bv8rB7XCd7hdRKQrW5AKsnVTdg DxUzPzRI0tDE8jwggmLhzFqhHfqJNRHLH5+JQWP7a3W53Ky4uQgn8IRabLeD+AzA0cV0 mblA== X-Gm-Message-State: AKGB3mLO6NHeO6eBd3uicfYjLbX/bAtYjgrNdEiUDBH/S4vbd9BJfkvE 3Yt8BFMUitEm4wkAlL/4SZ3I/w== X-Google-Smtp-Source: ACJfBosc4/O/hmD6NoJ8eZ0rDKTymk+qPGV6BklTszdy7O5HsMBDp4phCT21e+wJV0NFSxtd3iOKyw== X-Received: by 10.25.31.9 with SMTP id f9mr945019lff.4.1514741495328; Sun, 31 Dec 2017 09:31:35 -0800 (PST) Received: from localhost.localdomain (90-227-62-61-no75.tbcn.telia.com. [90.227.62.61]) by smtp.gmail.com with ESMTPSA id o64sm5048449lfo.53.2017.12.31.09.31.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 31 Dec 2017 09:31:34 -0800 (PST) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Cc: Erik Stromdahl Subject: [RFC v4 02/18] ath10k: add inlined wrappers for htt rx ops Date: Sun, 31 Dec 2017 18:29:09 +0100 Message-Id: <20171231172925.24014-3-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20171231172925.24014-1-erik.stromdahl@gmail.com> References: <20171231172925.24014-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 Added for the same reason as the TX wrappers. Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/htt.h | 38 ++++++++++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/htt_rx.c | 14 ++++++------ 2 files changed, 45 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index cdd87ef86c00..3fa1be7749b2 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h @@ -1907,6 +1907,44 @@ struct ath10k_htt_rx_ops { void* (*htt_get_vaddr_ring)(struct ath10k_htt *htt); void (*htt_reset_paddrs_ring)(struct ath10k_htt *htt, int idx); }; + +static inline size_t ath10k_htt_get_rx_ring_size(struct ath10k_htt *htt) +{ + if (!htt->rx_ops->htt_get_rx_ring_size) + return 0; + + return htt->rx_ops->htt_get_rx_ring_size(htt); +} + +static inline void ath10k_htt_config_paddrs_ring(struct ath10k_htt *htt, + void *vaddr) +{ + if (htt->rx_ops->htt_config_paddrs_ring) + htt->rx_ops->htt_config_paddrs_ring(htt, vaddr); +} + +static inline void ath10k_htt_set_paddrs_ring(struct ath10k_htt *htt, + dma_addr_t paddr, + int idx) +{ + if (htt->rx_ops->htt_set_paddrs_ring) + htt->rx_ops->htt_set_paddrs_ring(htt, paddr, idx); +} + +static inline void *ath10k_htt_get_vaddr_ring(struct ath10k_htt *htt) +{ + if (!htt->rx_ops->htt_get_vaddr_ring) + return NULL; + + return htt->rx_ops->htt_get_vaddr_ring(htt); +} + +static inline void ath10k_htt_reset_paddrs_ring(struct ath10k_htt *htt, int idx) +{ + if (htt->rx_ops->htt_reset_paddrs_ring) + htt->rx_ops->htt_reset_paddrs_ring(htt, idx); +} + #define RX_HTT_HDR_STATUS_LEN 64 /* This structure layout is programmed via rx ring setup diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 6d96f9560950..7b3d6bf015c7 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -180,7 +180,7 @@ static int __ath10k_htt_rx_ring_fill_n(struct ath10k_htt *htt, int num) rxcb = ATH10K_SKB_RXCB(skb); rxcb->paddr = paddr; htt->rx_ring.netbufs_ring[idx] = skb; - htt->rx_ops->htt_set_paddrs_ring(htt, paddr, idx); + ath10k_htt_set_paddrs_ring(htt, paddr, idx); htt->rx_ring.fill_cnt++; if (htt->rx_ring.in_ord_rx) { @@ -285,8 +285,8 @@ void ath10k_htt_rx_free(struct ath10k_htt *htt) ath10k_htt_rx_ring_free(htt); dma_free_coherent(htt->ar->dev, - htt->rx_ops->htt_get_rx_ring_size(htt), - htt->rx_ops->htt_get_vaddr_ring(htt), + ath10k_htt_get_rx_ring_size(htt), + ath10k_htt_get_vaddr_ring(htt), htt->rx_ring.base_paddr); dma_free_coherent(htt->ar->dev, @@ -313,7 +313,7 @@ static inline struct sk_buff *ath10k_htt_rx_netbuf_pop(struct ath10k_htt *htt) idx = htt->rx_ring.sw_rd_idx.msdu_payld; msdu = htt->rx_ring.netbufs_ring[idx]; htt->rx_ring.netbufs_ring[idx] = NULL; - htt->rx_ops->htt_reset_paddrs_ring(htt, idx); + ath10k_htt_reset_paddrs_ring(htt, idx); idx++; idx &= htt->rx_ring.size_mask; @@ -585,13 +585,13 @@ int ath10k_htt_rx_alloc(struct ath10k_htt *htt) if (!htt->rx_ring.netbufs_ring) goto err_netbuf; - size = htt->rx_ops->htt_get_rx_ring_size(htt); + size = ath10k_htt_get_rx_ring_size(htt); vaddr_ring = dma_alloc_coherent(htt->ar->dev, size, &paddr, GFP_KERNEL); if (!vaddr_ring) goto err_dma_ring; - htt->rx_ops->htt_config_paddrs_ring(htt, vaddr_ring); + ath10k_htt_config_paddrs_ring(htt, vaddr_ring); htt->rx_ring.base_paddr = paddr; vaddr = dma_alloc_coherent(htt->ar->dev, @@ -625,7 +625,7 @@ int ath10k_htt_rx_alloc(struct ath10k_htt *htt) err_dma_idx: dma_free_coherent(htt->ar->dev, - htt->rx_ops->htt_get_rx_ring_size(htt), + ath10k_htt_get_rx_ring_size(htt), vaddr_ring, htt->rx_ring.base_paddr); err_dma_ring: