diff options
author | David S. Miller <davem@davemloft.net> | 2008-07-16 06:12:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-07-17 22:21:28 -0400 |
commit | 78a5b30b7324b2d66bcf7d2e3935877d3c26497c (patch) | |
tree | a281f8611679c93c39cf6e9ff1e5b4121cbb8011 | |
parent | 53049978df1d9ae55bf397c9879e6b33218352db (diff) |
pkt_sched: Rework {sch,tbf}_tree_lock().
Make sch_tree_lock() lock the qdisc's root. All of the
users hold the RTNL semaphore and the root qdisc is not
changing.
Implement tbf_tree_{lock,unlock}() simply in terms of
sch_tree_{lock,unlock}().
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/sch_generic.h | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index 3cc4b5cd8c6a..60e1e9f9e453 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h | |||
@@ -183,10 +183,18 @@ static inline struct net_device *qdisc_dev(struct Qdisc *qdisc) | |||
183 | extern void qdisc_lock_tree(struct net_device *dev); | 183 | extern void qdisc_lock_tree(struct net_device *dev); |
184 | extern void qdisc_unlock_tree(struct net_device *dev); | 184 | extern void qdisc_unlock_tree(struct net_device *dev); |
185 | 185 | ||
186 | #define sch_tree_lock(q) qdisc_lock_tree(qdisc_dev(q)) | 186 | static inline void sch_tree_lock(struct Qdisc *q) |
187 | #define sch_tree_unlock(q) qdisc_unlock_tree(qdisc_dev(q)) | 187 | { |
188 | #define tcf_tree_lock(tp) qdisc_lock_tree(qdisc_dev((tp)->q)) | 188 | spin_lock_bh(qdisc_root_lock(q)); |
189 | #define tcf_tree_unlock(tp) qdisc_unlock_tree(qdisc_dev((tp)->q)) | 189 | } |
190 | |||
191 | static inline void sch_tree_unlock(struct Qdisc *q) | ||
192 | { | ||
193 | spin_unlock_bh(qdisc_root_lock(q)); | ||
194 | } | ||
195 | |||
196 | #define tcf_tree_lock(tp) sch_tree_lock((tp)->q) | ||
197 | #define tcf_tree_unlock(tp) sch_tree_unlock((tp)->q) | ||
190 | 198 | ||
191 | extern struct Qdisc noop_qdisc; | 199 | extern struct Qdisc noop_qdisc; |
192 | extern struct Qdisc_ops noop_qdisc_ops; | 200 | extern struct Qdisc_ops noop_qdisc_ops; |