Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Use bpf_tracing_net.h in bpf_dctcp

This patch uses bpf_tracing_net.h (i.e. vmlinux.h) in bpf_dctcp.
This will allow to retire the bpf_tcp_helpers.h and consolidate
tcp-cc tests to vmlinux.h.

It will have a dup on min/max macros with the bpf_cubic. It could
be further refactored in the future.

Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20240509175026.3423614-8-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Martin KaFai Lau and committed by
Alexei Starovoitov
6ad4e6e9 a824c9a8

+15 -7
+15 -7
tools/testing/selftests/bpf/progs/bpf_dctcp.c
··· 6 6 * the kernel BPF logic. 7 7 */ 8 8 9 - #include <stddef.h> 10 - #include <linux/bpf.h> 11 - #include <linux/types.h> 12 - #include <linux/stddef.h> 13 - #include <linux/tcp.h> 14 - #include <errno.h> 9 + #include "bpf_tracing_net.h" 15 10 #include <bpf/bpf_helpers.h> 16 11 #include <bpf/bpf_tracing.h> 17 - #include "bpf_tcp_helpers.h" 12 + 13 + #ifndef EBUSY 14 + #define EBUSY 16 15 + #endif 16 + #define min(a, b) ((a) < (b) ? (a) : (b)) 17 + #define max(a, b) ((a) > (b) ? (a) : (b)) 18 + #define min_not_zero(x, y) ({ \ 19 + typeof(x) __x = (x); \ 20 + typeof(y) __y = (y); \ 21 + __x == 0 ? __y : ((__y == 0) ? __x : min(__x, __y)); }) 22 + static bool before(__u32 seq1, __u32 seq2) 23 + { 24 + return (__s32)(seq1-seq2) < 0; 25 + } 18 26 19 27 char _license[] SEC("license") = "GPL"; 20 28