diff options
Diffstat (limited to 'samples')
| -rw-r--r-- | samples/bpf/Makefile | 23 | ||||
| -rw-r--r-- | samples/bpf/fds_example.c | 2 | ||||
| -rw-r--r-- | samples/bpf/hbm.c | 6 | ||||
| -rw-r--r-- | samples/bpf/ibumad_user.c | 2 | ||||
| -rw-r--r-- | samples/bpf/sockex1_user.c | 2 | ||||
| -rw-r--r-- | samples/bpf/sockex2_user.c | 2 | ||||
| -rw-r--r-- | samples/bpf/xdp1_user.c | 4 | ||||
| -rw-r--r-- | samples/bpf/xdp_adjust_tail_user.c | 4 | ||||
| -rw-r--r-- | samples/bpf/xdp_fwd_user.c | 2 | ||||
| -rw-r--r-- | samples/bpf/xdp_redirect_cpu_user.c | 2 | ||||
| -rw-r--r-- | samples/bpf/xdp_redirect_map_user.c | 2 | ||||
| -rw-r--r-- | samples/bpf/xdp_redirect_user.c | 2 | ||||
| -rw-r--r-- | samples/bpf/xdp_router_ipv4_user.c | 2 | ||||
| -rw-r--r-- | samples/bpf/xdp_rxq_info_user.c | 4 | ||||
| -rw-r--r-- | samples/bpf/xdp_tx_iptunnel_user.c | 2 | ||||
| -rw-r--r-- | samples/bpf/xdpsock_user.c | 4 |
16 files changed, 34 insertions, 31 deletions
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index 253e5a2856be..0917f8cf4fab 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Makefile | |||
| @@ -170,21 +170,12 @@ always += ibumad_kern.o | |||
| 170 | always += hbm_out_kern.o | 170 | always += hbm_out_kern.o |
| 171 | 171 | ||
| 172 | KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include | 172 | KBUILD_HOSTCFLAGS += -I$(objtree)/usr/include |
| 173 | KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ | 173 | KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/bpf/ |
| 174 | KBUILD_HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ | 174 | KBUILD_HOSTCFLAGS += -I$(srctree)/tools/testing/selftests/bpf/ |
| 175 | KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include | 175 | KBUILD_HOSTCFLAGS += -I$(srctree)/tools/lib/ -I$(srctree)/tools/include |
| 176 | KBUILD_HOSTCFLAGS += -I$(srctree)/tools/perf | 176 | KBUILD_HOSTCFLAGS += -I$(srctree)/tools/perf |
| 177 | 177 | ||
| 178 | HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable | 178 | HOSTCFLAGS_bpf_load.o += -I$(objtree)/usr/include -Wno-unused-variable |
| 179 | HOSTCFLAGS_trace_helpers.o += -I$(srctree)/tools/lib/bpf/ | ||
| 180 | |||
| 181 | HOSTCFLAGS_trace_output_user.o += -I$(srctree)/tools/lib/bpf/ | ||
| 182 | HOSTCFLAGS_offwaketime_user.o += -I$(srctree)/tools/lib/bpf/ | ||
| 183 | HOSTCFLAGS_spintest_user.o += -I$(srctree)/tools/lib/bpf/ | ||
| 184 | HOSTCFLAGS_trace_event_user.o += -I$(srctree)/tools/lib/bpf/ | ||
| 185 | HOSTCFLAGS_sampleip_user.o += -I$(srctree)/tools/lib/bpf/ | ||
| 186 | HOSTCFLAGS_task_fd_query_user.o += -I$(srctree)/tools/lib/bpf/ | ||
| 187 | HOSTCFLAGS_xdp_sample_pkts_user.o += -I$(srctree)/tools/lib/bpf/ | ||
| 188 | 179 | ||
| 189 | KBUILD_HOSTLDLIBS += $(LIBBPF) -lelf | 180 | KBUILD_HOSTLDLIBS += $(LIBBPF) -lelf |
| 190 | HOSTLDLIBS_tracex4 += -lrt | 181 | HOSTLDLIBS_tracex4 += -lrt |
| @@ -206,6 +197,17 @@ HOSTCC = $(CROSS_COMPILE)gcc | |||
| 206 | CLANG_ARCH_ARGS = -target $(ARCH) | 197 | CLANG_ARCH_ARGS = -target $(ARCH) |
| 207 | endif | 198 | endif |
| 208 | 199 | ||
| 200 | # Don't evaluate probes and warnings if we need to run make recursively | ||
| 201 | ifneq ($(src),) | ||
| 202 | HDR_PROBE := $(shell echo "\#include <linux/types.h>\n struct list_head { int a; }; int main() { return 0; }" | \ | ||
| 203 | $(HOSTCC) $(KBUILD_HOSTCFLAGS) -x c - -o /dev/null 2>/dev/null && \ | ||
| 204 | echo okay) | ||
| 205 | |||
| 206 | ifeq ($(HDR_PROBE),) | ||
| 207 | $(warning WARNING: Detected possible issues with include path.) | ||
| 208 | $(warning WARNING: Please install kernel headers locally (make headers_install).) | ||
| 209 | endif | ||
| 210 | |||
| 209 | BTF_LLC_PROBE := $(shell $(LLC) -march=bpf -mattr=help 2>&1 | grep dwarfris) | 211 | BTF_LLC_PROBE := $(shell $(LLC) -march=bpf -mattr=help 2>&1 | grep dwarfris) |
| 210 | BTF_PAHOLE_PROBE := $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF) | 212 | BTF_PAHOLE_PROBE := $(shell $(BTF_PAHOLE) --help 2>&1 | grep BTF) |
| 211 | BTF_OBJCOPY_PROBE := $(shell $(LLVM_OBJCOPY) --help 2>&1 | grep -i 'usage.*llvm') | 213 | BTF_OBJCOPY_PROBE := $(shell $(LLVM_OBJCOPY) --help 2>&1 | grep -i 'usage.*llvm') |
| @@ -223,6 +225,7 @@ ifneq ($(and $(BTF_LLC_PROBE),$(BTF_PAHOLE_PROBE),$(BTF_OBJCOPY_PROBE)),) | |||
| 223 | DWARF2BTF = y | 225 | DWARF2BTF = y |
| 224 | endif | 226 | endif |
| 225 | endif | 227 | endif |
| 228 | endif | ||
| 226 | 229 | ||
| 227 | # Trick to allow make to be run from this directory | 230 | # Trick to allow make to be run from this directory |
| 228 | all: | 231 | all: |
diff --git a/samples/bpf/fds_example.c b/samples/bpf/fds_example.c index e51eb060244e..2d4b717726b6 100644 --- a/samples/bpf/fds_example.c +++ b/samples/bpf/fds_example.c | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | #include <bpf/bpf.h> | 15 | #include <bpf/bpf.h> |
| 16 | 16 | ||
| 17 | #include "bpf/libbpf.h" | 17 | #include "libbpf.h" |
| 18 | #include "bpf_insn.h" | 18 | #include "bpf_insn.h" |
| 19 | #include "sock_example.h" | 19 | #include "sock_example.h" |
| 20 | 20 | ||
diff --git a/samples/bpf/hbm.c b/samples/bpf/hbm.c index 480b7ad6a1f2..b905b32ff185 100644 --- a/samples/bpf/hbm.c +++ b/samples/bpf/hbm.c | |||
| @@ -50,8 +50,8 @@ | |||
| 50 | #include "cgroup_helpers.h" | 50 | #include "cgroup_helpers.h" |
| 51 | #include "hbm.h" | 51 | #include "hbm.h" |
| 52 | #include "bpf_util.h" | 52 | #include "bpf_util.h" |
| 53 | #include "bpf/bpf.h" | 53 | #include "bpf.h" |
| 54 | #include "bpf/libbpf.h" | 54 | #include "libbpf.h" |
| 55 | 55 | ||
| 56 | bool outFlag = true; | 56 | bool outFlag = true; |
| 57 | int minRate = 1000; /* cgroup rate limit in Mbps */ | 57 | int minRate = 1000; /* cgroup rate limit in Mbps */ |
| @@ -411,7 +411,7 @@ static void Usage(void) | |||
| 411 | " -l also limit flows using loopback\n" | 411 | " -l also limit flows using loopback\n" |
| 412 | " -n <#> to create cgroup \"/hbm#\" and attach prog\n" | 412 | " -n <#> to create cgroup \"/hbm#\" and attach prog\n" |
| 413 | " Default is /hbm1\n" | 413 | " Default is /hbm1\n" |
| 414 | " --no_cn disable CN notifcations\n" | 414 | " --no_cn disable CN notifications\n" |
| 415 | " -r <rate> Rate in Mbps\n" | 415 | " -r <rate> Rate in Mbps\n" |
| 416 | " -s Update HBM stats\n" | 416 | " -s Update HBM stats\n" |
| 417 | " -t <time> Exit after specified seconds (default is 0)\n" | 417 | " -t <time> Exit after specified seconds (default is 0)\n" |
diff --git a/samples/bpf/ibumad_user.c b/samples/bpf/ibumad_user.c index 097d76143363..cb5a8f994849 100644 --- a/samples/bpf/ibumad_user.c +++ b/samples/bpf/ibumad_user.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | 25 | ||
| 26 | #include "bpf_load.h" | 26 | #include "bpf_load.h" |
| 27 | #include "bpf_util.h" | 27 | #include "bpf_util.h" |
| 28 | #include "bpf/libbpf.h" | 28 | #include "libbpf.h" |
| 29 | 29 | ||
| 30 | static void dump_counts(int fd) | 30 | static void dump_counts(int fd) |
| 31 | { | 31 | { |
diff --git a/samples/bpf/sockex1_user.c b/samples/bpf/sockex1_user.c index 7f90796ae15a..a219442afbee 100644 --- a/samples/bpf/sockex1_user.c +++ b/samples/bpf/sockex1_user.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #include <assert.h> | 3 | #include <assert.h> |
| 4 | #include <linux/bpf.h> | 4 | #include <linux/bpf.h> |
| 5 | #include <bpf/bpf.h> | 5 | #include <bpf/bpf.h> |
| 6 | #include "bpf/libbpf.h" | 6 | #include "libbpf.h" |
| 7 | #include "sock_example.h" | 7 | #include "sock_example.h" |
| 8 | #include <unistd.h> | 8 | #include <unistd.h> |
| 9 | #include <arpa/inet.h> | 9 | #include <arpa/inet.h> |
diff --git a/samples/bpf/sockex2_user.c b/samples/bpf/sockex2_user.c index bc257333ad92..6de383ddd08b 100644 --- a/samples/bpf/sockex2_user.c +++ b/samples/bpf/sockex2_user.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #include <assert.h> | 3 | #include <assert.h> |
| 4 | #include <linux/bpf.h> | 4 | #include <linux/bpf.h> |
| 5 | #include <bpf/bpf.h> | 5 | #include <bpf/bpf.h> |
| 6 | #include "bpf/libbpf.h" | 6 | #include "libbpf.h" |
| 7 | #include "sock_example.h" | 7 | #include "sock_example.h" |
| 8 | #include <unistd.h> | 8 | #include <unistd.h> |
| 9 | #include <arpa/inet.h> | 9 | #include <arpa/inet.h> |
diff --git a/samples/bpf/xdp1_user.c b/samples/bpf/xdp1_user.c index 5b39421adb44..a8e5fa02e8a8 100644 --- a/samples/bpf/xdp1_user.c +++ b/samples/bpf/xdp1_user.c | |||
| @@ -15,8 +15,8 @@ | |||
| 15 | #include <net/if.h> | 15 | #include <net/if.h> |
| 16 | 16 | ||
| 17 | #include "bpf_util.h" | 17 | #include "bpf_util.h" |
| 18 | #include "bpf/bpf.h" | 18 | #include "bpf.h" |
| 19 | #include "bpf/libbpf.h" | 19 | #include "libbpf.h" |
| 20 | 20 | ||
| 21 | static int ifindex; | 21 | static int ifindex; |
| 22 | static __u32 xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST; | 22 | static __u32 xdp_flags = XDP_FLAGS_UPDATE_IF_NOEXIST; |
diff --git a/samples/bpf/xdp_adjust_tail_user.c b/samples/bpf/xdp_adjust_tail_user.c index 07e1b9269e49..586ff751aba9 100644 --- a/samples/bpf/xdp_adjust_tail_user.c +++ b/samples/bpf/xdp_adjust_tail_user.c | |||
| @@ -18,8 +18,8 @@ | |||
| 18 | #include <netinet/ether.h> | 18 | #include <netinet/ether.h> |
| 19 | #include <unistd.h> | 19 | #include <unistd.h> |
| 20 | #include <time.h> | 20 | #include <time.h> |
| 21 | #include "bpf/bpf.h" | 21 | #include "bpf.h" |
| 22 | #include "bpf/libbpf.h" | 22 | #include "libbpf.h" |
| 23 | 23 | ||
| 24 | #define STATS_INTERVAL_S 2U | 24 | #define STATS_INTERVAL_S 2U |
| 25 | 25 | ||
diff --git a/samples/bpf/xdp_fwd_user.c b/samples/bpf/xdp_fwd_user.c index f88e1d7093d6..5b46ee12c696 100644 --- a/samples/bpf/xdp_fwd_user.c +++ b/samples/bpf/xdp_fwd_user.c | |||
| @@ -24,7 +24,7 @@ | |||
| 24 | #include <fcntl.h> | 24 | #include <fcntl.h> |
| 25 | #include <libgen.h> | 25 | #include <libgen.h> |
| 26 | 26 | ||
| 27 | #include "bpf/libbpf.h" | 27 | #include "libbpf.h" |
| 28 | #include <bpf/bpf.h> | 28 | #include <bpf/bpf.h> |
| 29 | 29 | ||
| 30 | 30 | ||
diff --git a/samples/bpf/xdp_redirect_cpu_user.c b/samples/bpf/xdp_redirect_cpu_user.c index 586b294d72d3..f5dc7e1f8bc6 100644 --- a/samples/bpf/xdp_redirect_cpu_user.c +++ b/samples/bpf/xdp_redirect_cpu_user.c | |||
| @@ -25,7 +25,7 @@ static const char *__doc__ = | |||
| 25 | #define MAX_PROG 6 | 25 | #define MAX_PROG 6 |
| 26 | 26 | ||
| 27 | #include <bpf/bpf.h> | 27 | #include <bpf/bpf.h> |
| 28 | #include "bpf/libbpf.h" | 28 | #include "libbpf.h" |
| 29 | 29 | ||
| 30 | #include "bpf_util.h" | 30 | #include "bpf_util.h" |
| 31 | 31 | ||
diff --git a/samples/bpf/xdp_redirect_map_user.c b/samples/bpf/xdp_redirect_map_user.c index be317f5f058f..15bb6f67f9c3 100644 --- a/samples/bpf/xdp_redirect_map_user.c +++ b/samples/bpf/xdp_redirect_map_user.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #include "bpf_util.h" | 17 | #include "bpf_util.h" |
| 18 | #include <bpf/bpf.h> | 18 | #include <bpf/bpf.h> |
| 19 | #include "bpf/libbpf.h" | 19 | #include "libbpf.h" |
| 20 | 20 | ||
| 21 | static int ifindex_in; | 21 | static int ifindex_in; |
| 22 | static int ifindex_out; | 22 | static int ifindex_out; |
diff --git a/samples/bpf/xdp_redirect_user.c b/samples/bpf/xdp_redirect_user.c index 09747bee6668..ce71be187205 100644 --- a/samples/bpf/xdp_redirect_user.c +++ b/samples/bpf/xdp_redirect_user.c | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | #include "bpf_util.h" | 17 | #include "bpf_util.h" |
| 18 | #include <bpf/bpf.h> | 18 | #include <bpf/bpf.h> |
| 19 | #include "bpf/libbpf.h" | 19 | #include "libbpf.h" |
| 20 | 20 | ||
| 21 | static int ifindex_in; | 21 | static int ifindex_in; |
| 22 | static int ifindex_out; | 22 | static int ifindex_out; |
diff --git a/samples/bpf/xdp_router_ipv4_user.c b/samples/bpf/xdp_router_ipv4_user.c index 1f66419631c3..1469b66ebad1 100644 --- a/samples/bpf/xdp_router_ipv4_user.c +++ b/samples/bpf/xdp_router_ipv4_user.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #include <sys/ioctl.h> | 21 | #include <sys/ioctl.h> |
| 22 | #include <sys/syscall.h> | 22 | #include <sys/syscall.h> |
| 23 | #include "bpf_util.h" | 23 | #include "bpf_util.h" |
| 24 | #include "bpf/libbpf.h" | 24 | #include "libbpf.h" |
| 25 | #include <sys/resource.h> | 25 | #include <sys/resource.h> |
| 26 | #include <libgen.h> | 26 | #include <libgen.h> |
| 27 | 27 | ||
diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c index 1210f3b170f0..c7e4e45d824a 100644 --- a/samples/bpf/xdp_rxq_info_user.c +++ b/samples/bpf/xdp_rxq_info_user.c | |||
| @@ -22,8 +22,8 @@ static const char *__doc__ = " XDP RX-queue info extract example\n\n" | |||
| 22 | #include <arpa/inet.h> | 22 | #include <arpa/inet.h> |
| 23 | #include <linux/if_link.h> | 23 | #include <linux/if_link.h> |
| 24 | 24 | ||
| 25 | #include "bpf/bpf.h" | 25 | #include "bpf.h" |
| 26 | #include "bpf/libbpf.h" | 26 | #include "libbpf.h" |
| 27 | #include "bpf_util.h" | 27 | #include "bpf_util.h" |
| 28 | 28 | ||
| 29 | static int ifindex = -1; | 29 | static int ifindex = -1; |
diff --git a/samples/bpf/xdp_tx_iptunnel_user.c b/samples/bpf/xdp_tx_iptunnel_user.c index e746a00d122e..394896430712 100644 --- a/samples/bpf/xdp_tx_iptunnel_user.c +++ b/samples/bpf/xdp_tx_iptunnel_user.c | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include <netinet/ether.h> | 14 | #include <netinet/ether.h> |
| 15 | #include <unistd.h> | 15 | #include <unistd.h> |
| 16 | #include <time.h> | 16 | #include <time.h> |
| 17 | #include "bpf/libbpf.h" | 17 | #include "libbpf.h" |
| 18 | #include <bpf/bpf.h> | 18 | #include <bpf/bpf.h> |
| 19 | #include "bpf_util.h" | 19 | #include "bpf_util.h" |
| 20 | #include "xdp_tx_iptunnel_common.h" | 20 | #include "xdp_tx_iptunnel_common.h" |
diff --git a/samples/bpf/xdpsock_user.c b/samples/bpf/xdpsock_user.c index d08ee1ab7bb4..0f5eb0d7f2df 100644 --- a/samples/bpf/xdpsock_user.c +++ b/samples/bpf/xdpsock_user.c | |||
| @@ -27,8 +27,8 @@ | |||
| 27 | #include <time.h> | 27 | #include <time.h> |
| 28 | #include <unistd.h> | 28 | #include <unistd.h> |
| 29 | 29 | ||
| 30 | #include "bpf/libbpf.h" | 30 | #include "libbpf.h" |
| 31 | #include "bpf/xsk.h" | 31 | #include "xsk.h" |
| 32 | #include <bpf/bpf.h> | 32 | #include <bpf/bpf.h> |
| 33 | 33 | ||
| 34 | #ifndef SOL_XDP | 34 | #ifndef SOL_XDP |
