Commit 6c0d54f1 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

net_sched: fix pfifo_head_drop behavior vs backlog

When the qdisc is full, we drop a packet at the head of the queue,
queue the current skb and return NET_XMIT_CN

Now we track backlog on upper qdiscs, we need to call
qdisc_tree_reduce_backlog(), even if the qlen did not change.

Fixes: 2ccccf5f ("net_sched: update hierarchical backlog too")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: WANG Cong <xiyou.wangcong@gmail.com>
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Acked-by: default avatarCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 881d0327
...@@ -37,14 +37,18 @@ static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc *sch) ...@@ -37,14 +37,18 @@ static int pfifo_enqueue(struct sk_buff *skb, struct Qdisc *sch)
static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc *sch) static int pfifo_tail_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{ {
unsigned int prev_backlog;
if (likely(skb_queue_len(&sch->q) < sch->limit)) if (likely(skb_queue_len(&sch->q) < sch->limit))
return qdisc_enqueue_tail(skb, sch); return qdisc_enqueue_tail(skb, sch);
prev_backlog = sch->qstats.backlog;
/* queue full, remove one skb to fulfill the limit */ /* queue full, remove one skb to fulfill the limit */
__qdisc_queue_drop_head(sch, &sch->q); __qdisc_queue_drop_head(sch, &sch->q);
qdisc_qstats_drop(sch); qdisc_qstats_drop(sch);
qdisc_enqueue_tail(skb, sch); qdisc_enqueue_tail(skb, sch);
qdisc_tree_reduce_backlog(sch, 0, prev_backlog - sch->qstats.backlog);
return NET_XMIT_CN; return NET_XMIT_CN;
} }
......
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