diff options
Diffstat (limited to 'kernel/bpf/helpers.c')
-rw-r--r-- | kernel/bpf/helpers.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c index 95eb59a045ea..bd7f5988ed9c 100644 --- a/kernel/bpf/helpers.c +++ b/kernel/bpf/helpers.c | |||
@@ -12,6 +12,7 @@ | |||
12 | #include <linux/bpf.h> | 12 | #include <linux/bpf.h> |
13 | #include <linux/rcupdate.h> | 13 | #include <linux/rcupdate.h> |
14 | #include <linux/random.h> | 14 | #include <linux/random.h> |
15 | #include <linux/smp.h> | ||
15 | 16 | ||
16 | /* If kernel subsystem is allowing eBPF programs to call this function, | 17 | /* If kernel subsystem is allowing eBPF programs to call this function, |
17 | * inside its own verifier_ops->get_func_proto() callback it should return | 18 | * inside its own verifier_ops->get_func_proto() callback it should return |
@@ -99,3 +100,14 @@ const struct bpf_func_proto bpf_get_prandom_u32_proto = { | |||
99 | .gpl_only = false, | 100 | .gpl_only = false, |
100 | .ret_type = RET_INTEGER, | 101 | .ret_type = RET_INTEGER, |
101 | }; | 102 | }; |
103 | |||
104 | static u64 bpf_get_smp_processor_id(u64 r1, u64 r2, u64 r3, u64 r4, u64 r5) | ||
105 | { | ||
106 | return raw_smp_processor_id(); | ||
107 | } | ||
108 | |||
109 | const struct bpf_func_proto bpf_get_smp_processor_id_proto = { | ||
110 | .func = bpf_get_smp_processor_id, | ||
111 | .gpl_only = false, | ||
112 | .ret_type = RET_INTEGER, | ||
113 | }; | ||