xref: /openbmc/linux/samples/bpf/tcp_bpf.readme (revision 65417d9f)
1This file describes how to run the tcp_*_kern.o tcp_bpf (or socket_ops)
2programs. These programs attach to a cgroupv2. The following commands create
3a cgroupv2 and attach a bash shell to the group.
4
5  mkdir -p /tmp/cgroupv2
6  mount -t cgroup2 none /tmp/cgroupv2
7  mkdir -p /tmp/cgroupv2/foo
8  bash
9  echo $$ >> /tmp/cgroupv2/foo/cgroup.procs
10
11Anything that runs under this shell belongs to the foo cgroupv2 To load
12(attach) one of the tcp_*_kern.o programs:
13
14  ./load_sock_ops -l /tmp/cgroupv2/foo tcp_basertt_kern.o
15
16If the "-l" flag is used, the load_sock_ops program will continue to run
17printing the BPF log buffer. The tcp_*_kern.o programs use special print
18functions to print logging information (if enabled by the ifdef).
19
20If using netperf/netserver to create traffic, you need to run them under the
21cgroupv2 to which the BPF programs are attached (i.e. under bash shell
22attached to the cgroupv2).
23
24To remove (unattach) a socket_ops BPF program from a cgroupv2:
25
26  ./load_sock_ops -r /tmp/cgroupv2/foo
27