Skip to content

Commit

Permalink
fq_codel: fix return value of fq_codel_drop()
Browse files Browse the repository at this point in the history
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: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Cong Wang <cwang@twopensource.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
WANG Cong authored and David S. Miller committed Jul 16, 2015
1 parent e8d092a commit c0afd9c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion net/sched/sch_fq_codel.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,15 @@ static unsigned int fq_codel_drop(struct Qdisc *sch)
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)
{
struct fq_codel_sched_data *q = qdisc_priv(sch);
Expand Down Expand Up @@ -604,7 +613,7 @@ static struct Qdisc_ops fq_codel_qdisc_ops __read_mostly = {
.enqueue = fq_codel_enqueue,
.dequeue = fq_codel_dequeue,
.peek = qdisc_peek_dequeued,
.drop = fq_codel_drop,
.drop = fq_codel_qdisc_drop,
.init = fq_codel_init,
.reset = fq_codel_reset,
.destroy = fq_codel_destroy,
Expand Down

0 comments on commit c0afd9c

Please sign in to comment.