diff options
author | Stanislav Fomichev <sdf@google.com> | 2020-05-08 10:46:09 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-05-09 00:48:20 +0200 |
commit | 488a23b89d175cc78f352417114f4f5a10470722 (patch) | |
tree | 547d059679ced0d9deb2f18100789bdedba84e1f /tools/testing/selftests/bpf/prog_tests/map_lock.c | |
parent | 33181bb8e8fe947e1f8020a4b103601a4cac94d9 (diff) |
selftests/bpf: Move existing common networking parts into network_helpers
1. Move pkt_v4 and pkt_v6 into network_helpers and adjust the users.
2. Copy-paste spin_lock_thread into two tests that use it.
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Acked-by: Andrey Ignatov <rdna@fb.com>
Link: https://lore.kernel.org/bpf/20200508174611.228805-3-sdf@google.com
Diffstat (limited to 'tools/testing/selftests/bpf/prog_tests/map_lock.c')
-rw-r--r-- | tools/testing/selftests/bpf/prog_tests/map_lock.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/prog_tests/map_lock.c b/tools/testing/selftests/bpf/prog_tests/map_lock.c index 8f91f1881d11..ce17b1ed8709 100644 --- a/tools/testing/selftests/bpf/prog_tests/map_lock.c +++ b/tools/testing/selftests/bpf/prog_tests/map_lock.c @@ -1,5 +1,19 @@ // SPDX-License-Identifier: GPL-2.0 #include <test_progs.h> +#include <network_helpers.h> + +static void *spin_lock_thread(void *arg) +{ + __u32 duration, retval; + int err, prog_fd = *(u32 *) arg; + + err = bpf_prog_test_run(prog_fd, 10000, &pkt_v4, sizeof(pkt_v4), + NULL, NULL, &retval, &duration); + CHECK(err || retval, "", + "err %d errno %d retval %d duration %d\n", + err, errno, retval, duration); + pthread_exit(arg); +} static void *parallel_map_access(void *arg) { |