1. 30 3月, 2020 3 次提交
  2. 29 3月, 2020 2 次提交
  3. 26 3月, 2020 2 次提交
  4. 18 3月, 2020 1 次提交
  5. 14 3月, 2020 2 次提交
  6. 13 3月, 2020 1 次提交
  7. 05 3月, 2020 2 次提交
  8. 04 3月, 2020 1 次提交
  9. 03 3月, 2020 3 次提交
  10. 21 2月, 2020 3 次提交
  11. 18 2月, 2020 1 次提交
  12. 25 1月, 2020 2 次提交
  13. 23 1月, 2020 1 次提交
  14. 18 1月, 2020 4 次提交
  15. 17 1月, 2020 1 次提交
  16. 16 1月, 2020 4 次提交
  17. 14 1月, 2020 1 次提交
  18. 11 1月, 2020 2 次提交
  19. 10 1月, 2020 4 次提交
    • A
      selftests/bpf: Ensure bpf_helper_defs.h are taken from selftests dir · 6910d7d3
      Andrii Nakryiko 提交于
      Reorder includes search path to ensure $(OUTPUT) and $(CURDIR) go before
      libbpf's directory. Also fix bpf_helpers.h to include bpf_helper_defs.h in
      such a way as to leverage includes search path. This allows selftests to not
      use libbpf's local and potentially stale bpf_helper_defs.h. It's important
      because selftests/bpf's Makefile only re-generates bpf_helper_defs.h in
      seltests' output directory, not the one in libbpf's directory.
      
      Also force regeneration of bpf_helper_defs.h when libbpf.a is updated to
      reduce staleness.
      
      Fixes: fa633a0f ("libbpf: Fix build on read-only filesystems")
      Reported-by: NAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: NAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20200110051716.1591485-3-andriin@fb.com
      6910d7d3
    • A
      libbpf,selftests/bpf: Fix clean targets · 2031af28
      Andrii Nakryiko 提交于
      Libbpf's clean target should clean out generated files in $(OUTPUT) directory
      and not make assumption that $(OUTPUT) directory is current working directory.
      
      Selftest's Makefile should delegate cleaning of libbpf-generated files to
      libbpf's Makefile. This ensures more robust clean up.
      Signed-off-by: NAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20200110051716.1591485-2-andriin@fb.com
      2031af28
    • A
      libbpf: Make bpf_map order and indices stable · 492ab020
      Andrii Nakryiko 提交于
      Currently, libbpf re-sorts bpf_map structs after all the maps are added and
      initialized, which might change their relative order and invalidate any
      bpf_map pointer or index taken before that. This is inconvenient and
      error-prone. For instance, it can cause .kconfig map index to point to a wrong
      map.
      
      Furthermore, libbpf itself doesn't rely on any specific ordering of bpf_maps,
      so it's just an unnecessary complication right now. This patch drops sorting
      of maps and makes their relative positions fixed. If efficient index is ever
      needed, it's better to have a separate array of pointers as a search index,
      instead of reordering bpf_map struct in-place. This will be less error-prone
      and will allow multiple independent orderings, if necessary (e.g., either by
      section index or by name).
      
      Fixes: 166750bc ("libbpf: Support libbpf-provided extern variables")
      Reported-by: NMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: NAndrii Nakryiko <andriin@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20200110034247.1220142-1-andriin@fb.com
      492ab020
    • M
      bpf: libbpf: Add STRUCT_OPS support · 590a0088
      Martin KaFai Lau 提交于
      This patch adds BPF STRUCT_OPS support to libbpf.
      
      The only sec_name convention is SEC(".struct_ops") to identify the
      struct_ops implemented in BPF,
      e.g. To implement a tcp_congestion_ops:
      
      SEC(".struct_ops")
      struct tcp_congestion_ops dctcp = {
      	.init           = (void *)dctcp_init,  /* <-- a bpf_prog */
      	/* ... some more func prts ... */
      	.name           = "bpf_dctcp",
      };
      
      Each struct_ops is defined as a global variable under SEC(".struct_ops")
      as above.  libbpf creates a map for each variable and the variable name
      is the map's name.  Multiple struct_ops is supported under
      SEC(".struct_ops").
      
      In the bpf_object__open phase, libbpf will look for the SEC(".struct_ops")
      section and find out what is the btf-type the struct_ops is
      implementing.  Note that the btf-type here is referring to
      a type in the bpf_prog.o's btf.  A "struct bpf_map" is added
      by bpf_object__add_map() as other maps do.  It will then
      collect (through SHT_REL) where are the bpf progs that the
      func ptrs are referring to.  No btf_vmlinux is needed in
      the open phase.
      
      In the bpf_object__load phase, the map-fields, which depend
      on the btf_vmlinux, are initialized (in bpf_map__init_kern_struct_ops()).
      It will also set the prog->type, prog->attach_btf_id, and
      prog->expected_attach_type.  Thus, the prog's properties do
      not rely on its section name.
      [ Currently, the bpf_prog's btf-type ==> btf_vmlinux's btf-type matching
        process is as simple as: member-name match + btf-kind match + size match.
        If these matching conditions fail, libbpf will reject.
        The current targeting support is "struct tcp_congestion_ops" which
        most of its members are function pointers.
        The member ordering of the bpf_prog's btf-type can be different from
        the btf_vmlinux's btf-type. ]
      
      Then, all obj->maps are created as usual (in bpf_object__create_maps()).
      
      Once the maps are created and prog's properties are all set,
      the libbpf will proceed to load all the progs.
      
      bpf_map__attach_struct_ops() is added to register a struct_ops
      map to a kernel subsystem.
      Signed-off-by: NMartin KaFai Lau <kafai@fb.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      Link: https://lore.kernel.org/bpf/20200109003514.3856730-1-kafai@fb.com
      590a0088