Lines Matching refs:bpf

28 	percpu_ref_kill(&cgrp->bpf.refcnt);  in cgroup_bpf_offline()
111 bpf.release_work); in cgroup_bpf_release()
113 struct list_head *storages = &cgrp->bpf.storages; in cgroup_bpf_release()
120 for (type = 0; type < ARRAY_SIZE(cgrp->bpf.progs); type++) { in cgroup_bpf_release()
121 struct list_head *progs = &cgrp->bpf.progs[type]; in cgroup_bpf_release()
134 cgrp->bpf.effective[type], in cgroup_bpf_release()
149 percpu_ref_exit(&cgrp->bpf.refcnt); in cgroup_bpf_release()
160 struct cgroup *cgrp = container_of(ref, struct cgroup, bpf.refcnt); in cgroup_bpf_release_fn()
162 INIT_WORK(&cgrp->bpf.release_work, cgroup_bpf_release); in cgroup_bpf_release_fn()
163 queue_work(system_wq, &cgrp->bpf.release_work); in cgroup_bpf_release_fn()
207 u32 flags = p->bpf.flags[type]; in hierarchy_allows_attach()
212 cnt = prog_list_length(&p->bpf.progs[type]); in hierarchy_allows_attach()
239 if (cnt == 0 || (p->bpf.flags[type] & BPF_F_ALLOW_MULTI)) in compute_effective_progs()
240 cnt += prog_list_length(&p->bpf.progs[type]); in compute_effective_progs()
252 if (cnt > 0 && !(p->bpf.flags[type] & BPF_F_ALLOW_MULTI)) in compute_effective_progs()
255 list_for_each_entry(pl, &p->bpf.progs[type], node) { in compute_effective_progs()
275 old_array = rcu_replace_pointer(cgrp->bpf.effective[type], old_array, in activate_effective_progs()
292 #define NR ARRAY_SIZE(cgrp->bpf.effective) in cgroup_bpf_inherit()
297 ret = percpu_ref_init(&cgrp->bpf.refcnt, cgroup_bpf_release_fn, 0, in cgroup_bpf_inherit()
306 INIT_LIST_HEAD(&cgrp->bpf.progs[i]); in cgroup_bpf_inherit()
308 INIT_LIST_HEAD(&cgrp->bpf.storages); in cgroup_bpf_inherit()
325 percpu_ref_exit(&cgrp->bpf.refcnt); in cgroup_bpf_inherit()
340 if (percpu_ref_is_zero(&desc->bpf.refcnt)) in update_effective_progs()
343 err = compute_effective_progs(desc, type, &desc->bpf.inactive); in update_effective_progs()
352 if (percpu_ref_is_zero(&desc->bpf.refcnt)) { in update_effective_progs()
353 if (unlikely(desc->bpf.inactive)) { in update_effective_progs()
354 bpf_prog_array_free(desc->bpf.inactive); in update_effective_progs()
355 desc->bpf.inactive = NULL; in update_effective_progs()
360 activate_effective_progs(desc, type, desc->bpf.inactive); in update_effective_progs()
361 desc->bpf.inactive = NULL; in update_effective_progs()
373 bpf_prog_array_free(desc->bpf.inactive); in update_effective_progs()
374 desc->bpf.inactive = NULL; in update_effective_progs()
439 struct list_head *progs = &cgrp->bpf.progs[type]; in __cgroup_bpf_attach()
460 if (!list_empty(progs) && cgrp->bpf.flags[type] != saved_flags) in __cgroup_bpf_attach()
493 cgrp->bpf.flags[type] = saved_flags; in __cgroup_bpf_attach()
537 if (percpu_ref_is_zero(&desc->bpf.refcnt)) in replace_effective_prog()
542 if (pos && !(cg->bpf.flags[type] & BPF_F_ALLOW_MULTI)) in replace_effective_prog()
545 head = &cg->bpf.progs[type]; in replace_effective_prog()
557 desc->bpf.effective[type], in replace_effective_prog()
577 struct list_head *progs = &cgrp->bpf.progs[link->type]; in __cgroup_bpf_replace()
670 struct list_head *progs = &cgrp->bpf.progs[type]; in __cgroup_bpf_detach()
671 u32 flags = cgrp->bpf.flags[type]; in __cgroup_bpf_detach()
698 cgrp->bpf.flags[type] = 0; in __cgroup_bpf_detach()
717 struct list_head *progs = &cgrp->bpf.progs[type]; in __cgroup_bpf_query()
718 u32 flags = cgrp->bpf.flags[type]; in __cgroup_bpf_query()
723 effective = rcu_dereference_protected(cgrp->bpf.effective[type], in __cgroup_bpf_query()
1013 cgrp->bpf.effective[type], skb, __bpf_prog_run_save_cb); in __cgroup_bpf_run_filter_skb()
1015 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], skb, in __cgroup_bpf_run_filter_skb()
1046 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], sk, BPF_PROG_RUN); in __cgroup_bpf_run_filter_sk()
1090 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], &ctx, BPF_PROG_RUN); in __cgroup_bpf_run_filter_sock_addr()
1119 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], sock_ops, in __cgroup_bpf_run_filter_sock_ops()
1138 allow = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], &ctx, in __cgroup_bpf_check_dev_permission()
1270 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], &ctx, BPF_PROG_RUN); in __cgroup_bpf_run_filter_sysctl()
1294 prog_array = rcu_dereference(cgrp->bpf.effective[attach_type]); in __cgroup_bpf_prog_array_is_empty()
1365 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[BPF_CGROUP_SETSOCKOPT], in __cgroup_bpf_run_filter_setsockopt()
1452 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[BPF_CGROUP_GETSOCKOPT], in __cgroup_bpf_run_filter_getsockopt()