mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
mt76x2: debugfs: add dfs statistics to debugfs
Signed-off-by: Lorenzo Bianconi <[email protected]>
This commit is contained in:
committed by
Felix Fietkau
parent
6375fc1abe
commit
d392047be6
@@ -84,6 +84,37 @@ static const struct file_operations fops_ampdu_stat = {
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static int
|
||||
mt76x2_dfs_stat_read(struct seq_file *file, void *data)
|
||||
{
|
||||
int i;
|
||||
struct mt76x2_dev *dev = file->private;
|
||||
struct mt76x2_dfs_pattern_detector *dfs_pd = &dev->dfs_pd;
|
||||
|
||||
for (i = 0; i < MT_DFS_NUM_ENGINES; i++) {
|
||||
seq_printf(file, "engine: %d\n", i);
|
||||
seq_printf(file, " hw pattern detected:\t%d\n",
|
||||
dfs_pd->stats[i].hw_pattern);
|
||||
seq_printf(file, " hw pulse discarded:\t%d\n",
|
||||
dfs_pd->stats[i].hw_pulse_discarded);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
mt76x2_dfs_stat_open(struct inode *inode, struct file *f)
|
||||
{
|
||||
return single_open(f, mt76x2_dfs_stat_read, inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations fops_dfs_stat = {
|
||||
.open = mt76x2_dfs_stat_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
void mt76x2_init_debugfs(struct mt76x2_dev *dev)
|
||||
{
|
||||
struct dentry *dir;
|
||||
@@ -96,6 +127,7 @@ void mt76x2_init_debugfs(struct mt76x2_dev *dev)
|
||||
debugfs_create_bool("tpc", S_IRUSR | S_IWUSR, dir, &dev->enable_tpc);
|
||||
|
||||
debugfs_create_file("ampdu_stat", S_IRUSR, dir, dev, &fops_ampdu_stat);
|
||||
debugfs_create_file("dfs_stats", S_IRUSR, dir, dev, &fops_dfs_stat);
|
||||
debugfs_create_devm_seqfile(dev->mt76.dev, "txpower", dir,
|
||||
read_txpower);
|
||||
}
|
||||
|
||||
@@ -341,11 +341,14 @@ void mt76x2_dfs_tasklet(unsigned long arg)
|
||||
|
||||
if (mt76x2_dfs_check_hw_pulse(dev, &pulse)) {
|
||||
/* hw detector rx radar pattern */
|
||||
dfs_pd->stats[i].hw_pattern++;
|
||||
ieee80211_radar_detected(dev->mt76.hw);
|
||||
/* reset hw detector */
|
||||
mt76_wr(dev, MT_BBP(DFS, 1), 0xf);
|
||||
|
||||
return;
|
||||
} else {
|
||||
dfs_pd->stats[i].hw_pulse_discarded++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -63,6 +63,11 @@ struct mt76x2_dfs_hw_pulse {
|
||||
u32 burst;
|
||||
};
|
||||
|
||||
struct mt76x2_dfs_engine_stats {
|
||||
u32 hw_pattern;
|
||||
u32 hw_pulse_discarded;
|
||||
};
|
||||
|
||||
struct mt76x2_dfs_pattern_detector {
|
||||
enum nl80211_dfs_regions region;
|
||||
|
||||
@@ -74,6 +79,8 @@ struct mt76x2_dfs_pattern_detector {
|
||||
u64 ch_busy_time;
|
||||
bool ch_busy;
|
||||
|
||||
struct mt76x2_dfs_engine_stats stats[MT_DFS_NUM_ENGINES];
|
||||
|
||||
struct tasklet_struct dfs_tasklet;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user