aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/core/gen_estimator.c25
-rw-r--r--net/sched/act_police.c4
2 files changed, 11 insertions, 18 deletions
diff --git a/net/core/gen_estimator.c b/net/core/gen_estimator.c
index 3885550f0187..9cc9f95b109e 100644
--- a/net/core/gen_estimator.c
+++ b/net/core/gen_estimator.c
@@ -163,8 +163,9 @@ static void gen_add_node(struct gen_estimator *est)
163 rb_insert_color(&est->node, &est_root); 163 rb_insert_color(&est->node, &est_root);
164} 164}
165 165
166static struct gen_estimator *gen_find_node(struct gnet_stats_basic *bstats, 166static
167 struct gnet_stats_rate_est *rate_est) 167struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats,
168 const struct gnet_stats_rate_est *rate_est)
168{ 169{
169 struct rb_node *p = est_root.rb_node; 170 struct rb_node *p = est_root.rb_node;
170 171
@@ -301,26 +302,16 @@ EXPORT_SYMBOL(gen_replace_estimator);
301 302
302/** 303/**
303 * gen_estimator_active - test if estimator is currently in use 304 * gen_estimator_active - test if estimator is currently in use
305 * @bstats: basic statistics
304 * @rate_est: rate estimator statistics 306 * @rate_est: rate estimator statistics
305 * 307 *
306 * Returns 1 if estimator is active, and 0 if not. 308 * Returns true if estimator is active, and false if not.
307 */ 309 */
308int gen_estimator_active(const struct gnet_stats_rate_est *rate_est) 310bool gen_estimator_active(const struct gnet_stats_basic *bstats,
311 const struct gnet_stats_rate_est *rate_est)
309{ 312{
310 int idx;
311 struct gen_estimator *e;
312
313 ASSERT_RTNL(); 313 ASSERT_RTNL();
314 314
315 for (idx=0; idx <= EST_MAX_INTERVAL; idx++) { 315 return gen_find_node(bstats, rate_est) != NULL;
316 if (!elist[idx].timer.function)
317 continue;
318
319 list_for_each_entry(e, &elist[idx].list, list) {
320 if (e->rate_est == rate_est)
321 return 1;
322 }
323 }
324 return 0;
325} 316}
326EXPORT_SYMBOL(gen_estimator_active); 317EXPORT_SYMBOL(gen_estimator_active);
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index c39f60cea6ee..5c72a116b1a4 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -183,7 +183,9 @@ override:
183 if (R_tab == NULL) 183 if (R_tab == NULL)
184 goto failure; 184 goto failure;
185 185
186 if (!est && !gen_estimator_active(&police->tcf_rate_est)) { 186 if (!est && (ret == ACT_P_CREATED ||
187 !gen_estimator_active(&police->tcf_bstats,
188 &police->tcf_rate_est))) {
187 err = -EINVAL; 189 err = -EINVAL;
188 goto failure; 190 goto failure;
189 } 191 }