Hi,
I have successful complied kernel with some ebpf configs. And the system could run some c example ebpf program of libbpf-bootstrap. But when run a ebpf program named with tc, it outputs some error below:
libbpf: loading object 'tc_bpf' from buffer
libbpf: elf: section(2) .symtab, size 192, link 1, flags 0, type=2
libbpf: elf: section(3) tc, size 144, link 0, flags 6, type=1
libbpf: sec 'tc': found program 'tc_ingress' at insn offset 0 (0 bytes), code size 18 insns (144 bytes)
libbpf: elf: section(4) .rodata, size 36, link 0, flags 2, type=1
libbpf: elf: section(5) license, size 4, link 0, flags 3, type=1
libbpf: license of tc_bpf is GPL
libbpf: elf: section(6) .reltc, size 16, link 2, flags 0, type=9
libbpf: elf: section(7) .BTF, size 2141, link 0, flags 0, type=1
libbpf: elf: section(8) .BTF.ext, size 316, link 0, flags 0, type=1
libbpf: looking for externs among 8 symbols...
libbpf: collected 0 externs total
libbpf: map 'tc_bpf.rodata' (global data): at sec_idx 4, offset 0, flags 80.
libbpf: map 0 is "tc_bpf.rodata"
libbpf: sec '.reltc': collecting relocation for section(3) 'tc'
libbpf: sec '.reltc': relo #0: insn #12 against '.rodata'
libbpf: prog 'tc_ingress': found data map 0 (tc_bpf.rodata, sec 4, off 0) for insn 12
libbpf: loading kernel BTF '/sys/kernel/btf/vmlinux': 0
libbpf: map 'tc_bpf.rodata': created successfully, fd=4
libbpf: sec 'tc': found 5 CO-RE relocations
libbpf: CO-RE relocating [2] struct __sk_buff: found target candidate [23253] struct __sk_buff in [vmlinux]
libbpf: prog 'tc_ingress': relo #0: <byte_off> [2] struct __sk_buff.data_end (0:16 @ offset 80)
libbpf: prog 'tc_ingress': relo #0: matching candidate #0 <byte_off> [23253] struct __sk_buff.data_end (0:16 @ offset 80)
libbpf: prog 'tc_ingress': relo #0: patched insn #0 (LDX/ST/STX) off 80 -> 80
libbpf: prog 'tc_ingress': relo #1: <byte_off> [2] struct __sk_buff.protocol (0:4 @ offset 16)
libbpf: prog 'tc_ingress': relo #1: matching candidate #0 <byte_off> [23253] struct __sk_buff.protocol (0:4 @ offset 16)
libbpf: prog 'tc_ingress': relo #1: patched insn #1 (LDX/ST/STX) off 16 -> 16
libbpf: prog 'tc_ingress': relo #2: <byte_off> [2] struct __sk_buff.data (0:15 @ offset 76)
libbpf: prog 'tc_ingress': relo #2: matching candidate #0 <byte_off> [23253] struct __sk_buff.data (0:15 @ offset 76)
libbpf: prog 'tc_ingress': relo #2: patched insn #3 (LDX/ST/STX) off 76 -> 76
libbpf: CO-RE relocating [19] struct iphdr: found target candidate [47109] struct iphdr in [vmlinux]
libbpf: prog 'tc_ingress': relo #3: <byte_off> [19] struct iphdr.ttl (0:6 @ offset 8)
libbpf: prog 'tc_ingress': relo #3: matching candidate #0 <byte_off> [47109] struct iphdr.ttl (0:6 @ offset 8)
libbpf: prog 'tc_ingress': relo #3: patched insn #9 (LDX/ST/STX) off 8 -> 8
libbpf: prog 'tc_ingress': relo #4: <byte_off> [19] struct iphdr.tot_len (0:3 @ offset 2)
libbpf: prog 'tc_ingress': relo #4: matching candidate #0 <byte_off> [47109] struct iphdr.tot_len (0:3 @ offset 2)
libbpf: prog 'tc_ingress': relo #4: patched insn #10 (LDX/ST/STX) off 2 -> 2
libbpf: Kernel error message: TC classifier not found
Failed to attach TC: -2
If need anything more, please let me know.
Any help will be grateful.
There is my whole kernel config.
config.txt (218.6 KB)