From: Florian Westphal <fw@strlen.de>
To: <netdev@vger.kernel.org>
Cc: Florian Westphal <fw@strlen.de>
Subject: [PATCH net-next 3/5] sched: remove qdisc arg from __qdisc_dequeue_head
Date: Sun, 18 Sep 2016 00:57:32 +0200 [thread overview]
Message-ID: <1474153054-9059-4-git-send-email-fw@strlen.de> (raw)
In-Reply-To: <1474153054-9059-1-git-send-email-fw@strlen.de>
Moves qdisc stat accouting to qdisc_dequeue_head.
The only direct caller of the __qdisc_dequeue_head version open-codes
this now.
This allows us to later use __qdisc_dequeue_head as a replacement
of __skb_dequeue() (which operates on sk_buff_head list).
Signed-off-by: Florian Westphal <fw@strlen.de>
---
include/net/sch_generic.h | 15 ++++++++-------
net/sched/sch_generic.c | 7 ++++++-
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 52a2015..0741ed4 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -614,11 +614,17 @@ static inline int qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch)
return __qdisc_enqueue_tail(skb, sch, &sch->q);
}
-static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch,
- struct sk_buff_head *list)
+static inline struct sk_buff *__qdisc_dequeue_head(struct sk_buff_head *list)
{
struct sk_buff *skb = __skb_dequeue(list);
+ return skb;
+}
+
+static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch)
+{
+ struct sk_buff *skb = __qdisc_dequeue_head(&sch->q);
+
if (likely(skb != NULL)) {
qdisc_qstats_backlog_dec(sch, skb);
qdisc_bstats_update(sch, skb);
@@ -627,11 +633,6 @@ static inline struct sk_buff *__qdisc_dequeue_head(struct Qdisc *sch,
return skb;
}
-static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch)
-{
- return __qdisc_dequeue_head(sch, &sch->q);
-}
-
/* Instead of calling kfree_skb() while root qdisc lock is held,
* queue the skb for future freeing at end of __dev_xmit_skb()
*/
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 5e63bf6..73877d9 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -506,7 +506,12 @@ static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
if (likely(band >= 0)) {
struct sk_buff_head *list = band2list(priv, band);
- struct sk_buff *skb = __qdisc_dequeue_head(qdisc, list);
+ struct sk_buff *skb = __qdisc_dequeue_head(list);
+
+ if (likely(skb != NULL)) {
+ qdisc_qstats_backlog_dec(qdisc, skb);
+ qdisc_bstats_update(qdisc, skb);
+ }
qdisc->q.qlen--;
if (skb_queue_empty(list))
--
2.7.3
next prev parent reply other threads:[~2016-09-17 22:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-17 22:57 [PATCH net-next 0/5] sched: convert queues to single-linked list Florian Westphal
2016-09-17 22:57 ` [PATCH net-next 1/5] pie: use qdisc_dequeue_head wrapper Florian Westphal
2016-09-17 22:57 ` [PATCH net-next 2/5] sched: don't use skb queue helpers Florian Westphal
2016-09-17 22:57 ` Florian Westphal [this message]
2016-09-17 22:57 ` [PATCH net-next 4/5] sched: replace __skb_dequeue with __qdisc_dequeue_head Florian Westphal
2016-09-17 22:57 ` [PATCH net-next 5/5] sched: add and use qdisc_skb_head helpers Florian Westphal
2016-09-19 5:47 ` [PATCH net-next 0/5] sched: convert queues to single-linked list 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=1474153054-9059-4-git-send-email-fw@strlen.de \
--to=fw@strlen.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).