Skip to content

Commit 61c9eaf

Browse files
Jarek Poplawskidavem330
authored andcommitted
pkt_sched: Fix qdisc len in qdisc_peek_dequeued()
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0a36b34 commit 61c9eaf

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

include/net/sch_generic.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,8 +442,12 @@ static inline struct sk_buff *qdisc_peek_head(struct Qdisc *sch)
442442
static inline struct sk_buff *qdisc_peek_dequeued(struct Qdisc *sch)
443443
{
444444
/* we can reuse ->gso_skb because peek isn't called for root qdiscs */
445-
if (!sch->gso_skb)
445+
if (!sch->gso_skb) {
446446
sch->gso_skb = sch->dequeue(sch);
447+
if (sch->gso_skb)
448+
/* it's still part of the queue */
449+
sch->q.qlen++;
450+
}
447451

448452
return sch->gso_skb;
449453
}
@@ -453,10 +457,12 @@ static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch)
453457
{
454458
struct sk_buff *skb = sch->gso_skb;
455459

456-
if (skb)
460+
if (skb) {
457461
sch->gso_skb = NULL;
458-
else
462+
sch->q.qlen--;
463+
} else {
459464
skb = sch->dequeue(sch);
465+
}
460466

461467
return skb;
462468
}

0 commit comments

Comments
 (0)