21 Jan, 2020

1 commit

  • Fix all files in samples/bpf to include libbpf header files with the bpf/
    prefix, to be consistent with external users of the library. Also ensure
    that all includes of exported libbpf header files (those that are exported
    on 'make install' of the library) use bracketed includes instead of quoted.

    To make sure no new files are introduced that doesn't include the bpf/
    prefix in its include, remove tools/lib/bpf from the include path entirely,
    and use tools/lib instead.

    Fixes: 6910d7d3867a ("selftests/bpf: Ensure bpf_helper_defs.h are taken from selftests dir")
    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Alexei Starovoitov
    Acked-by: Jesper Dangaard Brouer
    Acked-by: Andrii Nakryiko
    Link: https://lore.kernel.org/bpf/157952560911.1683545.8795966751309534150.stgit@toke.dk

    Toke Høiland-Jørgensen
     

09 Nov, 2019

1 commit

  • Since, the new syntax of BTF-defined map has been introduced,
    the syntax for using maps under samples directory are mixed up.
    For example, some are already using the new syntax, and some are using
    existing syntax by calling them as 'legacy'.

    As stated at commit abd29c931459 ("libbpf: allow specifying map
    definitions using BTF"), the BTF-defined map has more compatablility
    with extending supported map definition features.

    The commit doesn't replace all of the map to new BTF-defined map,
    because some of the samples still use bpf_load instead of libbpf, which
    can't properly create BTF-defined map.

    This will only updates the samples which uses libbpf API for loading bpf
    program. (ex. bpf_prog_load_xattr)

    Signed-off-by: Daniel T. Lee
    Acked-by: Andrii Nakryiko
    Signed-off-by: Alexei Starovoitov

    Daniel T. Lee
     

01 Sep, 2017

1 commit

  • Fix compilation error below:

    $ make samples/bpf/

    LLVM ERROR: 'xdp_redirect_dummy' label emitted multiple times to
    assembly file
    make[1]: *** [samples/bpf/xdp_redirect_kern.o] Error 1
    make: *** [samples/bpf/] Error 2

    Fixes: 306da4e685b4 ("samples/bpf: xdp_redirect load XDP dummy prog on TX device")
    Signed-off-by: Tariq Toukan
    Acked-by: Jesper Dangaard Brouer
    Acked-by: Daniel Borkmann
    Signed-off-by: David S. Miller

    Tariq Toukan
     

30 Aug, 2017

1 commit

  • For supporting XDP_REDIRECT, a device driver must (obviously)
    implement the "TX" function ndo_xdp_xmit(). An additional requirement
    is you cannot TX out a device, unless it also have a xdp bpf program
    attached. This dependency is caused by the driver code need to setup
    XDP resources before it can ndo_xdp_xmit.

    Update bpf samples xdp_redirect and xdp_redirect_map to automatically
    attach a dummy XDP program to the configured ifindex_out device. Use
    the XDP flag XDP_FLAGS_UPDATE_IF_NOEXIST on the dummy load, to avoid
    overriding an existing XDP prog on the device.

    Signed-off-by: Jesper Dangaard Brouer
    Signed-off-by: David S. Miller

    Jesper Dangaard Brouer
     

18 Jul, 2017

1 commit

  • This implements a sample program for testing bpf_redirect. It reports
    the number of packets redirected per second and as input takes the
    ifindex of the device to run the xdp program on and the ifindex of the
    interface to redirect packets to.

    Signed-off-by: John Fastabend
    Tested-by: Andy Gospodarek
    Acked-by: Daniel Borkmann
    Acked-by: Jesper Dangaard Brouer
    Signed-off-by: David S. Miller

    John Fastabend