1. 05 8月, 2021 1 次提交
  2. 26 5月, 2021 1 次提交
    • H
      selftests/bpf: Add xdp_redirect_multi test · d2329247
      Hangbin Liu 提交于
      Add a bpf selftest for new helper xdp_redirect_map_multi(). In this
      test there are 3 forward groups and 1 exclude group. The test will
      redirect each interface's packets to all the interfaces in the forward
      group, and exclude the interface in exclude map.
      
      Two maps (DEVMAP, DEVMAP_HASH) and two xdp modes (generic, drive) will
      be tested. XDP egress program will also be tested by setting pkt src MAC
      to egress interface's MAC address.
      
      For more test details, you can find it in the test script. Here is
      the test result.
      ]# time ./test_xdp_redirect_multi.sh
      Pass: xdpgeneric arp(F_BROADCAST) ns1-1
      Pass: xdpgeneric arp(F_BROADCAST) ns1-2
      Pass: xdpgeneric arp(F_BROADCAST) ns1-3
      Pass: xdpgeneric IPv4 (F_BROADCAST|F_EXCLUDE_INGRESS) ns1-1
      Pass: xdpgeneric IPv4 (F_BROADCAST|F_EXCLUDE_INGRESS) ns1-2
      Pass: xdpgeneric IPv4 (F_BROADCAST|F_EXCLUDE_INGRESS) ns1-3
      Pass: xdpgeneric IPv6 (no flags) ns1-1
      Pass: xdpgeneric IPv6 (no flags) ns1-2
      Pass: xdpdrv arp(F_BROADCAST) ns1-1
      Pass: xdpdrv arp(F_BROADCAST) ns1-2
      Pass: xdpdrv arp(F_BROADCAST) ns1-3
      Pass: xdpdrv IPv4 (F_BROADCAST|F_EXCLUDE_INGRESS) ns1-1
      Pass: xdpdrv IPv4 (F_BROADCAST|F_EXCLUDE_INGRESS) ns1-2
      Pass: xdpdrv IPv4 (F_BROADCAST|F_EXCLUDE_INGRESS) ns1-3
      Pass: xdpdrv IPv6 (no flags) ns1-1
      Pass: xdpdrv IPv6 (no flags) ns1-2
      Pass: xdpegress mac ns1-2
      Pass: xdpegress mac ns1-3
      Summary: PASS 18, FAIL 0
      
      real    1m18.321s
      user    0m0.123s
      sys     0m0.350s
      Signed-off-by: NHangbin Liu <liuhangbin@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NToke Høiland-Jørgensen <toke@redhat.com>
      Link: https://lore.kernel.org/bpf/20210519090747.1655268-5-liuhangbin@gmail.com
      d2329247
  3. 19 5月, 2021 3 次提交
  4. 25 4月, 2021 1 次提交
    • M
      tools: do not include scripts/Kbuild.include · b61442df
      Masahiro Yamada 提交于
      Since commit 57fd251c ("kbuild: split cc-option and friends to
      scripts/Makefile.compiler"), some kselftests fail to build.
      
      The tools/ directory opted out Kbuild, and went in a different
      direction. People copied scripts and Makefiles to the tools/ directory
      to create their own build system.
      
      tools/build/Build.include mimics scripts/Kbuild.include, but some
      tool Makefiles include the Kbuild one to import a feature that is
      missing in tools/build/Build.include:
      
       - Commit ec04aa3a ("tools/thermal: tmon: use "-fstack-protector"
         only if supported") included scripts/Kbuild.include from
         tools/thermal/tmon/Makefile to import the cc-option macro.
      
       - Commit c2390f16 ("selftests: kvm: fix for compilers that do
         not support -no-pie") included scripts/Kbuild.include from
         tools/testing/selftests/kvm/Makefile to import the try-run macro.
      
       - Commit 9cae4ace ("selftests/bpf: do not ignore clang
         failures") included scripts/Kbuild.include from
         tools/testing/selftests/bpf/Makefile to import the .DELETE_ON_ERROR
         target.
      
       - Commit 0695f8bc ("selftests/powerpc: Handle Makefile for
         unrecognized option") included scripts/Kbuild.include from
         tools/testing/selftests/powerpc/pmu/ebb/Makefile to import the
         try-run macro.
      
      Copy what they need into tools/build/Build.include, and make them
      include it instead of scripts/Kbuild.include.
      
      Link: https://lore.kernel.org/lkml/86dadf33-70f7-a5ac-cb8c-64966d2f45a1@linux.ibm.com/
      Fixes: 57fd251c ("kbuild: split cc-option and friends to scripts/Makefile.compiler")
      Reported-by: NJanosch Frank <frankja@linux.ibm.com>
      Reported-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: NChristian Borntraeger <borntraeger@de.ibm.com>
      Acked-by: NYonghong Song <yhs@fb.com>
      b61442df
  5. 24 4月, 2021 5 次提交
  6. 21 4月, 2021 1 次提交
  7. 16 4月, 2021 2 次提交
    • Y
      selftests/bpf: Silence clang compilation warnings · ef998589
      Yonghong Song 提交于
      With clang compiler:
        make -j60 LLVM=1 LLVM_IAS=1  <=== compile kernel
        make -j60 -C tools/testing/selftests/bpf LLVM=1 LLVM_IAS=1
      Some linker flags are not used/effective for some binaries and
      we have warnings like:
        warning: -lelf: 'linker' input unused [-Wunused-command-line-argument]
      
      We also have warnings like:
        .../selftests/bpf/prog_tests/ns_current_pid_tgid.c:74:57: note: treat the string as an argument to avoid this
              if (CHECK(waitpid(cpid, &wstatus, 0) == -1, "waitpid", strerror(errno)))
                                                                     ^
                                                                     "%s",
        .../selftests/bpf/test_progs.h:129:35: note: expanded from macro 'CHECK'
              _CHECK(condition, tag, duration, format)
                                               ^
        .../selftests/bpf/test_progs.h:108:21: note: expanded from macro '_CHECK'
                      fprintf(stdout, ##format);                              \
                                        ^
      The first warning can be silenced with clang option -Wno-unused-command-line-argument.
      For the second warning, source codes are modified as suggested by the compiler
      to silence the warning. Since gcc does not support the option
      -Wno-unused-command-line-argument and the warning only happens with clang
      compiler, the option -Wno-unused-command-line-argument is enabled only when
      clang compiler is used.
      Signed-off-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20210413153429.3029377-1-yhs@fb.com
      ef998589
    • Y
      selftests/bpf: Fix test_cpp compilation failure with clang · a22c0c81
      Yonghong Song 提交于
      With clang compiler:
        make -j60 LLVM=1 LLVM_IAS=1  <=== compile kernel
        make -j60 -C tools/testing/selftests/bpf LLVM=1 LLVM_IAS=1
      the test_cpp build failed due to the failure:
        warning: treating 'c-header' input as 'c++-header' when in C++ mode, this behavior is deprecated [-Wdeprecated]
        clang-13: error: cannot specify -o when generating multiple output files
      
      test_cpp compilation flag looks like:
        clang++ -g -Og -rdynamic -Wall -I<...> ... \
        -Dbpf_prog_load=bpf_prog_test_load -Dbpf_load_program=bpf_test_load_program \
        test_cpp.cpp <...>/test_core_extern.skel.h <...>/libbpf.a <...>/test_stub.o \
        -lcap -lelf -lz -lrt -lpthread -o <...>/test_cpp
      
      The clang++ compiler complains the header file in the command line and
      also failed the compilation due to this.
      Let us remove the header file from the command line which is not intended
      any way, and this fixed the compilation problem.
      Signed-off-by: NYonghong Song <yhs@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20210413153424.3028986-1-yhs@fb.com
      a22c0c81
  8. 19 3月, 2021 3 次提交
  9. 17 3月, 2021 1 次提交
  10. 09 3月, 2021 1 次提交
  11. 05 3月, 2021 1 次提交
  12. 27 2月, 2021 1 次提交
  13. 12 2月, 2021 1 次提交
  14. 29 1月, 2021 1 次提交
    • S
      tools: Factor Clang, LLC and LLVM utils definitions · 211a741c
      Sedat Dilek 提交于
      When dealing with BPF/BTF/pahole and DWARF v5 I wanted to build bpftool.
      
      While looking into the source code I found duplicate assignments in misc tools
      for the LLVM eco system, e.g. clang and llvm-objcopy.
      
      Move the Clang, LLC and/or LLVM utils definitions to tools/scripts/Makefile.include
      file and add missing includes where needed. Honestly, I was inspired by the commit
      c8a950d0 ("tools: Factor HOSTCC, HOSTLD, HOSTAR definitions").
      
      I tested with bpftool and perf on Debian/testing AMD64 and LLVM/Clang v11.1.0-rc1.
      
      Build instructions:
      
      [ make and make-options ]
      MAKE="make V=1"
      MAKE_OPTS="HOSTCC=clang HOSTCXX=clang++ HOSTLD=ld.lld CC=clang LD=ld.lld LLVM=1 LLVM_IAS=1"
      MAKE_OPTS="$MAKE_OPTS PAHOLE=/opt/pahole/bin/pahole"
      
      [ clean-up ]
      $MAKE $MAKE_OPTS -C tools/ clean
      
      [ bpftool ]
      $MAKE $MAKE_OPTS -C tools/bpf/bpftool/
      
      [ perf ]
      PYTHON=python3 $MAKE $MAKE_OPTS -C tools/perf/
      
      I was careful with respecting the user's wish to override custom compiler, linker,
      GNU/binutils and/or LLVM utils settings.
      Signed-off-by: NSedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAndrii Nakryiko <andrii@kernel.org>
      Acked-by: Jiri Olsa <jolsa@redhat.com> # tools/build and tools/perf
      Link: https://lore.kernel.org/bpf/20210128015117.20515-1-sedat.dilek@gmail.com
      211a741c
  15. 21 1月, 2021 1 次提交
  16. 15 1月, 2021 1 次提交
    • B
      bpf: Add tests for new BPF atomic operations · 98d666d0
      Brendan Jackman 提交于
      The prog_test that's added depends on Clang/LLVM features added by
      Yonghong in commit 286daafd6512 (was https://reviews.llvm.org/D72184).
      
      Note the use of a define called ENABLE_ATOMICS_TESTS: this is used
      to:
      
       - Avoid breaking the build for people on old versions of Clang
       - Avoid needing separate lists of test objects for no_alu32, where
         atomics are not supported even if Clang has the feature.
      
      The atomics_test.o BPF object is built unconditionally both for
      test_progs and test_progs-no_alu32. For test_progs, if Clang supports
      atomics, ENABLE_ATOMICS_TESTS is defined, so it includes the proper
      test code. Otherwise, progs and global vars are defined anyway, as
      stubs; this means that the skeleton user code still builds.
      
      The atomics_test.o userspace object is built once and used for both
      test_progs and test_progs-no_alu32. A variable called skip_tests is
      defined in the BPF object's data section, which tells the userspace
      object whether to skip the atomics test.
      Signed-off-by: NBrendan Jackman <jackmanb@google.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NYonghong Song <yhs@fb.com>
      Link: https://lore.kernel.org/bpf/20210114181751.768687-11-jackmanb@google.com
      98d666d0
  17. 14 1月, 2021 5 次提交
  18. 17 12月, 2020 1 次提交
  19. 11 12月, 2020 2 次提交
  20. 10 12月, 2020 1 次提交
  21. 09 12月, 2020 2 次提交
  22. 04 12月, 2020 2 次提交
  23. 01 12月, 2020 1 次提交
  24. 19 11月, 2020 1 次提交