summaryrefslogtreecommitdiffstats
path: root/include/net/sch_generic.h
diff options
context:
space:
mode:
authorJarek Poplawski <jarkao2@gmail.com>2008-10-31 08:47:01 +0100
committerDavid S. Miller <davem@davemloft.net>2008-10-31 08:47:01 +0100
commit77be155cba4e163e8bba9fd27222a8b6189ec4f7 (patch)
tree0819d4c0bb760080aaba8a00060a774205914034 /include/net/sch_generic.h
parentpkt_sched: Use qdisc->ops->peek() instead of ->dequeue() & ->requeue() (diff)
downloadlinux-77be155cba4e163e8bba9fd27222a8b6189ec4f7.tar.xz
linux-77be155cba4e163e8bba9fd27222a8b6189ec4f7.zip
pkt_sched: Add peek emulation for non-work-conserving qdiscs.
This patch adds qdisc_peek_dequeued() wrapper to emulate peek method with qdisc->dequeue() and storing "peeked" skb in qdisc->gso_skb until dequeuing. This is mainly for compatibility reasons not to break some strange configs because peeking is expected for non-work-conserving parent qdiscs to query work-conserving child qdiscs. This implementation requires using qdisc_dequeue_peeked() wrapper instead of directly calling qdisc->dequeue() for all qdiscs ever querried with qdisc->ops->peek() or qdisc_peek_dequeued(). Signed-off-by: Jarek Poplawski <jarkao2@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r--include/net/sch_generic.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index da6839a7ff50..9dcb5bfe094a 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -438,6 +438,29 @@ static inline struct sk_buff *qdisc_peek_head(struct Qdisc *sch)
return skb_peek(&sch->q);
}
+/* generic pseudo peek method for non-work-conserving qdisc */
+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)
+ sch->gso_skb = sch->dequeue(sch);
+
+ return sch->gso_skb;
+}
+
+/* use instead of qdisc->dequeue() for all qdiscs queried with ->peek() */
+static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch)
+{
+ struct sk_buff *skb = sch->gso_skb;
+
+ if (skb)
+ sch->gso_skb = NULL;
+ else
+ skb = sch->dequeue(sch);
+
+ return skb;
+}
+
static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch,
struct sk_buff_head *list)
{