Skip to content

Commit 34f374f

Browse files
LorenzoBianconinbd168
authored andcommitted
mt76: mt7915: add twt_stats knob in debugfs
Introduce twt_stats knob in debugfs in order to dump established agreements Tested-by: Peter Chiu <[email protected]> Tested-by: Evelyn Tsai <[email protected]> Signed-off-by: Lorenzo Bianconi <[email protected]> Signed-off-by: Felix Fietkau <[email protected]>
1 parent 2043247 commit 34f374f

File tree

1 file changed

+28
-0
lines changed
  • drivers/net/wireless/mediatek/mt76/mt7915

1 file changed

+28
-0
lines changed

drivers/net/wireless/mediatek/mt76/mt7915/debugfs.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,32 @@ mt7915_read_rate_txpower(struct seq_file *s, void *data)
437437
return 0;
438438
}
439439

440+
static int
441+
mt7915_twt_stats(struct seq_file *s, void *data)
442+
{
443+
struct mt7915_dev *dev = dev_get_drvdata(s->private);
444+
struct mt7915_twt_flow *iter;
445+
446+
rcu_read_lock();
447+
448+
seq_puts(s, " wcid | id | flags | exp | mantissa");
449+
seq_puts(s, " | duration | tsf |\n");
450+
list_for_each_entry_rcu(iter, &dev->twt_list, list)
451+
seq_printf(s,
452+
"%9d | %8d | %5c%c%c%c | %8d | %8d | %8d | %14lld |\n",
453+
iter->wcid, iter->id,
454+
iter->sched ? 's' : 'u',
455+
iter->protection ? 'p' : '-',
456+
iter->trigger ? 't' : '-',
457+
iter->flowtype ? '-' : 'a',
458+
iter->exp, iter->mantissa,
459+
iter->duration, iter->tsf);
460+
461+
rcu_read_unlock();
462+
463+
return 0;
464+
}
465+
440466
int mt7915_init_debugfs(struct mt7915_dev *dev)
441467
{
442468
struct dentry *dir;
@@ -454,6 +480,8 @@ int mt7915_init_debugfs(struct mt7915_dev *dev)
454480
debugfs_create_file("implicit_txbf", 0600, dir, dev,
455481
&fops_implicit_txbf);
456482
debugfs_create_u32("dfs_hw_pattern", 0400, dir, &dev->hw_pattern);
483+
debugfs_create_devm_seqfile(dev->mt76.dev, "twt_stats", dir,
484+
mt7915_twt_stats);
457485
/* test knobs */
458486
debugfs_create_file("radar_trigger", 0200, dir, dev,
459487
&fops_radar_trigger);

0 commit comments

Comments
 (0)