diff options
Diffstat (limited to 'include/net/sch_generic.h')
-rw-r--r-- | include/net/sch_generic.h | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 3fe49d808957..f8c47429044a 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -53,7 +53,6 @@ struct Qdisc | |||
53 | atomic_t refcnt; | 53 | atomic_t refcnt; |
54 | unsigned long state; | 54 | unsigned long state; |
55 | struct sk_buff *gso_skb; | 55 | struct sk_buff *gso_skb; |
56 | struct sk_buff_head requeue; | ||
57 | struct sk_buff_head q; | 56 | struct sk_buff_head q; |
58 | struct netdev_queue *dev_queue; | 57 | struct netdev_queue *dev_queue; |
59 | struct Qdisc *next_sched; | 58 | struct Qdisc *next_sched; |
@@ -111,7 +110,7 @@ struct Qdisc_ops | |||
111 | 110 | ||
112 | int (*enqueue)(struct sk_buff *, struct Qdisc *); | 111 | int (*enqueue)(struct sk_buff *, struct Qdisc *); |
113 | struct sk_buff * (*dequeue)(struct Qdisc *); | 112 | struct sk_buff * (*dequeue)(struct Qdisc *); |
114 | int (*requeue)(struct sk_buff *, struct Qdisc *); | 113 | struct sk_buff * (*peek)(struct Qdisc *); |
115 | unsigned int (*drop)(struct Qdisc *); | 114 | unsigned int (*drop)(struct Qdisc *); |
116 | 115 | ||
117 | int (*init)(struct Qdisc *, struct nlattr *arg); | 116 | int (*init)(struct Qdisc *, struct nlattr *arg); |
@@ -432,19 +431,38 @@ static inline struct sk_buff *qdisc_dequeue_tail(struct Qdisc *sch) | |||
432 | return __qdisc_dequeue_tail(sch, &sch->q); | 431 | return __qdisc_dequeue_tail(sch, &sch->q); |
433 | } | 432 | } |
434 | 433 | ||
435 | static inline int __qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch, | 434 | static inline struct sk_buff *qdisc_peek_head(struct Qdisc *sch) |
436 | struct sk_buff_head *list) | ||
437 | { | 435 | { |
438 | __skb_queue_head(list, skb); | 436 | return skb_peek(&sch->q); |
439 | sch->qstats.backlog += qdisc_pkt_len(skb); | 437 | } |
440 | sch->qstats.requeues++; | ||
441 | 438 | ||
442 | return NET_XMIT_SUCCESS; | 439 | /* generic pseudo peek method for non-work-conserving qdisc */ |
440 | static inline struct sk_buff *qdisc_peek_dequeued(struct Qdisc *sch) | ||
441 | { | ||
442 | /* we can reuse ->gso_skb because peek isn't called for root qdiscs */ | ||
443 | if (!sch->gso_skb) { | ||
444 | sch->gso_skb = sch->dequeue(sch); | ||
445 | if (sch->gso_skb) | ||
446 | /* it's still part of the queue */ | ||
447 | sch->q.qlen++; | ||
448 | } | ||
449 | |||
450 | return sch->gso_skb; | ||
443 | } | 451 | } |
444 | 452 | ||
445 | static inline int qdisc_requeue(struct sk_buff *skb, struct Qdisc *sch) | 453 | /* use instead of qdisc->dequeue() for all qdiscs queried with ->peek() */ |
454 | static inline struct sk_buff *qdisc_dequeue_peeked(struct Qdisc *sch) | ||
446 | { | 455 | { |
447 | return __qdisc_requeue(skb, sch, &sch->q); | 456 | struct sk_buff *skb = sch->gso_skb; |
457 | |||
458 | if (skb) { | ||
459 | sch->gso_skb = NULL; | ||
460 | sch->q.qlen--; | ||
461 | } else { | ||
462 | skb = sch->dequeue(sch); | ||
463 | } | ||
464 | |||
465 | return skb; | ||
448 | } | 466 | } |
449 | 467 | ||
450 | static inline void __qdisc_reset_queue(struct Qdisc *sch, | 468 | static inline void __qdisc_reset_queue(struct Qdisc *sch, |