35f07c1a9764d65c23eb5080f06eb99b7de38768
[openwrt/staging/ansuel.git] /
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sat, 25 Jun 2022 23:10:19 +0200
3 Subject: [PATCH] mac80211: only accumulate airtime deficit for active
4 clients
5
6 When a client does not generate any local tx activity, accumulating airtime
7 deficit for the round-robin scheduler can be harmful. If this goes on for too
8 long, the deficit could grow quite large, which might cause unreasonable
9 initial latency once the client becomes active
10
11 Signed-off-by: Felix Fietkau <nbd@nbd.name>
12 ---
13
14 --- a/net/mac80211/sta_info.c
15 +++ b/net/mac80211/sta_info.c
16 @@ -1900,6 +1900,7 @@ void ieee80211_sta_register_airtime(stru
17 struct ieee80211_local *local = sta->sdata->local;
18 u8 ac = ieee80211_ac_from_tid(tid);
19 u32 airtime = 0;
20 + u32 diff;
21
22 if (sta->local->airtime_flags & AIRTIME_USE_TX)
23 airtime += tx_airtime;
24 @@ -1909,7 +1910,11 @@ void ieee80211_sta_register_airtime(stru
25 spin_lock_bh(&local->active_txq_lock[ac]);
26 sta->airtime[ac].tx_airtime += tx_airtime;
27 sta->airtime[ac].rx_airtime += rx_airtime;
28 - sta->airtime[ac].deficit -= airtime;
29 +
30 + diff = (u32)jiffies - sta->airtime[ac].last_active;
31 + if (diff <= AIRTIME_ACTIVE_DURATION)
32 + sta->airtime[ac].deficit -= airtime;
33 +
34 spin_unlock_bh(&local->active_txq_lock[ac]);
35 }
36 EXPORT_SYMBOL(ieee80211_sta_register_airtime);