From patchwork Fri Aug 9 07:40:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anilkumar Kolli X-Patchwork-Id: 11085571 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-2.web.codeaurora.org (Postfix) with ESMTP id D51E11395 for ; Fri, 9 Aug 2019 07:41:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BA3F828C14 for ; Fri, 9 Aug 2019 07:41:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A8EC628C1E; Fri, 9 Aug 2019 07:41:10 +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=ham 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 2F80128C14 for ; Fri, 9 Aug 2019 07:41:10 +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:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date:Subject:To: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=MWtkAGPMXqD+9+Nsys701UpYlhiISIKMSURrNtzRTfo=; b=C/s25AOcsHn/IG gKYa3Jrykw7RWBt4+czk8wmLnYvOxdGFE7QRERmkDcWmpLG1IPIOIX/XcWRjL6lmbhxWg0TbAnKbr FQYWjk1StswEhFy3uk15Qr4X4NEW1mr2fFqzEnYmY1h4t+xmyxq/s8zUh8Yv4abyxtX0sDNoXVP8F O5LdU/2uB0ebGXkh0L7m3DYaiMk4ojjTigb1W2lMC2O8MHWeatIkVVvSvNUwjENT9P82pVxfSLnZ8 IaZsjy1BhKMoQjPMaMWmCRcK18rGW6+1FTU77WJ8CYgKI3GdNpP+/ul7aFkNz/hpboEYoNjLEd/sj 8N+p/4oCnBs22Dqh5FWw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hvzWN-0002Es-LB; Fri, 09 Aug 2019 07:41:07 +0000 Received: from smtp.codeaurora.org ([198.145.29.96]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hvzWK-0002BH-EY for ath11k@lists.infradead.org; Fri, 09 Aug 2019 07:41:05 +0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id F336860721; Fri, 9 Aug 2019 07:41:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1565336463; bh=9lwmPdoJfZqSzFp81XybgIRZD5H9pIGuvcq0XwrSiCo=; h=From:To:Cc:Subject:Date:From; b=lABFoYSwmZ5CwVl7PxbAzHZZbbASp9GkuS8TIwkxxF5Sv1ThJ8xvF5oKog7i8xX+B xVQvY+F22/Mt/kxtIOimke5XuzcxELWTbxW69q7zeY9S7vl/74tMX1uXCApkzZZxaF cAqnaE7y8vgVMSwurhgan/AYC+YKg7lACsC8D8i8= Received: from localhost (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: akolli@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id E5BE1602C3; Fri, 9 Aug 2019 07:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1565336461; bh=9lwmPdoJfZqSzFp81XybgIRZD5H9pIGuvcq0XwrSiCo=; h=From:To:Cc:Subject:Date:From; b=bNyFeqU+m3WodlwZ7ertUq8Qi0CBow9dtWbEllCaDgXeo+ELFfYNI0Mi1CQ7X1rFj S82hPIIKomm1kMwxFNq1FeaY5vY5m8yPS3FQaUkpHjoWa5zScX07HOkBlikjNOfD36 mB4fkmgm00nW+MRTp2BQCgqMvgjeN4ak2RTrvcAA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org E5BE1602C3 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=akolli@codeaurora.org From: Anilkumar Kolli To: ath11k@lists.infradead.org Subject: [PATCH] ath11k: Add debugfs per chip Date: Fri, 9 Aug 2019 13:10:44 +0530 Message-Id: <1565336444-26904-1-git-send-email-akolli@codeaurora.org> X-Mailer: git-send-email 1.9.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190809_004104_536465_AD800E6F X-CRM114-Status: GOOD ( 12.49 ) X-BeenThere: ath11k@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "ath11k" Errors-To: ath11k-bounces+patchwork-ath11k=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add debugfs per chip [soc/pci] under ath11k debugfs entry. Example: $ls -l /sys/kernel/debug/ath11k/ipq8074/ mac0/ mac2/ soc_ring_stats mac1/ simulate_fw_crash soc_rx_stats $ls -l /sys/kernel/debug/ieee80211/phy0/ lrwxrwxrwx 1 root root 0 Aug 6 17:06 ath11k -> ../../ath11k/ipq8074/mac0 $ ls -l /sys/kernel/debug/ieee80211/phy0/ath11k/ dfs_block_radar_events htt_stats spectral_bins dfs_simulate_radar htt_stats_reset spectral_count ext_rx_stats htt_stats_type spectral_scan0 ext_tx_stats pktlog/ spectral_scan_ctl fw_stats/ pktlog_filter Signed-off-by: Anilkumar Kolli --- drivers/net/wireless/ath/ath11k/core.c | 11 ++++++++++- drivers/net/wireless/ath/ath11k/core.h | 1 + drivers/net/wireless/ath/ath11k/debug.c | 26 +++++++++++++++++++++++--- drivers/net/wireless/ath/ath11k/debug.h | 11 +++++++++++ 4 files changed, 45 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/ath/ath11k/core.c b/drivers/net/wireless/ath/ath11k/core.c index 2e523afc4da8..24140a664c9b 100644 --- a/drivers/net/wireless/ath/ath11k/core.c +++ b/drivers/net/wireless/ath/ath11k/core.c @@ -374,11 +374,17 @@ static int ath11k_core_pdev_create(struct ath11k_base *sc) { int ret; + ret = ath11k_debug_pdev_create(sc); + if (ret) { + ath11k_err(sc, "failed to create core pdev debugfs: %d\n", ret); + return ret; + } + ret = ath11k_mac_create(sc); if (ret) { ath11k_err(sc, "failed to create new hw device with mac80211 :%d\n", ret); - return ret; + goto err_pdev_debug; } ret = ath11k_dp_pdev_alloc(sc); @@ -391,6 +397,8 @@ static int ath11k_core_pdev_create(struct ath11k_base *sc) err_mac_destroy: ath11k_mac_destroy(sc); +err_pdev_debug; + ath11k_debug_pdev_destroy(sc); return ret; } @@ -400,6 +408,7 @@ static void ath11k_core_pdev_destroy(struct ath11k_base *sc) ath11k_mac_unregister(sc); ath11k_ahb_ext_irq_disable(sc); ath11k_dp_pdev_free(sc); + ath11k_debug_pdev_destroy(sc); } static int ath11k_core_start(struct ath11k_base *sc, diff --git a/drivers/net/wireless/ath/ath11k/core.h b/drivers/net/wireless/ath/ath11k/core.h index 79134c4fb2e7..4ba0d100ce1c 100644 --- a/drivers/net/wireless/ath/ath11k/core.h +++ b/drivers/net/wireless/ath/ath11k/core.h @@ -632,6 +632,7 @@ struct ath11k_base { enum ath11k_dfs_region dfs_region; #ifdef CONFIG_ATH11K_DEBUGFS struct dentry *debugfs_soc; + struct dentry *debugfs_ath11k; #endif struct ath11k_soc_dp_rx_stats soc_stats; diff --git a/drivers/net/wireless/ath/ath11k/debug.c b/drivers/net/wireless/ath/ath11k/debug.c index 4fd99417585c..197392cdf799 100644 --- a/drivers/net/wireless/ath/ath11k/debug.c +++ b/drivers/net/wireless/ath/ath11k/debug.c @@ -802,9 +802,9 @@ static ssize_t ath11k_debug_dump_soc_rx_stats(struct file *file, .llseek = default_llseek, }; -int ath11k_debug_soc_create(struct ath11k_base *ab) +int ath11k_debug_pdev_create(struct ath11k_base *ab) { - ab->debugfs_soc = debugfs_create_dir("ath11k", NULL); + ab->debugfs_soc = debugfs_create_dir(ab->hw_params.name, ab->debugfs_ath11k); if (IS_ERR_OR_NULL(ab->debugfs_soc)) { if (IS_ERR(ab->debugfs_soc)) @@ -821,6 +821,26 @@ int ath11k_debug_soc_create(struct ath11k_base *ab) return 0; } +void ath11k_debug_pdev_destroy(struct ath11k_base *ab) +{ + debugfs_remove_recursive(ab->debugfs_ath11k); + ab->debugfs_ath11k = NULL; +} + + +int ath11k_debug_soc_create(struct ath11k_base *ab) +{ + ab->debugfs_ath11k = debugfs_create_dir("ath11k", NULL); + + if (IS_ERR_OR_NULL(ab->debugfs_ath11k)) { + if (IS_ERR(ab->debugfs_ath11k)) + return PTR_ERR(ab->debugfs_ath11k); + return -ENOMEM; + } + + return 0; +} + void ath11k_debug_soc_destroy(struct ath11k_base *ab) { debugfs_remove_recursive(ab->debugfs_soc); @@ -1007,7 +1027,7 @@ int ath11k_debug_register(struct ath11k *ar) } /* Create a symlink under ieee80211/phy* */ - snprintf(buf, 100, "../../%pd2", ar->debug.debugfs_pdev); + snprintf(buf, 100, "../../ath11k/%pd2", ar->debug.debugfs_pdev); debugfs_create_symlink("ath11k", ar->hw->wiphy->debugfsdir, buf); ath11k_debug_htt_stats_init(ar); diff --git a/drivers/net/wireless/ath/ath11k/debug.h b/drivers/net/wireless/ath/ath11k/debug.h index 9d90c7ba8a45..81b5e6b39b2f 100644 --- a/drivers/net/wireless/ath/ath11k/debug.h +++ b/drivers/net/wireless/ath/ath11k/debug.h @@ -131,6 +131,8 @@ static inline void ath11k_dbg_dump(struct ath11k_base *ab, #ifdef CONFIG_ATH11K_DEBUGFS int ath11k_debug_soc_create(struct ath11k_base *sc); void ath11k_debug_soc_destroy(struct ath11k_base *sc); +int ath11k_debug_pdev_create(struct ath11k_base *sc); +void ath11k_debug_pdev_destroy(struct ath11k_base *sc); int ath11k_debug_register(struct ath11k *ar); void ath11k_debug_unregister(struct ath11k *ar); void ath11k_dbg_htt_ext_stats_handler(struct ath11k_base *ab, @@ -175,6 +177,15 @@ static inline void ath11k_debug_soc_destroy(struct ath11k_base *sc) { } +static inline int ath11k_debug_pdev_create(struct ath11k_base *sc) +{ + return 0; +} + +static inline void ath11k_debug_pdev_destroy(struct ath11k_base *sc) +{ +} + static inline int ath11k_debug_register(struct ath11k *ar) { return 0;