Lines Matching refs:map
75 struct bpf_map map; member
130 bpf_map_init_from_attr(&dtab->map, attr); in dev_map_init_map()
133 dtab->n_buckets = roundup_pow_of_two(dtab->map.max_entries); in dev_map_init_map()
141 dtab->map.numa_node); in dev_map_init_map()
147 dtab->netdev_map = bpf_map_area_alloc((u64) dtab->map.max_entries * in dev_map_init_map()
149 dtab->map.numa_node); in dev_map_init_map()
179 return &dtab->map; in dev_map_alloc()
182 static void dev_map_free(struct bpf_map *map) in dev_map_free() argument
184 struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); in dev_map_free()
201 bpf_clear_redirect_map(map); in dev_map_free()
207 if (dtab->map.map_type == BPF_MAP_TYPE_DEVMAP_HASH) { in dev_map_free()
226 for (i = 0; i < dtab->map.max_entries; i++) { in dev_map_free()
245 static int dev_map_get_next_key(struct bpf_map *map, void *key, void *next_key) in dev_map_get_next_key() argument
247 struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); in dev_map_get_next_key()
251 if (index >= dtab->map.max_entries) { in dev_map_get_next_key()
256 if (index == dtab->map.max_entries - 1) in dev_map_get_next_key()
266 static void *__dev_map_hash_lookup_elem(struct bpf_map *map, u32 key) in __dev_map_hash_lookup_elem() argument
268 struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); in __dev_map_hash_lookup_elem()
280 static int dev_map_hash_get_next_key(struct bpf_map *map, void *key, in dev_map_hash_get_next_key() argument
283 struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); in dev_map_hash_get_next_key()
294 dev = __dev_map_hash_lookup_elem(map, idx); in dev_map_hash_get_next_key()
428 static void *__dev_map_lookup_elem(struct bpf_map *map, u32 key) in __dev_map_lookup_elem() argument
430 struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); in __dev_map_lookup_elem()
433 if (key >= map->max_entries) in __dev_map_lookup_elem()
590 struct bpf_map *map, bool exclude_ingress) in dev_map_enqueue_multi() argument
592 struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); in dev_map_enqueue_multi()
610 if (map->map_type == BPF_MAP_TYPE_DEVMAP) { in dev_map_enqueue_multi()
611 for (i = 0; i < map->max_entries; i++) { in dev_map_enqueue_multi()
711 struct bpf_prog *xdp_prog, struct bpf_map *map, in dev_map_redirect_multi() argument
714 struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); in dev_map_redirect_multi()
728 if (map->map_type == BPF_MAP_TYPE_DEVMAP) { in dev_map_redirect_multi()
729 for (i = 0; i < map->max_entries; i++) { in dev_map_redirect_multi()
786 static void *dev_map_lookup_elem(struct bpf_map *map, void *key) in dev_map_lookup_elem() argument
788 struct bpf_dtab_netdev *obj = __dev_map_lookup_elem(map, *(u32 *)key); in dev_map_lookup_elem()
793 static void *dev_map_hash_lookup_elem(struct bpf_map *map, void *key) in dev_map_hash_lookup_elem() argument
795 struct bpf_dtab_netdev *obj = __dev_map_hash_lookup_elem(map, in dev_map_hash_lookup_elem()
811 static int dev_map_delete_elem(struct bpf_map *map, void *key) in dev_map_delete_elem() argument
813 struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); in dev_map_delete_elem()
817 if (k >= map->max_entries) in dev_map_delete_elem()
826 static int dev_map_hash_delete_elem(struct bpf_map *map, void *key) in dev_map_hash_delete_elem() argument
828 struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); in dev_map_hash_delete_elem()
836 old_dev = __dev_map_hash_lookup_elem(map, k); in dev_map_hash_delete_elem()
856 dev = bpf_map_kmalloc_node(&dtab->map, sizeof(*dev), in __dev_map_alloc_node()
858 dtab->map.numa_node); in __dev_map_alloc_node()
896 static int __dev_map_update_elem(struct net *net, struct bpf_map *map, in __dev_map_update_elem() argument
899 struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); in __dev_map_update_elem()
906 if (unlikely(i >= dtab->map.max_entries)) in __dev_map_update_elem()
912 memcpy(&val, value, map->value_size); in __dev_map_update_elem()
936 static int dev_map_update_elem(struct bpf_map *map, void *key, void *value, in dev_map_update_elem() argument
940 map, key, value, map_flags); in dev_map_update_elem()
943 static int __dev_map_hash_update_elem(struct net *net, struct bpf_map *map, in __dev_map_hash_update_elem() argument
946 struct bpf_dtab *dtab = container_of(map, struct bpf_dtab, map); in __dev_map_hash_update_elem()
954 memcpy(&val, value, map->value_size); in __dev_map_hash_update_elem()
961 old_dev = __dev_map_hash_lookup_elem(map, idx); in __dev_map_hash_update_elem()
974 if (dtab->items >= dtab->map.max_entries) { in __dev_map_hash_update_elem()
996 static int dev_map_hash_update_elem(struct bpf_map *map, void *key, void *value, in dev_map_hash_update_elem() argument
1000 map, key, value, map_flags); in dev_map_hash_update_elem()
1003 static int dev_map_redirect(struct bpf_map *map, u32 ifindex, u64 flags) in dev_map_redirect() argument
1005 return __bpf_xdp_redirect_map(map, ifindex, flags, in dev_map_redirect()
1010 static int dev_hash_map_redirect(struct bpf_map *map, u32 ifindex, u64 flags) in dev_hash_map_redirect() argument
1012 return __bpf_xdp_redirect_map(map, ifindex, flags, in dev_hash_map_redirect()
1101 if (dtab->map.map_type == BPF_MAP_TYPE_DEVMAP_HASH) { in dev_map_notification()
1106 for (i = 0; i < dtab->map.max_entries; i++) { in dev_map_notification()