1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sun, 26 Jun 2022 11:43:25 +0200
3 Subject: [PATCH] mac80211: increase quantum for airtime scheduler
5 Given the typical AQL budget and queue length, a quantum of 256 with the
6 default station weight often requires iterating over all queues frequently,
7 until one of them becomes eligible.
8 Improve performance by using 8 times station weight as scheduler quantum
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
13 --- a/net/mac80211/ieee80211_i.h
14 +++ b/net/mac80211/ieee80211_i.h
15 @@ -92,6 +92,8 @@ extern const u8 ieee80211_ac_to_qos_mask
17 #define AIRTIME_ACTIVE_DURATION (HZ / 10)
19 +#define AIRTIME_QUANTUM_SHIFT 3
21 struct ieee80211_bss {
22 u32 device_ts_beacon, device_ts_presp;
24 --- a/net/mac80211/tx.c
25 +++ b/net/mac80211/tx.c
26 @@ -4059,7 +4059,7 @@ struct ieee80211_txq *ieee80211_next_txq
29 sta->airtime[txqi->txq.ac].deficit +=
30 - sta->airtime_weight;
31 + sta->airtime_weight << AIRTIME_QUANTUM_SHIFT;
33 if (deficit < 0 || !aql_check) {
34 list_move_tail(&txqi->schedule_order,
35 @@ -4202,7 +4202,8 @@ bool ieee80211_txq_may_transmit(struct i
37 sta = container_of(iter->txq.sta, struct sta_info, sta);
38 if (ieee80211_sta_deficit(sta, ac) < 0)
39 - sta->airtime[ac].deficit += sta->airtime_weight;
40 + sta->airtime[ac].deficit += sta->airtime_weight <<
41 + AIRTIME_QUANTUM_SHIFT;
42 list_move_tail(&iter->schedule_order, &local->active_txqs[ac]);
45 @@ -4210,7 +4211,7 @@ bool ieee80211_txq_may_transmit(struct i
46 if (sta->airtime[ac].deficit >= 0)
49 - sta->airtime[ac].deficit += sta->airtime_weight;
50 + sta->airtime[ac].deficit += sta->airtime_weight << AIRTIME_QUANTUM_SHIFT;
51 list_move_tail(&txqi->schedule_order, &local->active_txqs[ac]);
52 spin_unlock_bh(&local->active_txq_lock[ac]);