summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/test_skmsg_load_helpers.c
diff options
context:
space:
mode:
authorYonghong Song <yonghong.song@linux.dev>2024-04-09 21:35:42 -0700
committerAlexei Starovoitov <ast@kernel.org>2024-04-10 19:52:25 -0700
commita15d58b2bc82abd8c4c994af158b0410424a18d3 (patch)
treef5ccabb7cd293ca28b2663bed8ca11e0894ca8a6 /tools/testing/selftests/bpf/progs/test_skmsg_load_helpers.c
parent1f3e2091d25b2b140967480177fcaee2f0eebfb1 (diff)
downloadlinux-a15d58b2bc82abd8c4c994af158b0410424a18d3.tar.gz
linux-a15d58b2bc82abd8c4c994af158b0410424a18d3.tar.bz2
linux-a15d58b2bc82abd8c4c994af158b0410424a18d3.zip
selftests/bpf: Refactor out helper functions for a few tests
These helper functions will be used later new tests as well. There are no functionality change. Acked-by: Eduard Zingerman <eddyz87@gmail.com> Reviewed-by: John Fastabend <john.fastabend@gmail.com> Signed-off-by: Yonghong Song <yonghong.song@linux.dev> Link: https://lore.kernel.org/r/20240410043542.3738166-1-yonghong.song@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/test_skmsg_load_helpers.c')
-rw-r--r--tools/testing/selftests/bpf/progs/test_skmsg_load_helpers.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/testing/selftests/bpf/progs/test_skmsg_load_helpers.c b/tools/testing/selftests/bpf/progs/test_skmsg_load_helpers.c
index 45e8fc75a739..b753672f04c9 100644
--- a/tools/testing/selftests/bpf/progs/test_skmsg_load_helpers.c
+++ b/tools/testing/selftests/bpf/progs/test_skmsg_load_helpers.c
@@ -24,8 +24,7 @@ struct {
__type(value, __u64);
} socket_storage SEC(".maps");
-SEC("sk_msg")
-int prog_msg_verdict(struct sk_msg_md *msg)
+static int prog_msg_verdict_common(struct sk_msg_md *msg)
{
struct task_struct *task = (struct task_struct *)bpf_get_current_task();
int verdict = SK_PASS;
@@ -44,4 +43,10 @@ int prog_msg_verdict(struct sk_msg_md *msg)
return verdict;
}
+SEC("sk_msg")
+int prog_msg_verdict(struct sk_msg_md *msg)
+{
+ return prog_msg_verdict_common(msg);
+}
+
char _license[] SEC("license") = "GPL";