OSDN Git Service

selftests/bpf: check bpf verifier log buffer usage works for HW offload
authorQuentin Monnet <quentin.monnet@netronome.com>
Tue, 23 Jan 2018 19:22:55 +0000 (11:22 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Jan 2018 01:24:31 +0000 (20:24 -0500)
commit9045bdc8ed4e4e2c713d8d38bda9aa506b4bd8c5
tree93d80e1de32bdc2ab90e193d79bf8d2ccdcf1bf6
parent7c5db7e7292f7f3244f895e7fa301dcff647e07e
selftests/bpf: check bpf verifier log buffer usage works for HW offload

Make netdevsim print a message to the BPF verifier log buffer when a
program is offloaded.

Then use this message in hardware offload selftests to make sure that
using this buffer actually prints the message to the console for
eBPF hardware offload.

The message is appended after the last instruction is processed with the
verifying function from netdevsim. Output looks like the following:

    $ tc filter add dev foo ingress bpf obj sample_ret0.o \
        sec .text verbose skip_sw

    Prog section '.text' loaded (5)!
     - Type:         3
     - Instructions: 2 (0 over limit)
     - License:

    Verifier analysis:

    0: (b7) r0 = 0
    1: (95) exit
    [netdevsim] Hello from netdevsim!
    processed 2 insns, stack depth 0

"verbose" flag is required to see it in the console since netdevsim does
not throw an error after printing the message.

Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/netdevsim/bpf.c
tools/testing/selftests/bpf/test_offload.py