diff options
author | David S. Miller <davem@davemloft.net> | 2008-07-16 04:42:40 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-17 22:21:19 -0400 |
commit | 7698b4fcabcd790efc4f226bada1e7b5870653af (patch) | |
tree | 031ce7a911fc5bff995421a5615d9ab25416a479 /include/net | |
parent | e2627c8c2241bce45e368e150654d076b58a4595 (diff) |
pkt_sched: Add and use qdisc_root() and qdisc_root_lock().
When code wants to lock the qdisc tree state, the logic
operation it's doing is locking the top-level qdisc that
sits of the root of the netdev_queue.
Add qdisc_root_lock() to represent this and convert the
easiest cases.
In order for this to work out in all cases, we have to
hook up the noop_qdisc to a dummy netdev_queue.
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/sch_generic.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index bc2a09da21b1..92417825d387 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -161,6 +161,18 @@ struct tcf_proto | |||
161 | struct tcf_proto_ops *ops; | 161 | struct tcf_proto_ops *ops; |
162 | }; | 162 | }; |
163 | 163 | ||
164 | static inline struct Qdisc *qdisc_root(struct Qdisc *qdisc) | ||
165 | { | ||
166 | return qdisc->dev_queue->qdisc; | ||
167 | } | ||
168 | |||
169 | static inline spinlock_t *qdisc_root_lock(struct Qdisc *qdisc) | ||
170 | { | ||
171 | struct Qdisc *root = qdisc_root(qdisc); | ||
172 | |||
173 | return &root->dev_queue->lock; | ||
174 | } | ||
175 | |||
164 | static inline struct net_device *qdisc_dev(struct Qdisc *qdisc) | 176 | static inline struct net_device *qdisc_dev(struct Qdisc *qdisc) |
165 | { | 177 | { |
166 | return qdisc->dev_queue->dev; | 178 | return qdisc->dev_queue->dev; |