Lines Matching refs:map
15 static struct xsk_map_node *xsk_map_node_alloc(struct xsk_map *map, in xsk_map_node_alloc() argument
20 node = bpf_map_kzalloc(&map->map, sizeof(*node), in xsk_map_node_alloc()
25 bpf_map_inc(&map->map); in xsk_map_node_alloc()
26 atomic_inc(&map->count); in xsk_map_node_alloc()
28 node->map = map; in xsk_map_node_alloc()
35 struct xsk_map *map = node->map; in xsk_map_node_free() local
37 bpf_map_put(&node->map->map); in xsk_map_node_free()
39 atomic_dec(&map->count); in xsk_map_node_free()
82 bpf_map_init_from_attr(&m->map, attr); in xsk_map_alloc()
85 return &m->map; in xsk_map_alloc()
88 static u64 xsk_map_mem_usage(const struct bpf_map *map) in xsk_map_mem_usage() argument
90 struct xsk_map *m = container_of(map, struct xsk_map, map); in xsk_map_mem_usage()
92 return struct_size(m, xsk_map, map->max_entries) + in xsk_map_mem_usage()
96 static void xsk_map_free(struct bpf_map *map) in xsk_map_free() argument
98 struct xsk_map *m = container_of(map, struct xsk_map, map); in xsk_map_free()
104 static int xsk_map_get_next_key(struct bpf_map *map, void *key, void *next_key) in xsk_map_get_next_key() argument
106 struct xsk_map *m = container_of(map, struct xsk_map, map); in xsk_map_get_next_key()
110 if (index >= m->map.max_entries) { in xsk_map_get_next_key()
115 if (index == m->map.max_entries - 1) in xsk_map_get_next_key()
121 static int xsk_map_gen_lookup(struct bpf_map *map, struct bpf_insn *insn_buf) in xsk_map_gen_lookup() argument
127 *insn++ = BPF_JMP_IMM(BPF_JGE, ret, map->max_entries, 5); in xsk_map_gen_lookup()
141 static void *__xsk_map_lookup_elem(struct bpf_map *map, u32 key) in __xsk_map_lookup_elem() argument
143 struct xsk_map *m = container_of(map, struct xsk_map, map); in __xsk_map_lookup_elem()
145 if (key >= map->max_entries) in __xsk_map_lookup_elem()
151 static void *xsk_map_lookup_elem(struct bpf_map *map, void *key) in xsk_map_lookup_elem() argument
153 return __xsk_map_lookup_elem(map, *(u32 *)key); in xsk_map_lookup_elem()
156 static void *xsk_map_lookup_elem_sys_only(struct bpf_map *map, void *key) in xsk_map_lookup_elem_sys_only() argument
161 static long xsk_map_update_elem(struct bpf_map *map, void *key, void *value, in xsk_map_update_elem() argument
164 struct xsk_map *m = container_of(map, struct xsk_map, map); in xsk_map_update_elem()
174 if (unlikely(i >= m->map.max_entries)) in xsk_map_update_elem()
222 static long xsk_map_delete_elem(struct bpf_map *map, void *key) in xsk_map_delete_elem() argument
224 struct xsk_map *m = container_of(map, struct xsk_map, map); in xsk_map_delete_elem()
229 if (k >= map->max_entries) in xsk_map_delete_elem()
242 static long xsk_map_redirect(struct bpf_map *map, u64 index, u64 flags) in xsk_map_redirect() argument
244 return __bpf_xdp_redirect_map(map, index, flags, 0, in xsk_map_redirect()
248 void xsk_map_try_sock_delete(struct xsk_map *map, struct xdp_sock *xs, in xsk_map_try_sock_delete() argument
251 spin_lock_bh(&map->lock); in xsk_map_try_sock_delete()
256 spin_unlock_bh(&map->lock); in xsk_map_try_sock_delete()