Skip to content

Commit d76be36

Browse files
mrpreKernel Patches Daemon
authored and
Kernel Patches Daemon
committed
bpf: relocates the BPF net tracepoint definitions
This commit relocates the BPF tracepoint definitions for XDP and sockmap from the kernel directory to net/bpf. This ensures that these tracepoints are controlled by the CONFIG_NET, avoiding unnecessary function definitions when the CONFIG_NET is disabled. Additionally, it prevents build failures caused by the use of net module functions when CONFIG_NET is not enabled. Signed-off-by: Jiayuan Chen <[email protected]>
1 parent 7afae84 commit d76be36

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

kernel/bpf/core.c

-7
Original file line numberDiff line numberDiff line change
@@ -3180,10 +3180,3 @@ late_initcall(bpf_global_ma_init);
31803180

31813181
DEFINE_STATIC_KEY_FALSE(bpf_stats_enabled_key);
31823182
EXPORT_SYMBOL(bpf_stats_enabled_key);
3183-
3184-
/* All definitions of tracepoints related to BPF. */
3185-
#define CREATE_TRACE_POINTS
3186-
#include <linux/bpf_trace.h>
3187-
3188-
EXPORT_TRACEPOINT_SYMBOL_GPL(xdp_exception);
3189-
EXPORT_TRACEPOINT_SYMBOL_GPL(xdp_bulk_tx);

net/bpf/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0-only
22
obj-$(CONFIG_BPF_SYSCALL) := test_run.o
3+
obj-$(CONFIG_BPF_SYSCALL) += bpf_net_trace.o
34
ifeq ($(CONFIG_BPF_JIT),y)
45
obj-$(CONFIG_BPF_SYSCALL) += bpf_dummy_struct_ops.o
56
endif

net/bpf/bpf_net_trace.c

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
/* All definitions of net tracepoints related to BPF. */
4+
#define CREATE_TRACE_POINTS
5+
#include <linux/bpf_trace.h>
6+
7+
EXPORT_TRACEPOINT_SYMBOL_GPL(xdp_exception);
8+
EXPORT_TRACEPOINT_SYMBOL_GPL(xdp_bulk_tx);

0 commit comments

Comments
 (0)