Skip to content

Commit

Permalink
pkt_sched: Fix qdisc len in qdisc_peek_dequeued()
Browse files Browse the repository at this point in the history
A packet dequeued and stored as gso_skb in qdisc_peek_dequeued() should
be seen as part of the queue for sch->q.qlen queries until it's really
dequeued with qdisc_dequeue_peeked(), so qlen needs additional updating
in these functions. (Updating qstats.backlog shouldn't matter here.)

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jarek Poplawski authored and David S. Miller committed Nov 6, 2008
1 parent 0a36b34 commit 61c9eaf
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions include/net/sch_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,12 @@ static inline struct sk_buff *qdisc_peek_head(struct Qdisc *sch)
static inline struct sk_buff *qdisc_peek_dequeued(struct Qdisc *sch)
{
/* we can reuse ->gso_skb because peek isn't called for root qdiscs */
if (!sch->gso_skb)
if (!sch->gso_skb) {
sch->gso_skb = sch->dequeue(sch);
if (sch->gso_skb)
/* it's still part of the queue */
sch->q.qlen++;
}

return sch->gso_skb;
}
Expand All @@ -453,10 +457,12 @@ static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch)
{
struct sk_buff *skb = sch->gso_skb;

if (skb)
if (skb) {
sch->gso_skb = NULL;
else
sch->q.qlen--;
} else {
skb = sch->dequeue(sch);
}

return skb;
}
Expand Down

0 comments on commit 61c9eaf

Please sign in to comment.