diff options
author | WANG Cong <xiyou.wangcong@gmail.com> | 2014-02-11 17:07:32 -0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-02-12 19:23:32 -0500 |
commit | a5b5c958ffd1610545d6b4b8290aa9c5266d10fa (patch) | |
tree | 532a87c5ae6d0c2f2f766820c051f7a5b8f7a366 /net/sched/act_ipt.c | |
parent | 86062033feb8a1692f7a3d570c652f1b4a4b4b52 (diff) | |
download | linux-a5b5c958ffd1610545d6b4b8290aa9c5266d10fa.tar.gz linux-a5b5c958ffd1610545d6b4b8290aa9c5266d10fa.tar.bz2 linux-a5b5c958ffd1610545d6b4b8290aa9c5266d10fa.zip |
net_sched: act: refactor cleanup ops
For bindcnt and refcnt etc., they are common for all actions,
not need to repeat such operations for their own, they can be unified
now. Actions just need to do its specific cleanup if needed.
Cc: Jamal Hadi Salim <jhs@mojatatu.com>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched/act_ipt.c')
-rw-r--r-- | net/sched/act_ipt.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c index f5e69782d400..71f29f1b5a20 100644 --- a/net/sched/act_ipt.c +++ b/net/sched/act_ipt.c @@ -69,23 +69,12 @@ static void ipt_destroy_target(struct xt_entry_target *t) module_put(par.target->me); } -static int tcf_ipt_release(struct tc_action *a, int bind) +static void tcf_ipt_release(struct tc_action *a, int bind) { struct tcf_ipt *ipt = to_ipt(a); - int ret = 0; - if (ipt) { - if (bind) - ipt->tcf_bindcnt--; - ipt->tcf_refcnt--; - if (ipt->tcf_bindcnt <= 0 && ipt->tcf_refcnt <= 0) { - ipt_destroy_target(ipt->tcfi_t); - kfree(ipt->tcfi_tname); - kfree(ipt->tcfi_t); - tcf_hash_destroy(a); - ret = ACT_P_DELETED; - } - } - return ret; + ipt_destroy_target(ipt->tcfi_t); + kfree(ipt->tcfi_tname); + kfree(ipt->tcfi_t); } static const struct nla_policy ipt_policy[TCA_IPT_MAX + 1] = { @@ -133,7 +122,7 @@ static int tcf_ipt_init(struct net *net, struct nlattr *nla, struct nlattr *est, } else { if (bind)/* dont override defaults */ return 0; - tcf_ipt_release(a, bind); + tcf_hash_release(a, bind); if (!ovr) return -EEXIST; |