.. | .. |
---|
8 | 8 | bash |
---|
9 | 9 | echo $$ >> /tmp/cgroupv2/foo/cgroup.procs |
---|
10 | 10 | |
---|
11 | | -Anything that runs under this shell belongs to the foo cgroupv2 To load |
---|
| 11 | +Anything that runs under this shell belongs to the foo cgroupv2. To load |
---|
12 | 12 | (attach) one of the tcp_*_kern.o programs: |
---|
13 | 13 | |
---|
14 | | - ./load_sock_ops -l /tmp/cgroupv2/foo tcp_basertt_kern.o |
---|
| 14 | + bpftool prog load tcp_basertt_kern.o /sys/fs/bpf/tcp_prog |
---|
| 15 | + bpftool cgroup attach /tmp/cgroupv2/foo sock_ops pinned /sys/fs/bpf/tcp_prog |
---|
| 16 | + bpftool prog tracelog |
---|
15 | 17 | |
---|
16 | | -If the "-l" flag is used, the load_sock_ops program will continue to run |
---|
17 | | -printing the BPF log buffer. The tcp_*_kern.o programs use special print |
---|
18 | | -functions to print logging information (if enabled by the ifdef). |
---|
| 18 | +"bpftool prog tracelog" will continue to run printing the BPF log buffer. |
---|
| 19 | +The tcp_*_kern.o programs use special print functions to print logging |
---|
| 20 | +information (if enabled by the ifdef). |
---|
19 | 21 | |
---|
20 | 22 | If using netperf/netserver to create traffic, you need to run them under the |
---|
21 | 23 | cgroupv2 to which the BPF programs are attached (i.e. under bash shell |
---|
.. | .. |
---|
23 | 25 | |
---|
24 | 26 | To remove (unattach) a socket_ops BPF program from a cgroupv2: |
---|
25 | 27 | |
---|
26 | | - ./load_sock_ops -r /tmp/cgroupv2/foo |
---|
| 28 | + bpftool cgroup detach /tmp/cgroupv2/foo sock_ops pinned /sys/fs/bpf/tcp_prog |
---|