diff options
author | Patrick McHardy <kaber@trash.net> | 2007-07-03 01:47:37 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-07-11 01:16:38 -0400 |
commit | 4bdf39911e7a887c4499161422423cbaf16684e8 (patch) | |
tree | 3bf1ac8b4ee1e2682d7aff722d41175a694d41dc | |
parent | 876d48aabf30e4981653f1a0a7ae1e262b8c8b6f (diff) |
[NET_SCHED]: Remove unnecessary stats_lock pointers
Remove stats_lock pointers from qdisc-internal structures, in all cases
it points to dev->queue_lock. The only case where it is necessary is for
top-level qdiscs, where it might also point to dev->ingress_lock in case
of the ingress qdisc. Also remove it from actions completely, it always
points to the actions internal lock.
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | include/net/act_api.h | 2 | ||||
-rw-r--r-- | net/sched/act_api.c | 7 | ||||
-rw-r--r-- | net/sched/act_police.c | 8 | ||||
-rw-r--r-- | net/sched/sch_atm.c | 1 | ||||
-rw-r--r-- | net/sched/sch_cbq.c | 8 | ||||
-rw-r--r-- | net/sched/sch_hfsc.c | 10 |
6 files changed, 12 insertions, 24 deletions
diff --git a/include/net/act_api.h b/include/net/act_api.h index 8b06c2f3657f..2f0273feabd3 100644 --- a/include/net/act_api.h +++ b/include/net/act_api.h | |||
@@ -19,7 +19,6 @@ struct tcf_common { | |||
19 | struct gnet_stats_basic tcfc_bstats; | 19 | struct gnet_stats_basic tcfc_bstats; |
20 | struct gnet_stats_queue tcfc_qstats; | 20 | struct gnet_stats_queue tcfc_qstats; |
21 | struct gnet_stats_rate_est tcfc_rate_est; | 21 | struct gnet_stats_rate_est tcfc_rate_est; |
22 | spinlock_t *tcfc_stats_lock; | ||
23 | spinlock_t tcfc_lock; | 22 | spinlock_t tcfc_lock; |
24 | }; | 23 | }; |
25 | #define tcf_next common.tcfc_next | 24 | #define tcf_next common.tcfc_next |
@@ -32,7 +31,6 @@ struct tcf_common { | |||
32 | #define tcf_bstats common.tcfc_bstats | 31 | #define tcf_bstats common.tcfc_bstats |
33 | #define tcf_qstats common.tcfc_qstats | 32 | #define tcf_qstats common.tcfc_qstats |
34 | #define tcf_rate_est common.tcfc_rate_est | 33 | #define tcf_rate_est common.tcfc_rate_est |
35 | #define tcf_stats_lock common.tcfc_stats_lock | ||
36 | #define tcf_lock common.tcfc_lock | 34 | #define tcf_lock common.tcfc_lock |
37 | 35 | ||
38 | struct tcf_police { | 36 | struct tcf_police { |
diff --git a/net/sched/act_api.c b/net/sched/act_api.c index 72bb9bd1a22a..32cc191d9f90 100644 --- a/net/sched/act_api.c +++ b/net/sched/act_api.c | |||
@@ -230,13 +230,12 @@ struct tcf_common *tcf_hash_create(u32 index, struct rtattr *est, struct tc_acti | |||
230 | p->tcfc_bindcnt = 1; | 230 | p->tcfc_bindcnt = 1; |
231 | 231 | ||
232 | spin_lock_init(&p->tcfc_lock); | 232 | spin_lock_init(&p->tcfc_lock); |
233 | p->tcfc_stats_lock = &p->tcfc_lock; | ||
234 | p->tcfc_index = index ? index : tcf_hash_new_index(idx_gen, hinfo); | 233 | p->tcfc_index = index ? index : tcf_hash_new_index(idx_gen, hinfo); |
235 | p->tcfc_tm.install = jiffies; | 234 | p->tcfc_tm.install = jiffies; |
236 | p->tcfc_tm.lastuse = jiffies; | 235 | p->tcfc_tm.lastuse = jiffies; |
237 | if (est) | 236 | if (est) |
238 | gen_new_estimator(&p->tcfc_bstats, &p->tcfc_rate_est, | 237 | gen_new_estimator(&p->tcfc_bstats, &p->tcfc_rate_est, |
239 | p->tcfc_stats_lock, est); | 238 | &p->tcfc_lock, est); |
240 | a->priv = (void *) p; | 239 | a->priv = (void *) p; |
241 | return p; | 240 | return p; |
242 | } | 241 | } |
@@ -595,12 +594,12 @@ int tcf_action_copy_stats(struct sk_buff *skb, struct tc_action *a, | |||
595 | if (compat_mode) { | 594 | if (compat_mode) { |
596 | if (a->type == TCA_OLD_COMPAT) | 595 | if (a->type == TCA_OLD_COMPAT) |
597 | err = gnet_stats_start_copy_compat(skb, 0, | 596 | err = gnet_stats_start_copy_compat(skb, 0, |
598 | TCA_STATS, TCA_XSTATS, h->tcf_stats_lock, &d); | 597 | TCA_STATS, TCA_XSTATS, &h->tcf_lock, &d); |
599 | else | 598 | else |
600 | return 0; | 599 | return 0; |
601 | } else | 600 | } else |
602 | err = gnet_stats_start_copy(skb, TCA_ACT_STATS, | 601 | err = gnet_stats_start_copy(skb, TCA_ACT_STATS, |
603 | h->tcf_stats_lock, &d); | 602 | &h->tcf_lock, &d); |
604 | 603 | ||
605 | if (err < 0) | 604 | if (err < 0) |
606 | goto errout; | 605 | goto errout; |
diff --git a/net/sched/act_police.c b/net/sched/act_police.c index 580698db578a..3e8716dd738c 100644 --- a/net/sched/act_police.c +++ b/net/sched/act_police.c | |||
@@ -183,7 +183,6 @@ static int tcf_act_police_locate(struct rtattr *rta, struct rtattr *est, | |||
183 | ret = ACT_P_CREATED; | 183 | ret = ACT_P_CREATED; |
184 | police->tcf_refcnt = 1; | 184 | police->tcf_refcnt = 1; |
185 | spin_lock_init(&police->tcf_lock); | 185 | spin_lock_init(&police->tcf_lock); |
186 | police->tcf_stats_lock = &police->tcf_lock; | ||
187 | if (bind) | 186 | if (bind) |
188 | police->tcf_bindcnt = 1; | 187 | police->tcf_bindcnt = 1; |
189 | override: | 188 | override: |
@@ -231,7 +230,7 @@ override: | |||
231 | if (est) | 230 | if (est) |
232 | gen_replace_estimator(&police->tcf_bstats, | 231 | gen_replace_estimator(&police->tcf_bstats, |
233 | &police->tcf_rate_est, | 232 | &police->tcf_rate_est, |
234 | police->tcf_stats_lock, est); | 233 | &police->tcf_lock, est); |
235 | 234 | ||
236 | spin_unlock_bh(&police->tcf_lock); | 235 | spin_unlock_bh(&police->tcf_lock); |
237 | if (ret != ACT_P_CREATED) | 236 | if (ret != ACT_P_CREATED) |
@@ -450,7 +449,6 @@ struct tcf_police *tcf_police_locate(struct rtattr *rta, struct rtattr *est) | |||
450 | 449 | ||
451 | police->tcf_refcnt = 1; | 450 | police->tcf_refcnt = 1; |
452 | spin_lock_init(&police->tcf_lock); | 451 | spin_lock_init(&police->tcf_lock); |
453 | police->tcf_stats_lock = &police->tcf_lock; | ||
454 | if (parm->rate.rate) { | 452 | if (parm->rate.rate) { |
455 | police->tcfp_R_tab = | 453 | police->tcfp_R_tab = |
456 | qdisc_get_rtab(&parm->rate, tb[TCA_POLICE_RATE-1]); | 454 | qdisc_get_rtab(&parm->rate, tb[TCA_POLICE_RATE-1]); |
@@ -490,7 +488,7 @@ struct tcf_police *tcf_police_locate(struct rtattr *rta, struct rtattr *est) | |||
490 | police->tcf_action = parm->action; | 488 | police->tcf_action = parm->action; |
491 | if (est) | 489 | if (est) |
492 | gen_new_estimator(&police->tcf_bstats, &police->tcf_rate_est, | 490 | gen_new_estimator(&police->tcf_bstats, &police->tcf_rate_est, |
493 | police->tcf_stats_lock, est); | 491 | &police->tcf_lock, est); |
494 | h = tcf_hash(police->tcf_index, POL_TAB_MASK); | 492 | h = tcf_hash(police->tcf_index, POL_TAB_MASK); |
495 | write_lock_bh(&police_lock); | 493 | write_lock_bh(&police_lock); |
496 | police->tcf_next = tcf_police_ht[h]; | 494 | police->tcf_next = tcf_police_ht[h]; |
@@ -591,7 +589,7 @@ int tcf_police_dump_stats(struct sk_buff *skb, struct tcf_police *police) | |||
591 | struct gnet_dump d; | 589 | struct gnet_dump d; |
592 | 590 | ||
593 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, | 591 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, |
594 | TCA_XSTATS, police->tcf_stats_lock, | 592 | TCA_XSTATS, &police->tcf_lock, |
595 | &d) < 0) | 593 | &d) < 0) |
596 | goto errout; | 594 | goto errout; |
597 | 595 | ||
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c index d1c383fca82c..16fe802a66f7 100644 --- a/net/sched/sch_atm.c +++ b/net/sched/sch_atm.c | |||
@@ -71,7 +71,6 @@ struct atm_flow_data { | |||
71 | int ref; /* reference count */ | 71 | int ref; /* reference count */ |
72 | struct gnet_stats_basic bstats; | 72 | struct gnet_stats_basic bstats; |
73 | struct gnet_stats_queue qstats; | 73 | struct gnet_stats_queue qstats; |
74 | spinlock_t *stats_lock; | ||
75 | struct atm_flow_data *next; | 74 | struct atm_flow_data *next; |
76 | struct atm_flow_data *excess; /* flow for excess traffic; | 75 | struct atm_flow_data *excess; /* flow for excess traffic; |
77 | NULL to set CLP instead */ | 76 | NULL to set CLP instead */ |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index bf1ea9e75cd9..b093d8fce789 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
@@ -148,7 +148,6 @@ struct cbq_class | |||
148 | struct gnet_stats_basic bstats; | 148 | struct gnet_stats_basic bstats; |
149 | struct gnet_stats_queue qstats; | 149 | struct gnet_stats_queue qstats; |
150 | struct gnet_stats_rate_est rate_est; | 150 | struct gnet_stats_rate_est rate_est; |
151 | spinlock_t *stats_lock; | ||
152 | struct tc_cbq_xstats xstats; | 151 | struct tc_cbq_xstats xstats; |
153 | 152 | ||
154 | struct tcf_proto *filter_list; | 153 | struct tcf_proto *filter_list; |
@@ -1442,7 +1441,6 @@ static int cbq_init(struct Qdisc *sch, struct rtattr *opt) | |||
1442 | q->link.ewma_log = TC_CBQ_DEF_EWMA; | 1441 | q->link.ewma_log = TC_CBQ_DEF_EWMA; |
1443 | q->link.avpkt = q->link.allot/2; | 1442 | q->link.avpkt = q->link.allot/2; |
1444 | q->link.minidle = -0x7FFFFFFF; | 1443 | q->link.minidle = -0x7FFFFFFF; |
1445 | q->link.stats_lock = &sch->dev->queue_lock; | ||
1446 | 1444 | ||
1447 | qdisc_watchdog_init(&q->watchdog, sch); | 1445 | qdisc_watchdog_init(&q->watchdog, sch); |
1448 | hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); | 1446 | hrtimer_init(&q->delay_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); |
@@ -1871,7 +1869,8 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t | |||
1871 | 1869 | ||
1872 | if (tca[TCA_RATE-1]) | 1870 | if (tca[TCA_RATE-1]) |
1873 | gen_replace_estimator(&cl->bstats, &cl->rate_est, | 1871 | gen_replace_estimator(&cl->bstats, &cl->rate_est, |
1874 | cl->stats_lock, tca[TCA_RATE-1]); | 1872 | &sch->dev->queue_lock, |
1873 | tca[TCA_RATE-1]); | ||
1875 | return 0; | 1874 | return 0; |
1876 | } | 1875 | } |
1877 | 1876 | ||
@@ -1929,7 +1928,6 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t | |||
1929 | cl->allot = parent->allot; | 1928 | cl->allot = parent->allot; |
1930 | cl->quantum = cl->allot; | 1929 | cl->quantum = cl->allot; |
1931 | cl->weight = cl->R_tab->rate.rate; | 1930 | cl->weight = cl->R_tab->rate.rate; |
1932 | cl->stats_lock = &sch->dev->queue_lock; | ||
1933 | 1931 | ||
1934 | sch_tree_lock(sch); | 1932 | sch_tree_lock(sch); |
1935 | cbq_link_class(cl); | 1933 | cbq_link_class(cl); |
@@ -1959,7 +1957,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct rtattr **t | |||
1959 | 1957 | ||
1960 | if (tca[TCA_RATE-1]) | 1958 | if (tca[TCA_RATE-1]) |
1961 | gen_new_estimator(&cl->bstats, &cl->rate_est, | 1959 | gen_new_estimator(&cl->bstats, &cl->rate_est, |
1962 | cl->stats_lock, tca[TCA_RATE-1]); | 1960 | &sch->dev->queue_lock, tca[TCA_RATE-1]); |
1963 | 1961 | ||
1964 | *arg = (unsigned long)cl; | 1962 | *arg = (unsigned long)cl; |
1965 | return 0; | 1963 | return 0; |
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c index 7ccdf63a0cb5..7130a2441b0d 100644 --- a/net/sched/sch_hfsc.c +++ b/net/sched/sch_hfsc.c | |||
@@ -122,7 +122,6 @@ struct hfsc_class | |||
122 | struct gnet_stats_basic bstats; | 122 | struct gnet_stats_basic bstats; |
123 | struct gnet_stats_queue qstats; | 123 | struct gnet_stats_queue qstats; |
124 | struct gnet_stats_rate_est rate_est; | 124 | struct gnet_stats_rate_est rate_est; |
125 | spinlock_t *stats_lock; | ||
126 | unsigned int level; /* class level in hierarchy */ | 125 | unsigned int level; /* class level in hierarchy */ |
127 | struct tcf_proto *filter_list; /* filter list */ | 126 | struct tcf_proto *filter_list; /* filter list */ |
128 | unsigned int filter_cnt; /* filter count */ | 127 | unsigned int filter_cnt; /* filter count */ |
@@ -1056,7 +1055,8 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | |||
1056 | 1055 | ||
1057 | if (tca[TCA_RATE-1]) | 1056 | if (tca[TCA_RATE-1]) |
1058 | gen_replace_estimator(&cl->bstats, &cl->rate_est, | 1057 | gen_replace_estimator(&cl->bstats, &cl->rate_est, |
1059 | cl->stats_lock, tca[TCA_RATE-1]); | 1058 | &sch->dev->queue_lock, |
1059 | tca[TCA_RATE-1]); | ||
1060 | return 0; | 1060 | return 0; |
1061 | } | 1061 | } |
1062 | 1062 | ||
@@ -1096,7 +1096,6 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | |||
1096 | cl->qdisc = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, classid); | 1096 | cl->qdisc = qdisc_create_dflt(sch->dev, &pfifo_qdisc_ops, classid); |
1097 | if (cl->qdisc == NULL) | 1097 | if (cl->qdisc == NULL) |
1098 | cl->qdisc = &noop_qdisc; | 1098 | cl->qdisc = &noop_qdisc; |
1099 | cl->stats_lock = &sch->dev->queue_lock; | ||
1100 | INIT_LIST_HEAD(&cl->children); | 1099 | INIT_LIST_HEAD(&cl->children); |
1101 | cl->vt_tree = RB_ROOT; | 1100 | cl->vt_tree = RB_ROOT; |
1102 | cl->cf_tree = RB_ROOT; | 1101 | cl->cf_tree = RB_ROOT; |
@@ -1112,7 +1111,7 @@ hfsc_change_class(struct Qdisc *sch, u32 classid, u32 parentid, | |||
1112 | 1111 | ||
1113 | if (tca[TCA_RATE-1]) | 1112 | if (tca[TCA_RATE-1]) |
1114 | gen_new_estimator(&cl->bstats, &cl->rate_est, | 1113 | gen_new_estimator(&cl->bstats, &cl->rate_est, |
1115 | cl->stats_lock, tca[TCA_RATE-1]); | 1114 | &sch->dev->queue_lock, tca[TCA_RATE-1]); |
1116 | *arg = (unsigned long)cl; | 1115 | *arg = (unsigned long)cl; |
1117 | return 0; | 1116 | return 0; |
1118 | } | 1117 | } |
@@ -1440,8 +1439,6 @@ hfsc_init_qdisc(struct Qdisc *sch, struct rtattr *opt) | |||
1440 | return -EINVAL; | 1439 | return -EINVAL; |
1441 | qopt = RTA_DATA(opt); | 1440 | qopt = RTA_DATA(opt); |
1442 | 1441 | ||
1443 | sch->stats_lock = &sch->dev->queue_lock; | ||
1444 | |||
1445 | q->defcls = qopt->defcls; | 1442 | q->defcls = qopt->defcls; |
1446 | for (i = 0; i < HFSC_HSIZE; i++) | 1443 | for (i = 0; i < HFSC_HSIZE; i++) |
1447 | INIT_LIST_HEAD(&q->clhash[i]); | 1444 | INIT_LIST_HEAD(&q->clhash[i]); |
@@ -1456,7 +1453,6 @@ hfsc_init_qdisc(struct Qdisc *sch, struct rtattr *opt) | |||
1456 | sch->handle); | 1453 | sch->handle); |
1457 | if (q->root.qdisc == NULL) | 1454 | if (q->root.qdisc == NULL) |
1458 | q->root.qdisc = &noop_qdisc; | 1455 | q->root.qdisc = &noop_qdisc; |
1459 | q->root.stats_lock = &sch->dev->queue_lock; | ||
1460 | INIT_LIST_HEAD(&q->root.children); | 1456 | INIT_LIST_HEAD(&q->root.children); |
1461 | q->root.vt_tree = RB_ROOT; | 1457 | q->root.vt_tree = RB_ROOT; |
1462 | q->root.cf_tree = RB_ROOT; | 1458 | q->root.cf_tree = RB_ROOT; |