aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2014-01-15 18:23:26 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-16 20:21:55 -0500
commitfb1d598d482d9fd448ea68895751bdfb8f29ee8e (patch)
tree4b81ac94c7335bd991444414b2198cac5bee7edc
parent0aebd2d9ab42b764ba43875e185ef52cec2afdec (diff)
net_sched: act: use tcf_hash_release() in net/sched/act_police.c
Cc: Jamal Hadi Salim <jhs@mojatatu.com> Cc: David S. Miller <davem@davemloft.net> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/sched/act_police.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index a719fdff575e..5ba467b6124a 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -104,20 +104,6 @@ nla_put_failure:
104 goto done; 104 goto done;
105} 105}
106 106
107static void tcf_police_destroy(struct tcf_police *p)
108{
109 spin_lock_bh(&police_hash_info.lock);
110 hlist_del(&p->tcf_head);
111 spin_unlock_bh(&police_hash_info.lock);
112 gen_kill_estimator(&p->tcf_bstats,
113 &p->tcf_rate_est);
114 /*
115 * gen_estimator est_timer() might access p->tcf_lock
116 * or bstats, wait a RCU grace period before freeing p
117 */
118 kfree_rcu(p, tcf_rcu);
119}
120
121static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = { 107static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = {
122 [TCA_POLICE_RATE] = { .len = TC_RTAB_SIZE }, 108 [TCA_POLICE_RATE] = { .len = TC_RTAB_SIZE },
123 [TCA_POLICE_PEAKRATE] = { .len = TC_RTAB_SIZE }, 109 [TCA_POLICE_PEAKRATE] = { .len = TC_RTAB_SIZE },
@@ -272,19 +258,9 @@ failure:
272static int tcf_act_police_cleanup(struct tc_action *a, int bind) 258static int tcf_act_police_cleanup(struct tc_action *a, int bind)
273{ 259{
274 struct tcf_police *p = a->priv; 260 struct tcf_police *p = a->priv;
275 int ret = 0; 261 if (p)
276 262 return tcf_hash_release(&p->common, bind, &police_hash_info);
277 if (p != NULL) { 263 return 0;
278 if (bind)
279 p->tcf_bindcnt--;
280
281 p->tcf_refcnt--;
282 if (p->tcf_refcnt <= 0 && !p->tcf_bindcnt) {
283 tcf_police_destroy(p);
284 ret = 1;
285 }
286 }
287 return ret;
288} 264}
289 265
290static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a, 266static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a,