aboutsummaryrefslogtreecommitdiff
path: root/include/net/sch_generic.h
diff options
context:
space:
mode:
authorHagen Paul Pfeifer <hagen@jauu.net>2010-01-24 12:30:59 +0000
committerDavid S. Miller <davem@davemloft.net>2010-01-28 21:27:00 -0800
commit57dbb2d83d100ea601c54fe129bfde0678db5dee (patch)
tree40305bcd986692f512b1b5e848c0b0f612968c6a /include/net/sch_generic.h
parentd74340d31bf1dbeb00acadddd8697666528a7846 (diff)
sched: add head drop fifo queue
This adds an additional queuing strategy, called pfifo_head_drop, to remove the oldest skb in the case of an overflow within the queue - the head element - instead of the last skb (tail). To remove the oldest skb in congested situations is useful for sensor network environments where newer packets reflect the superior information. Reviewed-by: Florian Westphal <fw@strlen.de> Acked-by: Patrick McHardy <kaber@trash.net> Signed-off-by: Hagen Paul Pfeifer <hagen@jauu.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r--include/net/sch_generic.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index dad558bc06f..67dc08eaaa4 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -427,6 +427,25 @@ static inline struct sk_buff *qdisc_dequeue_head(struct Qdisc *sch)
return __qdisc_dequeue_head(sch, &sch->q);
}
+static inline unsigned int __qdisc_queue_drop_head(struct Qdisc *sch,
+ struct sk_buff_head *list)
+{
+ struct sk_buff *skb = __qdisc_dequeue_head(sch, list);
+
+ if (likely(skb != NULL)) {
+ unsigned int len = qdisc_pkt_len(skb);
+ kfree_skb(skb);
+ return len;
+ }
+
+ return 0;
+}
+
+static inline unsigned int qdisc_queue_drop_head(struct Qdisc *sch)
+{
+ return __qdisc_queue_drop_head(sch, &sch->q);
+}
+
static inline struct sk_buff *__qdisc_dequeue_tail(struct Qdisc *sch,
struct sk_buff_head *list)
{