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.
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.
3. Load custom XDP program
E.g.
$ ovs-vsctl add-port ovsbr0 veth0 -- set int veth0 options:xdp-mode=native \
options:xdp-obj="path/to/ovs/bpf/flowtable_afxdp.o"
$ ovs-vsctl add-port ovsbr0 veth1 -- set int veth1 options:xdp-mode=native \
options:xdp-obj="path/to/ovs/bpf/flowtable_afxdp.o"
Once clang is fixed, loading the program works:
2020-07-15T15:07:02.374Z|00049|netdev_offload|INFO|afxdp-p0: Assigned flow API
'linux_xdp'.
$~/ovs# bpftool map
42: devmap name output_map flags 0x80
key 4B value 4B max_entries 65536 memlock 524288B
44: array_of_maps name flow_table flags 0x0
key 4B value 4B max_entries 128 memlock 4096B
45: array name subtbl_masks_hd flags 0x0
key 4B value 4B max_entries 1 memlock 4096B
46: (null) name xsks_map flags 0x0
...
But ping between two namespace shows packet lost. Then I realize I
need to load dummy program.
4. Enable XDP_REDIRECT
If you use veth devices, make sure to load some (possibly dummy) programs
on the peers of veth devices.
Some HW NIC drivers require as many queues as cores on its system. Tweak
queues using "ethtool -L".
Maybe it's better put this dummy program under ovs/bpf/
OK, will do.
Toshiaki Makita
_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev