openwrt/package/kernel/mac80211/patches/subsys/378-mac80211-fix-memory-accounting-with-A-MSDU-aggregati.patch
Hauke Mehrtens ac5a6acbb1 mac80211: Update to version 4.19.7-1
This updates the backports package used in mac80211 to version 4.19.7-1
which is based on kernel 4.19.7. This integrates all the stable fixes
introduces in this kernel version.

The deleted patches are not needed any more because they are either
included in the upstream Linux kernel 4.19.7 or in backports 4.19.7-1.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2018-12-13 21:33:31 +01:00

59 lines
1.7 KiB
Diff

From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 8 Mar 2018 21:00:56 +0100
Subject: [PATCH] mac80211: fix memory accounting with A-MSDU aggregation
fq uses skb->truesize for memory usage tracking. Increments/decrements
are done on enqueue/dequeue.
When A-MSDU aggregation is performed on tx side, the packet is
aggregated with the last packet in the queue belonging to the same flow.
There are multiple bugs here:
- The truesize field of the aggregated packet isn't updated, so memory
usage is underestimated
- fq->memory_usage isn't adjusted.
Because of the combination of both bugs, this only causes tx issues in
rare cases, mainly when the A-MSDU head needs to be reallocated.
Fix this by adjusting both truesize of the A-MSDU head and adding the
truesize delta to fq->memory_usage.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3188,6 +3188,7 @@ static bool ieee80211_amsdu_aggregate(st
u8 max_subframes = sta->sta.max_amsdu_subframes;
int max_frags = local->hw.max_tx_fragments;
int max_amsdu_len = sta->sta.max_amsdu_len;
+ int orig_truesize;
__be16 len;
void *data;
bool ret = false;
@@ -3219,12 +3220,13 @@ static bool ieee80211_amsdu_aggregate(st
flow = fq_flow_classify(fq, tin, skb, fq_flow_get_default_func);
head = skb_peek_tail(&flow->queue);
if (!head)
- goto out;
+ goto unlock;
+ orig_truesize = head->truesize;
orig_len = head->len;
if (skb->len + head->len > max_amsdu_len)
- goto out;
+ goto unlock;
nfrags = 1 + skb_shinfo(skb)->nr_frags;
nfrags += 1 + skb_shinfo(head)->nr_frags;
@@ -3282,6 +3284,9 @@ out_recalc:
fq_recalc_backlog(fq, tin, flow);
}
out:
+ fq->memory_usage += head->truesize - orig_truesize;
+
+unlock:
spin_unlock_bh(&fq->lock);
return ret;