From patchwork Wed Feb 27 07:13:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Surabhi Vishnoi X-Patchwork-Id: 10831315 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2DFF11390 for ; Wed, 27 Feb 2019 07:14:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 129452C65B for ; Wed, 27 Feb 2019 07:14:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 073C72C67C; Wed, 27 Feb 2019 07:14:02 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 A6F942C65B for ; Wed, 27 Feb 2019 07:14:01 +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=4EhyYoWZo2uML8QP7cDhXxHKaqhGL6mQtWFf+tXG3j4=; b=klu8QLNZJ5xrDxfueX34ZjXP9c p6LRX0DoBbZRRykAqxPfymIWem7tW//AleaLjbuLZCzhDAHFcCdvEv5Lt/13wN4awJo4qfj1Doy3M AARtI9NKOXD0P/X81JhCzK9V0xIhi5Rupy3m7ckzzdUDN49ZCZJHIyznS6gv/hu2uueebi+nZYwcq 05nT+VZWYJ/Q0gdmF1KgMoDlQbY5jrBENOVKw+dsfeNs1S0/T5H7LIYHowFLkupKsTpGBH7QhcIwR 10fqSZS9Rnn49TJqP36BWrjHsTdfzbB0WcdME7BMAgABsdRelwKT20iv3w8oHrLzsPvQJCIIMSZUO sTTQTz4Q==; 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 1gytPk-0006Bm-NB; Wed, 27 Feb 2019 07:14:00 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gytPh-00068l-4w for ath10k@lists.infradead.org; Wed, 27 Feb 2019 07:13:59 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id D688760EA5; Wed, 27 Feb 2019 07:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551251636; bh=B7k7Q3hEHa3z40Pnv/U6OSqNCHOZU29S1i2SuAh24WQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q3UtaUv1gCLprtYq18qn6OTvyVemH6Z1KEm6XvYbytdShX38tLRLbWMxY94+cCVCr Wa/DpVIvOm0PwF1Vssja7+6Up8SsIhgmD1KXndf2AkQW6kSkyIdRjVi6qbSNmBDOoQ G1ydX1HihAX3RR4FI/vQuaqx9j0cNe2fB8N1qZE0= Received: from svishnoi-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: svishnoi@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3593D60AA3; Wed, 27 Feb 2019 07:13:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1551251636; bh=B7k7Q3hEHa3z40Pnv/U6OSqNCHOZU29S1i2SuAh24WQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q3UtaUv1gCLprtYq18qn6OTvyVemH6Z1KEm6XvYbytdShX38tLRLbWMxY94+cCVCr Wa/DpVIvOm0PwF1Vssja7+6Up8SsIhgmD1KXndf2AkQW6kSkyIdRjVi6qbSNmBDOoQ G1ydX1HihAX3RR4FI/vQuaqx9j0cNe2fB8N1qZE0= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3593D60AA3 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=svishnoi@codeaurora.org From: Surabhi Vishnoi To: ath10k@lists.infradead.org Subject: [PATCH 1/2] ath10k: Add support for adding htt_rx_ops based on htt_version Date: Wed, 27 Feb 2019 12:43:47 +0530 Message-Id: <1551251628-22518-2-git-send-email-svishnoi@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1551251628-22518-1-git-send-email-svishnoi@codeaurora.org> References: <1551251628-22518-1-git-send-email-svishnoi@codeaurora.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190226_231357_362683_6C14A195 X-CRM114-Status: GOOD ( 13.51 ) 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: linux-wireless@vger.kernel.org, Surabhi Vishnoi MIME-Version: 1.0 Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Refactor the code to add the support to attach htt_rx_ops based on HTT version. Tested HW: WCN3990 Tested FW: WLAN.HL.3.1-00784-QCAHLSWMTPLZ-1 Signed-off-by: Surabhi Vishnoi --- drivers/net/wireless/ath/ath10k/htt.h | 3 ++- drivers/net/wireless/ath/ath10k/htt_rx.c | 29 ++++++++++++++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/htt.h b/drivers/net/wireless/ath/ath10k/htt.h index fef716a..0ab29bd 100644 --- a/drivers/net/wireless/ath/ath10k/htt.h +++ b/drivers/net/wireless/ath/ath10k/htt.h @@ -1894,7 +1894,7 @@ struct ath10k_htt { bool tx_mem_allocated; const struct ath10k_htt_tx_ops *tx_ops; - const struct ath10k_htt_rx_ops *rx_ops; + struct ath10k_htt_rx_ops *rx_ops; }; struct ath10k_htt_tx_ops { @@ -1969,6 +1969,7 @@ struct ath10k_htt_rx_ops { int idx); void* (*htt_get_vaddr_ring)(struct ath10k_htt *htt); void (*htt_reset_paddrs_ring)(struct ath10k_htt *htt, int idx); + void (*htt_fetch_peer_stats)(struct ath10k *ar, struct sk_buff *skb); }; static inline size_t ath10k_htt_get_rx_ring_size(struct ath10k_htt *htt) diff --git a/drivers/net/wireless/ath/ath10k/htt_rx.c b/drivers/net/wireless/ath/ath10k/htt_rx.c index 4fc8856..c7a2411 100644 --- a/drivers/net/wireless/ath/ath10k/htt_rx.c +++ b/drivers/net/wireless/ath/ath10k/htt_rx.c @@ -3143,6 +3143,11 @@ static inline s8 ath10k_get_legacy_rate_idx(struct ath10k *ar, u8 rate) rate_idx); } +static void ath10k_htt_fetch_peer_stats_tlv(struct ath10k *ar, + struct sk_buff *skb) +{ +} + static void ath10k_htt_fetch_peer_stats(struct ath10k *ar, struct sk_buff *skb) { @@ -3556,7 +3561,7 @@ int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget) } EXPORT_SYMBOL(ath10k_htt_txrx_compl_task); -static const struct ath10k_htt_rx_ops htt_rx_ops_32 = { +static struct ath10k_htt_rx_ops htt_rx_ops_32 = { .htt_get_rx_ring_size = ath10k_htt_get_rx_ring_size_32, .htt_config_paddrs_ring = ath10k_htt_config_paddrs_ring_32, .htt_set_paddrs_ring = ath10k_htt_set_paddrs_ring_32, @@ -3564,7 +3569,10 @@ int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget) .htt_reset_paddrs_ring = ath10k_htt_reset_paddrs_ring_32, }; -static const struct ath10k_htt_rx_ops htt_rx_ops_64 = { +/* FIXME: Some other way to attach ops to static const htt rx_ops + * without removing const?? + */ +static struct ath10k_htt_rx_ops htt_rx_ops_64 = { .htt_get_rx_ring_size = ath10k_htt_get_rx_ring_size_64, .htt_config_paddrs_ring = ath10k_htt_config_paddrs_ring_64, .htt_set_paddrs_ring = ath10k_htt_set_paddrs_ring_64, @@ -3572,7 +3580,7 @@ int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget) .htt_reset_paddrs_ring = ath10k_htt_reset_paddrs_ring_64, }; -static const struct ath10k_htt_rx_ops htt_rx_ops_hl = { +static struct ath10k_htt_rx_ops htt_rx_ops_hl = { }; void ath10k_htt_set_rx_ops(struct ath10k_htt *htt) @@ -3585,4 +3593,19 @@ void ath10k_htt_set_rx_ops(struct ath10k_htt *htt) htt->rx_ops = &htt_rx_ops_64; else htt->rx_ops = &htt_rx_ops_32; + + switch (ar->running_fw->fw_file.htt_op_version) { + case ATH10K_FW_HTT_OP_VERSION_MAIN: + case ATH10K_FW_HTT_OP_VERSION_10_1: + case ATH10K_FW_HTT_OP_VERSION_10_4: + htt->rx_ops->htt_fetch_peer_stats = ath10k_htt_fetch_peer_stats; + break; + case ATH10K_FW_HTT_OP_VERSION_TLV: + htt->rx_ops->htt_fetch_peer_stats = ath10k_htt_fetch_peer_stats_tlv; + break; + case ATH10K_FW_HTT_OP_VERSION_MAX: + case ATH10K_FW_HTT_OP_VERSION_UNSET: + WARN_ON(1); + return; + } }