brintos

brintos / linux-shallow public Read only

0
0
Text · 1.1 KiB · 78e247f Raw
29 lines · plain
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 create3a cgroupv2 and attach a bash shell to the group.4 5  mkdir -p /tmp/cgroupv26  mount -t cgroup2 none /tmp/cgroupv27  mkdir -p /tmp/cgroupv2/foo8  bash9  echo $$ >> /tmp/cgroupv2/foo/cgroup.procs10 11Anything that runs under this shell belongs to the foo cgroupv2. To load12(attach) one of the tcp_*_kern.o programs:13 14  bpftool prog load tcp_basertt_kern.o /sys/fs/bpf/tcp_prog15  bpftool cgroup attach /tmp/cgroupv2/foo sock_ops pinned /sys/fs/bpf/tcp_prog16  bpftool prog tracelog17 18"bpftool prog tracelog" will continue to run printing the BPF log buffer.19The tcp_*_kern.o programs use special print functions to print logging20information (if enabled by the ifdef).21 22If using netperf/netserver to create traffic, you need to run them under the23cgroupv2 to which the BPF programs are attached (i.e. under bash shell24attached to the cgroupv2).25 26To remove (unattach) a socket_ops BPF program from a cgroupv2:27 28  bpftool cgroup detach /tmp/cgroupv2/foo sock_ops pinned /sys/fs/bpf/tcp_prog29