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>
This commit is contained in:
@@ -440,7 +440,9 @@ static struct Qdisc_ops pfifo_fast_ops __read_mostly = {
|
||||
.owner = THIS_MODULE,
|
||||
};
|
||||
|
||||
struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops)
|
||||
struct Qdisc *qdisc_alloc(struct net_device *dev,
|
||||
struct netdev_queue *dev_queue,
|
||||
struct Qdisc_ops *ops)
|
||||
{
|
||||
void *p;
|
||||
struct Qdisc *sch;
|
||||
@@ -462,6 +464,7 @@ struct Qdisc *qdisc_alloc(struct net_device *dev, struct Qdisc_ops *ops)
|
||||
sch->ops = ops;
|
||||
sch->enqueue = ops->enqueue;
|
||||
sch->dequeue = ops->dequeue;
|
||||
sch->dev_queue = dev_queue;
|
||||
sch->dev = dev;
|
||||
dev_hold(dev);
|
||||
atomic_set(&sch->refcnt, 1);
|
||||
@@ -471,12 +474,14 @@ errout:
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
struct Qdisc * qdisc_create_dflt(struct net_device *dev, struct Qdisc_ops *ops,
|
||||
struct Qdisc * qdisc_create_dflt(struct net_device *dev,
|
||||
struct netdev_queue *dev_queue,
|
||||
struct Qdisc_ops *ops,
|
||||
unsigned int parentid)
|
||||
{
|
||||
struct Qdisc *sch;
|
||||
|
||||
sch = qdisc_alloc(dev, ops);
|
||||
sch = qdisc_alloc(dev, dev_queue, ops);
|
||||
if (IS_ERR(sch))
|
||||
goto errout;
|
||||
sch->stats_lock = &dev->queue_lock;
|
||||
@@ -545,7 +550,8 @@ void dev_activate(struct net_device *dev)
|
||||
if (dev->qdisc_sleeping == &noop_qdisc) {
|
||||
struct Qdisc *qdisc;
|
||||
if (dev->tx_queue_len) {
|
||||
qdisc = qdisc_create_dflt(dev, &pfifo_fast_ops,
|
||||
qdisc = qdisc_create_dflt(dev, &dev->tx_queue,
|
||||
&pfifo_fast_ops,
|
||||
TC_H_ROOT);
|
||||
if (qdisc == NULL) {
|
||||
printk(KERN_INFO "%s: activation failed\n", dev->name);
|
||||
|
Reference in New Issue
Block a user