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

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Martin KaFai Lau and committed by
Alexei Starovoitov
cc5b18ce cbaec46d

+3 -21
+1 -7
tools/testing/selftests/bpf/progs/tcp_ca_incompl_cong_ops.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 3 - #include "vmlinux.h" 4 - 3 + #include "bpf_tracing_net.h" 5 4 #include <bpf/bpf_helpers.h> 6 5 #include <bpf/bpf_tracing.h> 7 6 8 7 char _license[] SEC("license") = "GPL"; 9 - 10 - static inline struct tcp_sock *tcp_sk(const struct sock *sk) 11 - { 12 - return (struct tcp_sock *)sk; 13 - } 14 8 15 9 SEC("struct_ops/incompl_cong_ops_ssthresh") 16 10 __u32 BPF_PROG(incompl_cong_ops_ssthresh, struct sock *sk)
+1 -7
tools/testing/selftests/bpf/progs/tcp_ca_update.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 3 - #include "vmlinux.h" 4 - 3 + #include "bpf_tracing_net.h" 5 4 #include <bpf/bpf_helpers.h> 6 5 #include <bpf/bpf_tracing.h> 7 6 ··· 8 9 9 10 int ca1_cnt = 0; 10 11 int ca2_cnt = 0; 11 - 12 - static inline struct tcp_sock *tcp_sk(const struct sock *sk) 13 - { 14 - return (struct tcp_sock *)sk; 15 - } 16 12 17 13 SEC("struct_ops/ca_update_1_init") 18 14 void BPF_PROG(ca_update_1_init, struct sock *sk)
+1 -7
tools/testing/selftests/bpf/progs/tcp_ca_write_sk_pacing.c
··· 1 1 // SPDX-License-Identifier: GPL-2.0 2 2 3 - #include "vmlinux.h" 4 - 3 + #include "bpf_tracing_net.h" 5 4 #include <bpf/bpf_helpers.h> 6 5 #include <bpf/bpf_tracing.h> 7 6 ··· 9 10 #define USEC_PER_SEC 1000000UL 10 11 11 12 #define min(a, b) ((a) < (b) ? (a) : (b)) 12 - 13 - static inline struct tcp_sock *tcp_sk(const struct sock *sk) 14 - { 15 - return (struct tcp_sock *)sk; 16 - } 17 13 18 14 static inline unsigned int tcp_left_out(const struct tcp_sock *tp) 19 15 {