Lines Matching +full:multi +full:- +full:attr

1 /* SPDX-License-Identifier: GPL-2.0 */
10 * bpf_mprog is a generic layer for multi-program attachment. In-kernel users
15 * inside the multi-program array as well as prepend and append behavior if
26 * // bpf_mprog user-side lock
40 * // bpf_mprog user-side unlock
47 * // bpf_mprog user-side lock
52 * // all (*) marked is optional and depends on the use-case
65 * // bpf_mprog user-side unlock
72 * // bpf_mprog user-side lock
75 * ret = bpf_mprog_query(attr, uattr, entry);
76 * // bpf_mprog user-side unlock
116 for (fp = &entry->fp_items[0], cp = &entry->parent->cp_items[0];\
118 t.prog = READ_ONCE(fp->prog); \
119 t.link = cp->link; \
125 for (fp = &entry->fp_items[0]; \
126 (p = READ_ONCE(fp->prog)); \
161 if (entry == &entry->parent->a) in bpf_mprog_peer()
162 return &entry->parent->b; in bpf_mprog_peer()
164 return &entry->parent->a; in bpf_mprog_peer()
169 BUILD_BUG_ON(sizeof(bundle->a.fp_items[0]) > sizeof(u64)); in bpf_mprog_bundle_init()
170 BUILD_BUG_ON(ARRAY_SIZE(bundle->a.fp_items) != in bpf_mprog_bundle_init()
171 ARRAY_SIZE(bundle->cp_items)); in bpf_mprog_bundle_init()
174 atomic64_set(&bundle->revision, 1); in bpf_mprog_bundle_init()
175 bundle->a.parent = bundle; in bpf_mprog_bundle_init()
176 bundle->b.parent = bundle; in bpf_mprog_bundle_init()
181 entry->parent->count++; in bpf_mprog_inc()
186 entry->parent->count--; in bpf_mprog_dec()
191 return ARRAY_SIZE(((struct bpf_mprog_entry *)NULL)->fp_items) - 1; in bpf_mprog_max()
196 int total = entry->parent->count; in bpf_mprog_total()
218 WARN_ON_ONCE(entry->parent->ref); in bpf_mprog_mark_for_release()
219 if (!tuple->link) in bpf_mprog_mark_for_release()
220 entry->parent->ref = tuple->prog; in bpf_mprog_mark_for_release()
225 /* In the non-link case prog deletions can only drop the reference in bpf_mprog_complete_release()
231 if (entry->parent->ref) { in bpf_mprog_complete_release()
232 bpf_prog_put(entry->parent->ref); in bpf_mprog_complete_release()
233 entry->parent->ref = NULL; in bpf_mprog_complete_release()
239 atomic64_inc(&entry->parent->revision); in bpf_mprog_revision_new()
250 return atomic64_read(&entry->parent->revision); in bpf_mprog_revision()
256 memcpy(dst->fp_items, src->fp_items, sizeof(src->fp_items)); in bpf_mprog_entry_copy()
261 memset(dst->fp_items, 0, sizeof(dst->fp_items)); in bpf_mprog_entry_clear()
271 peer->parent->count = 0; in bpf_mprog_clear_all()
279 memmove(entry->fp_items + idx + 1, in bpf_mprog_entry_grow()
280 entry->fp_items + idx, in bpf_mprog_entry_grow()
281 (total - idx) * sizeof(struct bpf_mprog_fp)); in bpf_mprog_entry_grow()
283 memmove(entry->parent->cp_items + idx + 1, in bpf_mprog_entry_grow()
284 entry->parent->cp_items + idx, in bpf_mprog_entry_grow()
285 (total - idx) * sizeof(struct bpf_mprog_cp)); in bpf_mprog_entry_grow()
293 int total = ARRAY_SIZE(entry->fp_items); in bpf_mprog_entry_shrink()
295 memmove(entry->fp_items + idx, in bpf_mprog_entry_shrink()
296 entry->fp_items + idx + 1, in bpf_mprog_entry_shrink()
297 (total - idx - 1) * sizeof(struct bpf_mprog_fp)); in bpf_mprog_entry_shrink()
299 memmove(entry->parent->cp_items + idx, in bpf_mprog_entry_shrink()
300 entry->parent->cp_items + idx + 1, in bpf_mprog_entry_shrink()
301 (total - idx - 1) * sizeof(struct bpf_mprog_cp)); in bpf_mprog_entry_shrink()
308 *fp = &entry->fp_items[idx]; in bpf_mprog_read()
309 *cp = &entry->parent->cp_items[idx]; in bpf_mprog_read()
316 WRITE_ONCE(fp->prog, tuple->prog); in bpf_mprog_write()
317 cp->link = tuple->link; in bpf_mprog_write()
331 int bpf_mprog_query(const union bpf_attr *attr, union bpf_attr __user *uattr,