提交 c0afd9ce 编写于 作者: W WANG Cong 提交者: David S. Miller

fq_codel: fix return value of fq_codel_drop()

The ->drop() is supposed to return the number of bytes it dropped,
however fq_codel_drop() returns the index of the flow where it drops
a packet from.

Fix this by introducing a helper to wrap fq_codel_drop().

Cc: Eric Dumazet <edumazet@google.com>
Signed-off-by: NCong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: NCong Wang <cwang@twopensource.com>
Acked-by: NEric Dumazet <edumazet@google.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e8d092aa
...@@ -163,6 +163,15 @@ static unsigned int fq_codel_drop(struct Qdisc *sch) ...@@ -163,6 +163,15 @@ static unsigned int fq_codel_drop(struct Qdisc *sch)
return idx; return idx;
} }
static unsigned int fq_codel_qdisc_drop(struct Qdisc *sch)
{
unsigned int prev_backlog;
prev_backlog = sch->qstats.backlog;
fq_codel_drop(sch);
return prev_backlog - sch->qstats.backlog;
}
static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch) static int fq_codel_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{ {
struct fq_codel_sched_data *q = qdisc_priv(sch); struct fq_codel_sched_data *q = qdisc_priv(sch);
...@@ -604,7 +613,7 @@ static struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = { ...@@ -604,7 +613,7 @@ static struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = {
.enqueue = fq_codel_enqueue, .enqueue = fq_codel_enqueue,
.dequeue = fq_codel_dequeue, .dequeue = fq_codel_dequeue,
.peek = qdisc_peek_dequeued, .peek = qdisc_peek_dequeued,
.drop = fq_codel_drop, .drop = fq_codel_qdisc_drop,
.init = fq_codel_init, .init = fq_codel_init,
.reset = fq_codel_reset, .reset = fq_codel_reset,
.destroy = fq_codel_destroy, .destroy = fq_codel_destroy,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册