Subject: [PATCH 4/5] PKT_SCHED: Use generic rate estimator

From: Thomas Graf <[email-masked]>
Date: Thu, 7 Oct 2004 03:07:09 +0200

Adapts qdiscs to use generic estimator.

Signed-off-by: Thomas Graf <[email-masked]>

diff -Nru linux-2.6.9-rc3-bk6.orig/net/sched/sch_api.c linux-2.6.9-rc3-bk6/net/sched/sch_api.c
--- linux-2.6.9-rc3-bk6.orig/net/sched/sch_api.c	2004-10-07 00:48:10.000000000 +0200
+++ linux-2.6.9-rc3-bk6/net/sched/sch_api.c	2004-10-07 00:46:34.000000000 +0200
@@ -461,8 +461,8 @@
 
 #ifdef CONFIG_NET_ESTIMATOR
 		if (tca[TCA_RATE-1])
-			qdisc_new_estimator(&sch->stats, sch->stats_lock,
-					    tca[TCA_RATE-1]);
+			gen_new_estimator(&sch->bstats, &sch->rate_est,
+				sch->stats_lock, tca[TCA_RATE-1]);
 #endif
 		return sch;
 	}
@@ -489,11 +489,9 @@
 			return err;
 	}
 #ifdef CONFIG_NET_ESTIMATOR
-	if (tca[TCA_RATE-1]) {
-		qdisc_kill_estimator(&sch->stats);
-		qdisc_new_estimator(&sch->stats, sch->stats_lock,
-				    tca[TCA_RATE-1]);
-	}
+	if (tca[TCA_RATE-1])
+		gen_replace_estimator(&sch->bstats, &sch->rate_est,
+			sch->stats_lock, tca[TCA_RATE-1]);
 #endif
 	return 0;
 }
diff -Nru linux-2.6.9-rc3-bk6.orig/net/sched/sch_generic.c linux-2.6.9-rc3-bk6/net/sched/sch_generic.c
--- linux-2.6.9-rc3-bk6.orig/net/sched/sch_generic.c	2004-10-07 00:32:25.000000000 +0200
+++ linux-2.6.9-rc3-bk6/net/sched/sch_generic.c	2004-10-07 00:46:57.000000000 +0200
@@ -465,7 +465,7 @@
 	struct Qdisc_ops  *ops = qdisc->ops;
 
 #ifdef CONFIG_NET_ESTIMATOR
-	qdisc_kill_estimator(&qdisc->stats);
+	gen_kill_estimator(&qdisc->bstats, &qdisc->rate_est);
 #endif
 	write_lock(&qdisc_tree_lock);
 	if (ops->reset)