mac80211: add airtime fairness improvements
[openwrt/staging/ansuel.git] / package / kernel / mac80211 / patches / subsys / 331-mac80211-make-sta-airtime-deficit-field-s32-instead-.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Mon, 20 Jun 2022 14:53:04 +0200
3 Subject: [PATCH] mac80211: make sta airtime deficit field s32 instead of
4 s64
5
6 32 bit is more than enough range for the airtime deficit
7
8 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 ---
10
11 --- a/net/mac80211/debugfs_sta.c
12 +++ b/net/mac80211/debugfs_sta.c
13 @@ -202,7 +202,7 @@ static ssize_t sta_airtime_read(struct f
14 size_t bufsz = 400;
15 char *buf = kzalloc(bufsz, GFP_KERNEL), *p = buf;
16 u64 rx_airtime = 0, tx_airtime = 0;
17 - s64 deficit[IEEE80211_NUM_ACS];
18 + s32 deficit[IEEE80211_NUM_ACS];
19 ssize_t rv;
20 int ac;
21
22 @@ -219,7 +219,7 @@ static ssize_t sta_airtime_read(struct f
23
24 p += scnprintf(p, bufsz + buf - p,
25 "RX: %llu us\nTX: %llu us\nWeight: %u\n"
26 - "Deficit: VO: %lld us VI: %lld us BE: %lld us BK: %lld us\n",
27 + "Deficit: VO: %d us VI: %d us BE: %d us BK: %d us\n",
28 rx_airtime, tx_airtime, sta->airtime_weight,
29 deficit[0], deficit[1], deficit[2], deficit[3]);
30
31 --- a/net/mac80211/sta_info.h
32 +++ b/net/mac80211/sta_info.h
33 @@ -138,7 +138,7 @@ enum ieee80211_agg_stop_reason {
34 struct airtime_info {
35 u64 rx_airtime;
36 u64 tx_airtime;
37 - s64 deficit;
38 + s32 deficit;
39 atomic_t aql_tx_pending; /* Estimated airtime for frames pending */
40 u32 aql_limit_low;
41 u32 aql_limit_high;
42 --- a/net/mac80211/tx.c
43 +++ b/net/mac80211/tx.c
44 @@ -3847,7 +3847,7 @@ struct ieee80211_txq *ieee80211_next_txq
45 struct sta_info *sta = container_of(txqi->txq.sta,
46 struct sta_info, sta);
47 bool aql_check = ieee80211_txq_airtime_check(hw, &txqi->txq);
48 - s64 deficit = sta->airtime[txqi->txq.ac].deficit;
49 + s32 deficit = sta->airtime[txqi->txq.ac].deficit;
50
51 if (aql_check)
52 found_eligible_txq = true;