Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fb1d598d authored by WANG Cong's avatar WANG Cong Committed by David S. Miller
Browse files

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: default avatarCong Wang <xiyou.wangcong@gmail.com>
Acked-by: default avatarJamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0aebd2d9
Loading
Loading
Loading
Loading
+3 −27
Original line number Diff line number Diff line
@@ -104,20 +104,6 @@ static int tcf_act_police_walker(struct sk_buff *skb, struct netlink_callback *c
	goto done;
}

static void tcf_police_destroy(struct tcf_police *p)
{
	spin_lock_bh(&police_hash_info.lock);
	hlist_del(&p->tcf_head);
	spin_unlock_bh(&police_hash_info.lock);
	gen_kill_estimator(&p->tcf_bstats,
			   &p->tcf_rate_est);
	/*
	 * gen_estimator est_timer() might access p->tcf_lock
	 * or bstats, wait a RCU grace period before freeing p
	 */
	kfree_rcu(p, tcf_rcu);
}

static const struct nla_policy police_policy[TCA_POLICE_MAX + 1] = {
	[TCA_POLICE_RATE]	= { .len = TC_RTAB_SIZE },
	[TCA_POLICE_PEAKRATE]	= { .len = TC_RTAB_SIZE },
@@ -272,19 +258,9 @@ static int tcf_act_police_locate(struct net *net, struct nlattr *nla,
static int tcf_act_police_cleanup(struct tc_action *a, int bind)
{
	struct tcf_police *p = a->priv;
	int ret = 0;

	if (p != NULL) {
		if (bind)
			p->tcf_bindcnt--;

		p->tcf_refcnt--;
		if (p->tcf_refcnt <= 0 && !p->tcf_bindcnt) {
			tcf_police_destroy(p);
			ret = 1;
		}
	}
	return ret;
	if (p)
		return tcf_hash_release(&p->common, bind, &police_hash_info);
	return 0;
}

static int tcf_act_police(struct sk_buff *skb, const struct tc_action *a,