Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 122253
b: refs/heads/master
c: 244e6c2
h: refs/heads/master
i:
  122251: a6fcbd7
v: v3
  • Loading branch information
Jarek Poplawski authored and David S. Miller committed Nov 26, 2008
1 parent 15d44bf commit 9ba56ca
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3d4cd60ed0533d3b33832e298530c7b021da982b
refs/heads/master: 244e6c2d0724bc4908a1995804704bdee3b31528
4 changes: 2 additions & 2 deletions trunk/include/net/gen_stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ extern void gen_kill_estimator(struct gnet_stats_basic *bstats,
extern int gen_replace_estimator(struct gnet_stats_basic *bstats,
struct gnet_stats_rate_est *rate_est,
spinlock_t *stats_lock, struct nlattr *opt);
extern int gen_estimator_active(const struct gnet_stats_rate_est *rate_est);

extern bool gen_estimator_active(const struct gnet_stats_basic *bstats,
const struct gnet_stats_rate_est *rate_est);
#endif
25 changes: 8 additions & 17 deletions trunk/net/core/gen_estimator.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,9 @@ static void gen_add_node(struct gen_estimator *est)
rb_insert_color(&est->node, &est_root);
}

static struct gen_estimator *gen_find_node(struct gnet_stats_basic *bstats,
struct gnet_stats_rate_est *rate_est)
static
struct gen_estimator *gen_find_node(const struct gnet_stats_basic *bstats,
const struct gnet_stats_rate_est *rate_est)
{
struct rb_node *p = est_root.rb_node;

Expand Down Expand Up @@ -301,26 +302,16 @@ EXPORT_SYMBOL(gen_replace_estimator);

/**
* gen_estimator_active - test if estimator is currently in use
* @bstats: basic statistics
* @rate_est: rate estimator statistics
*
* Returns 1 if estimator is active, and 0 if not.
* Returns true if estimator is active, and false if not.
*/
int gen_estimator_active(const struct gnet_stats_rate_est *rate_est)
bool gen_estimator_active(const struct gnet_stats_basic *bstats,
const struct gnet_stats_rate_est *rate_est)
{
int idx;
struct gen_estimator *e;

ASSERT_RTNL();

for (idx=0; idx <= EST_MAX_INTERVAL; idx++) {
if (!elist[idx].timer.function)
continue;

list_for_each_entry(e, &elist[idx].list, list) {
if (e->rate_est == rate_est)
return 1;
}
}
return 0;
return gen_find_node(bstats, rate_est) != NULL;
}
EXPORT_SYMBOL(gen_estimator_active);
4 changes: 3 additions & 1 deletion trunk/net/sched/act_police.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ static int tcf_act_police_locate(struct nlattr *nla, struct nlattr *est,
if (R_tab == NULL)
goto failure;

if (!est && !gen_estimator_active(&police->tcf_rate_est)) {
if (!est && (ret == ACT_P_CREATED ||
!gen_estimator_active(&police->tcf_bstats,
&police->tcf_rate_est))) {
err = -EINVAL;
goto failure;
}
Expand Down

0 comments on commit 9ba56ca

Please sign in to comment.