Skip to content

Commit 6ad4e6e

Browse files
Martin KaFai LauAlexei Starovoitov
authored andcommitted
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>
1 parent a824c9a commit 6ad4e6e

1 file changed

Lines changed: 15 additions & 7 deletions

File tree

tools/testing/selftests/bpf/progs/bpf_dctcp.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,23 @@
66
* the kernel BPF logic.
77
*/
88

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"
1510
#include <bpf/bpf_helpers.h>
1611
#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+
}
1826

1927
char _license[] SEC("license") = "GPL";
2028

0 commit comments

Comments
 (0)