Skip to contentSkip to conversation

ath11k: Add debugfs per chip

PATCH In review Anilkumar Kolli 2 participants 4 messages Aug 9, 2019 – Oct 11, 2019 Qualcomm Atheros ATH11K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath11k: Add debugfs per chip

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
---
 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(-)
drivers/net/wireless/ath/ath11k/core.c +10 -1
index 2e523afc4da8..24140a664c9b 100644
@@ -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,
drivers/net/wireless/ath/ath11k/core.h +1 -0
index 79134c4fb2e7..4ba0d100ce1c 100644
@@ -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;
 
drivers/net/wireless/ath/ath11k/debug.c +23 -3
index 4fd99417585c..197392cdf799 100644
@@ -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);
drivers/net/wireless/ath/ath11k/debug.h +11 -0
index 9d90c7ba8a45..81b5e6b39b2f 100644
@@ -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;
Signature · 7 lines
1.9.1


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#1 lore raw
Quoted 16 lines · Anilkumar Kolli

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
Quoted 1 line

This didn't apply but I fixed the conflicts myself. Please double check:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending-ath11k&id=727f4796623292eb33ce560a3e25ba0040d17871

Signature · 6 lines
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#2 lore raw
Quoted 18 lines · Kalle Valo
Quoted 16 lines · Anilkumar Kolli

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
Quoted 5 lines
Quoted 1 line

This didn't apply but I fixed the conflicts myself. Please double check:

https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending-ath11k&id=727f4796623292eb33ce560a3e25ba0040d17871

Thanks Kalle, This looks good.

Regards
Anil.

_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k

#3 lore raw
In reply to Anilkumar Kolli
Quoted 16 lines · Anilkumar Kolli

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
Quoted 2 lines

Patch applied to ath11k-bringup branch of ath.git, thanks.

78b6da0fb67c ath11k: Add debugfs per chip

Signature · 9 lines
https://patchwork.kernel.org/patch/11085571/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


_______________________________________________
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k