1. 27 Nov, 2020 2 commits
    • Daniel T. Lee's avatar
      samples: bpf: Refactor test_cgrp2_sock2 program with libbpf · d89af13c
      Daniel T. Lee authored
      This commit refactors the existing cgroup program with libbpf bpf
      loader. The original test_cgrp2_sock2 has keeped the bpf program
      attached to the cgroup hierarchy even after the exit of user program.
      To implement the same functionality with libbpf, this commit uses the
      BPF_LINK_PINNING to pin the link attachment even after it is closed.
      
      Since this uses LINK instead of ATTACH, detach of bpf program from
      cgroup with 'test_cgrp2_sock' is not used anymore.
      
      The code to mount the bpf was added to the .sh file in case the bpff
      was not mounted on /sys/fs/bpf. Additionally, to fix the problem that
      shell script cannot find the binary object from the current path,
      relative path './' has been added in front of binary.
      
      Fixes: 554ae6e7 ("samples/bpf: add userspace example for prohibiting sockets")
      Signed-off-by: default avatarDaniel T. Lee <danieltimlee@gmail.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20201124090310.24374-3-danieltimlee@gmail.com
      d89af13c
    • Daniel T. Lee's avatar
      samples: bpf: Refactor hbm program with libbpf · c5815ac7
      Daniel T. Lee authored
      This commit refactors the existing cgroup programs with libbpf
      bpf loader. Since bpf_program__attach doesn't support cgroup program
      attachment, this explicitly attaches cgroup bpf program with
      bpf_program__attach_cgroup(bpf_prog, cg1).
      
      Also, to change attach_type of bpf program, this uses libbpf's
      bpf_program__set_expected_attach_type helper to switch EGRESS to
      INGRESS. To keep bpf program attached to the cgroup hierarchy even
      after the exit, this commit uses the BPF_LINK_PINNING to pin the link
      attachment even after it is closed.
      
      Besides, this program was broken due to the typo of BPF MAP definition.
      But this commit solves the problem by fixing this from 'queue_stats' map
      struct hvm_queue_stats -> hbm_queue_stats.
      
      Fixes: 36b5d471 ("selftests/bpf: samples/bpf: Split off legacy stuff from bpf_helpers.h")
      Signed-off-by: default avatarDaniel T. Lee <danieltimlee@gmail.com>
      Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Link: https://lore.kernel.org/bpf/20201124090310.24374-2-danieltimlee@gmail.com
      c5815ac7
  2. 25 Nov, 2020 6 commits
  3. 24 Nov, 2020 4 commits
  4. 20 Nov, 2020 2 commits
  5. 19 Nov, 2020 4 commits
  6. 18 Nov, 2020 3 commits
  7. 17 Nov, 2020 8 commits
  8. 16 Nov, 2020 1 commit
  9. 14 Nov, 2020 10 commits