diff options
| author | David S. Miller <davem@davemloft.net> | 2008-09-23 01:15:30 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2008-09-23 01:15:30 -0400 |
| commit | 242f8bfefe4bed626df4e4727ac8f315d80b567a (patch) | |
| tree | 44047828a0092e87def4e5c0edfefeadc96a89f8 /net/sched | |
| parent | 3d09274cc9d816d62945408840a9cb76a5e7aac7 (diff) | |
pkt_sched: Make qdisc->gso_skb a list.
The idea is that we can use this to get rid of
->requeue().
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
| -rw-r--r-- | net/sched/sch_generic.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index ec0a0839ce51..5961536be60c 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c | |||
| @@ -45,7 +45,7 @@ static inline int qdisc_qlen(struct Qdisc *q) | |||
| 45 | static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) | 45 | static inline int dev_requeue_skb(struct sk_buff *skb, struct Qdisc *q) |
| 46 | { | 46 | { |
| 47 | if (unlikely(skb->next)) | 47 | if (unlikely(skb->next)) |
| 48 | q->gso_skb = skb; | 48 | __skb_queue_head(&q->requeue, skb); |
| 49 | else | 49 | else |
| 50 | q->ops->requeue(skb, q); | 50 | q->ops->requeue(skb, q); |
| 51 | 51 | ||
| @@ -57,9 +57,8 @@ static inline struct sk_buff *dequeue_skb(struct Qdisc *q) | |||
| 57 | { | 57 | { |
| 58 | struct sk_buff *skb; | 58 | struct sk_buff *skb; |
| 59 | 59 | ||
| 60 | if ((skb = q->gso_skb)) | 60 | skb = __skb_dequeue(&q->requeue); |
| 61 | q->gso_skb = NULL; | 61 | if (!skb) |
| 62 | else | ||
| 63 | skb = q->dequeue(q); | 62 | skb = q->dequeue(q); |
| 64 | 63 | ||
| 65 | return skb; | 64 | return skb; |
| @@ -327,6 +326,7 @@ struct Qdisc noop_qdisc = { | |||
| 327 | .flags = TCQ_F_BUILTIN, | 326 | .flags = TCQ_F_BUILTIN, |
| 328 | .ops = &noop_qdisc_ops, | 327 | .ops = &noop_qdisc_ops, |
| 329 | .list = LIST_HEAD_INIT(noop_qdisc.list), | 328 | .list = LIST_HEAD_INIT(noop_qdisc.list), |
| 329 | .requeue.lock = __SPIN_LOCK_UNLOCKED(noop_qdisc.q.lock), | ||
| 330 | .q.lock = __SPIN_LOCK_UNLOCKED(noop_qdisc.q.lock), | 330 | .q.lock = __SPIN_LOCK_UNLOCKED(noop_qdisc.q.lock), |
| 331 | .dev_queue = &noop_netdev_queue, | 331 | .dev_queue = &noop_netdev_queue, |
| 332 | }; | 332 | }; |
| @@ -352,6 +352,7 @@ static struct Qdisc noqueue_qdisc = { | |||
| 352 | .flags = TCQ_F_BUILTIN, | 352 | .flags = TCQ_F_BUILTIN, |
| 353 | .ops = &noqueue_qdisc_ops, | 353 | .ops = &noqueue_qdisc_ops, |
| 354 | .list = LIST_HEAD_INIT(noqueue_qdisc.list), | 354 | .list = LIST_HEAD_INIT(noqueue_qdisc.list), |
| 355 | .requeue.lock = __SPIN_LOCK_UNLOCKED(noqueue_qdisc.q.lock), | ||
| 355 | .q.lock = __SPIN_LOCK_UNLOCKED(noqueue_qdisc.q.lock), | 356 | .q.lock = __SPIN_LOCK_UNLOCKED(noqueue_qdisc.q.lock), |
| 356 | .dev_queue = &noqueue_netdev_queue, | 357 | .dev_queue = &noqueue_netdev_queue, |
| 357 | }; | 358 | }; |
| @@ -472,6 +473,7 @@ struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue, | |||
| 472 | sch->padded = (char *) sch - (char *) p; | 473 | sch->padded = (char *) sch - (char *) p; |
| 473 | 474 | ||
| 474 | INIT_LIST_HEAD(&sch->list); | 475 | INIT_LIST_HEAD(&sch->list); |
| 476 | skb_queue_head_init(&sch->requeue); | ||
| 475 | skb_queue_head_init(&sch->q); | 477 | skb_queue_head_init(&sch->q); |
| 476 | sch->ops = ops; | 478 | sch->ops = ops; |
| 477 | sch->enqueue = ops->enqueue; | 479 | sch->enqueue = ops->enqueue; |
| @@ -539,7 +541,7 @@ void qdisc_destroy(struct Qdisc *qdisc) | |||
| 539 | module_put(ops->owner); | 541 | module_put(ops->owner); |
| 540 | dev_put(qdisc_dev(qdisc)); | 542 | dev_put(qdisc_dev(qdisc)); |
| 541 | 543 | ||
| 542 | kfree_skb(qdisc->gso_skb); | 544 | __skb_queue_purge(&qdisc->requeue); |
| 543 | 545 | ||
| 544 | kfree((char *) qdisc - qdisc->padded); | 546 | kfree((char *) qdisc - qdisc->padded); |
| 545 | } | 547 | } |
