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.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 6502115e8f55..ab0d5e3f9892 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -76,6 +76,49 @@ const struct bpf_func_proto bpf_map_delete_elem_proto = {
76 .arg2_type = ARG_PTR_TO_MAP_KEY, 76 .arg2_type = ARG_PTR_TO_MAP_KEY,
77}; 77};
78 78
79BPF_CALL_3(bpf_map_push_elem, struct bpf_map *, map, void *, value, u64, flags)
80{
81 return map->ops->map_push_elem(map, value, flags);
82}
83
84const struct bpf_func_proto bpf_map_push_elem_proto = {
85 .func = bpf_map_push_elem,
86 .gpl_only = false,
87 .pkt_access = true,
88 .ret_type = RET_INTEGER,
89 .arg1_type = ARG_CONST_MAP_PTR,
90 .arg2_type = ARG_PTR_TO_MAP_VALUE,
91 .arg3_type = ARG_ANYTHING,
92};
93
94BPF_CALL_2(bpf_map_pop_elem, struct bpf_map *, map, void *, value)
95{
96 return map->ops->map_pop_elem(map, value);
97}
98
99const struct bpf_func_proto bpf_map_pop_elem_proto = {
100 .func = bpf_map_pop_elem,
101 .gpl_only = false,
102 .pkt_access = true,
103 .ret_type = RET_INTEGER,
104 .arg1_type = ARG_CONST_MAP_PTR,
105 .arg2_type = ARG_PTR_TO_UNINIT_MAP_VALUE,
106};
107
108BPF_CALL_2(bpf_map_peek_elem, struct bpf_map *, map, void *, value)
109{
110 return map->ops->map_peek_elem(map, value);
111}
112
113const struct bpf_func_proto bpf_map_peek_elem_proto = {
114 .func = bpf_map_pop_elem,
115 .gpl_only = false,
116 .pkt_access = true,
117 .ret_type = RET_INTEGER,
118 .arg1_type = ARG_CONST_MAP_PTR,
119 .arg2_type = ARG_PTR_TO_UNINIT_MAP_VALUE,
120};
121
79const struct bpf_func_proto bpf_get_prandom_u32_proto = { 122const struct bpf_func_proto bpf_get_prandom_u32_proto = {
80 .func = bpf_user_rnd_u32, 123 .func = bpf_user_rnd_u32,
81 .gpl_only = false, 124 .gpl_only = false,