Patchwork [01/14] pkt_sched: Add qdisc_dequeue() helper.

login
register
mail settings
Submitter Jarek Poplawski
Date Oct. 14, 2008, 9:53 a.m.
Message ID <20081014095308.GB10804@ff.dom.local>
Download mbox | patch
Permalink /patch/4426/
State RFC
Delegated to: David Miller
Headers show

Comments

Jarek Poplawski - Oct. 14, 2008, 9:53 a.m.
-------- Original Message --------
Subject: [PATCH 3/9]: pkt_sched: Add qdisc_dequeue() helper.
Date: Mon, 18 Aug 2008 01:36:55 -0700 (PDT)
From: David Miller <davem@davemloft.net>

Modified sch_generic.c part.

------------->
From: David Miller <davem@davemloft.net>
pkt_sched: Add qdisc_dequeue() helper.

It prioritizes packets on the ->requeue list.

Use in qdisc_restart() as it's basically a complete
copy of dequeue_skb().

Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---
 include/net/sch_generic.h |    8 ++++++++
 net/sched/sch_generic.c   |    2 +-
 2 files changed, 9 insertions(+), 1 deletions(-)

Patch

diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 3fe49d8..00c1309 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -369,6 +369,14 @@  enum net_xmit_qdisc_t {
 #define net_xmit_drop_count(e)	(1)
 #endif
 
+static inline struct sk_buff *qdisc_dequeue(struct Qdisc *sch)
+{
+	struct sk_buff *skb = __skb_dequeue(&sch->requeue);
+	if (!skb)
+		skb = sch->dequeue(sch);
+	return skb;
+}
+
 static inline int qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
 {
 #ifdef CONFIG_NET_SCHED
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 7b5572d..6730bac 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -66,7 +66,7 @@  static inline struct sk_buff *dequeue_skb(struct Qdisc *q)
 		else
 			skb = NULL;
 	} else {
-		skb = q->dequeue(q);
+		skb = qdisc_dequeue(q);
 	}
 
 	return skb;