Commit 77f57761 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

fq_codel: fix memory limitation drift

memory_usage must be decreased in dequeue_func(), not in
fq_codel_dequeue(), otherwise packets dropped by Codel algo
are missing this decrease.

Also we need to clear memory_usage in fq_codel_reset()

Fixes: 95b58430 ("fq_codel: add memory limitation per queue")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fd24d72c
...@@ -262,6 +262,7 @@ static struct sk_buff *dequeue_func(struct codel_vars *vars, void *ctx) ...@@ -262,6 +262,7 @@ static struct sk_buff *dequeue_func(struct codel_vars *vars, void *ctx)
if (flow->head) { if (flow->head) {
skb = dequeue_head(flow); skb = dequeue_head(flow);
q->backlogs[flow - q->flows] -= qdisc_pkt_len(skb); q->backlogs[flow - q->flows] -= qdisc_pkt_len(skb);
q->memory_usage -= skb->truesize;
sch->q.qlen--; sch->q.qlen--;
sch->qstats.backlog -= qdisc_pkt_len(skb); sch->qstats.backlog -= qdisc_pkt_len(skb);
} }
...@@ -318,7 +319,6 @@ static struct sk_buff *fq_codel_dequeue(struct Qdisc *sch) ...@@ -318,7 +319,6 @@ static struct sk_buff *fq_codel_dequeue(struct Qdisc *sch)
list_del_init(&flow->flowchain); list_del_init(&flow->flowchain);
goto begin; goto begin;
} }
q->memory_usage -= skb->truesize;
qdisc_bstats_update(sch, skb); qdisc_bstats_update(sch, skb);
flow->deficit -= qdisc_pkt_len(skb); flow->deficit -= qdisc_pkt_len(skb);
/* We cant call qdisc_tree_reduce_backlog() if our qlen is 0, /* We cant call qdisc_tree_reduce_backlog() if our qlen is 0,
...@@ -355,6 +355,7 @@ static void fq_codel_reset(struct Qdisc *sch) ...@@ -355,6 +355,7 @@ static void fq_codel_reset(struct Qdisc *sch)
} }
memset(q->backlogs, 0, q->flows_cnt * sizeof(u32)); memset(q->backlogs, 0, q->flows_cnt * sizeof(u32));
sch->q.qlen = 0; sch->q.qlen = 0;
q->memory_usage = 0;
} }
static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = { static const struct nla_policy fq_codel_policy[TCA_FQ_CODEL_MAX + 1] = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment