09 Jul, 2019

1 commit


04 Jul, 2019

1 commit

  • Daniel Borkmann says:

    ====================
    pull-request: bpf 2019-07-03

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

    The main changes are:

    1) Fix the interpreter to properly handle BPF_ALU32 | BPF_ARSH
    on BE architectures, from Jiong.

    2) Fix several bugs in the x32 BPF JIT for handling shifts by 0,
    from Luke and Xi.

    3) Fix NULL pointer deref in btf_type_is_resolve_source_only(),
    from Stanislav.

    4) Properly handle the check that forwarding is enabled on the device
    in bpf_ipv6_fib_lookup() helper code, from Anton.

    5) Fix UAPI bpf_prog_info fields alignment for archs that have 16 bit
    alignment such as m68k, from Baruch.

    6) Fix kernel hanging in unregister_netdevice loop while unregistering
    device bound to XDP socket, from Ilya.

    7) Properly terminate tail update in xskq_produce_flush_desc(), from Nathan.

    8) Fix broken always_inline handling in test_lwt_seg6local, from Jiri.

    9) Fix bpftool to use correct argument in cgroup errors, from Jakub.

    10) Fix detaching dummy prog in XDP redirect sample code, from Prashant.

    11) Add Jonathan to AF_XDP reviewers, from Björn.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     

26 Jun, 2019

1 commit

  • Currently, each xdp samples are inconsistent in the use.
    Most of the samples fetch the interface with it's name.
    (ex. xdp1, xdp2skb, xdp_redirect_cpu, xdp_sample_pkts, etc.)

    But some of the xdp samples are fetching the interface with
    ifindex by command argument.

    This commit enables xdp samples to fetch interface with it's name
    without changing the original index interface fetching.
    ( fetching in the same way as xdp_sample_pkts_user.c does.)

    Signed-off-by: Daniel T. Lee
    Acked-by: Toke Høiland-Jørgensen
    Acked-by: Jesper Dangaard Brouer
    Acked-by: Song Liu
    Signed-off-by: Daniel Borkmann

    Daniel T. Lee
     

24 Jun, 2019

1 commit

  • When we terminate xdp_redirect, it ends up with following message:
    "Program on iface OUT changed, not removing"
    This results in dummy prog still attached to OUT interface.
    It is because signal handler checks if the programs are the same that
    we had attached. But while fetching dummy_prog_id, current code uses
    prog_fd instead of dummy_prog_fd. This patch passes the correct fd.

    Fixes: 3b7a8ec2dec3 ("samples/bpf: Check the prog id before exiting")
    Signed-off-by: Prashant Bhole
    Acked-by: Toke Høiland-Jørgensen
    Signed-off-by: Daniel Borkmann

    Prashant Bhole
     

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
     

05 Jun, 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 this program is
    distributed in the hope that it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

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

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

    Thomas Gleixner
     

22 Feb, 2019

1 commit

  • The xdp_redirect and xdp_redirect_map sample programs both load a dummy
    program onto the egress interfaces. However, the unload code checks these
    programs against the wrong id number, and thus refuses to unload them. Fix
    the comparison to avoid this.

    Fixes: 3b7a8ec2dec3 ("samples/bpf: Check the prog id before exiting")
    Signed-off-by: Toke Høiland-Jørgensen
    Acked-by: Maciej Fijalkowski
    Acked-by: Martin KaFai Lau
    Signed-off-by: Daniel Borkmann

    Toke Høiland-Jørgensen
     

02 Feb, 2019

3 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
     
  • 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


14 Feb, 2018

1 commit


03 Feb, 2018

1 commit


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

2 commits

  • When testing with a driver that has both native and generic redirect support:

    $ sudo ./samples/bpf/xdp_redirect -N 5 6
    input: 5 output: 6
    ifindex 6: 4961879 pkt/s
    ifindex 6: 6391319 pkt/s
    ifindex 6: 6419468 pkt/s

    $ sudo ./samples/bpf/xdp_redirect -S 5 6
    input: 5 output: 6
    ifindex 6: 1845435 pkt/s
    ifindex 6: 3882850 pkt/s
    ifindex 6: 3893974 pkt/s

    $ sudo ./samples/bpf/xdp_redirect_map -N 5 6
    input: 5 output: 6
    map[0] (vports) = 4, map[1] (map) = 5, map[2] (count) = 0
    ifindex 6: 2207374 pkt/s
    ifindex 6: 6212869 pkt/s
    ifindex 6: 6286515 pkt/s

    $ sudo ./samples/bpf/xdp_redirect_map -S 5 6
    input: 5 output: 6
    map[0] (vports) = 4, map[1] (map) = 5, map[2] (count) = 0
    ifindex 6: 5052528 pkt/s
    ifindex 6: 5736631 pkt/s
    ifindex 6: 5739962 pkt/s

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

    Andy Gospodarek
     
  • 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