diff options
author | Martin KaFai Lau <martin.lau@kernel.org> | 2024-05-09 10:50:22 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2024-05-09 11:13:12 -0700 |
commit | a824c9a8a4d9a654d62674a8425c0f1abc9c3d33 (patch) | |
tree | 849109c0f9b65ebe1eaa9b52ba5c644ee82a6787 | |
parent | b1d87ae9b0d3d91767d85183e40c96f4229a6c21 (diff) | |
download | linux-a824c9a8a4d9a654d62674a8425c0f1abc9c3d33.tar.gz linux-a824c9a8a4d9a654d62674a8425c0f1abc9c3d33.tar.bz2 linux-a824c9a8a4d9a654d62674a8425c0f1abc9c3d33.zip |
selftests/bpf: Use bpf_tracing_net.h in bpf_cubic
This patch uses bpf_tracing_net.h (i.e. vmlinux.h) in bpf_cubic.
This will allow to retire the bpf_tcp_helpers.h and consolidate
tcp-cc tests to vmlinux.h.
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20240509175026.3423614-7-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
-rw-r--r-- | tools/testing/selftests/bpf/progs/bpf_cubic.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/tools/testing/selftests/bpf/progs/bpf_cubic.c b/tools/testing/selftests/bpf/progs/bpf_cubic.c index 53872e2d2c52..d665b8a15cc4 100644 --- a/tools/testing/selftests/bpf/progs/bpf_cubic.c +++ b/tools/testing/selftests/bpf/progs/bpf_cubic.c @@ -14,14 +14,22 @@ * "ca->ack_cnt / delta" operation. */ -#include <linux/bpf.h> -#include <linux/stddef.h> -#include <linux/tcp.h> -#include "bpf_tcp_helpers.h" +#include "bpf_tracing_net.h" +#include <bpf/bpf_tracing.h> char _license[] SEC("license") = "GPL"; #define clamp(val, lo, hi) min((typeof(val))max(val, lo), hi) +#define min(a, b) ((a) < (b) ? (a) : (b)) +#define max(a, b) ((a) > (b) ? (a) : (b)) +static bool before(__u32 seq1, __u32 seq2) +{ + return (__s32)(seq1-seq2) < 0; +} +#define after(seq2, seq1) before(seq1, seq2) + +extern __u32 tcp_slow_start(struct tcp_sock *tp, __u32 acked) __ksym; +extern void tcp_cong_avoid_ai(struct tcp_sock *tp, __u32 w, __u32 acked) __ksym; #define BICTCP_BETA_SCALE 1024 /* Scale factor beta calculation * max_cwnd = snd_cwnd * beta |