Lines Matching refs: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) \
116 for (fp = &entry->fp_items[0], cp = &entry->parent->cp_items[0];\
124 #define bpf_mprog_foreach_prog(entry, fp, p) \
125 for (fp = &entry->fp_items[0]; \
159 bpf_mprog_peer(const struct bpf_mprog_entry *entry)
161 if (entry == &entry->parent->a)
162 return &entry->parent->b;
164 return &entry->parent->a;
179 static inline void bpf_mprog_inc(struct bpf_mprog_entry *entry)
181 entry->parent->count++;
184 static inline void bpf_mprog_dec(struct bpf_mprog_entry *entry)
186 entry->parent->count--;
194 static inline int bpf_mprog_total(struct bpf_mprog_entry *entry)
196 int total = entry->parent->count;
202 static inline bool bpf_mprog_exists(struct bpf_mprog_entry *entry,
208 bpf_mprog_foreach_prog(entry, fp, tmp) {
215 static inline void bpf_mprog_mark_for_release(struct bpf_mprog_entry *entry,
218 WARN_ON_ONCE(entry->parent->ref);
220 entry->parent->ref = tuple->prog;
223 static inline void bpf_mprog_complete_release(struct bpf_mprog_entry *entry)
231 if (entry->parent->ref) {
232 bpf_prog_put(entry->parent->ref);
233 entry->parent->ref = NULL;
237 static inline void bpf_mprog_revision_new(struct bpf_mprog_entry *entry)
239 atomic64_inc(&entry->parent->revision);
242 static inline void bpf_mprog_commit(struct bpf_mprog_entry *entry)
244 bpf_mprog_complete_release(entry);
245 bpf_mprog_revision_new(entry);
248 static inline u64 bpf_mprog_revision(struct bpf_mprog_entry *entry)
250 return atomic64_read(&entry->parent->revision);
264 static inline void bpf_mprog_clear_all(struct bpf_mprog_entry *entry,
269 peer = bpf_mprog_peer(entry);
275 static inline void bpf_mprog_entry_grow(struct bpf_mprog_entry *entry, int idx)
277 int total = bpf_mprog_total(entry);
279 memmove(entry->fp_items + idx + 1,
280 entry->fp_items + idx,
283 memmove(entry->parent->cp_items + idx + 1,
284 entry->parent->cp_items + idx,
288 static inline void bpf_mprog_entry_shrink(struct bpf_mprog_entry *entry, int idx)
291 * entry is copied at the end.
293 int total = ARRAY_SIZE(entry->fp_items);
295 memmove(entry->fp_items + idx,
296 entry->fp_items + idx + 1,
299 memmove(entry->parent->cp_items + idx,
300 entry->parent->cp_items + idx + 1,
304 static inline void bpf_mprog_read(struct bpf_mprog_entry *entry, u32 idx,
308 *fp = &entry->fp_items[idx];
309 *cp = &entry->parent->cp_items[idx];
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);