Commit ec9742a8 authored by Ryder Lee's avatar Ryder Lee Committed by Felix Fietkau

mt76: mt7915: add .sta_add_debugfs support

This generation supports much more per-peer statistics than legacy ones,
so add .sta_add_debugfs accordingly.

This is convenient to set/get more settings/counters in the long run.
Signed-off-by: default avatarRyder Lee <ryder.lee@mediatek.com>
Signed-off-by: default avatarFelix Fietkau <nbd@nbd.name>
parent a82dd24d
...@@ -302,3 +302,68 @@ int mt7915_init_debugfs(struct mt7915_dev *dev) ...@@ -302,3 +302,68 @@ int mt7915_init_debugfs(struct mt7915_dev *dev)
return 0; return 0;
} }
/** per-station debugfs **/
static int
mt7915_sta_stats_read(struct seq_file *s, void *data)
{
struct ieee80211_sta *sta = s->private;
struct mt7915_sta *msta = (struct mt7915_sta *)sta->drv_priv;
struct mt7915_sta_stats *stats = &msta->stats;
struct rate_info *rate = &stats->prob_rate;
static const char * const bw[] = {
"BW20", "BW5", "BW10", "BW40",
"BW80", "BW160", "BW_HE_RU"
};
if (!rate->legacy && !rate->flags)
return 0;
seq_puts(s, "Probing rate - ");
if (rate->flags & RATE_INFO_FLAGS_MCS)
seq_puts(s, "HT ");
else if (rate->flags & RATE_INFO_FLAGS_VHT_MCS)
seq_puts(s, "VHT ");
else if (rate->flags & RATE_INFO_FLAGS_HE_MCS)
seq_puts(s, "HE ");
else
seq_printf(s, "Bitrate %d\n", rate->legacy);
if (rate->flags) {
seq_printf(s, "%s NSS%d MCS%d ",
bw[rate->bw], rate->nss, rate->mcs);
if (rate->flags & RATE_INFO_FLAGS_SHORT_GI)
seq_puts(s, "SGI ");
else if (rate->he_gi)
seq_puts(s, "HE GI ");
if (rate->he_dcm)
seq_puts(s, "DCM ");
}
seq_printf(s, "\nPPDU PER: %ld.%1ld%%\n",
stats->per / 10, stats->per % 10);
return 0;
}
static int
mt7915_sta_stats_open(struct inode *inode, struct file *f)
{
return single_open(f, mt7915_sta_stats_read, inode->i_private);
}
static const struct file_operations fops_sta_stats = {
.open = mt7915_sta_stats_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
void mt7915_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct dentry *dir)
{
debugfs_create_file("stats", 0400, dir, sta, &fops_sta_stats);
}
...@@ -746,4 +746,7 @@ const struct ieee80211_ops mt7915_ops = { ...@@ -746,4 +746,7 @@ const struct ieee80211_ops mt7915_ops = {
.get_antenna = mt76_get_antenna, .get_antenna = mt76_get_antenna,
.set_antenna = mt7915_set_antenna, .set_antenna = mt7915_set_antenna,
.set_coverage_class = mt7915_set_coverage_class, .set_coverage_class = mt7915_set_coverage_class,
#ifdef CONFIG_MAC80211_DEBUGFS
.sta_add_debugfs = mt7915_sta_add_debugfs,
#endif
}; };
...@@ -448,5 +448,9 @@ int mt7915_dfs_init_radar_detector(struct mt7915_phy *phy); ...@@ -448,5 +448,9 @@ int mt7915_dfs_init_radar_detector(struct mt7915_phy *phy);
void mt7915_set_stream_he_caps(struct mt7915_phy *phy); void mt7915_set_stream_he_caps(struct mt7915_phy *phy);
void mt7915_update_channel(struct mt76_dev *mdev); void mt7915_update_channel(struct mt76_dev *mdev);
int mt7915_init_debugfs(struct mt7915_dev *dev); int mt7915_init_debugfs(struct mt7915_dev *dev);
#ifdef CONFIG_MAC80211_DEBUGFS
void mt7915_sta_add_debugfs(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_sta *sta, struct dentry *dir);
#endif
#endif #endif
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