diff options
| author | Jiri Pirko <[email protected]> | 2017-02-09 13:38:56 +0000 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2017-02-10 16:38:08 +0000 |
| commit | cf1facda2f61bc3e9ffd985b6d624dec6ad3f279 (patch) | |
| tree | b6dda3c94a8e34fa9d895defe3ca6f46b6b898a6 /net/sched/cls_api.c | |
| parent | sched: rename tcf_destroy to tcf_destroy_proto (diff) | |
| download | kernel-cf1facda2f61bc3e9ffd985b6d624dec6ad3f279.tar.gz kernel-cf1facda2f61bc3e9ffd985b6d624dec6ad3f279.zip | |
sched: move tcf_proto_destroy and tcf_destroy_chain helpers into cls_api
Creation is done in this file, move destruction to be at the same place.
Signed-off-by: Jiri Pirko <[email protected]>
Acked-by: Jamal Hadi Salim <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'net/sched/cls_api.c')
| -rw-r--r-- | net/sched/cls_api.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 90536ebae02a..4efa4df8322f 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c @@ -127,6 +127,27 @@ static inline u32 tcf_auto_prio(struct tcf_proto *tp) return first; } +static bool tcf_proto_destroy(struct tcf_proto *tp, bool force) +{ + if (tp->ops->destroy(tp, force)) { + module_put(tp->ops->owner); + kfree_rcu(tp, rcu); + return true; + } + return false; +} + +void tcf_destroy_chain(struct tcf_proto __rcu **fl) +{ + struct tcf_proto *tp; + + while ((tp = rtnl_dereference(*fl)) != NULL) { + RCU_INIT_POINTER(*fl, tp->next); + tcf_proto_destroy(tp, true); + } +} +EXPORT_SYMBOL(tcf_destroy_chain); + /* Add/change/delete/get a filter node */ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n) |
