Skip to content

Commit cc5b18c

Browse files
Martin KaFai LauAlexei Starovoitov
authored andcommitted
selftests/bpf: Reuse the tcp_sk() from the bpf_tracing_net.h
This patch removes the individual tcp_sk implementations from the tcp-cc tests. The tcp_sk() implementation from the bpf_tracing_net.h is reused instead. Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Link: https://lore.kernel.org/r/20240509175026.3423614-4-martin.lau@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
1 parent cbaec46 commit cc5b18c

3 files changed

Lines changed: 3 additions & 21 deletions

File tree

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
// SPDX-License-Identifier: GPL-2.0
22

3-
#include "vmlinux.h"
4-
3+
#include "bpf_tracing_net.h"
54
#include <bpf/bpf_helpers.h>
65
#include <bpf/bpf_tracing.h>
76

87
char _license[] SEC("license") = "GPL";
98

10-
static inline struct tcp_sock *tcp_sk(const struct sock *sk)
11-
{
12-
return (struct tcp_sock *)sk;
13-
}
14-
159
SEC("struct_ops/incompl_cong_ops_ssthresh")
1610
__u32 BPF_PROG(incompl_cong_ops_ssthresh, struct sock *sk)
1711
{

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22

3-
#include "vmlinux.h"
4-
3+
#include "bpf_tracing_net.h"
54
#include <bpf/bpf_helpers.h>
65
#include <bpf/bpf_tracing.h>
76

@@ -10,11 +9,6 @@ char _license[] SEC("license") = "GPL";
109
int ca1_cnt = 0;
1110
int ca2_cnt = 0;
1211

13-
static inline struct tcp_sock *tcp_sk(const struct sock *sk)
14-
{
15-
return (struct tcp_sock *)sk;
16-
}
17-
1812
SEC("struct_ops/ca_update_1_init")
1913
void BPF_PROG(ca_update_1_init, struct sock *sk)
2014
{

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

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: GPL-2.0
22

3-
#include "vmlinux.h"
4-
3+
#include "bpf_tracing_net.h"
54
#include <bpf/bpf_helpers.h>
65
#include <bpf/bpf_tracing.h>
76

@@ -11,11 +10,6 @@ char _license[] SEC("license") = "GPL";
1110

1211
#define min(a, b) ((a) < (b) ? (a) : (b))
1312

14-
static inline struct tcp_sock *tcp_sk(const struct sock *sk)
15-
{
16-
return (struct tcp_sock *)sk;
17-
}
18-
1913
static inline unsigned int tcp_left_out(const struct tcp_sock *tp)
2014
{
2115
return tp->sacked_out + tp->lost_out;

0 commit comments

Comments
 (0)