aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched/sch_cbq.c
diff options
context:
space:
mode:
authorJohn Fastabend <john.fastabend@gmail.com>2014-09-28 14:52:56 -0400
committerDavid S. Miller <davem@davemloft.net>2014-09-30 01:02:26 -0400
commit22e0f8b9322cb1a48b1357e8f4ae6f5a9eca8cfa (patch)
tree2c9ef18dca9d9a441d92ea57cf7f7a292f4ceb3f /net/sched/sch_cbq.c
parent79cf79abce71eb7dbc40e2f3121048ca5405cb47 (diff)
net: sched: make bstats per cpu and estimator RCU safe
In order to run qdisc's without locking statistics and estimators need to be handled correctly. To resolve bstats make the statistics per cpu. And because this is only needed for qdiscs that are running without locks which is not the case for most qdiscs in the near future only create percpu stats when qdiscs set the TCQ_F_CPUSTATS flag. Next because estimators use the bstats to calculate packets per second and bytes per second the estimator code paths are updated to use the per cpu statistics. Signed-off-by: John Fastabend <john.r.fastabend@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/sch_cbq.c')
-rw-r--r--net/sched/sch_cbq.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index d2cd981ba60d..22a3a029a911 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -1601,7 +1601,7 @@ cbq_dump_class_stats(struct Qdisc *sch, unsigned long arg,
1601 if (cl->undertime != PSCHED_PASTPERFECT) 1601 if (cl->undertime != PSCHED_PASTPERFECT)
1602 cl->xstats.undertime = cl->undertime - q->now; 1602 cl->xstats.undertime = cl->undertime - q->now;
1603 1603
1604 if (gnet_stats_copy_basic(d, &cl->bstats) < 0 || 1604 if (gnet_stats_copy_basic(d, NULL, &cl->bstats) < 0 ||
1605 gnet_stats_copy_rate_est(d, &cl->bstats, &cl->rate_est) < 0 || 1605 gnet_stats_copy_rate_est(d, &cl->bstats, &cl->rate_est) < 0 ||
1606 gnet_stats_copy_queue(d, &cl->qstats) < 0) 1606 gnet_stats_copy_queue(d, &cl->qstats) < 0)
1607 return -1; 1607 return -1;
@@ -1759,7 +1759,8 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
1759 } 1759 }
1760 1760
1761 if (tca[TCA_RATE]) { 1761 if (tca[TCA_RATE]) {
1762 err = gen_replace_estimator(&cl->bstats, &cl->rate_est, 1762 err = gen_replace_estimator(&cl->bstats, NULL,
1763 &cl->rate_est,
1763 qdisc_root_sleeping_lock(sch), 1764 qdisc_root_sleeping_lock(sch),
1764 tca[TCA_RATE]); 1765 tca[TCA_RATE]);
1765 if (err) { 1766 if (err) {
@@ -1852,7 +1853,7 @@ cbq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, struct nlattr **t
1852 goto failure; 1853 goto failure;
1853 1854
1854 if (tca[TCA_RATE]) { 1855 if (tca[TCA_RATE]) {
1855 err = gen_new_estimator(&cl->bstats, &cl->rate_est, 1856 err = gen_new_estimator(&cl->bstats, NULL, &cl->rate_est,
1856 qdisc_root_sleeping_lock(sch), 1857 qdisc_root_sleeping_lock(sch),
1857 tca[TCA_RATE]); 1858 tca[TCA_RATE]);
1858 if (err) { 1859 if (err) {