Lines Matching refs:bpf

28 	percpu_ref_kill(&cgrp->bpf.refcnt);  in cgroup_bpf_offline()
39 bpf.release_work); in cgroup_bpf_release()
46 for (type = 0; type < ARRAY_SIZE(cgrp->bpf.progs); type++) { in cgroup_bpf_release()
47 struct list_head *progs = &cgrp->bpf.progs[type]; in cgroup_bpf_release()
61 cgrp->bpf.effective[type], in cgroup_bpf_release()
68 percpu_ref_exit(&cgrp->bpf.refcnt); in cgroup_bpf_release()
79 struct cgroup *cgrp = container_of(ref, struct cgroup, bpf.refcnt); in cgroup_bpf_release_fn()
81 INIT_WORK(&cgrp->bpf.release_work, cgroup_bpf_release); in cgroup_bpf_release_fn()
82 queue_work(system_wq, &cgrp->bpf.release_work); in cgroup_bpf_release_fn()
115 u32 flags = p->bpf.flags[type]; in hierarchy_allows_attach()
120 cnt = prog_list_length(&p->bpf.progs[type]); in hierarchy_allows_attach()
147 if (cnt == 0 || (p->bpf.flags[type] & BPF_F_ALLOW_MULTI)) in compute_effective_progs()
148 cnt += prog_list_length(&p->bpf.progs[type]); in compute_effective_progs()
160 if (cnt > 0 && !(p->bpf.flags[type] & BPF_F_ALLOW_MULTI)) in compute_effective_progs()
163 list_for_each_entry(pl, &p->bpf.progs[type], node) { in compute_effective_progs()
183 rcu_swap_protected(cgrp->bpf.effective[type], old_array, in activate_effective_progs()
200 #define NR ARRAY_SIZE(cgrp->bpf.effective) in cgroup_bpf_inherit()
204 ret = percpu_ref_init(&cgrp->bpf.refcnt, cgroup_bpf_release_fn, 0, in cgroup_bpf_inherit()
210 INIT_LIST_HEAD(&cgrp->bpf.progs[i]); in cgroup_bpf_inherit()
224 percpu_ref_exit(&cgrp->bpf.refcnt); in cgroup_bpf_inherit()
239 if (percpu_ref_is_zero(&desc->bpf.refcnt)) in update_effective_progs()
242 err = compute_effective_progs(desc, type, &desc->bpf.inactive); in update_effective_progs()
251 if (percpu_ref_is_zero(&desc->bpf.refcnt)) { in update_effective_progs()
252 if (unlikely(desc->bpf.inactive)) { in update_effective_progs()
253 bpf_prog_array_free(desc->bpf.inactive); in update_effective_progs()
254 desc->bpf.inactive = NULL; in update_effective_progs()
259 activate_effective_progs(desc, type, desc->bpf.inactive); in update_effective_progs()
260 desc->bpf.inactive = NULL; in update_effective_progs()
272 bpf_prog_array_free(desc->bpf.inactive); in update_effective_progs()
273 desc->bpf.inactive = NULL; in update_effective_progs()
294 struct list_head *progs = &cgrp->bpf.progs[type]; in __cgroup_bpf_attach()
310 if (!list_empty(progs) && cgrp->bpf.flags[type] != flags) in __cgroup_bpf_attach()
376 cgrp->bpf.flags[type] = flags; in __cgroup_bpf_attach()
423 struct list_head *progs = &cgrp->bpf.progs[type]; in __cgroup_bpf_detach()
425 u32 flags = cgrp->bpf.flags[type]; in __cgroup_bpf_detach()
478 cgrp->bpf.flags[type] = 0; in __cgroup_bpf_detach()
496 struct list_head *progs = &cgrp->bpf.progs[type]; in __cgroup_bpf_query()
497 u32 flags = cgrp->bpf.flags[type]; in __cgroup_bpf_query()
501 effective = rcu_dereference_protected(cgrp->bpf.effective[type], in __cgroup_bpf_query()
642 cgrp->bpf.effective[type], skb, __bpf_prog_run_save_cb); in __cgroup_bpf_run_filter_skb()
644 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], skb, in __cgroup_bpf_run_filter_skb()
675 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], sk, BPF_PROG_RUN); in __cgroup_bpf_run_filter_sk()
719 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], &ctx, BPF_PROG_RUN); in __cgroup_bpf_run_filter_sock_addr()
748 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], sock_ops, in __cgroup_bpf_run_filter_sock_ops()
767 allow = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], &ctx, in __cgroup_bpf_check_dev_permission()
926 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[type], &ctx, BPF_PROG_RUN); in __cgroup_bpf_run_filter_sysctl()
950 prog_array = rcu_dereference(cgrp->bpf.effective[attach_type]); in __cgroup_bpf_prog_array_is_empty()
1014 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[BPF_CGROUP_SETSOCKOPT], in __cgroup_bpf_run_filter_setsockopt()
1098 ret = BPF_PROG_RUN_ARRAY(cgrp->bpf.effective[BPF_CGROUP_GETSOCKOPT], in __cgroup_bpf_run_filter_getsockopt()