v1.5 branch refresh based upon upstream master @ c8677ca89e53e3be7988d54280fce166cc894a7e
[librecmc/librecmc.git] / target / linux / generic / pending-4.4 / 034-fq_codel-fix-memory-limitation-drift.patch
1 From: Eric Dumazet <edumazet@google.com>
2 Date: Sun, 15 May 2016 18:16:38 -0700
3 Subject: [PATCH] fq_codel: fix memory limitation drift
4
5 memory_usage must be decreased in dequeue_func(), not in
6 fq_codel_dequeue(), otherwise packets dropped by Codel algo
7 are missing this decrease.
8
9 Also we need to clear memory_usage in fq_codel_reset()
10
11 Fixes: 95b58430abe7 ("fq_codel: add memory limitation per queue")
12 Signed-off-by: Eric Dumazet <edumazet@google.com>
13 ---
14
15 --- a/net/sched/sch_fq_codel.c
16 +++ b/net/sched/sch_fq_codel.c
17 @@ -259,6 +259,7 @@ static struct sk_buff *dequeue(struct co
18         if (flow->head) {
19                 skb = dequeue_head(flow);
20                 q->backlogs[flow - q->flows] -= qdisc_pkt_len(skb);
21 +               q->memory_usage -= skb->truesize;
22                 sch->q.qlen--;
23         }
24         return skb;
25 @@ -306,7 +307,6 @@ begin:
26                         list_del_init(&flow->flowchain);
27                 goto begin;
28         }
29 -       q->memory_usage -= skb->truesize;
30         qdisc_bstats_update(sch, skb);
31         flow->deficit -= qdisc_pkt_len(skb);
32         /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0,
33 @@ -343,6 +343,7 @@ static void fq_codel_reset(struct Qdisc
34         }
35         memset(q->backlogs, 0, q->flows_cnt * sizeof(u32));
36         sch->q.qlen = 0;
37 +       q->memory_usage = 0;
38  }
39  
40  static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = {