df45a520fa3c533db62edd30aa0164f2464896cc
[openwrt/staging/981213.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sat, 25 Jun 2022 21:25:40 +0200
3 Subject: [PATCH] mac80211: add debugfs file to display per-phy AQL pending
4 airtime
5
6 Now that the global pending airtime is more relevant for airtime fairness,
7 it makes sense to make it accessible via debugfs for debugging
8
9 Signed-off-by: Felix Fietkau <nbd@nbd.name>
10 ---
11
12 --- a/net/mac80211/debugfs.c
13 +++ b/net/mac80211/debugfs.c
14 @@ -201,6 +201,36 @@ static const struct file_operations airt
15 .llseek = default_llseek,
16 };
17
18 +static ssize_t aql_pending_read(struct file *file,
19 + char __user *user_buf,
20 + size_t count, loff_t *ppos)
21 +{
22 + struct ieee80211_local *local = file->private_data;
23 + char buf[400];
24 + int len = 0;
25 +
26 + len = scnprintf(buf, sizeof(buf),
27 + "AC AQL pending\n"
28 + "VO %u us\n"
29 + "VI %u us\n"
30 + "BE %u us\n"
31 + "BK %u us\n"
32 + "total %u us\n",
33 + atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_VO]),
34 + atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_VI]),
35 + atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_BE]),
36 + atomic_read(&local->aql_ac_pending_airtime[IEEE80211_AC_BK]),
37 + atomic_read(&local->aql_total_pending_airtime));
38 + return simple_read_from_buffer(user_buf, count, ppos,
39 + buf, len);
40 +}
41 +
42 +static const struct file_operations aql_pending_ops = {
43 + .read = aql_pending_read,
44 + .open = simple_open,
45 + .llseek = default_llseek,
46 +};
47 +
48 static ssize_t aql_txq_limit_read(struct file *file,
49 char __user *user_buf,
50 size_t count,
51 @@ -628,6 +658,7 @@ void debugfs_hw_add(struct ieee80211_loc
52 DEBUGFS_ADD(hw_conf);
53 DEBUGFS_ADD_MODE(force_tx_status, 0600);
54 DEBUGFS_ADD_MODE(aql_enable, 0600);
55 + DEBUGFS_ADD(aql_pending);
56
57 if (local->ops->wake_tx_queue)
58 DEBUGFS_ADD_MODE(aqm, 0600);