041ba31a37886da2ffa66b63c7e9f17af19a3684
[openwrt/staging/hauke.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sat, 23 Jan 2021 00:10:34 +0100
3 Subject: [PATCH] mac80211: minstrel_ht: show sampling rates in debugfs
4
5 This makes it easier to see what rates are going to be tested next
6
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 ---
9
10 --- a/net/mac80211/rc80211_minstrel_ht_debugfs.c
11 +++ b/net/mac80211/rc80211_minstrel_ht_debugfs.c
12 @@ -32,6 +32,18 @@ minstrel_stats_release(struct inode *ino
13 return 0;
14 }
15
16 +static bool
17 +minstrel_ht_is_sample_rate(struct minstrel_ht_sta *mi, int idx)
18 +{
19 + int type, i;
20 +
21 + for (type = 0; type < ARRAY_SIZE(mi->sample); type++)
22 + for (i = 0; i < MINSTREL_SAMPLE_RATES; i++)
23 + if (mi->sample[type].cur_sample_rates[i] == idx)
24 + return true;
25 + return false;
26 +}
27 +
28 static char *
29 minstrel_ht_stats_dump(struct minstrel_ht_sta *mi, int i, char *p)
30 {
31 @@ -84,6 +96,7 @@ minstrel_ht_stats_dump(struct minstrel_h
32 *(p++) = (idx == mi->max_tp_rate[2]) ? 'C' : ' ';
33 *(p++) = (idx == mi->max_tp_rate[3]) ? 'D' : ' ';
34 *(p++) = (idx == mi->max_prob_rate) ? 'P' : ' ';
35 + *(p++) = minstrel_ht_is_sample_rate(mi, idx) ? 'S' : ' ';
36
37 if (gflags & IEEE80211_TX_RC_MCS) {
38 p += sprintf(p, " MCS%-2u", (mg->streams - 1) * 8 + j);
39 @@ -145,9 +158,9 @@ minstrel_ht_stats_open(struct inode *ino
40
41 p += sprintf(p, "\n");
42 p += sprintf(p,
43 - " best ____________rate__________ ____statistics___ _____last____ ______sum-of________\n");
44 + " best ____________rate__________ ____statistics___ _____last____ ______sum-of________\n");
45 p += sprintf(p,
46 - "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob)] [retry|suc|att] [#success | #attempts]\n");
47 + "mode guard # rate [name idx airtime max_tp] [avg(tp) avg(prob)] [retry|suc|att] [#success | #attempts]\n");
48
49 p = minstrel_ht_stats_dump(mi, MINSTREL_CCK_GROUP, p);
50 for (i = 0; i < MINSTREL_CCK_GROUP; i++)
51 @@ -228,6 +241,7 @@ minstrel_ht_stats_csv_dump(struct minstr
52 p += sprintf(p, "%s" ,((idx == mi->max_tp_rate[2]) ? "C" : ""));
53 p += sprintf(p, "%s" ,((idx == mi->max_tp_rate[3]) ? "D" : ""));
54 p += sprintf(p, "%s" ,((idx == mi->max_prob_rate) ? "P" : ""));
55 + p += sprintf(p, "%s", (minstrel_ht_is_sample_rate(mi, idx) ? "S" : ""));
56
57 if (gflags & IEEE80211_TX_RC_MCS) {
58 p += sprintf(p, ",MCS%-2u,", (mg->streams - 1) * 8 + j);