From patchwork Sun Apr 15 12:22:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Erik Stromdahl X-Patchwork-Id: 10341545 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 E8D71601D7 for ; Sun, 15 Apr 2018 12:22:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC8F628329 for ; Sun, 15 Apr 2018 12:22:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D03682835B; Sun, 15 Apr 2018 12:22:54 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, 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 55DB228329 for ; Sun, 15 Apr 2018 12:22:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752528AbeDOMWw (ORCPT ); Sun, 15 Apr 2018 08:22:52 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:34873 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752519AbeDOMWu (ORCPT ); Sun, 15 Apr 2018 08:22:50 -0400 Received: by mail-lf0-f68.google.com with SMTP id r125-v6so1516380lfe.2 for ; Sun, 15 Apr 2018 05:22:49 -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=vAFLcGaeWQldVywcbcYh8gc+quEK4FRaKk7Gzar3Zkk=; b=iKrIy0INVrpwOoBwFHko22J+luPbQm43KXi3iqEsZAdXaUlsqpajsuvf0JR4Wt4qDi cKWxLjNnv0HcwwrLLZW3jV50nwnTt9kLKqdN/kMJZ5Fm1f/b74hyMKoyWTBfld5UE84J caoNSLIE6X6fUnIsYRgyuDxBN9M845Wc3+8/T9e3Vz/z0lpR5sqsRVro6+WKLMtfIv9I CeqLiudf57jq/QT3WJtf5A5YtTAijK+2s91cHusZEw7X6Hd/auXb91LA0KyO883FXKC4 /jJVohgDfmlvpwRzJoGWIC5HFviT+1ZxMFHYiQncDhXfWtSB0ho/lK8HfRChG3dJbyFt AVow== 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=vAFLcGaeWQldVywcbcYh8gc+quEK4FRaKk7Gzar3Zkk=; b=hyucbZrZmS4ViSYGDYwtlNcfDfJPJkNAAD5USLqdjPnSZvJvjaYsXP+E7Wlt7wMNkv CG0SfV+dSBIBKOloOYkro7S8n6MjJCNpWVgPT/0sR2093RkXcMe8dtCRv7fBSa9Z4BU7 +HJDTYDIbgvi659uZnRpq8Oi2sFq7rMUImKtX7qEXP50k1gezHTNon3rGYnGGbJMkUpo ImH4piTDgy0+YW/wP3oHm660NvwsQzWxXtUff7XBNwLYak8YztgcL3mpigZK4IOsvoFq lASxK2/wHt5cHTVtE6iI4QnM3Qy7ggQKhm+5zXT/43TgzlVrI4HLsm8soqYXviObL9OA sFuA== X-Gm-Message-State: ALQs6tCTozAwp2OhQGmMVJGDmV6lnl7EMjJzYq2b9wNG3WfkPZVeIe/7 jXW6S599JL3RmZAaegAc6oD3xw== X-Google-Smtp-Source: AIpwx4+V39Ef19KojW/mDLLwTCGKDEC7oxeOEcYkyl92gFptRBzWz3Q8pVaRI5YgictTvSR2j6cLVw== X-Received: by 2002:a19:5308:: with SMTP id h8-v6mr10148974lfb.85.1523794968906; Sun, 15 Apr 2018 05:22:48 -0700 (PDT) Received: from localhost.localdomain (90-227-62-61-no75.tbcn.telia.com. [90.227.62.61]) by smtp.gmail.com with ESMTPSA id h9-v6sm2269891lfj.78.2018.04.15.05.22.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Apr 2018 05:22:48 -0700 (PDT) From: Erik Stromdahl To: kvalo@qca.qualcomm.com, linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Cc: Erik Stromdahl Subject: [PATCH 1/2] ath10k: add inlined wrappers for htt tx ops Date: Sun, 15 Apr 2018 14:22:27 +0200 Message-Id: <20180415122228.12565-2-erik.stromdahl@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180415122228.12565-1-erik.stromdahl@gmail.com> References: <20180415122228.12565-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 These wrappers makes the HTT ops align better with the HIF ops (where similar wrappers are used). It also makes it easier for a target to have unsupported ops (by letting the corresponding function pointer be NULL). Signed-off-by: Erik Stromdahl --- drivers/net/wireless/ath/ath10k/htt.c | 4 +- drivers/net/wireless/ath/ath10k/htt.h | 51 ++++++++++++++++++++++++ drivers/net/wireless/ath/ath10k/htt_tx.c | 12 +++--- drivers/net/wireless/ath/ath10k/mac.c | 2 +- 4 files changed, 60 insertions(+), 9 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt.c b/drivers/net/wireless/ath/ath10k/htt.c index 625198dea18b..21a67f82f037 100644 --- a/drivers/net/wireless/ath/ath10k/htt.c +++ b/drivers/net/wireless/ath/ath10k/htt.c @@ -257,11 +257,11 @@ int ath10k_htt_setup(struct ath10k_htt *htt) return status; } - status = htt->tx_ops->htt_send_frag_desc_bank_cfg(htt); + status = ath10k_htt_send_frag_desc_bank_cfg(htt); if (status) return status; - status = htt->tx_ops->htt_send_rx_ring_cfg(htt); + status = ath10k_htt_send_rx_ring_cfg(htt); if (status) { ath10k_warn(ar, "failed to setup rx ring: %d\n", status); diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index 8cc2a8b278e4..c76f6daafe70 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h @@ -1848,6 +1848,57 @@ struct ath10k_htt_tx_ops { void (*htt_free_txbuff)(struct ath10k_htt *htt); }; +static inline int ath10k_htt_send_rx_ring_cfg(struct ath10k_htt *htt) +{ + if (!htt->tx_ops->htt_send_rx_ring_cfg) + return -EOPNOTSUPP; + + return htt->tx_ops->htt_send_rx_ring_cfg(htt); +} + +static inline int ath10k_htt_send_frag_desc_bank_cfg(struct ath10k_htt *htt) +{ + if (!htt->tx_ops->htt_send_frag_desc_bank_cfg) + return -EOPNOTSUPP; + + return htt->tx_ops->htt_send_frag_desc_bank_cfg(htt); +} + +static inline int ath10k_htt_alloc_frag_desc(struct ath10k_htt *htt) +{ + if (!htt->tx_ops->htt_alloc_frag_desc) + return -EOPNOTSUPP; + + return htt->tx_ops->htt_alloc_frag_desc(htt); +} + +static inline void ath10k_htt_free_frag_desc(struct ath10k_htt *htt) +{ + if (htt->tx_ops->htt_free_frag_desc) + htt->tx_ops->htt_free_frag_desc(htt); +} + +static inline int ath10k_htt_tx(struct ath10k_htt *htt, + enum ath10k_hw_txrx_mode txmode, + struct sk_buff *msdu) +{ + return htt->tx_ops->htt_tx(htt, txmode, msdu); +} + +static inline int ath10k_htt_alloc_txbuff(struct ath10k_htt *htt) +{ + if (!htt->tx_ops->htt_alloc_txbuff) + return -EOPNOTSUPP; + + return htt->tx_ops->htt_alloc_txbuff(htt); +} + +static inline void ath10k_htt_free_txbuff(struct ath10k_htt *htt) +{ + if (htt->tx_ops->htt_free_txbuff) + htt->tx_ops->htt_free_txbuff(htt); +} + struct ath10k_htt_rx_ops { size_t (*htt_get_rx_ring_size)(struct ath10k_htt *htt); void (*htt_config_paddrs_ring)(struct ath10k_htt *htt, void *vaddr); diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c index d334b7be1fea..a086958c39b6 100644 --- a/drivers/net/wireless/ath/ath10k/htt_tx.c +++ b/drivers/net/wireless/ath/ath10k/htt_tx.c @@ -443,13 +443,13 @@ static int ath10k_htt_tx_alloc_buf(struct ath10k_htt *htt) struct ath10k *ar = htt->ar; int ret; - ret = htt->tx_ops->htt_alloc_txbuff(htt); + ret = ath10k_htt_alloc_txbuff(htt); if (ret) { ath10k_err(ar, "failed to alloc cont tx buffer: %d\n", ret); return ret; } - ret = htt->tx_ops->htt_alloc_frag_desc(htt); + ret = ath10k_htt_alloc_frag_desc(htt); if (ret) { ath10k_err(ar, "failed to alloc cont frag desc: %d\n", ret); goto free_txbuf; @@ -473,10 +473,10 @@ static int ath10k_htt_tx_alloc_buf(struct ath10k_htt *htt) ath10k_htt_tx_free_txq(htt); free_frag_desc: - htt->tx_ops->htt_free_frag_desc(htt); + ath10k_htt_free_frag_desc(htt); free_txbuf: - htt->tx_ops->htt_free_txbuff(htt); + ath10k_htt_free_txbuff(htt); return ret; } @@ -530,9 +530,9 @@ void ath10k_htt_tx_destroy(struct ath10k_htt *htt) if (!htt->tx_mem_allocated) return; - htt->tx_ops->htt_free_txbuff(htt); + ath10k_htt_free_txbuff(htt); ath10k_htt_tx_free_txq(htt); - htt->tx_ops->htt_free_frag_desc(htt); + ath10k_htt_free_frag_desc(htt); ath10k_htt_tx_free_txdone_fifo(htt); htt->tx_mem_allocated = false; } diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c index bf05a3689558..fc3320f94f45 100644 --- a/drivers/net/wireless/ath/ath10k/mac.c +++ b/drivers/net/wireless/ath/ath10k/mac.c @@ -3598,7 +3598,7 @@ static int ath10k_mac_tx_submit(struct ath10k *ar, switch (txpath) { case ATH10K_MAC_TX_HTT: - ret = htt->tx_ops->htt_tx(htt, txmode, skb); + ret = ath10k_htt_tx(htt, txmode, skb); break; case ATH10K_MAC_TX_HTT_MGMT: ret = ath10k_htt_mgmt_tx(htt, skb);