From patchwork Tue Jan 2 19:48:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Greear X-Patchwork-Id: 10141293 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 68D586035E for ; Tue, 2 Jan 2018 19:48:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 583B728E0D for ; Tue, 2 Jan 2018 19:48:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4BD0128E1C; Tue, 2 Jan 2018 19:48:24 +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=-6.9 required=2.0 tests=BAYES_00,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 9533F28E0D for ; Tue, 2 Jan 2018 19:48:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751266AbeABTsV (ORCPT ); Tue, 2 Jan 2018 14:48:21 -0500 Received: from mail2.candelatech.com ([208.74.158.173]:42174 "EHLO mail2.candelatech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751014AbeABTsV (ORCPT ); Tue, 2 Jan 2018 14:48:21 -0500 Received: from ben-dt3.candelatech.com (firewall.candelatech.com [50.251.239.81]) by mail2.candelatech.com (Postfix) with ESMTP id CADDB409E08; Tue, 2 Jan 2018 11:48:18 -0800 (PST) From: greearb@candelatech.com To: linux-wireless@vger.kernel.org Cc: ath10k@lists.infradead.org, Ben Greear Subject: [PATCH] ath10k: Report and display mem use for 10.4, 10.2 firmware. Date: Tue, 2 Jan 2018 11:48:16 -0800 Message-Id: <1514922496-7952-1-git-send-email-greearb@candelatech.com> X-Mailer: git-send-email 2.4.11 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 From: Ben Greear The 10.4 'mem' reporting struct had the wrong order vs the 10.2, so just make a new _10_4 specific struct. Save these reported values and make them available via debugfs. Stock 10.4 firmware probably reports zero values for this currently, but they will be notified of a fix for this shortly. I did not test 10.2 firmware, so not sure what it reports. Signed-off-by: Ben Greear --- drivers/net/wireless/ath/ath10k/core.h | 5 +++++ drivers/net/wireless/ath/ath10k/wmi.c | 13 +++++++++++++ drivers/net/wireless/ath/ath10k/wmi.h | 9 +++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/core.h b/drivers/net/wireless/ath/ath10k/core.h index 1aacc9b8..bcee3ec 100644 --- a/drivers/net/wireless/ath/ath10k/core.h +++ b/drivers/net/wireless/ath/ath10k/core.h @@ -289,6 +289,11 @@ struct ath10k_fw_stats_pdev { s32 mpdu_errs; s32 rx_ovfl_errs; s32 rx_timeout_errs; + + /* Other PDEV stats */ + s32 dram_free; + s32 iram_free; + s32 sram_free; }; struct ath10k_fw_stats { diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c index cba6dad..f29ce83 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.c +++ b/drivers/net/wireless/ath/ath10k/wmi.c @@ -3046,6 +3046,9 @@ static int ath10k_wmi_10_2_op_pull_fw_stats(struct ath10k *ar, ath10k_wmi_pull_pdev_stats_base(&src->base, dst); ath10k_wmi_pull_pdev_stats_tx(&src->tx, dst); ath10k_wmi_pull_pdev_stats_rx(&src->rx, dst); + dst->rx_timeout_errs = __le32_to_cpu(src->pdev_rx_timeout); + dst->dram_free = __le32_to_cpu(src->mem.dram_free); + dst->iram_free = __le32_to_cpu(src->mem.iram_free); ath10k_wmi_pull_pdev_stats_extra(&src->extra, dst); /* FIXME: expose 10.2 specific values */ @@ -3219,6 +3222,9 @@ static int ath10k_wmi_10_4_op_pull_fw_stats(struct ath10k *ar, ath10k_wmi_pull_pdev_stats_rx(&src->rx, dst); dst->rx_timeout_errs = __le32_to_cpu(src->pdev_rx_timeout); dst->rx_ovfl_errs = __le32_to_cpu(src->rx_ovfl_errs); + dst->dram_free = __le32_to_cpu(src->mem.dram_free); + dst->iram_free = __le32_to_cpu(src->mem.iram_free); + dst->sram_free = __le32_to_cpu(src->mem.sram_free); ath10k_wmi_pull_pdev_stats_extra(&src->extra, dst); list_add_tail(&dst->list, &stats->pdevs); @@ -8249,6 +8255,13 @@ void ath10k_wmi_10_4_op_fw_stats_fill(struct ath10k *ar, len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", "Num Rx Overflow errors", pdev->rx_ovfl_errs); + len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", + "DRAM Free", pdev->dram_free); + len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", + "IRAM Free", pdev->iram_free); + len += scnprintf(buf + len, buf_len - len, "%30s %10d\n", + "SRAM Free", pdev->sram_free); + len += scnprintf(buf + len, buf_len - len, "\n"); len += scnprintf(buf + len, buf_len - len, "%30s (%zu)\n", "ath10k VDEV stats", num_vdevs); diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h index 93ca8e8..a3ba191 100644 --- a/drivers/net/wireless/ath/ath10k/wmi.h +++ b/drivers/net/wireless/ath/ath10k/wmi.h @@ -4419,6 +4419,12 @@ struct wmi_pdev_stats_mem { __le32 iram_free; } __packed; +struct wmi_pdev_stats_mem_10_4 { + __le32 iram_free; + __le32 dram_free; + __le32 sram_free; +} __packed; + struct wmi_10_2_pdev_stats { struct wmi_pdev_stats_base base; struct wmi_pdev_stats_tx tx; @@ -4436,8 +4442,7 @@ struct wmi_10_4_pdev_stats { struct wmi_pdev_stats_rx rx; __le32 pdev_rx_timeout; __le32 rx_ovfl_errs; - struct wmi_pdev_stats_mem mem; - __le32 sram_free_size; + struct wmi_pdev_stats_mem_10_4 mem; struct wmi_pdev_stats_extra extra; } __packed;