Lines Matching refs:attr
52 int array_map_alloc_check(union bpf_attr *attr) in array_map_alloc_check() argument
54 bool percpu = attr->map_type == BPF_MAP_TYPE_PERCPU_ARRAY; in array_map_alloc_check()
55 int numa_node = bpf_map_attr_numa_node(attr); in array_map_alloc_check()
58 if (attr->max_entries == 0 || attr->key_size != 4 || in array_map_alloc_check()
59 attr->value_size == 0 || in array_map_alloc_check()
60 attr->map_flags & ~ARRAY_CREATE_FLAG_MASK || in array_map_alloc_check()
61 !bpf_map_flags_access_ok(attr->map_flags) || in array_map_alloc_check()
65 if (attr->map_type != BPF_MAP_TYPE_ARRAY && in array_map_alloc_check()
66 attr->map_flags & (BPF_F_MMAPABLE | BPF_F_INNER_MAP)) in array_map_alloc_check()
69 if (attr->map_type != BPF_MAP_TYPE_PERF_EVENT_ARRAY && in array_map_alloc_check()
70 attr->map_flags & BPF_F_PRESERVE_ELEMS) in array_map_alloc_check()
74 if (attr->value_size > INT_MAX) in array_map_alloc_check()
80 static struct bpf_map *array_map_alloc(union bpf_attr *attr) in array_map_alloc() argument
82 bool percpu = attr->map_type == BPF_MAP_TYPE_PERCPU_ARRAY; in array_map_alloc()
83 int numa_node = bpf_map_attr_numa_node(attr); in array_map_alloc()
89 elem_size = round_up(attr->value_size, 8); in array_map_alloc()
91 max_entries = attr->max_entries; in array_map_alloc()
108 if (max_entries < attr->max_entries) in array_map_alloc()
119 if (attr->map_flags & BPF_F_MMAPABLE) { in array_map_alloc()
128 if (attr->map_flags & BPF_F_MMAPABLE) { in array_map_alloc()
146 bpf_map_init_from_attr(&array->map, attr); in array_map_alloc()
778 static int fd_array_map_alloc_check(union bpf_attr *attr) in fd_array_map_alloc_check() argument
781 if (attr->value_size != sizeof(u32)) in fd_array_map_alloc_check()
784 if (attr->map_flags & (BPF_F_RDONLY_PROG | BPF_F_WRONLY_PROG)) in fd_array_map_alloc_check()
786 return array_map_alloc_check(attr); in fd_array_map_alloc_check()
1071 static struct bpf_map *prog_array_map_alloc(union bpf_attr *attr) in prog_array_map_alloc() argument
1084 map = array_map_alloc(attr); in prog_array_map_alloc()
1269 static struct bpf_map *array_of_map_alloc(union bpf_attr *attr) in array_of_map_alloc() argument
1273 inner_map_meta = bpf_map_meta_alloc(attr->inner_map_fd); in array_of_map_alloc()
1277 map = array_map_alloc(attr); in array_of_map_alloc()