aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_api.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2007-04-16 20:02:10 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-04-26 01:29:07 -0400
commit0463d4ae25771aaf3379bb6b2392f6edf23c2828 (patch)
tree5c820b718abfe086a7b1d91814cb99d721439a46 /net/sched/sch_api.c
parentffa4d7216e848fbfdcb8e6f0bb66abeaa1888964 (diff)
[NET_SCHED]: Eliminate qdisc_tree_lock
Since we're now holding the rtnl during the entire dump operation, we can remove qdisc_tree_lock, whose only purpose is to protect dump callbacks from concurrent changes to the qdisc tree. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_api.c')
-rw-r--r--net/sched/sch_api.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c
index 2e863bdaa9a1..0ce6914f5981 100644
--- a/net/sched/sch_api.c
+++ b/net/sched/sch_api.c
@@ -191,7 +191,7 @@ int unregister_qdisc(struct Qdisc_ops *qops)
191 (root qdisc, all its children, children of children etc.) 191 (root qdisc, all its children, children of children etc.)
192 */ 192 */
193 193
194static struct Qdisc *__qdisc_lookup(struct net_device *dev, u32 handle) 194struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle)
195{ 195{
196 struct Qdisc *q; 196 struct Qdisc *q;
197 197
@@ -202,16 +202,6 @@ static struct Qdisc *__qdisc_lookup(struct net_device *dev, u32 handle)
202 return NULL; 202 return NULL;
203} 203}
204 204
205struct Qdisc *qdisc_lookup(struct net_device *dev, u32 handle)
206{
207 struct Qdisc *q;
208
209 read_lock(&qdisc_tree_lock);
210 q = __qdisc_lookup(dev, handle);
211 read_unlock(&qdisc_tree_lock);
212 return q;
213}
214
215static struct Qdisc *qdisc_leaf(struct Qdisc *p, u32 classid) 205static struct Qdisc *qdisc_leaf(struct Qdisc *p, u32 classid)
216{ 206{
217 unsigned long cl; 207 unsigned long cl;
@@ -405,7 +395,7 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
405 if (n == 0) 395 if (n == 0)
406 return; 396 return;
407 while ((parentid = sch->parent)) { 397 while ((parentid = sch->parent)) {
408 sch = __qdisc_lookup(sch->dev, TC_H_MAJ(parentid)); 398 sch = qdisc_lookup(sch->dev, TC_H_MAJ(parentid));
409 cops = sch->ops->cl_ops; 399 cops = sch->ops->cl_ops;
410 if (cops->qlen_notify) { 400 if (cops->qlen_notify) {
411 cl = cops->get(sch, parentid); 401 cl = cops->get(sch, parentid);
@@ -905,7 +895,6 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
905 continue; 895 continue;
906 if (idx > s_idx) 896 if (idx > s_idx)
907 s_q_idx = 0; 897 s_q_idx = 0;
908 read_lock(&qdisc_tree_lock);
909 q_idx = 0; 898 q_idx = 0;
910 list_for_each_entry(q, &dev->qdisc_list, list) { 899 list_for_each_entry(q, &dev->qdisc_list, list) {
911 if (q_idx < s_q_idx) { 900 if (q_idx < s_q_idx) {
@@ -913,13 +902,10 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
913 continue; 902 continue;
914 } 903 }
915 if (tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid, 904 if (tc_fill_qdisc(skb, q, q->parent, NETLINK_CB(cb->skb).pid,
916 cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0) { 905 cb->nlh->nlmsg_seq, NLM_F_MULTI, RTM_NEWQDISC) <= 0)
917 read_unlock(&qdisc_tree_lock);
918 goto done; 906 goto done;
919 }
920 q_idx++; 907 q_idx++;
921 } 908 }
922 read_unlock(&qdisc_tree_lock);
923 } 909 }
924 910
925done: 911done:
@@ -1142,7 +1128,6 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
1142 s_t = cb->args[0]; 1128 s_t = cb->args[0];
1143 t = 0; 1129 t = 0;
1144 1130
1145 read_lock(&qdisc_tree_lock);
1146 list_for_each_entry(q, &dev->qdisc_list, list) { 1131 list_for_each_entry(q, &dev->qdisc_list, list) {
1147 if (t < s_t || !q->ops->cl_ops || 1132 if (t < s_t || !q->ops->cl_ops ||
1148 (tcm->tcm_parent && 1133 (tcm->tcm_parent &&
@@ -1164,7 +1149,6 @@ static int tc_dump_tclass(struct sk_buff *skb, struct netlink_callback *cb)
1164 break; 1149 break;
1165 t++; 1150 t++;
1166 } 1151 }
1167 read_unlock(&qdisc_tree_lock);
1168 1152
1169 cb->args[0] = t; 1153 cb->args[0] = t;
1170 1154