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: 10138275 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 BA14F60362 for ; Sun, 31 Dec 2017 17:32:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A17412886B for ; Sun, 31 Dec 2017 17:32:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 965CF2887A; Sun, 31 Dec 2017 17:32:32 +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=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3D0D22886B for ; Sun, 31 Dec 2017 17:32:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=PvZi9azJUrsJwW5iFjXLHrJPtzer8/6aV1MfBaWGRwk=; b=ZaHHyo739eFMf4PXTxafYB6Sgk +EhaWGNA5X56DGSV+ToZrMukaMiMfqDZZyFnsZMxcXbRFaVNxy+P5ygDRNdz9FEl0gz4agf6v3khC QHO08FtStot7m+uUBDpPnTgwBOmCHD+QYHYkndEmC+OsC0jYK2Bh45BNty5dDKXF8ZCyWUPDaMVG1 U/ymEmCvD1iIsAO9UmCl3iY1Xd8KmnSx0A6tH7pbLWtHlFAGalJQDlvEwHFSgrQhUCeFy/c4iVd1Z xcjSgzw78octfJmS/r2+hryWnR6iqM4VoMmvu0Q7yzrEA5xDWOY1emG1VZ2FcxJT2teuT3epaMJC/ WEtmrhSQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eVhTE-0006NO-N0; Sun, 31 Dec 2017 17:32:24 +0000 Received: from mail-lf0-x241.google.com ([2a00:1450:4010:c07::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eVhSd-0005yX-7r for ath10k@lists.infradead.org; Sun, 31 Dec 2017 17:31:52 +0000 Received: by mail-lf0-x241.google.com with SMTP id e27so17425802lfb.9 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=nxAqjmb9iOgD33JWRIp684pYv3tceRa8b+HkQNdx3ZqNw5s7t/omFBftAUD/afM1iP 9Zb42yyHEaSlRomOIx61gZ9+lB0EVtxe8utZot99WNyaPthRozy6j51/Qe4+A02C1X1g KKAvPCMofJcrFvQ1hAFi3NEzJjGUKlmmnY9QL3/0OeY376xenAmgs2I6UVQAZ+4HWaWR fUqVuOZjd+UbNspK5VcNeDcX9pNXiUY9wkpZmOWTC1xWAdqpBFJZ4V4EGmjDK48X2ilM FeD40HROXZibj6pMxmkXsVoPgxDsUUpfAnkVsGS1dhoy4rhy3GV5oLP1n8cail0/LSip ztbQ== X-Gm-Message-State: AKGB3mJ1SDmIIv5sz6bDHCJlnyV9QNif3FFstYaTZV6lieYePYKc1FbD z5blyLxwyRkswfpaUTz2wfw= 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171231_093147_432518_599035A9 X-CRM114-Status: UNSURE ( 9.46 ) X-CRM114-Notice: Please train this message. X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Erik Stromdahl MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.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: