mac80211: update to 6.6.15
[openwrt/openwrt.git] / package / kernel / mac80211 / patches / subsys / 305-mac80211-increase-quantum-for-airtime-scheduler.patch
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
4
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
9
10 Signed-off-by: Felix Fietkau <nbd@nbd.name>
11 ---
12
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
16 */
17 #define AIRTIME_ACTIVE_DURATION (HZ / 10)
18
19 +#define AIRTIME_QUANTUM_SHIFT 3
20 +
21 struct ieee80211_bss {
22 u32 device_ts_beacon, device_ts_presp;
23
24 --- a/net/mac80211/tx.c
25 +++ b/net/mac80211/tx.c
26 @@ -4060,7 +4060,7 @@ struct ieee80211_txq *ieee80211_next_txq
27
28 if (deficit < 0)
29 sta->airtime[txqi->txq.ac].deficit +=
30 - sta->airtime_weight;
31 + sta->airtime_weight << AIRTIME_QUANTUM_SHIFT;
32
33 if (deficit < 0 || !aql_check) {
34 list_move_tail(&txqi->schedule_order,
35 @@ -4203,7 +4203,8 @@ bool ieee80211_txq_may_transmit(struct i
36 }
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]);
43 }
44
45 @@ -4211,7 +4212,7 @@ bool ieee80211_txq_may_transmit(struct i
46 if (sta->airtime[ac].deficit >= 0)
47 goto out;
48
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]);
53