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: 10341549 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 168A6601D7 for ; Sun, 15 Apr 2018 12:23:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 08B0628346 for ; Sun, 15 Apr 2018 12:23:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F068E28390; Sun, 15 Apr 2018 12:23:17 +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=-2.9 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, MAILING_LIST_MULTI autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 6A34C28329 for ; Sun, 15 Apr 2018 12:23:17 +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=rVhb0pqnzVqZOkYTH3Q4HnAHZApGnr6y7qZU3s7Nqzo=; b=dVrsUF+0nFHAoP27RMPilwTra1 0kj+QHBkxxqJmbr4mkH1Jz03MIng7o7quxxeHU2ZhdsIiGPrNIVb8y7pNrVzsHuJMYyCzVHFXB+uq C9E9w0ZmLxGZ/UfEJo+1mPrDEGD235XCYo55p1SnQx1rDhExfXTVitc/qcrqtykZAdf4rC/m9drqR FGxQC/1TzoEpIq7H2ypvTAGOtKSkcps45sBX5jdBxSASwCHswZMMKmzY+w6d4TVZwiFzXW8U1UGml ANXVS0eltZJtChs3S6SCTmJaIdmZFHfWyDbcPLz+VLuAMMZwMowYkHCtnTtk7kDfwMvwA0u+srhri vHQ/ewdw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1f7ggT-0001By-Th; Sun, 15 Apr 2018 12:23:05 +0000 Received: from mail-lf0-x242.google.com ([2a00:1450:4010:c07::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1f7ggO-00017h-LF for ath10k@lists.infradead.org; Sun, 15 Apr 2018 12:23:02 +0000 Received: by mail-lf0-x242.google.com with SMTP id j68-v6so18227840lfg.13 for ; Sun, 15 Apr 2018 05:22:50 -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=NWTmZv5yP4+OrnV9qZsaxCNeU4cYaQUQw+DOo1Jwjjvmditm3aqswnUa0NfHkhFh1m 601w2rHMWb/Nyeoh+aqub4cTUH/4YuSfP3X6VvUOZrli2K13kT48qs7cHyAJhLgOIINC XrNOaDYYymaIRuu8XJHUOBByp9khRjFirKxxU07SkuA2680t8E16vBW9FRB2O6sbcJ6A xBFqBslUT8jPlNZ5v7gMh/Cnpl/tUaCX03O5D0zhE+iDsdqCYOFH7xAns3kwGFxFX9s9 bRzevWaPYu6hAxdb9QcJTs+WftK78RpgAh5p0oIqn9QOHQVr+IXCvsOl+555XRwkgeth Ib1g== X-Gm-Message-State: ALQs6tCWKe1C9mSOhVIV7uC80qxeOlkuLgAPEzpawanIpe6Ejh69/DDK D6C/esnINFnfG6l9bssdflU= 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180415_052300_693438_31BD942E X-CRM114-Status: GOOD ( 14.97 ) 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 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);