1. 17 10月, 2017 1 次提交
  2. 08 10月, 2017 2 次提交
  3. 07 10月, 2017 3 次提交
  4. 05 10月, 2017 2 次提交
  5. 02 10月, 2017 1 次提交
  6. 29 9月, 2017 1 次提交
    • M
      bpf: libbpf: Provide basic API support to specify BPF obj name · 88cda1c9
      Martin KaFai Lau 提交于
      This patch extends the libbpf to provide API support to
      allow specifying BPF object name.
      
      In tools/lib/bpf/libbpf, the C symbol of the function
      and the map is used.  Regarding section name, all maps are
      under the same section named "maps".  Hence, section name
      is not a good choice for map's name.  To be consistent with
      map, bpf_prog also follows and uses its function symbol as
      the prog's name.
      
      This patch adds logic to collect function's symbols in libbpf.
      There is existing codes to collect the map's symbols and no change
      is needed.
      
      The bpf_load_program_name() and bpf_map_create_name() are
      added to take the name argument.  For the other bpf_map_create_xxx()
      variants, a name argument is directly added to them.
      
      In samples/bpf, bpf_load.c in particular, the symbol is also
      used as the map's name and the map symbols has already been
      collected in the existing code.  For bpf_prog, bpf_load.c does
      not collect the function symbol name.  We can consider to collect
      them later if there is a need to continue supporting the bpf_load.c.
      Signed-off-by: NMartin KaFai Lau <kafai@fb.com>
      Acked-by: NAlexei Starovoitov <ast@fb.com>
      Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      88cda1c9
  7. 22 9月, 2017 4 次提交
  8. 02 9月, 2017 1 次提交
  9. 01 9月, 2017 6 次提交
  10. 30 8月, 2017 2 次提交
    • J
      samples/bpf: xdp_monitor tool based on tracepoints · 3ffab546
      Jesper Dangaard Brouer 提交于
      This tool xdp_monitor demonstrate how to use the different xdp_redirect
      tracepoints xdp_redirect{,_map}{,_err} from a BPF program.
      
      The default mode is to only monitor the error counters, to avoid
      affecting the per packet performance. Tracepoints comes with a base
      overhead of 25 nanosec for an attached bpf_prog, and 48 nanosec for
      using a full perf record (with non-matching filter).  Thus, default
      loading the --stats mode could affect the maximum performance.
      
      This version of the tool is very simple and count all types of errors
      as one.  It will be natural to extend this later with the different
      types of errors that can occur, which should help users quickly
      identify common mistakes.
      
      Because the TP_STRUCT was kept in sync all the tracepoints loads the
      same BPF code.  It would also be natural to extend the map version to
      demonstrate how the map information could be used.
      Signed-off-by: NJesper Dangaard Brouer <brouer@redhat.com>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3ffab546
    • J
      samples/bpf: xdp_redirect load XDP dummy prog on TX device · 306da4e6
      Jesper Dangaard Brouer 提交于
      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: NJesper Dangaard Brouer <brouer@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      306da4e6
  11. 29 8月, 2017 2 次提交
  12. 20 8月, 2017 2 次提交
  13. 17 8月, 2017 2 次提交
    • K
      samples: Unrename SECCOMP_RET_KILL · 6849243b
      Kees Cook 提交于
      Since samples can still be built before header installs, avoid the
      cosmetic renaming of SECCOMP_RET_KILL to avoid build failures in -next.
      
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NKees Cook <keescook@chromium.org>
      6849243b
    • J
      bpf: sockmap sample program · 69e8cc13
      John Fastabend 提交于
      This program binds a program to a cgroup and then matches hard
      coded IP addresses and adds these to a sockmap.
      
      This will receive messages from the backend and send them to
      the client.
      
           client:X <---> frontend:10000 client:X <---> backend:10001
      
      To keep things simple this is only designed for 1:1 connections
      using hard coded values. A more complete example would allow many
      backends and clients.
      
      To run,
      
       # sockmap <cgroup2_dir>
      Signed-off-by: NJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      69e8cc13
  14. 15 8月, 2017 1 次提交
  15. 08 8月, 2017 1 次提交
  16. 01 8月, 2017 1 次提交
  17. 18 7月, 2017 3 次提交
  18. 13 7月, 2017 1 次提交
  19. 12 7月, 2017 1 次提交
    • Y
      samples/bpf: fix a build issue · 53335022
      Yonghong Song 提交于
      With latest net-next:
      
      ====
      clang  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/6.3.1/include -I./arch/x86/include -I./arch/x86/include/generated/uapi -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h  -Isamples/bpf \
          -D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \
          -Wno-compare-distinct-pointer-types \
          -Wno-gnu-variable-sized-type-not-at-end \
          -Wno-address-of-packed-member -Wno-tautological-compare \
          -Wno-unknown-warning-option \
          -O2 -emit-llvm -c samples/bpf/tcp_synrto_kern.c -o -| llc -march=bpf -filetype=obj -o samples/bpf/tcp_synrto_kern.o
      samples/bpf/tcp_synrto_kern.c:20:10: fatal error: 'bpf_endian.h' file not found
                ^~~~~~~~~~~~~~
      1 error generated.
      ====
      
      net has the same issue.
      
      Add support for ntohl and htonl in tools/testing/selftests/bpf/bpf_endian.h.
      Also move bpf_helpers.h from samples/bpf to selftests/bpf and change
      compiler include logic so that programs in samples/bpf can access the headers
      in selftests/bpf, but not the other way around.
      Signed-off-by: NYonghong Song <yhs@fb.com>
      Acked-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NLawrence Brakmo <brakmo@fb.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      53335022
  20. 05 7月, 2017 1 次提交
    • L
      bpf: fix return in load_bpf_file · f856e469
      Lawrence Brakmo 提交于
      The function load_bpf_file ignores the return value of
      load_and_attach(), so even if load_and_attach() returns an error,
      load_bpf_file() will return 0.
      
      Now, load_bpf_file() can call load_and_attach() multiple times and some
      can succeed and some could fail. I think the correct behavor is to
      return error on the first failed load_and_attach().
      
      v2: Added missing SOB
      Signed-off-by: NLawrence Brakmo <brakmo@fb.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f856e469
  21. 02 7月, 2017 2 次提交