Hi William,

On 2020/07/16 23:05, Toshiaki Makita wrote:
Hi William,

Thank you for taking a look!

On 2020/07/16 0:49, William Tu wrote:
Hi Toshiaki,

Thanks for the interesting patch series!
I haven't finished reviewing, but I went through a couple of
steps to make sure it works in my environment.
Comments below:

On Tue, Jun 30, 2020 at 12:30:29AM +0900, Toshiaki Makita wrote:
...
* How to use

1. Install clang/llvm >= 9, libbpf >= 0.0.6 (included in kernel 5.5), and
    kernel >= 5.3.
Encounter an error:
lib/netdev-offload-xdp.c: In function ‘probe_meta_info’:
lib/netdev-offload-xdp.c:386:19: error: implicit declaration of function 
‘btf__find_by_name_kind’
[-Werror=implicit-function-declaration]
      meta_sec_id = btf__find_by_name_kind(btf, ".ovs_meta", BTF_KIND_DATASEC);

$~/bpf-next/tools/lib/bpf# nm libbpf.so.0.0.7  | grep "btf__.*kind" | grep T
000000000001d4b3 T btf__find_by_name_kind
$~/bpf-next/tools/lib/bpf# nm libbpf.so.0.0.6  | grep "btf__.*kind" | grep T

Actually we need libbpf 0.0.7

Hmm...? It should be 0.0.6...

https://github.com/libbpf/libbpf/blob/v0.0.6/src/libbpf.map#L208

LIBBPF_0.0.6 {
     global:
         [...]
         btf__find_by_name_kind;

I'll double check if my 0.0.6 binary has this function.

Confirmed.

```
$ rpm -q libbpf
libbpf-0.0.6-1.fc31.x86_64

$ nm -D /lib64/libbpf.so.0.0.6 | grep "btf__.*kind" | grep T
00000000000091f0 T btf__find_by_name_kind
```

William, would you check your configuration again?
libbpf 0.0.6 should include btf__find_by_name_kind.

2. make with --enable-afxdp --enable-bpf
--enable-bpf will generate XDP program "bpf/flowtable_afxdp.o".  Note that
the BPF object will not be installed anywhere by "make install" at this point.

This works ok for me. I was using clang8 and it doesn't work due to BTF.
2020-07-15T14:59:15.224Z|00043|netdev_afxdp|WARN|libbpf: BTF is required, but 
is missing or corrupted.

Maybe we should check clang version at ./configure time.

Actually we already have checking for BTF:

     AC_MSG_CHECKING([for BTF DATASEC support])
     AC_LANG_CONFTEST(
       [AC_LANG_SOURCE([__attribute__((section("_x"), used)) int x;])])
     if clang -g -O2 -S -target bpf -emit-llvm -c conftest.c -o conftest.ll && \
        llc -march=bpf -filetype=obj -o conftest.o conftest.ll && \
        readelf -p.BTF conftest.o 2>/dev/null | grep -q -w _x; then
       AC_MSG_RESULT([yes])

I'll check why this did not work for you.

I tried reproducing this with clang 8, but couldn't.

```
$ clang --version
clang version 8.0.0 (Fedora 8.0.0-3.fc30)

$ ./boot.sh
$ ./configure --enable-bpf
[...]
checking for BTF DATASEC support... no
configure: error: LLVM does not support BTF DATASEC
```

Could you try ./configure --enable-bpf again?

Toshiaki Makita
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to