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>
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index d970864..b626a4f 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -364,7 +364,7 @@
{
struct sk_buff_head *list = prio2list(skb, qdisc);
- if (skb_queue_len(list) < qdisc->dev->tx_queue_len) {
+ if (skb_queue_len(list) < qdisc_dev(qdisc)->tx_queue_len) {
qdisc->q.qlen++;
return __qdisc_enqueue_tail(skb, qdisc, list);
}
@@ -440,8 +440,7 @@
.owner = THIS_MODULE,
};
-struct Qdisc *qdisc_alloc(struct net_device *dev,
- struct netdev_queue *dev_queue,
+struct Qdisc *qdisc_alloc(struct netdev_queue *dev_queue,
struct Qdisc_ops *ops)
{
void *p;
@@ -465,8 +464,7 @@
sch->enqueue = ops->enqueue;
sch->dequeue = ops->dequeue;
sch->dev_queue = dev_queue;
- sch->dev = dev;
- dev_hold(dev);
+ dev_hold(qdisc_dev(sch));
atomic_set(&sch->refcnt, 1);
return sch;
@@ -481,7 +479,7 @@
{
struct Qdisc *sch;
- sch = qdisc_alloc(dev, dev_queue, ops);
+ sch = qdisc_alloc(dev_queue, ops);
if (IS_ERR(sch))
goto errout;
sch->stats_lock = &dev->queue_lock;
@@ -534,7 +532,7 @@
ops->destroy(qdisc);
module_put(ops->owner);
- dev_put(qdisc->dev);
+ dev_put(qdisc_dev(qdisc));
call_rcu(&qdisc->q_rcu, __qdisc_destroy);
}
EXPORT_SYMBOL(qdisc_destroy);