summaryrefslogtreecommitdiff
path: root/net/sched/act_api.c
diff options
context:
space:
mode:
authorWANG Cong <xiyou.wangcong@gmail.com>2014-02-12 01:07:32 (GMT)
committerDavid S. Miller <davem@davemloft.net>2014-02-13 00:23:32 (GMT)
commita5b5c958ffd1610545d6b4b8290aa9c5266d10fa (patch)
tree532a87c5ae6d0c2f2f766820c051f7a5b8f7a366 /net/sched/act_api.c
parent86062033feb8a1692f7a3d570c652f1b4a4b4b52 (diff)
downloadlinux-a5b5c958ffd1610545d6b4b8290aa9c5266d10fa.tar.xz
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_api.c')
-rw-r--r--net/sched/act_api.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 4f2b807..a5bf935 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -56,6 +56,8 @@ int tcf_hash_release(struct tc_action *a, int bind)
p->tcfc_refcnt--;
if (p->tcfc_bindcnt <= 0 && p->tcfc_refcnt <= 0) {
+ if (a->ops->cleanup)
+ a->ops->cleanup(a, bind);
tcf_hash_destroy(a);
ret = 1;
}
@@ -277,8 +279,8 @@ int tcf_register_action(struct tc_action_ops *act)
{
struct tc_action_ops *a;
- /* Must supply act, dump, cleanup and init */
- if (!act->act || !act->dump || !act->cleanup || !act->init)
+ /* Must supply act, dump and init */
+ if (!act->act || !act->dump || !act->init)
return -EINVAL;
/* Supply defaults */
@@ -390,7 +392,7 @@ void tcf_action_destroy(struct list_head *actions, int bind)
struct tc_action *a, *tmp;
list_for_each_entry_safe(a, tmp, actions, list) {
- if (a->ops->cleanup(a, bind) == ACT_P_DELETED)
+ if (tcf_hash_release(a, bind) == ACT_P_DELETED)
module_put(a->ops->owner);
list_del(&a->list);
kfree(a);