Commit 8e6d9ae2 authored by Martin KaFai Lau's avatar Martin KaFai Lau Committed by Andrii Nakryiko

selftests/bpf: Use bpf_tracing.h instead of bpf_tcp_helpers.h

The bpf programs that this patch changes require the BPF_PROG macro.
The BPF_PROG macro is defined in the libbpf's bpf_tracing.h.
Some tests include bpf_tcp_helpers.h which includes bpf_tracing.h.
They don't need other things from bpf_tcp_helpers.h other than
bpf_tracing.h. This patch simplifies it by directly including
the bpf_tracing.h.

The motivation of this unnecessary code churn is to retire
the bpf_tcp_helpers.h by directly using vmlinux.h. Right now,
the main usage of the bpf_tcp_helpers.h is the partial kernel
socket definitions (e.g. socket, sock, tcp_sock). While the test
cases continue to grow, fields are kept adding to those partial
socket definitions (e.g. the recent bpf_cc_cubic.c test which
tried to extend bpf_tcp_helpers.c but eventually used the
vmlinux.h instead).

The idea is to retire bpf_tcp_helpers.c and consistently use
vmlinux.h for the tests that require the kernel sockets. This
patch tackles the obvious tests that can directly use bpf_tracing.h
instead of bpf_tcp_helpers.h.
Signed-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20240504005045.848376-1-martin.lau@linux.dev
parent a9e7715c
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
/* Copyright (c) 2021 Facebook */ /* Copyright (c) 2021 Facebook */
#include <linux/bpf.h> #include <linux/bpf.h>
#include <time.h> #include <time.h>
#include <stdbool.h>
#include <errno.h> #include <errno.h>
#include <bpf/bpf_helpers.h> #include <bpf/bpf_helpers.h>
#include "bpf_tcp_helpers.h" #include <bpf/bpf_tracing.h>
char _license[] SEC("license") = "GPL"; char _license[] SEC("license") = "GPL";
struct hmap_elem { struct hmap_elem {
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#include <bpf/bpf_helpers.h> #include <bpf/bpf_helpers.h>
#include <bpf/bpf_tracing.h>
#include "bpf_misc.h" #include "bpf_misc.h"
#include "bpf_tcp_helpers.h"
char _license[] SEC("license") = "GPL"; char _license[] SEC("license") = "GPL";
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#include <bpf/bpf_helpers.h> #include <bpf/bpf_helpers.h>
#include "bpf_tcp_helpers.h" #include <bpf/bpf_tracing.h>
char _license[] SEC("license") = "GPL"; char _license[] SEC("license") = "GPL";
struct hmap_elem { struct hmap_elem {
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <time.h> #include <time.h>
#include <errno.h> #include <errno.h>
#include <bpf/bpf_helpers.h> #include <bpf/bpf_helpers.h>
#include "bpf_tcp_helpers.h" #include <bpf/bpf_tracing.h>
char _license[] SEC("license") = "GPL"; char _license[] SEC("license") = "GPL";
struct hmap_elem { struct hmap_elem {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment