mt76x2: debugfs: add dfs statistics to debugfs

Signed-off-by: Lorenzo Bianconi <[email protected]>
This commit is contained in:
Lorenzo Bianconi
2016-09-25 18:13:27 +02:00
committed by Felix Fietkau
parent 6375fc1abe
commit d392047be6
3 changed files with 42 additions and 0 deletions
+32
View File
@@ -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);
}
+3
View File
@@ -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++;
}
}
}
+7
View File
@@ -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;
};