Skip to content

Commit

Permalink
bpf: create samples/bpf/tcp_bpf.readme
Browse files Browse the repository at this point in the history
Readme file explaining how to create a cgroupv2 and attach one
of the tcp_*_kern.o socket_ops BPF program.

Signed-off-by: Lawrence Brakmo <brakmo@fb.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked_by: Alexei Starovoitov <ast@fb.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Lawrence Brakmo authored and David S. Miller committed Oct 22, 2017
1 parent c890063 commit bfdf756
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions samples/bpf/tcp_bbf.readme
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
This file describes how to run the tcp_*_kern.o tcp_bpf (or socket_ops)
programs. These programs attach to a cgroupv2. The following commands create
a cgroupv2 and attach a bash shell to the group.

mkdir -p /tmp/cgroupv2
mount -t cgroup2 none /tmp/cgroupv2
mkdir -p /tmp/cgroupv2/foo
bash
echo $$ >> /tmp/cgroupv2/foo/cgroup.procs

Anything that runs under this shell belongs to the foo cgroupv2 To load
(attach) one of the tcp_*_kern.o programs:

./load_sock_ops -l /tmp/cgroupv2/foo tcp_basertt_kern.o

If the "-l" flag is used, the load_sock_ops program will continue to run
printing the BPF log buffer. The tcp_*_kern.o programs use special print
functions to print logging information (if enabled by the ifdef).

If using netperf/netserver to create traffic, you need to run them under the
cgroupv2 to which the BPF programs are attached (i.e. under bash shell
attached to the cgroupv2).

To remove (unattach) a socket_ops BPF program from a cgroupv2:

./load_sock_ops -r /tmp/cgroupv2/foo

0 comments on commit bfdf756

Please sign in to comment.