提交 472f5837 编写于 作者: J Jiri Pirko 提交者: David S. Miller

net_sched: cls_bpf: remove unnecessary iteration and use passed arg

Signed-off-by: NJiri Pirko <jiri@resnulli.us>
Acked-by: NJamal Hadi Salim <jhs@mojatatu.com>
Acked-by: NDaniel Borkmann <dborkman@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e4386456
...@@ -109,19 +109,12 @@ static void __cls_bpf_delete_prog(struct rcu_head *rcu) ...@@ -109,19 +109,12 @@ static void __cls_bpf_delete_prog(struct rcu_head *rcu)
static int cls_bpf_delete(struct tcf_proto *tp, unsigned long arg) static int cls_bpf_delete(struct tcf_proto *tp, unsigned long arg)
{ {
struct cls_bpf_head *head = rtnl_dereference(tp->root); struct cls_bpf_prog *prog = (struct cls_bpf_prog *) arg;
struct cls_bpf_prog *prog, *todel = (struct cls_bpf_prog *) arg;
list_for_each_entry(prog, &head->plist, link) {
if (prog == todel) {
list_del_rcu(&prog->link);
tcf_unbind_filter(tp, &prog->res);
call_rcu(&prog->rcu, __cls_bpf_delete_prog);
return 0;
}
}
return -ENOENT; list_del_rcu(&prog->link);
tcf_unbind_filter(tp, &prog->res);
call_rcu(&prog->rcu, __cls_bpf_delete_prog);
return 0;
} }
static void cls_bpf_destroy(struct tcf_proto *tp) static void cls_bpf_destroy(struct tcf_proto *tp)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册