Re: [PATCH bpf-next v2 1/7] samples: bpf: refactor hbm program with libbpf

2020-11-24 Thread Daniel T. Lee
Sorry for the late reply. On Sat, Nov 21, 2020 at 11:34 AM Martin KaFai Lau wrote: > > On Thu, Nov 19, 2020 at 03:06:11PM +, Daniel T. Lee wrote: > [ ... ] > > > static int run_bpf_prog(char *prog, int cg_id) > > [ ... ] > > if (!outFlag) > > - type = BPF_CGROUP_INET_INGRES

Re: [PATCH bpf-next v2 1/7] samples: bpf: refactor hbm program with libbpf

2020-11-20 Thread Martin KaFai Lau
On Fri, Nov 20, 2020 at 06:34:05PM -0800, Martin KaFai Lau wrote: > On Thu, Nov 19, 2020 at 03:06:11PM +, Daniel T. Lee wrote: > [ ... ] > > > static int run_bpf_prog(char *prog, int cg_id) > > { > > - int map_fd; > > - int rc = 0; > > + struct hbm_queue_stats qstats = {0}; > > + cha

Re: [PATCH bpf-next v2 1/7] samples: bpf: refactor hbm program with libbpf

2020-11-20 Thread Martin KaFai Lau
On Thu, Nov 19, 2020 at 03:06:11PM +, Daniel T. Lee wrote: [ ... ] > static int run_bpf_prog(char *prog, int cg_id) > { > - int map_fd; > - int rc = 0; > + struct hbm_queue_stats qstats = {0}; > + char cg_dir[100], cg_pin_path[100]; > + struct bpf_link *link = NULL; >

[PATCH bpf-next v2 1/7] samples: bpf: refactor hbm program with libbpf

2020-11-19 Thread Daniel T. Lee
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