aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bpf.h
diff options
context:
space:
mode:
authorRoman Gushchin <guro@fb.com>2018-09-28 10:45:36 -0400
committerDaniel Borkmann <daniel@iogearbox.net>2018-10-01 10:18:32 -0400
commit8bad74f9840f87661f20ced3dc80c84ab4fd55a1 (patch)
tree1ac3ef2547d12f0fd6a232fbc1daac2672537907 /include/linux/bpf.h
parent5bf7a60b8e70969f65c961d7e2c4eb40eb2c664d (diff)
bpf: extend cgroup bpf core to allow multiple cgroup storage types
In order to introduce per-cpu cgroup storage, let's generalize bpf cgroup core to support multiple cgroup storage types. Potentially, per-node cgroup storage can be added later. This commit is mostly a formal change that replaces cgroup_storage pointer with a array of cgroup_storage pointers. It doesn't actually introduce a new storage type, it will be done later. Each bpf program is now able to have one cgroup storage of each type. Signed-off-by: Roman Gushchin <guro@fb.com> Acked-by: Song Liu <songliubraving@fb.com> Cc: Daniel Borkmann <daniel@iogearbox.net> Cc: Alexei Starovoitov <ast@kernel.org> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'include/linux/bpf.h')
-rw-r--r--include/linux/bpf.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index 988a00797bcd..b457fbe7b70b 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -272,6 +272,13 @@ struct bpf_prog_offload {
272 u32 jited_len; 272 u32 jited_len;
273}; 273};
274 274
275enum bpf_cgroup_storage_type {
276 BPF_CGROUP_STORAGE_SHARED,
277 __BPF_CGROUP_STORAGE_MAX
278};
279
280#define MAX_BPF_CGROUP_STORAGE_TYPE __BPF_CGROUP_STORAGE_MAX
281
275struct bpf_prog_aux { 282struct bpf_prog_aux {
276 atomic_t refcnt; 283 atomic_t refcnt;
277 u32 used_map_cnt; 284 u32 used_map_cnt;
@@ -289,7 +296,7 @@ struct bpf_prog_aux {
289 struct bpf_prog *prog; 296 struct bpf_prog *prog;
290 struct user_struct *user; 297 struct user_struct *user;
291 u64 load_time; /* ns since boottime */ 298 u64 load_time; /* ns since boottime */
292 struct bpf_map *cgroup_storage; 299 struct bpf_map *cgroup_storage[MAX_BPF_CGROUP_STORAGE_TYPE];
293 char name[BPF_OBJ_NAME_LEN]; 300 char name[BPF_OBJ_NAME_LEN];
294#ifdef CONFIG_SECURITY 301#ifdef CONFIG_SECURITY
295 void *security; 302 void *security;
@@ -358,7 +365,7 @@ int bpf_prog_test_run_skb(struct bpf_prog *prog, const union bpf_attr *kattr,
358 */ 365 */
359struct bpf_prog_array_item { 366struct bpf_prog_array_item {
360 struct bpf_prog *prog; 367 struct bpf_prog *prog;
361 struct bpf_cgroup_storage *cgroup_storage; 368 struct bpf_cgroup_storage *cgroup_storage[MAX_BPF_CGROUP_STORAGE_TYPE];
362}; 369};
363 370
364struct bpf_prog_array { 371struct bpf_prog_array {