WSL2-Linux-Kernel/net/mac80211
Toke Høiland-Jørgensen 2433647bc8 mac80211: Switch to a virtual time-based airtime scheduler
This switches the airtime scheduler in mac80211 to use a virtual
time-based scheduler instead of the round-robin scheduler used before.
This has a couple of advantages:

- No need to sync up the round-robin scheduler in firmware/hardware with
  the round-robin airtime scheduler.

- If several stations are eligible for transmission we can schedule both
  of them; no need to hard-block the scheduling rotation until the head
  of the queue has used up its quantum.

- The check of whether a station is eligible for transmission becomes
  simpler (in ieee80211_txq_may_transmit()).

The drawback is that scheduling becomes slightly more expensive, as we
need to maintain an rbtree of TXQs sorted by virtual time. This means
that ieee80211_register_airtime() becomes O(logN) in the number of
currently scheduled TXQs because it can change the order of the
scheduled stations. We mitigate this overhead by only resorting when a
station changes position in the tree, and hopefully N rarely grows too
big (it's only TXQs currently backlogged, not all associated stations),
so it shouldn't be too big of an issue.

To prevent divisions in the fast path, we maintain both station sums and
pre-computed reciprocals of the sums. This turns the fast-path operation
into a multiplication, with divisions only happening as the number of
active stations change (to re-compute the current sum of all active
station weights). To prevent this re-computation of the reciprocal from
happening too frequently, we use a time-based notion of station
activity, instead of updating the weight every time a station gets
scheduled or de-scheduled. As queues can oscillate between empty and
occupied quite frequently, this can significantly cut down on the number
of re-computations. It also has the added benefit of making the station
airtime calculation independent on whether the queue happened to have
drained at the time an airtime value was accounted.

Co-developed-by: Yibo Zhao <yiboz@codeaurora.org>
Signed-off-by: Yibo Zhao <yiboz@codeaurora.org>
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://lore.kernel.org/r/20210623134755.235545-1-toke@redhat.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2021-06-23 18:12:00 +02:00
..
Kconfig
Makefile
aead_api.c mac80211: Check crypto_aead_encrypt for errors 2021-03-16 21:20:41 +01:00
aead_api.h
aes_ccm.h
aes_cmac.c mac80211: aes_cmac: check crypto_shash_setkey() return value 2021-04-19 12:01:40 +02:00
aes_cmac.h
aes_gcm.h
aes_gmac.c mac80211: Check crypto_aead_encrypt for errors 2021-03-16 21:20:41 +01:00
aes_gmac.h
agg-rx.c
agg-tx.c
airtime.c
cfg.c mac80211: Switch to a virtual time-based airtime scheduler 2021-06-23 18:12:00 +02:00
chan.c mac80211: handle rate control (RC) racing with chanctx definition 2021-06-23 11:29:14 +02:00
debug.h
debugfs.c mac80211: Switch to a virtual time-based airtime scheduler 2021-06-23 18:12:00 +02:00
debugfs.h
debugfs_key.c
debugfs_key.h
debugfs_netdev.c mac80211: Switch to a virtual time-based airtime scheduler 2021-06-23 18:12:00 +02:00
debugfs_netdev.h
debugfs_sta.c mac80211: Switch to a virtual time-based airtime scheduler 2021-06-23 18:12:00 +02:00
debugfs_sta.h
driver-ops.c
driver-ops.h mac80211: notify driver on mgd TX completion 2021-06-23 13:10:46 +02:00
ethtool.c
fils_aead.c
fils_aead.h
he.c mac80211: fix NULL ptr dereference during mesh peer connection for non HE devices 2021-06-23 18:06:44 +02:00
ht.c mac80211: allow SMPS requests only in client mode 2021-06-23 11:29:13 +02:00
ibss.c mac80211: fix double free in ibss_leave 2021-03-16 21:13:09 +01:00
ieee80211_i.h mac80211: Switch to a virtual time-based airtime scheduler 2021-06-23 18:12:00 +02:00
iface.c mac80211: Switch to a virtual time-based airtime scheduler 2021-06-23 18:12:00 +02:00
key.c mac80211: prevent mixed key and fragment cache attacks 2021-05-11 20:12:51 +02:00
key.h mac80211: prevent mixed key and fragment cache attacks 2021-05-11 20:12:51 +02:00
led.c mac80211: don't open-code LED manipulations 2021-06-23 11:29:12 +02:00
led.h
main.c mac80211: Switch to a virtual time-based airtime scheduler 2021-06-23 18:12:00 +02:00
mesh.c
mesh.h mac80211: fix some spelling mistakes 2021-06-23 12:36:32 +02:00
mesh_hwmp.c mac80211: fix some spelling mistakes 2021-06-23 12:36:32 +02:00
mesh_pathtbl.c mac80211: fix some spelling mistakes 2021-06-23 12:36:32 +02:00
mesh_plink.c mac80211: fix some spelling mistakes 2021-06-23 12:36:32 +02:00
mesh_ps.c
mesh_sync.c
michael.c
michael.h
mlme.c Revert "mac80211: HE STA disassoc due to QOS NULL not sent" 2021-06-23 18:11:21 +02:00
ocb.c
offchannel.c
pm.c
rate.c mac80211: add rate control support for encap offload 2021-06-23 11:29:13 +02:00
rate.h
rc80211_minstrel_ht.c mac80211: fix some spelling mistakes 2021-06-23 12:36:32 +02:00
rc80211_minstrel_ht.h mac80211: minstrel_ht: remove sample rate switching code for constrained devices 2021-02-12 08:58:22 +01:00
rc80211_minstrel_ht_debugfs.c mac80211: minstrel_ht: show sampling rates in debugfs 2021-02-12 08:58:11 +01:00
rx.c mac80211: Switch to a virtual time-based airtime scheduler 2021-06-23 18:12:00 +02:00
s1g.c
scan.c mac80211: fix skb length check in ieee80211_scan_rx() 2021-05-31 21:39:10 +02:00
spectmgmt.c
sta_info.c mac80211: Switch to a virtual time-based airtime scheduler 2021-06-23 18:12:00 +02:00
sta_info.h mac80211: Switch to a virtual time-based airtime scheduler 2021-06-23 18:12:00 +02:00
status.c mac80211: Switch to a virtual time-based airtime scheduler 2021-06-23 18:12:00 +02:00
tdls.c mac80211: use sdata->skb_queue for TDLS 2021-06-23 11:00:17 +02:00
tkip.c
tkip.h
trace.c
trace.h mac80211: notify driver on mgd TX completion 2021-06-23 13:10:46 +02:00
trace_msg.h
tx.c mac80211: Switch to a virtual time-based airtime scheduler 2021-06-23 18:12:00 +02:00
util.c mac80211: add HE 6 GHz capability only if supported 2021-06-23 13:10:47 +02:00
vht.c
wep.c
wep.h
wme.c
wme.h
wpa.c mac80211: check defrag PN against current frame 2021-05-11 20:13:45 +02:00
wpa.h