9fe2a924df7a689bbef0bad3ebfc181e9f20523f
[openwrt/staging/ynezz.git] /
1 From: =?UTF-8?q?Toke=20H=C3=B8iland-J=C3=B8rgensen?= <toke@redhat.com>
2 Date: Wed, 23 Oct 2019 11:59:00 +0200
3 Subject: [PATCH] mac80211: Shrink the size of ack_frame_id to make room for
4 tx_time_est
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 To implement airtime queue limiting, we need to keep a running account of
10 the estimated airtime of all skbs queued into the device. Do to this
11 correctly, we need to store the airtime estimate into the skb so we can
12 decrease the outstanding balance when the skb is freed. This means that the
13 time estimate must be stored somewhere that will survive for the lifetime
14 of the skb.
15
16 To get this, decrease the size of the ack_frame_id field to 6 bits, and
17 lower the size of the ID space accordingly. This leaves 10 bits for use for
18 tx_time_est, which is enough to store a maximum of 4096 us, if we shift the
19 values so they become units of 4us.
20
21 Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
22 Link: https://lore.kernel.org/r/157182474063.150713.16132669599100802716.stgit@toke.dk
23 Signed-off-by: Johannes Berg <johannes.berg@intel.com>
24 ---
25
26 --- a/include/net/mac80211.h
27 +++ b/include/net/mac80211.h
28 @@ -967,6 +967,7 @@ ieee80211_rate_get_vht_nss(const struct
29 * @band: the band to transmit on (use for checking for races)
30 * @hw_queue: HW queue to put the frame on, skb_get_queue_mapping() gives the AC
31 * @ack_frame_id: internal frame ID for TX status, used internally
32 + * @tx_time_est: TX time estimate in units of 4us, used internally
33 * @control: union part for control data
34 * @control.rates: TX rates array to try
35 * @control.rts_cts_rate_idx: rate for RTS or CTS
36 @@ -1007,7 +1008,8 @@ struct ieee80211_tx_info {
37
38 u8 hw_queue;
39
40 - u16 ack_frame_id;
41 + u16 ack_frame_id:6;
42 + u16 tx_time_est:10;
43
44 union {
45 struct {
46 --- a/net/mac80211/cfg.c
47 +++ b/net/mac80211/cfg.c
48 @@ -3449,7 +3449,7 @@ int ieee80211_attach_ack_skb(struct ieee
49
50 spin_lock_irqsave(&local->ack_status_lock, spin_flags);
51 id = idr_alloc(&local->ack_status_frames, ack_skb,
52 - 1, 0x10000, GFP_ATOMIC);
53 + 1, 0x40, GFP_ATOMIC);
54 spin_unlock_irqrestore(&local->ack_status_lock, spin_flags);
55
56 if (id < 0) {
57 --- a/net/mac80211/tx.c
58 +++ b/net/mac80211/tx.c
59 @@ -2452,7 +2452,7 @@ static int ieee80211_store_ack_skb(struc
60
61 spin_lock_irqsave(&local->ack_status_lock, flags);
62 id = idr_alloc(&local->ack_status_frames, ack_skb,
63 - 1, 0x10000, GFP_ATOMIC);
64 + 1, 0x40, GFP_ATOMIC);
65 spin_unlock_irqrestore(&local->ack_status_lock, flags);
66
67 if (id >= 0) {