• Quentin Monnet's avatar
    selftests/bpf: check bpf verifier log buffer usage works for HW offload · 9045bdc8
    Quentin Monnet authored
    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: default avatarQuentin Monnet <quentin.monnet@netronome.com>
    Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    9045bdc8
bpf.c 15.3 KB