Lines Matching full:entry
23 * struct bpf_mprog_entry *entry, *entry_new;
27 * // fetch active @entry from attach location
29 * ret = bpf_mprog_attach(entry, &entry_new, [...]);
31 * if (entry != entry_new) {
32 * // swap @entry to @entry_new at attach location
33 * // ensure there are no inflight users of @entry:
36 * bpf_mprog_commit(entry);
44 * struct bpf_mprog_entry *entry, *entry_new;
48 * // fetch active @entry from attach location
50 * ret = bpf_mprog_detach(entry, &entry_new, [...]);
56 * // swap @entry to @entry_new at attach location
57 * // ensure there are no inflight users of @entry:
59 * bpf_mprog_commit(entry);
69 * struct bpf_mprog_entry *entry;
73 * // fetch active @entry from attach location
75 * ret = bpf_mprog_query(attr, uattr, entry);
80 * struct bpf_mprog_entry *entry;
86 * // fetch active @entry from attach location
88 * bpf_mprog_foreach_prog(entry, fp, prog) {
115 #define bpf_mprog_foreach_tuple(entry, fp, cp, t) \ argument
116 for (fp = &entry->fp_items[0], cp = &entry->parent->cp_items[0];\
124 #define bpf_mprog_foreach_prog(entry, fp, p) \ argument
125 for (fp = &entry->fp_items[0]; \
159 bpf_mprog_peer(const struct bpf_mprog_entry *entry) in bpf_mprog_peer() argument
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()
179 static inline void bpf_mprog_inc(struct bpf_mprog_entry *entry) in bpf_mprog_inc() argument
181 entry->parent->count++; in bpf_mprog_inc()
184 static inline void bpf_mprog_dec(struct bpf_mprog_entry *entry) in bpf_mprog_dec() argument
186 entry->parent->count--; in bpf_mprog_dec()
194 static inline int bpf_mprog_total(struct bpf_mprog_entry *entry) in bpf_mprog_total() argument
196 int total = entry->parent->count; in bpf_mprog_total()
202 static inline bool bpf_mprog_exists(struct bpf_mprog_entry *entry, in bpf_mprog_exists() argument
208 bpf_mprog_foreach_prog(entry, fp, tmp) { in bpf_mprog_exists()
215 static inline void bpf_mprog_mark_for_release(struct bpf_mprog_entry *entry, in bpf_mprog_mark_for_release() argument
218 WARN_ON_ONCE(entry->parent->ref); in bpf_mprog_mark_for_release()
220 entry->parent->ref = tuple->prog; in bpf_mprog_mark_for_release()
223 static inline void bpf_mprog_complete_release(struct bpf_mprog_entry *entry) in bpf_mprog_complete_release() argument
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()
237 static inline void bpf_mprog_revision_new(struct bpf_mprog_entry *entry) in bpf_mprog_revision_new() argument
239 atomic64_inc(&entry->parent->revision); in bpf_mprog_revision_new()
242 static inline void bpf_mprog_commit(struct bpf_mprog_entry *entry) in bpf_mprog_commit() argument
244 bpf_mprog_complete_release(entry); in bpf_mprog_commit()
245 bpf_mprog_revision_new(entry); in bpf_mprog_commit()
248 static inline u64 bpf_mprog_revision(struct bpf_mprog_entry *entry) in bpf_mprog_revision() argument
250 return atomic64_read(&entry->parent->revision); in bpf_mprog_revision()
264 static inline void bpf_mprog_clear_all(struct bpf_mprog_entry *entry, in bpf_mprog_clear_all() argument
269 peer = bpf_mprog_peer(entry); in bpf_mprog_clear_all()
275 static inline void bpf_mprog_entry_grow(struct bpf_mprog_entry *entry, int idx) in bpf_mprog_entry_grow() argument
277 int total = bpf_mprog_total(entry); in bpf_mprog_entry_grow()
279 memmove(entry->fp_items + idx + 1, in bpf_mprog_entry_grow()
280 entry->fp_items + idx, 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()
288 static inline void bpf_mprog_entry_shrink(struct bpf_mprog_entry *entry, int idx) in bpf_mprog_entry_shrink() argument
291 * entry is copied at the end. in bpf_mprog_entry_shrink()
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()
299 memmove(entry->parent->cp_items + idx, in bpf_mprog_entry_shrink()
300 entry->parent->cp_items + idx + 1, in bpf_mprog_entry_shrink()
304 static inline void bpf_mprog_read(struct bpf_mprog_entry *entry, u32 idx, in bpf_mprog_read() argument
308 *fp = &entry->fp_items[idx]; in bpf_mprog_read()
309 *cp = &entry->parent->cp_items[idx]; in bpf_mprog_read()
320 int bpf_mprog_attach(struct bpf_mprog_entry *entry,
326 int bpf_mprog_detach(struct bpf_mprog_entry *entry,
332 struct bpf_mprog_entry *entry);