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
     

16 Dec, 2019

1 commit

  • When attaching XDP programs, userspace can set flags to request the attach
    mode (generic/SKB mode, driver mode or hw offloaded mode). If no such flags
    are requested, the kernel will attempt to attach in driver mode, and then
    silently fall back to SKB mode if this fails.

    The silent fallback is a major source of user confusion, as users will try
    to load a program on a device without XDP support, and instead of an error
    they will get the silent fallback behaviour, not notice, and then wonder
    why performance is not what they were expecting.

    In an attempt to combat this, let's switch all the samples to default to
    explicitly requesting driver-mode attach. As part of this, ensure that all
    the userspace utilities have a switch to enable SKB mode. For those that
    have a switch to request driver mode, keep it but turn it into a no-op.

    Signed-off-by: Toke Høiland-Jørgensen
    Signed-off-by: Alexei Starovoitov
    Acked-by: Jesper Dangaard Brouer
    Acked-by: David Ahern
    Link: https://lore.kernel.org/bpf/20191216110742.364456-1-toke@redhat.com

    Toke Høiland-Jørgensen
     

20 Jun, 2019

1 commit

  • Alexei Starovoitov says:

    ====================
    pull-request: bpf-next 2019-06-19

    The following pull-request contains BPF updates for your *net-next* tree.

    The main changes are:

    1) new SO_REUSEPORT_DETACH_BPF setsocktopt, from Martin.

    2) BTF based map definition, from Andrii.

    3) support bpf_map_lookup_elem for xskmap, from Jonathan.

    4) bounded loops and scalar precision logic in the verifier, from Alexei.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

18 Jun, 2019

1 commit

  • Currently, header inclusion in each file is inconsistent.
    For example, "libbpf.h" header is included as multiple ways.

    #include "bpf/libbpf.h"
    #include "libbpf.h"

    Due to commit b552d33c80a9 ("samples/bpf: fix include path
    in Makefile"), $(srctree)/tools/lib/bpf/ path had been included
    during build, path "bpf/" in header isn't necessary anymore.

    This commit removes path "bpf/" in header inclusion.

    Signed-off-by: Daniel T. Lee
    Signed-off-by: Daniel Borkmann

    Daniel T. Lee
     

31 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of version 2 of the gnu general public license as
    published by the free software foundation

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 107 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Richard Fontana
    Reviewed-by: Steve Winslow
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190528171438.615055994@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

02 Feb, 2019

4 commits

  • Check the program id within the signal handler on polling xdp samples
    that were previously converted to libbpf usage. Avoid the situation of
    unloading the program that was not attached by sample that is exiting.
    Handle also the case where bpf_get_link_xdp_id didn't exit with an error
    but the xdp program was not found on an interface.

    Reported-by: Michal Papaj
    Reported-by: Jakub Spizewski
    Signed-off-by: Maciej Fijalkowski
    Reviewed-by: Jakub Kicinski
    Signed-off-by: Daniel Borkmann

    Maciej Fijalkowski
     
  • Make xdp samples consistent with iproute2 behavior and set the
    XDP_FLAGS_UPDATE_IF_NOEXIST by default when setting the xdp program on
    interface. Provide an option for user to force the program loading,
    which as a result will not include the mentioned flag in
    bpf_set_link_xdp_fd call.

    Signed-off-by: Maciej Fijalkowski
    Reviewed-by: Jakub Kicinski
    Acked-by: John Fastabend
    Signed-off-by: Daniel Borkmann

    Maciej Fijalkowski
     
  • There is a common problem with xdp samples that happens when user wants
    to run a particular sample and some bpf program is already loaded. The
    default 64kb RLIMIT_MEMLOCK resource limit will cause a following error
    (assuming that xdp sample that is failing was converted to libbpf
    usage):

    libbpf: Error in bpf_object__probe_name():Operation not permitted(1).
    Couldn't load basic 'r0 = 0' BPF program.
    libbpf: failed to load object './xdp_sample_pkts_kern.o'

    Fix it in xdp_sample_pkts and xdp_router_ipv4 by setting RLIMIT_MEMLOCK
    to RLIM_INFINITY.

    Signed-off-by: Maciej Fijalkowski
    Reviewed-by: Jakub Kicinski
    Acked-by: Jesper Dangaard Brouer
    Acked-by: John Fastabend
    Signed-off-by: Daniel Borkmann

    Maciej Fijalkowski
     
  • Some of XDP samples that are attaching the bpf program to the interface
    via libbpf's bpf_set_link_xdp_fd are still using the bpf_load.c for
    loading and manipulating the ebpf program and maps. Convert them to do
    this through libbpf usage and remove bpf_load from the picture.

    While at it remove what looks like debug leftover in
    xdp_redirect_map_user.c

    In xdp_redirect_cpu, change the way that the program to be loaded onto
    interface is chosen - user now needs to pass the program's section name
    instead of the relative number. In case of typo print out the section
    names to choose from.

    Signed-off-by: Maciej Fijalkowski
    Reviewed-by: Jakub Kicinski
    Acked-by: Jesper Dangaard Brouer
    Signed-off-by: Daniel Borkmann

    Maciej Fijalkowski
     

15 May, 2018

1 commit


03 Feb, 2018

1 commit


14 Nov, 2017

1 commit


08 Nov, 2017

1 commit