X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Fnet%2Fsch_generic.h;h=3d78a4d224601f5003aef260f4363bc88707d3be;hb=984947dc64f82bc6cafa4d84ba1a139718f634a8;hp=3fe49d808957309f29f1cb9532892fc06e936f2e;hpb=7b3b6e42032e94a6132a85642e95106f5346650e;p=pandora-kernel.git diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 3fe49d808957..3d78a4d22460 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -42,9 +42,10 @@ struct Qdisc int (*enqueue)(struct sk_buff *skb, struct Qdisc *dev); struct sk_buff * (*dequeue)(struct Qdisc *dev); unsigned flags; -#define TCQ_F_BUILTIN 1 -#define TCQ_F_THROTTLED 2 -#define TCQ_F_INGRESS 4 +#define TCQ_F_BUILTIN 1 +#define TCQ_F_THROTTLED 2 +#define TCQ_F_INGRESS 4 +#define TCQ_F_WARN_NONWC (1 << 16) int padded; struct Qdisc_ops *ops; struct qdisc_size_table *stab; @@ -53,7 +54,6 @@ struct Qdisc atomic_t refcnt; unsigned long state; struct sk_buff *gso_skb; - struct sk_buff_head requeue; struct sk_buff_head q; struct netdev_queue *dev_queue; struct Qdisc *next_sched; @@ -111,7 +111,7 @@ struct Qdisc_ops int (*enqueue)(struct sk_buff *, struct Qdisc *); struct sk_buff * (*dequeue)(struct Qdisc *); - int (*requeue)(struct sk_buff *, struct Qdisc *); + struct sk_buff * (*peek)(struct Qdisc *); unsigned int (*drop)(struct Qdisc *); int (*init)(struct Qdisc *, struct nlattr *arg); @@ -432,19 +432,38 @@ static inline struct sk_buff *qdisc_dequeue_tail(struct Qdisc *sch) return __qdisc_dequeue_tail(sch, &sch->q); } -static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch, - struct sk_buff_head *list) +static inline struct sk_buff *qdisc_peek_head(struct Qdisc *sch) { - __skb_queue_head(list, skb); - sch->qstats.backlog += qdisc_pkt_len(skb); - sch->qstats.requeues++; + return skb_peek(&sch->q); +} - return NET_XMIT_SUCCESS; +/* 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); + if (sch->gso_skb) + /* it's still part of the queue */ + sch->q.qlen++; + } + + return sch->gso_skb; } -static inline int qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch) +/* use instead of qdisc->dequeue() for all qdiscs queried with ->peek() */ +static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch) { - return __qdisc_requeue(skb, sch, &sch->q); + struct sk_buff *skb = sch->gso_skb; + + if (skb) { + sch->gso_skb = NULL; + sch->q.qlen--; + } else { + skb = sch->dequeue(sch); + } + + return skb; } static inline void __qdisc_reset_queue(struct Qdisc *sch,