aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_generic.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-07-08 20:06:30 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-08 20:06:30 -0400
commit5ce2d488fe039ddd86a638496cf704df86c74eeb (patch)
tree71b4d982bfa8bd457bb41c0693c0e70d75b524b4 /net/sched/sch_generic.c
parentbb949fbd1878973c3539d9aecff52f284482a937 (diff)
pkt_sched: Remove 'dev' member of struct Qdisc.
It can be obtained via the netdev_queue. So create a helper routine, qdisc_dev(), to make the transformations nicer looking. Now, qdisc_alloc() now no longer needs a net_device pointer argument. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_generic.c')
-rw-r--r--net/sched/sch_generic.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index d97086480893..b626a4f32b6b 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -364,7 +364,7 @@ static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc* qdisc)
364{ 364{
365 struct sk_buff_head *list = prio2list(skb, qdisc); 365 struct sk_buff_head *list = prio2list(skb, qdisc);
366 366
367 if (skb_queue_len(list) < qdisc->dev->tx_queue_len) { 367 if (skb_queue_len(list) < qdisc_dev(qdisc)->tx_queue_len) {
368 qdisc->q.qlen++; 368 qdisc->q.qlen++;
369 return __qdisc_enqueue_tail(skb, qdisc, list); 369 return __qdisc_enqueue_tail(skb, qdisc, list);
370 } 370 }
@@ -440,8 +440,7 @@ static struct Qdisc_ops pfifo_fast_ops __read_mostly = {
440 .owner = THIS_MODULE, 440 .owner = THIS_MODULE,
441}; 441};
442 442
443struct Qdisc *qdisc_alloc(struct net_device *dev, 443struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
444 struct netdev_queue *dev_queue,
445 struct Qdisc_ops *ops) 444 struct Qdisc_ops *ops)
446{ 445{
447 void *p; 446 void *p;
@@ -465,8 +464,7 @@ struct Qdisc *qdisc_alloc(struct net_device *dev,
465 sch->enqueue = ops->enqueue; 464 sch->enqueue = ops->enqueue;
466 sch->dequeue = ops->dequeue; 465 sch->dequeue = ops->dequeue;
467 sch->dev_queue = dev_queue; 466 sch->dev_queue = dev_queue;
468 sch->dev = dev; 467 dev_hold(qdisc_dev(sch));
469 dev_hold(dev);
470 atomic_set(&sch->refcnt, 1); 468 atomic_set(&sch->refcnt, 1);
471 469
472 return sch; 470 return sch;
@@ -481,7 +479,7 @@ struct Qdisc * qdisc_create_dflt(struct net_device *dev,
481{ 479{
482 struct Qdisc *sch; 480 struct Qdisc *sch;
483 481
484 sch = qdisc_alloc(dev, dev_queue, ops); 482 sch = qdisc_alloc(dev_queue, ops);
485 if (IS_ERR(sch)) 483 if (IS_ERR(sch))
486 goto errout; 484 goto errout;
487 sch->stats_lock = &dev->queue_lock; 485 sch->stats_lock = &dev->queue_lock;
@@ -534,7 +532,7 @@ void qdisc_destroy(struct Qdisc *qdisc)
534 ops->destroy(qdisc); 532 ops->destroy(qdisc);
535 533
536 module_put(ops->owner); 534 module_put(ops->owner);
537 dev_put(qdisc->dev); 535 dev_put(qdisc_dev(qdisc));
538 call_rcu(&qdisc->q_rcu, __qdisc_destroy); 536 call_rcu(&qdisc->q_rcu, __qdisc_destroy);
539} 537}
540EXPORT_SYMBOL(qdisc_destroy); 538EXPORT_SYMBOL(qdisc_destroy);