From: Patrick McHardy <kaber@trash.net>
To: netdev@vger.kernel.org
Cc: Patrick McHardy <kaber@trash.net>
Subject: [RFC NET_SCHED 03/05]: Introduce child qdisc helpers
Date: Sun, 20 Jan 2008 19:28:53 +0100 (MET) [thread overview]
Message-ID: <20080120182852.10972.63289.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20080120182848.10972.46380.sendpatchset@localhost.localdomain>
commit a6d1954517202bffb14f5122756891d8c5b8e2e2
Author: Patrick McHardy <kaber@trash.net>
Date: Wed Jan 16 12:08:18 2008 +0100
[NET_SCHED]: Introduce child qdisc helpers
Introduce a few helpers to dispatch calls to child qdiscs without
repeating the qdisc argument every time.
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 3ade673..decc339 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -180,6 +180,26 @@ extern struct Qdisc *qdisc_create_dflt(struct net_device *dev,
extern void tcf_destroy(struct tcf_proto *tp);
extern void tcf_destroy_chain(struct tcf_proto *fl);
+static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
+{
+ return sch->enqueue(skb, sch);
+}
+
+static inline struct sk_buff *qdisc_dequeue(struct Qdisc *sch)
+{
+ return sch->dequeue(sch);
+}
+
+static inline int qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch)
+{
+ return sch->ops->requeue(skb, sch);
+}
+
+static inline unsigned int qdisc_drop(struct Qdisc *sch)
+{
+ return sch->ops->drop ? sch->ops->drop(sch) : 0;
+}
+
static inline int __qdisc_q_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
struct sk_buff_head *list)
{
@@ -278,7 +298,7 @@ static inline unsigned int qdisc_q_drop(struct Qdisc *sch)
return __qdisc_q_drop(sch, &sch->q);
}
-static inline int qdisc_drop(struct sk_buff *skb, struct Qdisc *sch)
+static inline int qdisc_drop_skb(struct sk_buff *skb, struct Qdisc *sch)
{
kfree_skb(skb);
sch->qstats.drops++;
diff --git a/net/sched/sch_blackhole.c b/net/sched/sch_blackhole.c
index 507fb48..ac374eb 100644
--- a/net/sched/sch_blackhole.c
+++ b/net/sched/sch_blackhole.c
@@ -19,7 +19,7 @@
static int blackhole_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{
- qdisc_drop(skb, sch);
+ qdisc_drop_skb(skb, sch);
return NET_XMIT_SUCCESS;
}
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 6afd59e..8e186e1 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -347,7 +347,7 @@ static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc)
return __qdisc_q_enqueue_tail(skb, qdisc, list);
}
- return qdisc_drop(skb, qdisc);
+ return qdisc_drop_skb(skb, qdisc);
}
static struct sk_buff *pfifo_fast_dequeue(struct Qdisc* qdisc)
diff --git a/net/sched/sch_gred.c b/net/sched/sch_gred.c
index d933565..ca65e7c 100644
--- a/net/sched/sch_gred.c
+++ b/net/sched/sch_gred.c
@@ -233,10 +233,10 @@ static int gred_enqueue(struct sk_buff *skb, struct Qdisc* sch)
q->stats.pdrop++;
drop:
- return qdisc_drop(skb, sch);
+ return qdisc_drop_skb(skb, sch);
congestion_drop:
- qdisc_drop(skb, sch);
+ qdisc_drop_skb(skb, sch);
return NET_XMIT_CN;
}
@@ -316,7 +316,7 @@ static unsigned int gred_drop(struct Qdisc* sch)
red_start_of_idle_period(&q->parms);
}
- qdisc_drop(skb, sch);
+ qdisc_drop_skb(skb, sch);
return len;
}
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index 699f83d..acf06d9 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -104,7 +104,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
return ret;
congestion_drop:
- qdisc_drop(skb, sch);
+ qdisc_drop_skb(skb, sch);
return NET_XMIT_CN;
}
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index c58fa6e..0b46589 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -257,7 +257,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc* sch)
* i.e. drop _this_ packet.
*/
if (q->qs[x].qlen >= q->limit)
- return qdisc_drop(skb, sch);
+ return qdisc_drop_skb(skb, sch);
sch->qstats.backlog += skb->len;
__skb_queue_tail(&q->qs[x], skb);
next prev parent reply other threads:[~2008-01-20 18:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-20 18:28 [RFC NET_SCHED 00/05]: Pseudo-classful qdisc consolidation Patrick McHardy
2008-01-20 18:28 ` [RFC NET_SCHED 01/05]: Consolidate default fifo setup Patrick McHardy
2008-01-20 18:28 ` [RFC NET_SCHED 02/05]: Rename qdisc helpers for built-in queue Patrick McHardy
2008-01-20 18:28 ` Patrick McHardy [this message]
2008-01-20 18:28 ` [RFC NET_SCHED 04/05]: Use qdisc helpers Patrick McHardy
2008-01-20 18:28 ` [RFC NET_SCHED 05/05]: Consolidate class ops for pseudo classful qdisc Patrick McHardy
2008-01-20 18:32 ` Patrick McHardy
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=20080120182852.10972.63289.sendpatchset@localhost.localdomain \
--to=kaber@trash.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.