aboutsummaryrefslogtreecommitdiffstats
path: root/net/sched
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2014-12-02 12:00:32 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-08 20:53:40 -0500
commit472f58370128d5e18f9d5429313a87d0f30af45e (patch)
treedf8757348be586aeffab2f72fa6fbaf6e75386f5 /net/sched
parente4386456ae4eca2104e67f70a8ff7b7c949fb248 (diff)
net_sched: cls_bpf: remove unnecessary iteration and use passed arg
Signed-off-by: Jiri Pirko <jiri@resnulli.us> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Acked-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sched')
-rw-r--r--net/sched/cls_bpf.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/net/sched/cls_bpf.c b/net/sched/cls_bpf.c
index eed49d1d0878..cbfaf6f8feb3 100644
--- a/net/sched/cls_bpf.c
+++ b/net/sched/cls_bpf.c
@@ -109,19 +109,12 @@ static void __cls_bpf_delete_prog(struct rcu_head *rcu)
109 109
110static int cls_bpf_delete(struct tcf_proto *tp, unsigned long arg) 110static int cls_bpf_delete(struct tcf_proto *tp, unsigned long arg)
111{ 111{
112 struct cls_bpf_head *head = rtnl_dereference(tp->root); 112 struct cls_bpf_prog *prog = (struct cls_bpf_prog *) arg;
113 struct cls_bpf_prog *prog, *todel = (struct cls_bpf_prog *) arg;
114
115 list_for_each_entry(prog, &head->plist, link) {
116 if (prog == todel) {
117 list_del_rcu(&prog->link);
118 tcf_unbind_filter(tp, &prog->res);
119 call_rcu(&prog->rcu, __cls_bpf_delete_prog);
120 return 0;
121 }
122 }
123 113
124 return -ENOENT; 114 list_del_rcu(&prog->link);
115 tcf_unbind_filter(tp, &prog->res);
116 call_rcu(&prog->rcu, __cls_bpf_delete_prog);
117 return 0;
125} 118}
126 119
127static void cls_bpf_destroy(struct tcf_proto *tp) 120static void cls_bpf_destroy(struct tcf_proto *tp)