]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpftool: Add net attach/detach command to tcx prog
authorTao Chen <chen.dylane@gmail.com>
Sun, 21 Jul 2024 14:42:21 +0000 (22:42 +0800)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 29 Jul 2024 19:54:00 +0000 (12:54 -0700)
commit3b9d4fee8ad32599ba20ab36da7694feef022b48
tree568ef0a200a6951824d24fd418255fbbd8f9d049
parentb7264f87f76c59698c7fd019a8797378fa17e7e3
bpftool: Add net attach/detach command to tcx prog

Now, attach/detach tcx prog supported in libbpf, so we can add new
command 'bpftool attach/detach tcx' to attach tcx prog with bpftool
for user.

 # bpftool prog load tc_prog.bpf.o /sys/fs/bpf/tc_prog
 # bpftool prog show
...
192: sched_cls  name tc_prog  tag 187aeb611ad00cfc  gpl
loaded_at 2024-07-11T15:58:16+0800  uid 0
xlated 152B  jited 97B  memlock 4096B  map_ids 100,99,97
btf_id 260
 # bpftool net attach tcx_ingress name tc_prog dev lo
 # bpftool net
...
tc:
lo(1) tcx/ingress tc_prog prog_id 29

 # bpftool net detach tcx_ingress dev lo
 # bpftool net
...
tc:
 # bpftool net attach tcx_ingress name tc_prog dev lo
 # bpftool net
tc:
lo(1) tcx/ingress tc_prog prog_id 29

Test environment: ubuntu_22_04, 6.7.0-060700-generic

Signed-off-by: Tao Chen <chen.dylane@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Quentin Monnet <qmo@kernel.org>
Link: https://lore.kernel.org/bpf/20240721144221.96228-1-chen.dylane@gmail.com
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
tools/bpf/bpftool/net.c