selftests/bpf: Add a few tcp helper functions and macros to bpf_tracing_net.h
authorMartin KaFai Lau <martin.lau@kernel.org>
Thu, 9 May 2024 17:50:18 +0000 (10:50 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 9 May 2024 18:13:11 +0000 (11:13 -0700)
commitcbaec46df6c08a2fab6be03d093d3d6ce74adc9a
treec99c5157cb79050ec7f9326c8283d03edd32acd2
parentc0338e609e6e8aff8a7052c90cff83a6bc792ebc
selftests/bpf: Add a few tcp helper functions and macros to bpf_tracing_net.h

This patch adds a few tcp related helper functions to bpf_tracing_net.h.
They will be useful for both tcp-cc and network tracing related
bpf progs. They have already been in the bpf_tcp_helpers.h. This change
is needed to retire the bpf_tcp_helpers.h and consolidate all tests
to vmlinux.h (i.e. bpf_tracing_net.h).

Some of the helpers (tcp_sk and inet_csk) are also defined in
bpf_cc_cubic.c and they are removed. While at it, remove
the vmlinux.h from bpf_cc_cubic.c. bpf_tracing_net.h (which has
vmlinux.h after this patch) is enough and will be consistent
with the other tcp-cc tests in the later patches.

The other TCP_* macro additions will be needed for the bpf_dctcp
changes in the later patch.

Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://lore.kernel.org/r/20240509175026.3423614-3-martin.lau@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/progs/bpf_cc_cubic.c
tools/testing/selftests/bpf/progs/bpf_tracing_net.h