aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/bpf/progs/bpf_cubic.c
diff options
context:
space:
mode:
authorSong Liu <song@kernel.org>2023-09-18 23:02:58 -0700
committerAlexei Starovoitov <ast@kernel.org>2023-09-19 02:59:28 -0700
commit48f5e7d3f7300ff679dc50bfb7a7451de6f29e4c (patch)
treecc9c6941fc983916828daec9468a9a3a691d73d8 /tools/testing/selftests/bpf/progs/bpf_cubic.c
parents390/bpf: Let arch_prepare_bpf_trampoline return program size (diff)
downloadlinux-48f5e7d3f7300ff679dc50bfb7a7451de6f29e4c.tar.xz
linux-48f5e7d3f7300ff679dc50bfb7a7451de6f29e4c.zip
selftests/bpf: Check bpf_cubic_acked() is called via struct_ops
Test bpf_tcp_ca (in test_progs) checks multiple tcp_congestion_ops. However, there isn't a test that verifies functions in the tcp_congestion_ops is actually called. Add a check to verify that bpf_cubic_acked is actually called during the test. Suggested-by: Martin KaFai Lau <martin.lau@kernel.org> Signed-off-by: Song Liu <song@kernel.org> Acked-by: Ilya Leoshkevich <iii@linux.ibm.com> Link: https://lore.kernel.org/r/20230919060258.3237176-3-song@kernel.org Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/bpf_cubic.c')
-rw-r--r--tools/testing/selftests/bpf/progs/bpf_cubic.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/progs/bpf_cubic.c b/tools/testing/selftests/bpf/progs/bpf_cubic.c
index d9660e7200e2..c997e3e3d3fb 100644
--- a/tools/testing/selftests/bpf/progs/bpf_cubic.c
+++ b/tools/testing/selftests/bpf/progs/bpf_cubic.c
@@ -490,6 +490,8 @@ static __always_inline void hystart_update(struct sock *sk, __u32 delay)
}
}
+int bpf_cubic_acked_called = 0;
+
void BPF_STRUCT_OPS(bpf_cubic_acked, struct sock *sk,
const struct ack_sample *sample)
{
@@ -497,6 +499,7 @@ void BPF_STRUCT_OPS(bpf_cubic_acked, struct sock *sk,
struct bictcp *ca = inet_csk_ca(sk);
__u32 delay;
+ bpf_cubic_acked_called = 1;
/* Some calls are for duplicates without timetamps */
if (sample->rtt_us < 0)
return;