aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bpf/helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/bpf/helpers.c')
-rw-r--r--kernel/bpf/helpers.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 1991466b8327..9070b2ace6aa 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -194,16 +194,18 @@ const struct bpf_func_proto bpf_get_current_cgroup_id_proto = {
194 .ret_type = RET_INTEGER, 194 .ret_type = RET_INTEGER,
195}; 195};
196 196
197DECLARE_PER_CPU(void*, bpf_cgroup_storage); 197#ifdef CONFIG_CGROUP_BPF
198DECLARE_PER_CPU(void*, bpf_cgroup_storage[MAX_BPF_CGROUP_STORAGE_TYPE]);
198 199
199BPF_CALL_2(bpf_get_local_storage, struct bpf_map *, map, u64, flags) 200BPF_CALL_2(bpf_get_local_storage, struct bpf_map *, map, u64, flags)
200{ 201{
201 /* map and flags arguments are not used now, 202 /* flags argument is not used now,
202 * but provide an ability to extend the API 203 * but provides an ability to extend the API.
203 * for other types of local storages. 204 * verifier checks that its value is correct.
204 * verifier checks that their values are correct.
205 */ 205 */
206 return (unsigned long) this_cpu_read(bpf_cgroup_storage); 206 enum bpf_cgroup_storage_type stype = cgroup_storage_type(map);
207
208 return (unsigned long) this_cpu_read(bpf_cgroup_storage[stype]);
207} 209}
208 210
209const struct bpf_func_proto bpf_get_local_storage_proto = { 211const struct bpf_func_proto bpf_get_local_storage_proto = {
@@ -214,3 +216,4 @@ const struct bpf_func_proto bpf_get_local_storage_proto = {
214 .arg2_type = ARG_ANYTHING, 216 .arg2_type = ARG_ANYTHING,
215}; 217};
216#endif 218#endif
219#endif