Skip to content

Commit b8b327a

Browse files
committed
Merge branch 'tracing-some-simple-fixes'
2 parents dfbf26b + 986cae0 commit b8b327a

6 files changed

Lines changed: 27 additions & 25 deletions

File tree

tracing01-xdp-simple/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
XDP_TARGETS := trace_prog_kern xdp_prog_kern
55
USER_TARGETS := trace_load_and_stats
66

7+
COPY_LOADER = xdp_loader
8+
79
LIBBPF_DIR = ../libbpf/src/
810
COMMON_DIR = ../common/
911

tracing01-xdp-simple/README.org

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,20 @@ hooks on xdp:exception tracepoint and get its values to user space
77
stats application.
88

99
* Table of Contents :TOC:
10-
- [[#using-libbpf][XDP tracepoints]]
11-
- [[#xdp-tracepoints][XDP tracepoints]]
10+
- [[#xdp-tracepoints][XDP tracepoints]]
1211
- [[#tracepoint-program-section][Tracepoint program section]]
1312
- [[#tracepoint-arguments][Tracepoint arguments]]
1413
- [[#tracepoint-attaching][Tracepoint attaching]]
1514
- [[#hash-map][HASH map]]
1615
- [[#assignments][Assignments]]
17-
- [[#assignment-1][Assignment 1: Setting up your test lab]]
18-
- [[#assignment-2][Assignment 2: Load tracepoint monitor program]]
16+
- [[#assignment-1-setting-up-your-test-lab][Assignment 1: Setting up your test lab]]
17+
- [[#assignment-2-load-tracepoint-monitor-program][Assignment 2: Load tracepoint monitor program]]
1918

2019

2120
* XDP tracepoints
2221

2322
The eBPF programs can be attached also to tracepoints. There are
24-
several tracepoints related to xdp:
23+
several tracepoints related to the xdp tracepoint subsystem:
2524

2625
#+begin_example sh
2726
ls /sys/kernel/debug/tracing/events/xdp/
@@ -41,13 +40,11 @@ The bpf library expects the tracepoint eBPF program to be stored
4140
in a section with following name:
4241

4342
#+begin_example sh
44-
tracepoint/sys/tracepoint
43+
tracepoint/<sys>/<tracepoint>
4544
#+end_example
4645

47-
where 'sys' is the tracepoint subsystem and 'tracepoint' is
48-
the tracepoint name.
49-
50-
which can be done with following construct:
46+
where =<sys>= is the tracepoint subsystem and =<tracepoint>= is
47+
the tracepoint name, which can be done with following construct:
5148

5249
#+begin_example sh
5350
SEC("tracepoint/xdp/xdp_exception")
@@ -174,7 +171,7 @@ $ sudo ../testenv/testenv.sh setup --name veth-basic02
174171
Load the XDP program, tak produces aborted packets:
175172

176173
#+begin_example sh
177-
$ sudo ../basic02-prog-by-name/xdp_loader --dev veth-basic02 --force --progsec xdp_abort
174+
$ sudo ./xdp_loader --dev veth-basic02 --force --progsec xdp_abort
178175
#+end_example
179176

180177
and make some packets:

tracing02-xdp-monitor/README.org

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ xdp related raw tracepoints and some related info to user space
77
stat application.
88

99
* Table of Contents :TOC:
10-
- [[#raw-tracepoint][RAW tracepoints]]
11-
- [[#todo][TODO]]
10+
- [[#raw-tracepoints][RAW tracepoints]]
1211
- [[#assignments][Assignments]]
13-
- [[#assignment-1][Assignment 1: Monitor all xdp tracepoints]]
12+
- [[#assignment-1-monitor-all-xdp-tracepoints][Assignment 1: Monitor all xdp tracepoints]]
1413

1514
* RAW tracepoints
1615

@@ -22,10 +21,10 @@ The bpf library expects the raw tracepoint eBPF program to be stored
2221
in a section with following name:
2322

2423
#+begin_example sh
25-
raw_tracepoint/tracepoint/sys/tracepoint
24+
raw_tracepoint/<sys>/<tracepoint>
2625
#+end_example
2726

28-
where 'sys' is the tracepoint subsystem and 'tracepoint' is
27+
where =<sys>= is the tracepoint subsystem and =<tracepoint>= is
2928
the tracepoint name, which can be done with following construct:
3029

3130
#+begin_example sh
@@ -34,7 +33,7 @@ int trace_xdp_exception(struct xdp_exception_ctx *ctx)
3433
#+end_example
3534

3635
The libbpf library exports interface to load and attach raw tracepoint
37-
programs, following call will load every program in the cfg->filename
36+
programs, following call will load every program in the =cfg->filename=
3837
object as raw tracepoint programs:
3938

4039
#+begin_example sh

tracing03-xdp-debug-print/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
XDP_TARGETS := xdp_prog_kern
44
USER_TARGETS := trace_read
55

6+
COPY_LOADER = xdp_loader
7+
68
LLC ?= llc
79
CLANG ?= clang
810
CC := gcc

tracing03-xdp-debug-print/README.org

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ In this lesson we will show how to print message from eBPF program
66
into tracefs buffer.
77

88
* Table of Contents :TOC:
9-
- [[#bpf-trace-printk][eBPF trace printk helper]]
10-
- [[#tracefs-pipe-reader][The tracefs pipe reader]]
9+
- [[#ebpf-trace-printk-helper][eBPF trace printk helper]]
10+
- [[#the-tracefs-pipe-reader][The tracefs pipe reader]]
1111
- [[#assignments][Assignments]]
1212
- [[#assignment-1-setting-up-your-test-lab][Assignment 1: Setting up your test lab]]
13-
- [[#assignment-2-bpf-trace-printk][Assignment 2: Run debug code]]
13+
- [[#assignment-2-run-debug-code][Assignment 2: Run debug code]]
1414

1515

1616
* eBPF trace printk helper
@@ -90,7 +90,7 @@ Load XDP program from xdp_prog_kern.o that will print
9090
ethertnet header on every incoming packet:
9191

9292
#+begin_example sh
93-
$ sudo ../basic02-prog-by-name/xdp_loader --dev veth-basic02 --force --progsec xdp
93+
$ sudo ./xdp_loader --dev veth-basic02 --force --progsec xdp
9494
#+end_example
9595

9696
and make some packets:
@@ -101,7 +101,7 @@ $ sudo ../testenv/testenv.sh enter --name veth-basic02
101101
PING fc00:dead:cafe:1::1(fc00:dead:cafe:1::1) 56 data bytes
102102
#+end_example
103103

104-
- Assignment 2: Run debug code
104+
** Assignment 2: Run debug code
105105

106106
#+begin_example sh
107107
bpf_printk("src: %llu, dst: %llu, proto: %u\n",

tracing04-xdp-tcpdump/README.org

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ from XDP program all the way to the pcap dump file.
99
* Table of Contents :TOC:
1010
- [[#dump-the-packet-sample][Dump the packet sample]]
1111
- [[#assignments][Assignments]]
12-
- [[#assignment-1-setup][Assignment 1: Setting up your test lab]]
13-
- [[#assignment-2-pcap-dump][Assignment 2: The PCAP dump file]]
12+
- [[#assignment-1-setting-up-your-test-lab][Assignment 1: Setting up your test lab]]
13+
- [[#assignment-2-the-pcap-dump-file][Assignment 2: The PCAP dump file]]
1414

1515
* Dump the packet sample
1616

@@ -100,7 +100,9 @@ PING fc00:dead:cafe:1::1(fc00:dead:cafe:1::1) 56 data bytes
100100

101101
** Assignment 2: The PCAP dump file
102102

103-
Load the eBPF kernel packets dump program and store the packets to the dump file:
103+
Build the =xdp_sample_pkts_user= dump program; to do so you might have to
104+
install the =libpcap-dev= and the 32 bit libc dev packages. Load the eBPF
105+
kernel packets dump program and store the packets to the dump file:
104106

105107
#+begin_example sh
106108
$ sudo ./xdp_sample_pkts_user -d veth-basic02 -F

0 commit comments

Comments
 (0)