Commit 34f374f8 authored by Lorenzo Bianconi's avatar Lorenzo Bianconi Committed by Felix Fietkau

mt76: mt7915: add twt_stats knob in debugfs

Introduce twt_stats knob in debugfs in order to dump established
agreements
Tested-by: default avatarPeter Chiu <chui-hao.chiu@mediatek.com>
Tested-by: default avatarEvelyn Tsai <evelyn.tsai@mediatek.com>
Signed-off-by: default avatarLorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent 20432476
...@@ -437,6 +437,32 @@ mt7915_read_rate_txpower(struct seq_file *s, void *data) ...@@ -437,6 +437,32 @@ mt7915_read_rate_txpower(struct seq_file *s, void *data)
return 0; return 0;
} }
static int
mt7915_twt_stats(struct seq_file *s, void *data)
{
struct mt7915_dev *dev = dev_get_drvdata(s->private);
struct mt7915_twt_flow *iter;
rcu_read_lock();
seq_puts(s, " wcid | id | flags | exp | mantissa");
seq_puts(s, " | duration | tsf |\n");
list_for_each_entry_rcu(iter, &dev->twt_list, list)
seq_printf(s,
"%9d | %8d | %5c%c%c%c | %8d | %8d | %8d | %14lld |\n",
iter->wcid, iter->id,
iter->sched ? 's' : 'u',
iter->protection ? 'p' : '-',
iter->trigger ? 't' : '-',
iter->flowtype ? '-' : 'a',
iter->exp, iter->mantissa,
iter->duration, iter->tsf);
rcu_read_unlock();
return 0;
}
int mt7915_init_debugfs(struct mt7915_dev *dev) int mt7915_init_debugfs(struct mt7915_dev *dev)
{ {
struct dentry *dir; struct dentry *dir;
...@@ -454,6 +480,8 @@ int mt7915_init_debugfs(struct mt7915_dev *dev) ...@@ -454,6 +480,8 @@ int mt7915_init_debugfs(struct mt7915_dev *dev)
debugfs_create_file("implicit_txbf", 0600, dir, dev, debugfs_create_file("implicit_txbf", 0600, dir, dev,
&fops_implicit_txbf); &fops_implicit_txbf);
debugfs_create_u32("dfs_hw_pattern", 0400, dir, &dev->hw_pattern); debugfs_create_u32("dfs_hw_pattern", 0400, dir, &dev->hw_pattern);
debugfs_create_devm_seqfile(dev->mt76.dev, "twt_stats", dir,
mt7915_twt_stats);
/* test knobs */ /* test knobs */
debugfs_create_file("radar_trigger", 0200, dir, dev, debugfs_create_file("radar_trigger", 0200, dir, dev,
&fops_radar_trigger); &fops_radar_trigger);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment