• Home
Name Date Size #Lines LOC

..--

MakefileD08-May-20245.5 KiB162137

README.rstD08-May-20241.9 KiB6745

bpf_helpers.hD08-May-20245.8 KiB156128

bpf_load.cD08-May-20249.6 KiB441356

bpf_load.hD08-May-2024858 3416

fds_example.cD08-May-20244 KiB184155

lathist_kern.cD08-May-20242.1 KiB10068

lathist_user.cD08-May-20242 KiB10475

libbpf.cD08-May-20243.9 KiB179144

libbpf.hD08-May-20245.6 KiB214156

map_perf_test_kern.cD08-May-20242.5 KiB10182

map_perf_test_user.cD08-May-20243.2 KiB157121

offwaketime_kern.cD08-May-20243.5 KiB152118

offwaketime_user.cD08-May-20242.4 KiB12196

parse_ldabs.cD08-May-20241.2 KiB4332

parse_simple.cD08-May-20241.3 KiB5036

parse_varlen.cD08-May-20243.5 KiB155125

sampleip_kern.cD08-May-2024924 3926

sampleip_user.cD08-May-20244.2 KiB197152

sock_example.cD08-May-20242.7 KiB10270

sockex1_kern.cD08-May-2024648 3024

sockex1_user.cD08-May-2024979 5037

sockex2_kern.cD08-May-20244.7 KiB222188

sockex2_user.cD08-May-20241 KiB5343

sockex3_kern.cD08-May-20246.1 KiB291226

sockex3_user.cD08-May-20241.4 KiB7059

spintest_kern.cD08-May-20242.1 KiB6955

spintest_user.cD08-May-20241 KiB5144

tc_l2_redirect.shD08-May-20244.9 KiB174135

tc_l2_redirect_kern.cD08-May-20246 KiB237181

tc_l2_redirect_user.cD08-May-20241.5 KiB7456

tcbpf1_kern.cD08-May-20242.5 KiB9175

tcbpf2_kern.cD08-May-20248.1 KiB383311

test_cgrp2_array_pin.cD08-May-20242.2 KiB11091

test_cgrp2_attach.cD08-May-20244.1 KiB148101

test_cgrp2_tc.shD08-May-20244.1 KiB185158

test_cgrp2_tc_kern.cD08-May-20241.8 KiB7155

test_cls_bpf.shD08-May-2024880 3831

test_current_task_under_cgroup_kern.cD08-May-20241.1 KiB4429

test_current_task_under_cgroup_user.cD08-May-20243.2 KiB146103

test_ipip.shD08-May-20245.6 KiB179147

test_maps.cD08-May-202413.3 KiB504340

test_overhead_kprobe_kern.cD08-May-20241 KiB4229

test_overhead_tp_kern.cD08-May-2024828 3726

test_overhead_user.cD08-May-20243.2 KiB163135

test_probe_write_user_kern.cD08-May-20241.6 KiB5332

test_probe_write_user_user.cD08-May-20242.4 KiB7960

test_tunnel_bpf.shD08-May-20244.2 KiB168129

test_verifier.cD08-May-202474.2 KiB2,5362,479

trace_event_kern.cD08-May-20241.7 KiB6650

trace_event_user.cD08-May-20244.6 KiB214175

trace_output_kern.cD08-May-2024609 3124

trace_output_user.cD08-May-20244 KiB197154

tracex1_kern.cD08-May-20241.4 KiB4925

tracex1_user.cD08-May-2024403 2619

tracex2_kern.cD08-May-20242.3 KiB10176

tracex2_user.cD08-May-20243 KiB150124

tracex3_kern.cD08-May-20242.1 KiB9058

tracex3_user.cD08-May-20243.1 KiB158131

tracex4_kern.cD08-May-20241.2 KiB5536

tracex4_user.cD08-May-20241.4 KiB7051

tracex5_kern.cD08-May-20241.9 KiB7453

tracex5_user.cD08-May-20241.1 KiB5038

tracex6_kern.cD08-May-2024611 2822

tracex6_user.cD08-May-20241.4 KiB7360

xdp1_kern.cD08-May-20242.1 KiB9472

xdp1_user.cD08-May-20243.9 KiB182144

xdp2_kern.cD08-May-20242.4 KiB11590

README.rst

1eBPF sample programs
2====================
3
4This directory contains a mini eBPF library, test stubs, verifier
5test-suite and examples for using eBPF.
6
7Build dependencies
8==================
9
10Compiling requires having installed:
11 * clang >= version 3.4.0
12 * llvm >= version 3.7.1
13
14Note that LLVM's tool 'llc' must support target 'bpf', list version
15and supported targets with command: ``llc --version``
16
17Kernel headers
18--------------
19
20There are usually dependencies to header files of the current kernel.
21To avoid installing devel kernel headers system wide, as a normal
22user, simply call::
23
24 make headers_install
25
26This will creates a local "usr/include" directory in the git/build top
27level directory, that the make system automatically pickup first.
28
29Compiling
30=========
31
32For building the BPF samples, issue the below command from the kernel
33top level directory::
34
35 make samples/bpf/
36
37Do notice the "/" slash after the directory name.
38
39It is also possible to call make from this directory.  This will just
40hide the the invocation of make as above with the appended "/".
41
42Manually compiling LLVM with 'bpf' support
43------------------------------------------
44
45Since version 3.7.0, LLVM adds a proper LLVM backend target for the
46BPF bytecode architecture.
47
48By default llvm will build all non-experimental backends including bpf.
49To generate a smaller llc binary one can use::
50
51 -DLLVM_TARGETS_TO_BUILD="BPF"
52
53Quick sniplet for manually compiling LLVM and clang
54(build dependencies are cmake and gcc-c++)::
55
56 $ git clone http://llvm.org/git/llvm.git
57 $ cd llvm/tools
58 $ git clone --depth 1 http://llvm.org/git/clang.git
59 $ cd ..; mkdir build; cd build
60 $ cmake .. -DLLVM_TARGETS_TO_BUILD="BPF;X86"
61 $ make -j $(getconf _NPROCESSORS_ONLN)
62
63It is also possible to point make to the newly compiled 'llc' or
64'clang' command via redefining LLC or CLANG on the make command line::
65
66 make samples/bpf/ LLC=~/git/llvm/build/bin/llc CLANG=~/git/llvm/build/bin/clang
67