]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
pkt_sched: Rework {sch,tbf}_tree_lock().
authorDavid S. Miller <davem@davemloft.net>
Wed, 16 Jul 2008 10:12:24 +0000 (03:12 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 Jul 2008 02:21:28 +0000 (19:21 -0700)
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>
include/net/sch_generic.h

index 3cc4b5cd8c6a16c4301f5b37c5a0960648939cb3..60e1e9f9e453e4de31a9642f4b57081322a5c726 100644 (file)
@@ -183,10 +183,18 @@ static inline struct net_device *qdisc_dev(struct Qdisc *qdisc)
 extern void qdisc_lock_tree(struct net_device *dev);
 extern void qdisc_unlock_tree(struct net_device *dev);
 
-#define sch_tree_lock(q)       qdisc_lock_tree(qdisc_dev(q))
-#define sch_tree_unlock(q)     qdisc_unlock_tree(qdisc_dev(q))
-#define tcf_tree_lock(tp)      qdisc_lock_tree(qdisc_dev((tp)->q))
-#define tcf_tree_unlock(tp)    qdisc_unlock_tree(qdisc_dev((tp)->q))
+static inline void sch_tree_lock(struct Qdisc *q)
+{
+       spin_lock_bh(qdisc_root_lock(q));
+}
+
+static inline void sch_tree_unlock(struct Qdisc *q)
+{
+       spin_unlock_bh(qdisc_root_lock(q));
+}
+
+#define tcf_tree_lock(tp)      sch_tree_lock((tp)->q)
+#define tcf_tree_unlock(tp)    sch_tree_unlock((tp)->q)
 
 extern struct Qdisc noop_qdisc;
 extern struct Qdisc_ops noop_qdisc_ops;