aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_generic.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2008-07-08 19:55:56 -0400
committerDavid S. Miller <davem@davemloft.net>2008-07-08 19:55:56 -0400
commitbb949fbd1878973c3539d9aecff52f284482a937 (patch)
treee8bde854b18be79723502167c16e2131914a75b7 /net/sched/sch_generic.c
parente65d22e18038eed7307276e46810d884c402d57d (diff)
netdev: Create netdev_queue abstraction.
A netdev_queue is an entity managed by a qdisc. Currently there is one RX and one TX queue, and a netdev_queue merely contains a backpointer to the net_device. The Qdisc struct is augmented with a netdev_queue pointer as well. Eventually the 'dev' Qdisc member will go away and we will have the resulting hierarchy: net_device --> netdev_queue --> Qdisc Also, qdisc_alloc() and qdisc_create_dflt() now take a netdev_queue 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.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 13afa7214392..d97086480893 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -440,7 +440,9 @@ 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, struct Qdisc_ops *ops) 443struct Qdisc *qdisc_alloc(struct net_device *dev,
444 struct netdev_queue *dev_queue,
445 struct Qdisc_ops *ops)
444{ 446{
445 void *p; 447 void *p;
446 struct Qdisc *sch; 448 struct Qdisc *sch;
@@ -462,6 +464,7 @@ struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops)
462 sch->ops = ops; 464 sch->ops = ops;
463 sch->enqueue = ops->enqueue; 465 sch->enqueue = ops->enqueue;
464 sch->dequeue = ops->dequeue; 466 sch->dequeue = ops->dequeue;
467 sch->dev_queue = dev_queue;
465 sch->dev = dev; 468 sch->dev = dev;
466 dev_hold(dev); 469 dev_hold(dev);
467 atomic_set(&sch->refcnt, 1); 470 atomic_set(&sch->refcnt, 1);
@@ -471,12 +474,14 @@ errout:
471 return ERR_PTR(err); 474 return ERR_PTR(err);
472} 475}
473 476
474struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops, 477struct Qdisc * qdisc_create_dflt(struct net_device *dev,
478 struct netdev_queue *dev_queue,
479 struct Qdisc_ops *ops,
475 unsigned int parentid) 480 unsigned int parentid)
476{ 481{
477 struct Qdisc *sch; 482 struct Qdisc *sch;
478 483
479 sch = qdisc_alloc(dev, ops); 484 sch = qdisc_alloc(dev, dev_queue, ops);
480 if (IS_ERR(sch)) 485 if (IS_ERR(sch))
481 goto errout; 486 goto errout;
482 sch->stats_lock = &dev->queue_lock; 487 sch->stats_lock = &dev->queue_lock;
@@ -545,7 +550,8 @@ void dev_activate(struct net_device *dev)
545 if (dev->qdisc_sleeping == &noop_qdisc) { 550 if (dev->qdisc_sleeping == &noop_qdisc) {
546 struct Qdisc *qdisc; 551 struct Qdisc *qdisc;
547 if (dev->tx_queue_len) { 552 if (dev->tx_queue_len) {
548 qdisc = qdisc_create_dflt(dev, &pfifo_fast_ops, 553 qdisc = qdisc_create_dflt(dev, &dev->tx_queue,
554 &pfifo_fast_ops,
549 TC_H_ROOT); 555 TC_H_ROOT);
550 if (qdisc == NULL) { 556 if (qdisc == NULL) {
551 printk(KERN_INFO "%s: activation failed\n", dev->name); 557 printk(KERN_INFO "%s: activation failed\n", dev->name);