From: Jarek Poplawski <jarkao2@gmail.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next] pkt_sched: Fix qdisc len in qdisc_peek_dequeued()
Date: Wed, 5 Nov 2008 13:44:54 +0000 [thread overview]
Message-ID: <20081105134454.GA9376@ff.dom.local> (raw)
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 <jarkao2@gmail.com>
---
include/net/sch_generic.h | 12 +++++++++---
1 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 9dcb5bf..64ae1ba 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -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;
}
@@ -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;
}
next reply other threads:[~2008-11-05 13:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-05 13:44 Jarek Poplawski [this message]
2008-11-06 0:02 ` [PATCH net-next] pkt_sched: Fix qdisc len in qdisc_peek_dequeued() David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20081105134454.GA9376@ff.dom.local \
--to=jarkao2@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.