diff mbox series

[2/2] wifi: ath12k: Add radar simulation debugfs support

Message ID 20240320171305.655288-3-quic_rgnanase@quicinc.com (mailing list archive)
State Accepted
Commit f51d917b73307a8547c65c3cc86a672a7b4ba98d
Delegated to: Kalle Valo
Headers show
Series wifi: ath12k: Add initial debugfs support in ath12k | expand

Commit Message

Ramya Gnanasekar March 20, 2024, 5:13 p.m. UTC
Create dfs_simulate_radar debugfs in ath12k debugfs directory.

Usage:
echo 1 > /sys/kernel/debug/ath12k/pci-0000:06:00.0/mac0/dfs_simulate_radar

This debugfs helps user to simulate RADAR interference in run time.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1

Signed-off-by: Ramya Gnanasekar <quic_rgnanase@quicinc.com>
---
 drivers/net/wireless/ath/ath12k/debugfs.c | 29 +++++++++++++++++++++++
 1 file changed, 29 insertions(+)

Comments

Jeff Johnson March 20, 2024, 8:57 p.m. UTC | #1
On 3/20/2024 10:13 AM, Ramya Gnanasekar wrote:
> Create dfs_simulate_radar debugfs in ath12k debugfs directory.
> 
> Usage:
> echo 1 > /sys/kernel/debug/ath12k/pci-0000:06:00.0/mac0/dfs_simulate_radar
> 
> This debugfs helps user to simulate RADAR interference in run time.
> 
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
> 
> Signed-off-by: Ramya Gnanasekar <quic_rgnanase@quicinc.com>
Acked-by: Jeff Johnson <quic_jjohnson@quicinc.com>
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath12k/debugfs.c b/drivers/net/wireless/ath/ath12k/debugfs.c
index 65f3c8bf3f10..8d8ba951093b 100644
--- a/drivers/net/wireless/ath/ath12k/debugfs.c
+++ b/drivers/net/wireless/ath/ath12k/debugfs.c
@@ -7,6 +7,29 @@ 
 #include "core.h"
 #include "debugfs.h"
 
+static ssize_t ath12k_write_simulate_radar(struct file *file,
+					   const char __user *user_buf,
+					   size_t count, loff_t *ppos)
+{
+	struct ath12k *ar = file->private_data;
+	int ret;
+
+	mutex_lock(&ar->conf_mutex);
+	ret = ath12k_wmi_simulate_radar(ar);
+	if (ret)
+		goto exit;
+
+	ret = count;
+exit:
+	mutex_unlock(&ar->conf_mutex);
+	return ret;
+}
+
+static const struct file_operations fops_simulate_radar = {
+	.write = ath12k_write_simulate_radar,
+	.open = simple_open
+};
+
 void ath12k_debugfs_soc_create(struct ath12k_base *ab)
 {
 	bool dput_needed;
@@ -58,4 +81,10 @@  void ath12k_debugfs_register(struct ath12k *ar)
 	/* Create a symlink under ieee80211/phy* */
 	scnprintf(buf, sizeof(buf), "../../ath12k/%pd2", ar->debug.debugfs_pdev);
 	debugfs_create_symlink("ath12k", hw->wiphy->debugfsdir, buf);
+
+	if (ar->mac.sbands[NL80211_BAND_5GHZ].channels) {
+		debugfs_create_file("dfs_simulate_radar", 0200,
+				    ar->debug.debugfs_pdev, ar,
+				    &fops_simulate_radar);
+	}
 }