blob: 9cda99573b13316328087adba00f001db2d19478 [file] [log] [blame]
developer05f3b2b2024-08-19 19:17:34 +08001From 75b59026efecf9c1f6a9486537566121ea3f9055 Mon Sep 17 00:00:00 2001
2From: Howard Hsu <howard-yh.hsu@mediatek.com>
3Date: Mon, 3 Jun 2024 15:18:05 +0800
4Subject: [PATCH 172/199] mtk: mt76: mt7996: support muru dbg info debug
5 commands
6
7Support enable muru debug functionality by debugfs.
8Usage:
9$ echo <item>-<val> > /sys/kernel/debug/ieee80211/phy0/mt76/muru_dbg
10
11The purpose of this commit is for WiFi 7 R1 cert UL-MU test cases.
12
13Signed-off-by: Howard Hsu <howard-yh.hsu@mediatek.com>
14---
15 mt7996/mtk_debugfs.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
16 1 file changed, 44 insertions(+)
17
18diff --git a/mt7996/mtk_debugfs.c b/mt7996/mtk_debugfs.c
19index b16ea5fe..b698c68a 100644
20--- a/mt7996/mtk_debugfs.c
21+++ b/mt7996/mtk_debugfs.c
22@@ -4326,6 +4326,48 @@ mt7996_drr_info(struct seq_file *s, void *data)
23 return 0;
24 }
25
26+static ssize_t mt7996_muru_dbg_info_set(struct file *file,
27+ const char __user *user_buf,
28+ size_t count, loff_t *ppos)
29+{
30+ struct mt7996_dev *dev = file->private_data;
31+ char buf[10];
32+ u16 item;
33+ u8 val;
34+ int ret;
35+
36+ if (count >= sizeof(buf))
37+ return -EINVAL;
38+
39+ if (copy_from_user(buf, user_buf, count))
40+ return -EFAULT;
41+
42+ if (count && buf[count - 1] == '\n')
43+ buf[count - 1] = '\0';
44+ else
45+ buf[count] = '\0';
46+
47+ if (sscanf(buf, "%hu-%hhu", &item, &val) != 2) {
48+ dev_warn(dev->mt76.dev,"format: item-value\n");
49+ return -EINVAL;
50+ }
51+
52+ ret = mt7996_mcu_muru_dbg_info(dev, item, val);
53+ if (ret) {
54+ dev_warn(dev->mt76.dev, "Fail to send mcu cmd.\n");
55+ return -EFAULT;
56+ }
57+
58+ return count;
59+}
60+
61+static const struct file_operations fops_muru_dbg_info = {
62+ .write = mt7996_muru_dbg_info_set,
63+ .open = simple_open,
64+ .owner = THIS_MODULE,
65+ .llseek = default_llseek,
66+};
67+
68 void mt7996_mtk_init_band_debugfs(struct mt7996_phy *phy, struct dentry *dir)
69 {
70 /* agg */
71@@ -4447,6 +4489,8 @@ void mt7996_mtk_init_dev_debugfs(struct mt7996_dev *dev, struct dentry *dir)
72 /* Drop counters */
73 debugfs_create_file("tx_drop_stats", 0400, dir, dev, &mt7996_tx_drop_fops);
74 debugfs_create_file("rx_drop_stats", 0400, dir, dev, &mt7996_rx_drop_fops);
75+
76+ debugfs_create_file("muru_dbg", 0200, dir, dev, &fops_muru_dbg_info);
77 }
78
79 #endif
80--
812.18.0
82