[PATCH] samples: bpf: fix style in bpf_load

2019-05-21 Thread Daniel T. Lee
This commit fixes style problem in samples/bpf/bpf_load.c Styles that have been changed are: - Magic string use of 'DEBUGFS' - Useless zero initialization of a global variable - Minor style fix with whitespace Signed-off-by: Daniel T. Lee --- samples/bpf/bpf_load.c | 11 +++--

[PATCH v2] samples: bpf: fix style in bpf_load

2019-05-23 Thread Daniel T. Lee
This commit fixes style problem in samples/bpf/bpf_load.c Styles that have been changed are: - Magic string use of 'DEBUGFS' - Useless zero initialization of a global variable - Minor style fix with whitespace Signed-off-by: Daniel T. Lee --- Changes in v2: - Fix string concaten

[PATCH 0/2] tools: bpftool: add net (un)load command to load XDP

2019-07-30 Thread Daniel T. Lee
rt for XDP, through `net (un)load`, bpftool can further support other prog attach types. XDP (un)load tested on Netronome Agilio. Daniel T. Lee (2): tools: bpftool: add net load command to load XDP on interface tools: bpftool: add net unload command to unload XDP on interface tools/bpf/bpftool/

[PATCH 1/2] tools: bpftool: add net load command to load XDP on interface

2019-07-30 Thread Daniel T. Lee
k_xdp_fd'. Signed-off-by: Daniel T. Lee --- tools/bpf/bpftool/net.c | 107 +++- 1 file changed, 106 insertions(+), 1 deletion(-) diff --git a/tools/bpf/bpftool/net.c b/tools/bpf/bpftool/net.c index 67e99c56bc88..d3a4f18b5b95 100644 --- a/tools/bpf/bpftool/net.c

[PATCH 2/2] tools: bpftool: add net unload command to unload XDP on interface

2019-07-30 Thread Daniel T. Lee
By this commit, using `bpftool net unload`, the loaded XDP prog can be unloaded. Unloading the BPF prog will be done through libbpf 'bpf_set_link_xdp_fd' with the progfd set to -1. Signed-off-by: Daniel T. Lee --- tools/bpf/bpftool/net.c | 55 +++

Re: [PATCH 1/2] tools: bpftool: add net load command to load XDP on interface

2019-07-31 Thread Daniel T. Lee
On Wed, Jul 31, 2019 at 7:08 PM Jesper Dangaard Brouer wrote: > > On Wed, 31 Jul 2019 03:48:20 +0900 > "Daniel T. Lee" wrote: > > > By this commit, using `bpftool net load`, user can load XDP prog on > > interface. New type of enum 'net_load_type'

[v2,0/2] tools: bpftool: add net attach/detach command to attach XDP prog

2019-08-01 Thread Daniel T. Lee
this patch only contains support for XDP, through `net attach/detach`, bpftool can further support other prog attach types. XDP attach/detach tested on Mellanox ConnectX-4 and Netronome Agilio. --- Changes in v2: - command 'load/unload' changed to 'attach/detach' for the consis

[v2,1/2] tools: bpftool: add net attach command to attach XDP on interface

2019-08-01 Thread Daniel T. Lee
set_link_xdp_fd'. Signed-off-by: Daniel T. Lee --- Changes in v2: - command 'load' changed to 'attach' for the consistency - 'NET_ATTACH_TYPE_XDP_DRIVE' changed to 'NET_ATTACH_TYPE_XDP_DRIVER' tools/bpf/bpftool/net.c | 107 ++

[v2,2/2] tools: bpftool: add net detach command to detach XDP on interface

2019-08-01 Thread Daniel T. Lee
By this commit, using `bpftool net detach`, the attached XDP prog can be detached. Detaching the BPF prog will be done through libbpf 'bpf_set_link_xdp_fd' with the progfd set to -1. Signed-off-by: Daniel T. Lee --- Changes in v2: - command 'unload' changed to 'de

Re: [v2,1/2] tools: bpftool: add net attach command to attach XDP on interface

2019-08-01 Thread Daniel T. Lee
On Fri, Aug 2, 2019 at 8:36 AM Jakub Kicinski wrote: > > On Thu, 1 Aug 2019 17:11:32 +0900, Daniel T. Lee wrote: > > By this commit, using `bpftool net attach`, user can attach XDP prog on > > interface. New type of enum 'net_attach_type' has been made, as stated at &

Re: [v2,0/2] tools: bpftool: add net attach/detach command to attach XDP prog

2019-08-01 Thread Daniel T. Lee
Thank you for letting me know. I will add to next version of patch. And, thank you for the detailed review. :) On Fri, Aug 2, 2019 at 8:21 AM Jakub Kicinski wrote: > > On Thu, 1 Aug 2019 17:11:31 +0900, Daniel T. Lee wrote: > > Currently, bpftool net only supports dumping progs att

Re: [v2,2/2] tools: bpftool: add net detach command to detach XDP on interface

2019-08-02 Thread Daniel T. Lee
On Fri, Aug 2, 2019 at 3:26 PM Y Song wrote: > > On Thu, Aug 1, 2019 at 2:04 AM Daniel T. Lee wrote: > > > > By this commit, using `bpftool net detach`, the attached XDP prog can > > be detached. Detaching the BPF prog will be done through libbpf > > 'bpf_set_

Re: [v2,1/2] tools: bpftool: add net attach command to attach XDP on interface

2019-08-02 Thread Daniel T. Lee
On Fri, Aug 2, 2019 at 3:23 PM Y Song wrote: > > On Thu, Aug 1, 2019 at 2:04 AM Daniel T. Lee wrote: > > > > By this commit, using `bpftool net attach`, user can attach XDP prog on > > interface. New type of enum 'net_attach_type' has been made, as stated a

Re: [v2,1/2] tools: bpftool: add net attach command to attach XDP on interface

2019-08-03 Thread Daniel T. Lee
On Sat, Aug 3, 2019 at 3:39 AM Jakub Kicinski wrote: > > On Fri, 2 Aug 2019 14:02:29 +0900, Daniel T. Lee wrote: > > On Fri, Aug 2, 2019 at 8:36 AM Jakub Kicinski wrote: > > > On Thu, 1 Aug 2019 17:11:32 +0900, Daniel T. Lee wrote: > > > > By this commit, usi

[v3,3/4] tools: bpftool: add bash-completion for net attach/detach

2019-08-06 Thread Daniel T. Lee
This commit adds bash-completion for new "net attach/detach" subcommand for attaching XDP program on interface. Signed-off-by: Daniel T. Lee --- tools/bpf/bpftool/bash-completion/bpftool | 64 +++ 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a

[v3,2/4] tools: bpftool: add net detach command to detach XDP on interface

2019-08-06 Thread Daniel T. Lee
By this commit, using `bpftool net detach`, the attached XDP prog can be detached. Detaching the BPF prog will be done through libbpf 'bpf_set_link_xdp_fd' with the progfd set to -1. Signed-off-by: Daniel T. Lee --- tools/bpf/bpftool/net.c | 42 +++

[v3,1/4] tools: bpftool: add net attach command to attach XDP on interface

2019-08-06 Thread Daniel T. Lee
attached XDP program could be replaced. Added new helper 'net_parse_dev' to parse the network device at argument. BPF prog will be attached through libbpf 'bpf_set_link_xdp_fd'. Signed-off-by: Daniel T. Lee --- tools/bpf/bpftool/net.c | 141 ---

[v3,0/4] tools: bpftool: add net attach/detach command to attach XDP prog

2019-08-06 Thread Daniel T. Lee
PE' comes first) - add 'dev' keyword in front of - added bash-completion and documentation Changes in v2: - command 'load/unload' changed to 'attach/detach' for the consistency Daniel T. Lee (4): tools: bpftool: add net attach command to attach XDP on int

[v3,4/4] tools: bpftool: add documentation for net attach/detach

2019-08-06 Thread Daniel T. Lee
Since, new sub-command 'net attach/detach' has been added for attaching XDP program on interface, this commit documents usage and sample output of `net attach/detach`. Signed-off-by: Daniel T. Lee --- .../bpf/bpftool/Documentation/bpftool-net.rst | 51 +-- 1 file c

Re: [v3,1/4] tools: bpftool: add net attach command to attach XDP on interface

2019-08-08 Thread Daniel T. Lee
On Thu, Aug 8, 2019 at 5:42 AM Jakub Kicinski wrote: > > On Wed, 7 Aug 2019 11:25:06 +0900, Daniel T. Lee wrote: > > By this commit, using `bpftool net attach`, user can attach XDP prog on > > interface. New type of enum 'net_attach_type' has been made, as stated at &

Re: [v3,1/4] tools: bpftool: add net attach command to attach XDP on interface

2019-08-08 Thread Daniel T. Lee
On Fri, Aug 9, 2019 at 2:50 AM Jakub Kicinski wrote: > > On Thu, 8 Aug 2019 07:15:22 +0900, Daniel T. Lee wrote: > > > > + return -EINVAL; > > > > + } > > > > + > > > > + NEXT_ARG(); > > > > > > nit: the n

Re: [v3,3/4] tools: bpftool: add bash-completion for net attach/detach

2019-08-08 Thread Daniel T. Lee
On Fri, Aug 9, 2019 at 1:48 AM Quentin Monnet wrote: > > 2019-08-07 11:25 UTC+0900 ~ Daniel T. Lee > > This commit adds bash-completion for new "net attach/detach" > > subcommand for attaching XDP program on interface. > > > > Signed-off-by: Daniel T.

Re: [v3,4/4] tools: bpftool: add documentation for net attach/detach

2019-08-08 Thread Daniel T. Lee
On Fri, Aug 9, 2019 at 1:48 AM Quentin Monnet wrote: > > 2019-08-07 11:25 UTC+0900 ~ Daniel T. Lee > > Since, new sub-command 'net attach/detach' has been added for > > attaching XDP program on interface, > > this commit documents usage and sample output of `

[v4,1/4] tools: bpftool: add net attach command to attach XDP on interface

2019-08-09 Thread Daniel T. Lee
attached XDP program could be replaced. Added new helper 'net_parse_dev' to parse the network device at argument. BPF prog will be attached through libbpf 'bpf_set_link_xdp_fd'. Signed-off-by: Daniel T. Lee --- tools/bpf/bpftool/net.c | 136 +-

[v4,0/4] tools: bpftool: add net attach/detach command to attach XDP prog

2019-08-09 Thread Daniel T. Lee
#x27; changed to 'attach/detach' for the consistency Daniel T. Lee (4): tools: bpftool: add net attach command to attach XDP on interface tools: bpftool: add net detach command to detach XDP on interface tools: bpftool: add bash-completion for net attach/detach tools: bpftool: add doc

[v4,3/4] tools: bpftool: add bash-completion for net attach/detach

2019-08-09 Thread Daniel T. Lee
This commit adds bash-completion for new "net attach/detach" subcommand for attaching XDP program on interface. Signed-off-by: Daniel T. Lee --- tools/bpf/bpftool/bash-completion/bpftool | 65 +++ 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a

[v4,4/4] tools: bpftool: add documentation for net attach/detach

2019-08-09 Thread Daniel T. Lee
Since, new sub-command 'net attach/detach' has been added for attaching XDP program on interface, this commit documents usage and sample output of `net attach/detach`. Signed-off-by: Daniel T. Lee --- .../bpf/bpftool/Documentation/bpftool-net.rst | 57 ++- 1 file c

[v4,2/4] tools: bpftool: add net detach command to detach XDP on interface

2019-08-09 Thread Daniel T. Lee
By this commit, using `bpftool net detach`, the attached XDP prog can be detached. Detaching the BPF prog will be done through libbpf 'bpf_set_link_xdp_fd' with the progfd set to -1. Signed-off-by: Daniel T. Lee --- tools/bpf/bpftool/net.c | 42 +++

Re: [v4,1/4] tools: bpftool: add net attach command to attach XDP on interface

2019-08-12 Thread Daniel T. Lee
On Mon, Aug 12, 2019 at 9:27 AM Y Song wrote: > > On Fri, Aug 9, 2019 at 6:35 AM Daniel T. Lee wrote: > > > > By this commit, using `bpftool net attach`, user can attach XDP prog on > > interface. New type of enum 'net_attach_type' has been made, as stated a

[v5,2/4] tools: bpftool: add net detach command to detach XDP on interface

2019-08-12 Thread Daniel T. Lee
By this commit, using `bpftool net detach`, the attached XDP prog can be detached. Detaching the BPF prog will be done through libbpf 'bpf_set_link_xdp_fd' with the progfd set to -1. Acked-by: Yonghong Song Signed-off-by: Daniel T. Lee --- tools/bpf/bpftool/

[v5,0/4] tools: bpftool: add net attach/detach command to attach XDP prog

2019-08-12 Thread Daniel T. Lee
h-completion and documentation Changes in v2: - command 'load/unload' changed to 'attach/detach' for the consistency Daniel T. Lee (4): tools: bpftool: add net attach command to attach XDP on interface tools: bpftool: add net detach command to detach XDP on interface

[v5,3/4] tools: bpftool: add bash-completion for net attach/detach

2019-08-12 Thread Daniel T. Lee
This commit adds bash-completion for new "net attach/detach" subcommand for attaching XDP program on interface. Signed-off-by: Daniel T. Lee --- tools/bpf/bpftool/bash-completion/bpftool | 65 +++ 1 file changed, 55 insertions(+), 10 deletions(-) diff --git a

[v5,4/4] tools: bpftool: add documentation for net attach/detach

2019-08-12 Thread Daniel T. Lee
Since, new sub-command 'net attach/detach' has been added for attaching XDP program on interface, this commit documents usage and sample output of `net attach/detach`. Signed-off-by: Daniel T. Lee --- .../bpf/bpftool/Documentation/bpftool-net.rst | 57 ++- 1 file c

[v5,1/4] tools: bpftool: add net attach command to attach XDP on interface

2019-08-12 Thread Daniel T. Lee
attached XDP program could be replaced. Added new helper 'net_parse_dev' to parse the network device at argument. BPF prog will be attached through libbpf 'bpf_set_link_xdp_fd'. Acked-by: Yonghong Song Signed-off-by: Daniel T. Lee --- tools/bpf/bpftool/net.c | 136 +++

Re: [PATCH bpf-next 3/9] samples: bpf: refactor test_cgrp2_sock2 program with libbpf

2020-11-18 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 2:58 PM Martin KaFai Lau wrote: > > On Tue, Nov 17, 2020 at 02:56:38PM +, Daniel T. Lee wrote: > [ ... ] > > > + err = bpf_link__pin(link, link_pin_path); > > + if (err < 0) { > > + printf("err : %d\n&

Re: [PATCH bpf-next 2/9] samples: bpf: refactor hbm program with libbpf

2020-11-18 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 11:10 AM Martin KaFai Lau wrote: > > On Tue, Nov 17, 2020 at 02:56:37PM +, Daniel T. Lee wrote: > [ ... ] > > > + > > +cleanup: > > + if (rc != 0) > so this test can be avoided. > Thanks for pointing

[PATCH bpf-next v2 0/7] bpf: remove bpf_load loader completely

2020-11-19 Thread Daniel T. Lee
d variable - change to destroy link even after link__pin() - fix return error code on exit - merge commit with changing Makefile Daniel T. Lee (7): samples: bpf: refactor hbm program with libbpf samples: bpf: refactor test_cgrp2_sock2 program with libbpf samples: bpf: refactor task_fd_query pr

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

2020-11-19 Thread Daniel T. Lee
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: 36b5d471135c ("selftests/bpf: samples/bpf: Split off legacy stuff from bpf_helpers.h") Signed-off-by: Daniel T. L

[PATCH bpf-next v2 2/7] samples: bpf: refactor test_cgrp2_sock2 program with libbpf

2020-11-19 Thread Daniel T. Lee
oblem that shell script cannot find the binary object from the current path, relative path './' has been added in front of binary. Fixes: 554ae6e792ef3 ("samples/bpf: add userspace example for prohibiting sockets") Signed-off-by: Daniel T. Lee --- Changes in v2: - cha

[PATCH bpf-next v2 3/7] samples: bpf: refactor task_fd_query program with libbpf

2020-11-19 Thread Daniel T. Lee
probe events, O_TRUNC flag has been used to clear 'uprobe_events' interface. Signed-off-by: Daniel T. Lee --- Changes in v2: - add static at global variable and drop {} - fix return error code on exit - restore DEBUGFS macro to absolute string path samples/bpf/Makefile |

[PATCH bpf-next v2 4/7] samples: bpf: refactor ibumad program with libbpf

2020-11-19 Thread Daniel T. Lee
not used on this program. Signed-off-by: Daniel T. Lee --- Changes in v2: - add static at global variable and drop {} - fix return error code on exit samples/bpf/Makefile | 2 +- samples/bpf/ibumad_kern.c | 26 +++--- samples/bpf/ibumad_user.c | 71

[PATCH bpf-next v2 6/7] samples: bpf: fix lwt_len_hist reusing previous BPF map

2020-11-19 Thread Daniel T. Lee
his commit add the executable permission to shell script files. Fixes: f74599f7c5309 ("bpf: Add tests and samples for LWT-BPF") Signed-off-by: Daniel T. Lee --- samples/bpf/lwt_len_hist.sh | 2 ++ samples/bpf/test_lwt_bpf.sh | 0 2 files changed, 2 insertions(+) mode change 100644 =

[PATCH bpf-next v2 7/7] samples: bpf: remove bpf_load loader completely

2020-11-19 Thread Daniel T. Lee
with the latest kernel BPF and causes confusion. Also, this commit removes the unused trace_helper and bpf_load from samples/bpf target objects from Makefile. Signed-off-by: Daniel T. Lee Acked-by: Jesper Dangaard Brouer Acked-by: Andrii Nakryiko --- Changes in v2: - merge commit with changing

[PATCH bpf-next v2 5/7] samples: bpf: refactor test_overhead program with libbpf

2020-11-19 Thread Daniel T. Lee
code, this commit uses the number of available cpus with _SC_NPROCESSORS_ONLN. Signed-off-by: Daniel T. Lee Acked-by: Andrii Nakryiko --- Changes in v2: - add static at global variable and drop {} samples/bpf/Makefile | 2 +- samples/bpf/test_overhead_user.c | 82

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 (!o

[PATCH bpf-next v3 0/7] bpf: remove bpf_load loader completely

2020-11-24 Thread Daniel T. Lee
d variable - change to destroy link even after link__pin() - fix return error code on exit - merge commit with changing Makefile Changes in v3: - cleanup bpf_link, bpf_object and cgroup fd both on success and error Daniel T. Lee (7): samples: bpf: refactor hbm program with libbpf samples: bpf

[PATCH bpf-next v3 2/7] samples: bpf: refactor test_cgrp2_sock2 program with libbpf

2020-11-24 Thread Daniel T. Lee
oblem that shell script cannot find the binary object from the current path, relative path './' has been added in front of binary. Fixes: 554ae6e792ef3 ("samples/bpf: add userspace example for prohibiting sockets") Signed-off-by: Daniel T. Lee --- Changes in v2: - cha

[PATCH bpf-next v3 5/7] samples: bpf: refactor test_overhead program with libbpf

2020-11-24 Thread Daniel T. Lee
code, this commit uses the number of available cpus with _SC_NPROCESSORS_ONLN. Signed-off-by: Daniel T. Lee Acked-by: Andrii Nakryiko --- Changes in v2: - add static at global variable and drop {} samples/bpf/Makefile | 2 +- samples/bpf/test_overhead_user.c | 82

[PATCH bpf-next v3 4/7] samples: bpf: refactor ibumad program with libbpf

2020-11-24 Thread Daniel T. Lee
not used on this program. Signed-off-by: Daniel T. Lee --- Changes in v2: - add static at global variable and drop {} - fix return error code on exit samples/bpf/Makefile | 2 +- samples/bpf/ibumad_kern.c | 26 +++--- samples/bpf/ibumad_user.c | 71

[PATCH bpf-next v3 6/7] samples: bpf: fix lwt_len_hist reusing previous BPF map

2020-11-24 Thread Daniel T. Lee
his commit add the executable permission to shell script files. Fixes: f74599f7c5309 ("bpf: Add tests and samples for LWT-BPF") Signed-off-by: Daniel T. Lee --- samples/bpf/lwt_len_hist.sh | 2 ++ samples/bpf/test_lwt_bpf.sh | 0 2 files changed, 2 insertions(+) mode change 100644 =

[PATCH bpf-next v3 3/7] samples: bpf: refactor task_fd_query program with libbpf

2020-11-24 Thread Daniel T. Lee
probe events, O_TRUNC flag has been used to clear 'uprobe_events' interface. Signed-off-by: Daniel T. Lee --- Changes in v2: - add static at global variable and drop {} - fix return error code on exit - restore DEBUGFS macro to absolute string path samples/bpf/Makefile

[PATCH bpf-next v3 7/7] samples: bpf: remove bpf_load loader completely

2020-11-24 Thread Daniel T. Lee
with the latest kernel BPF and causes confusion. Also, this commit removes the unused trace_helper and bpf_load from samples/bpf target objects from Makefile. Signed-off-by: Daniel T. Lee Acked-by: Jesper Dangaard Brouer Acked-by: Andrii Nakryiko --- Changes in v2: - merge commit with changing

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

2020-11-24 Thread Daniel T. Lee
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: 36b5d471135c ("selftests/bpf: samples/bpf: Split off legacy stuff from bpf_helpers.h") Signed-off-by: Daniel T. L

[PATCH bpf-next 3/9] samples: bpf: refactor test_cgrp2_sock2 program with libbpf

2020-11-17 Thread Daniel T. Lee
oblem that shell script cannot find the binary object from the current path, relative path './' has been added in front of binary. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile| 2 +- samples/bpf/test_cgrp2_sock2.c | 63 - samples/

[PATCH bpf-next 8/9] samples: bpf: remove unused trace_helper and bpf_load from Makefile

2020-11-17 Thread Daniel T. Lee
This commit removes the unused trace_helper and bpf_load from samples/bpf target objects from Makefile. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index

[PATCH bpf-next 2/9] samples: bpf: refactor hbm program with libbpf

2020-11-17 Thread Daniel T. Lee
6b5d471135c ("selftests/bpf: samples/bpf: Split off legacy stuff from bpf_helpers.h") Signed-off-by: Daniel T. Lee --- samples/bpf/.gitignore | 3 ++ samples/bpf/Makefile | 2 +- samples/bpf/hbm.c | 96 +- samples/bpf/hbm_kern.h | 2 +

[PATCH bpf-next 5/9] samples: bpf: refactor ibumad program with libbpf

2020-11-17 Thread Daniel T. Lee
not used on this program. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 2 +- samples/bpf/ibumad_kern.c | 26 +++ samples/bpf/ibumad_user.c | 66 ++- 3 files changed, 65 insertions(+), 29 deletions(-) diff --git a/samples/bpf

[PATCH bpf-next 6/9] samples: bpf: refactor test_overhead program with libbpf

2020-11-17 Thread Daniel T. Lee
code, this commit uses the number of available cpus with _SC_NPROCESSORS_ONLN. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 2 +- samples/bpf/test_overhead_user.c | 82 +++- 2 files changed, 60 insertions(+), 24 deletions(-) diff --git a/samples

[PATCH bpf-next 9/9] samples: bpf: remove bpf_load loader completely

2020-11-17 Thread Daniel T. Lee
with the latest kernel BPF and causes confusion. Signed-off-by: Daniel T. Lee --- samples/bpf/bpf_load.c | 667 samples/bpf/bpf_load.h | 57 --- samples/bpf/xdp2skb_meta_kern.c | 2 +- 3 files changed, 1 insertion(+), 725 deletions(-) delete

[PATCH bpf-next 0/9] bpf: remove bpf_load loader completely

2020-11-17 Thread Daniel T. Lee
bpf_load, an outdated bpf loader that is difficult to keep up with the latest kernel BPF and causes confusion. Daniel T. Lee (9): selftests: bpf: move tracing helpers to trace_helper.h samples: bpf: refactor hbm program with libbpf samples: bpf: refactor test_cgrp2_sock2 program with libbpf

[PATCH bpf-next 4/9] samples: bpf: refactor task_fd_query program with libbpf

2020-11-17 Thread Daniel T. Lee
ed to control uprobe events. Furthermore, to prevent conflict of same named uprobe events, O_TRUNC flag has been used to clear 'uprobe_events' interface. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 2 +- samples/bpf/task_fd_query_user.c | 101 +++

[PATCH bpf-next 1/9] selftests: bpf: move tracing helpers to trace_helper

2020-11-17 Thread Daniel T. Lee
Under the samples/bpf directory, similar tracing helpers are fragmented around. To keep consistent of tracing programs, this commit moves the helper and define locations to increase the reuse of each helper function. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile

[PATCH bpf-next 7/9] samples: bpf: fix lwt_len_hist reusing previous BPF map

2020-11-17 Thread Daniel T. Lee
his commit add the executable permission to shell script files. Fixes: f74599f7c5309 ("bpf: Add tests and samples for LWT-BPF") Signed-off-by: Daniel T. Lee --- samples/bpf/lwt_len_hist.sh | 2 ++ samples/bpf/test_lwt_bpf.sh | 0 2 files changed, 2 insertions(+) mode change 100644 =

Re: [PATCH bpf-next 1/9] selftests: bpf: move tracing helpers to trace_helper

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 10:19 AM Martin KaFai Lau wrote: > > On Tue, Nov 17, 2020 at 02:56:36PM +, Daniel T. Lee wrote: > > Under the samples/bpf directory, similar tracing helpers are > > fragmented around. To keep consistent of tracing programs, this commit > > mov

Re: [PATCH bpf-next 1/9] selftests: bpf: move tracing helpers to trace_helper

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 10:58 AM Andrii Nakryiko wrote: > > On Tue, Nov 17, 2020 at 6:57 AM Daniel T. Lee wrote: > > > > Under the samples/bpf directory, similar tracing helpers are > > fragmented around. To keep consistent of tracing programs, this commit > &g

Re: [PATCH bpf-next 9/9] samples: bpf: remove bpf_load loader completely

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 11:49 AM Andrii Nakryiko wrote: > > On Tue, Nov 17, 2020 at 6:58 AM Daniel T. Lee wrote: > > > > Numerous refactoring that rewrites BPF programs written with bpf_load > > to use the libbpf loader was finally completed, resulting in BPF > >

Re: [PATCH bpf-next 5/9] samples: bpf: refactor ibumad program with libbpf

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 11:52 AM Andrii Nakryiko wrote: > > On Tue, Nov 17, 2020 at 6:57 AM Daniel T. Lee wrote: > > > > This commit refactors the existing ibumad program with libbpf bpf > > loader. Attach/detach of Tracepoint bpf programs has been mana

Re: [PATCH bpf-next 4/9] samples: bpf: refactor task_fd_query program with libbpf

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 11:58 AM Andrii Nakryiko wrote: > > On Tue, Nov 17, 2020 at 6:57 AM Daniel T. Lee wrote: > > > > This commit refactors the existing kprobe program with libbpf bpf > > loader. To attach bpf program, this uses generic bpf_program__attach() > &

Re: [PATCH bpf-next 3/9] samples: bpf: refactor test_cgrp2_sock2 program with libbpf

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 12:02 PM Andrii Nakryiko wrote: > > On Tue, Nov 17, 2020 at 6:57 AM Daniel T. Lee wrote: > > > > This commit refactors the existing cgroup program with libbpf bpf > > loader. The original test_cgrp2_sock2 has keeped the bpf program > > at

Re: [PATCH bpf-next 5/9] samples: bpf: refactor ibumad program with libbpf

2020-11-17 Thread Daniel T. Lee
On Wed, Nov 18, 2020 at 12:10 PM Andrii Nakryiko wrote: > > On Tue, Nov 17, 2020 at 7:05 PM Daniel T. Lee wrote: > > > > On Wed, Nov 18, 2020 at 11:52 AM Andrii Nakryiko > > wrote: > > > > > > On Tue, Nov 17, 2020 at 6:57 AM Daniel T. Lee > > &g

[PATCH bpf-next] samples: bpf: Fix broken bpf programs due to removed symbol

2020-08-17 Thread Daniel T. Lee
attach kprobe events to blk_account_io_done() to modify them to perform the same behavior as before. Signed-off-by: Daniel T. Lee --- samples/bpf/task_fd_query_kern.c | 2 +- samples/bpf/task_fd_query_user.c | 2 +- samples/bpf/tracex3_kern.c | 2 +- 3 files changed, 3 insertions(+), 3 delet

[PATCH bpf-next 3/3] samples: bpf: Refactor tracepoint tracing programs with libbpf

2020-08-23 Thread Daniel T. Lee
through bpf_program_attach(). - Instead of using the existing BPF MAP definition, MAP definition has been refactored with the new BTF-defined MAP format. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 6 ++-- samples/bpf/cpustat_kern.c | 36

[PATCH bpf-next 1/3] samples: bpf: cleanup bpf_load.o from Makefile

2020-08-23 Thread Daniel T. Lee
erformance test with libbpf") Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile index f87ee02073ba..0cac89230c6d 100644 --- a/samples/bpf/Makefile +++ b/samples/bpf/Mak

[PATCH bpf-next 0/3] samples: bpf: Refactor tracing programs with libbpf

2020-08-23 Thread Daniel T. Lee
() macro in trace_common.h was used. - Adding a kprobe/tracepoint event and attaching a bpf program to it was done through bpf_program_attach(). - Instead of using the existing BPF MAP definition, MAP definition has been refactored with the new BTF-defined MAP format. Daniel T. Lee (3

[PATCH bpf-next 2/3] samples: bpf: Refactor kprobe tracing programs with libbpf

2020-08-23 Thread Daniel T. Lee
trace_common.h was used. - Adding a kprobe event and attaching a bpf program to it was done through bpf_program_attach(). - Instead of using the existing BPF MAP definition, MAP definition has been refactored with the new BTF-defined MAP format. Signed-off-by: Daniel T. Lee

[PATCH 2/2] samples: bpf: refactor header include path

2019-06-15 Thread Daniel T. Lee
e)/tools/lib/bpf/ path had been included during build, path "bpf/" in header isn't necessary anymore. This commit removes path "bpf/" in header inclusion. Signed-off-by: Daniel T. Lee --- samples/bpf/fds_example.c | 2 +- samples/bpf/hbm.c

[PATCH 1/2] samples: bpf: remove unnecessary include options in Makefile

2019-06-15 Thread Daniel T. Lee
Due to recent change of include path at commit b552d33c80a9 ("samples/bpf: fix include path in Makefile"), some of the previous include options became unnecessary. This commit removes duplicated include options in Makefile. Signed-off-by: Daniel T. Lee --- samples/bpf/Makefile | 9 --

[PATCH] samples: bpf: make the use of xdp samples consistent

2019-06-24 Thread Daniel T. Lee
those two samples to fetch interface with it's name without changing the original index interface fetching. ( fetching in the same way as xdp_sample_pkts_user.c does.) Signed-off-by: Daniel T. Lee --- samples/bpf/xdp_adjust_tail_user.c | 12 ++-- samples/bpf/xdp_tx_iptunnel_u

Re: [PATCH] samples: bpf: make the use of xdp samples consistent

2019-06-24 Thread Daniel T. Lee
Will do right away! :) On Tue, Jun 25, 2019 at 3:24 AM Toke Høiland-Jørgensen wrote: > > "Daniel T. Lee" writes: > > > Currently, each xdp samples are inconsistent in the use. > > Most of the samples fetch the interface with it's name. > > (ex. xdp1, x

[PATCH v2] samples: bpf: make the use of xdp samples consistent

2019-06-24 Thread Daniel T. Lee
mples to fetch interface with it's name without changing the original index interface fetching. ( fetching in the same way as xdp_sample_pkts_user.c does.) Signed-off-by: Daniel T. Lee --- Changes in v2: - added xdp_redirect_user.c, xdp_redirect_map_user.c samples/bpf/xdp_adjust_tail_us

[PATCH v2] samples: bpf: make the use of xdp samples consistent

2019-06-24 Thread Daniel T. Lee
mples to fetch interface with it's name without changing the original index interface fetching. ( fetching in the same way as xdp_sample_pkts_user.c does.) Signed-off-by: Daniel T. Lee --- Changes in v2: - added xdp_redirect_user.c, xdp_redirect_map_user.c samples/bpf/xdp_adjust_tail_us

[PATCH 2/2] samples: pktgen: allow to specify destination port

2019-06-29 Thread Daniel T. Lee
script. -p : ($DST_PORT) destination PORT range (e.g. 433-444) is also allowed Signed-off-by: Daniel T. Lee --- samples/pktgen/README.rst| 1 + samples/pktgen/parameters.sh | 7 ++- .../pktgen/pktgen_bench_xmit_mode_netif_re

[PATCH 1/2] samples: pktgen: add some helper functions for port parsing

2019-06-29 Thread Daniel T. Lee
This commit adds port parsing and port validate helper function to parse single or range of port(s) from a given string. (e.g. 1234, 443-444) Helpers will be used in prior to set target port(s) in samples/pktgen. Signed-off-by: Daniel T. Lee --- samples/pktgen/functions.sh | 34

Re: [PATCH 2/2] samples: pktgen: allow to specify destination port

2019-07-01 Thread Daniel T. Lee
9 22:33:58 +0900 > "Daniel T. Lee" wrote: > > > Currently, kernel pktgen has the feature to specify udp destination port > > for sending packet. (e.g. pgset "udp_dst_min 9") > > > > But on samples, each of the scripts doesn't have any option to ac

[PATCH] tools: bpftool: add raw_tracepoint_writable prog type to header

2019-07-11 Thread Daniel T. Lee
ure'. This commit adds BPF_PROG_TYPE_RAW_TRACEPOINT_WRITABLE entry to prog_type_name enum, and will eventually fixes the segfault issue. Signed-off-by: Daniel T. Lee --- tools/bpf/bpftool/main.h | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpfto

Re: [v5,0/4] tools: bpftool: add net attach/detach command to attach XDP prog

2019-08-14 Thread Daniel T. Lee
On Wed, Aug 14, 2019 at 6:43 AM Jakub Kicinski wrote: > > On Tue, 13 Aug 2019 11:46:17 +0900, Daniel T. Lee wrote: > > Currently, bpftool net only supports dumping progs attached on the > > interface. To attach XDP prog on interface, user must use other tool > > (eg.

[PATCH] samples: bpf: add max_pckt_size option at xdp_adjust_tail

2019-08-26 Thread Daniel T. Lee
is used, the size of maximum packet will be 600 as a default. Signed-off-by: Daniel T. Lee --- samples/bpf/xdp_adjust_tail_kern.c | 23 +++ samples/bpf/xdp_adjust_tail_user.c | 21 +++-- 2 files changed, 38 insertions(+), 6 deletions(-) diff

[bpf-next, v2] samples: bpf: add max_pckt_size option at xdp_adjust_tail

2019-08-26 Thread Daniel T. Lee
is used, the size of maximum packet will be 600 as a default. Signed-off-by: Daniel T. Lee --- Changes in v2: - Change the helper to fetch map from 'bpf_map__next' to 'bpf_object__find_map_fd_by_name'. samples/bpf/xdp_adjust_tail_kern.c | 23 +++

Re: [PATCH] samples: bpf: add max_pckt_size option at xdp_adjust_tail

2019-08-26 Thread Daniel T. Lee
On Tue, Aug 27, 2019 at 12:54 AM Maciej Fijalkowski wrote: > > On Mon, 26 Aug 2019 18:57:22 +0900 > "Daniel T. Lee" wrote: > > > Currently, at xdp_adjust_tail_kern.c, MAX_PCKT_SIZE is limited > > to 600. To make this size flexible, a new map 'pcktsz' i

[PATCH 3/3] samples: pktgen: allow to specify destination IP range (CIDR)

2019-08-28 Thread Daniel T. Lee
, length 16 05:14:18.083366 IP6 fe80::99.107 > fe80::22.3000: UDP, length 16 05:14:18.083585 IP6 fe80::99.97 > fe80::21.3000: UDP, length 16 Signed-off-by: Daniel T. Lee --- samples/pktgen/README.rst | 2 +- samples/pktgen/parameters.sh

[PATCH 1/3] samples: pktgen: make variable consistent with option

2019-08-28 Thread Daniel T. Lee
existing variable name DST_MIN should be changed. Variable names are matched to the exact keyword used with pg_ctrl. Signed-off-by: Daniel T. Lee --- .../pktgen_bench_xmit_mode_netif_receive.sh | 8 .../pktgen/pktgen_bench_xmit_mode_queue_xmit.sh | 8 samples/pk

[PATCH 2/3] samples: pktgen: add helper functions for IP(v4/v6) CIDR parsing

2019-08-28 Thread Daniel T. Lee
This commit adds CIDR parsing and IP validate helper function to parse single IP or range of IP with CIDR. (e.g. 198.18.0.0/15) Helpers will be used in prior to set target address in samples/pktgen. Signed-off-by: Daniel T. Lee --- samples/pktgen/functions.sh | 134

Re: [bpf-next, v2] samples: bpf: add max_pckt_size option at xdp_adjust_tail

2019-08-29 Thread Daniel T. Lee
On Fri, Aug 30, 2019 at 5:42 AM Song Liu wrote: > > On Mon, Aug 26, 2019 at 9:52 AM Daniel T. Lee wrote: > > > > Currently, at xdp_adjust_tail_kern.c, MAX_PCKT_SIZE is limited > > to 600. To make this size flexible, a new map 'pcktsz' is added. > > >

Re: [PATCH 2/3] samples: pktgen: add helper functions for IP(v4/v6) CIDR parsing

2019-08-30 Thread Daniel T. Lee
On Fri, Aug 30, 2019 at 10:28 PM Jesper Dangaard Brouer wrote: > > On Thu, 29 Aug 2019 05:42:42 +0900 > "Daniel T. Lee" wrote: > > > This commit adds CIDR parsing and IP validate helper function to parse > > single IP or range of IP with CIDR. (e.g. 198.18.0.0/1

Re: [bpf-next, v2] samples: bpf: add max_pckt_size option at xdp_adjust_tail

2019-09-01 Thread Daniel T. Lee
On Fri, Aug 30, 2019 at 3:23 AM Daniel T. Lee wrote: > > On Fri, Aug 30, 2019 at 5:42 AM Song Liu wrote: > > > > On Mon, Aug 26, 2019 at 9:52 AM Daniel T. Lee > > wrote: > > > > > > Currently, at xdp_adjust_tail_kern.c, MAX_PCKT_SIZE is limited >

[PATCH] samples: bpf: fix: broken sample regarding removed function

2019-02-26 Thread Daniel T. Lee
er" no longer exists) $ sudo ./task_fd_query failed to create kprobe 'blk_start_request' error 'No such file or directory' This commit will change the function 'blk_start_request' to 'blk_mq_start_request' to fix the broken sample. Signed-off-by: Dan

[PATCH V2] samples: bpf: fix: broken sample regarding removed function

2019-02-26 Thread Daniel T. Lee
er" no longer exists) $ sudo ./task_fd_query failed to create kprobe 'blk_start_request' error 'No such file or directory' This commit will change the function 'blk_start_request' to 'blk_mq_start_request' to fix the broken sample. Signed-off-by: Dani

[PATCH] samples: bpf: add xdp_sample_pkts to .gitignore

2019-03-04 Thread Daniel T. Lee
This commit adds xdp_sample_pkts to .gitignore which is currently ommited from the ignore file. Signed-off-by: Daniel T. Lee --- samples/bpf/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/samples/bpf/.gitignore b/samples/bpf/.gitignore index 8ae4940025f8..5a1d084be806 100644

[PATCH 1/2] selftests/bpf: ksym_search won't check symbols exists

2019-03-14 Thread Daniel T. Lee
ification logic whether symbols are loaded prior to the symbol search. Signed-off-by: Daniel T. Lee --- tools/testing/selftests/bpf/trace_helpers.c | 4 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/bpf/trace_helpers.c b/tools/testing/selftests/bpf/trace_helper

[PATCH 2/2] samples/bpf: add NULL check for ksym_search

2019-03-14 Thread Daniel T. Lee
Since, ksym_search added with verification logic for symbols existence, it could return NULL when the kernel symbols are not loaded. This commit will add NULL check logic after ksym_search. Signed-off-by: Daniel T. Lee --- samples/bpf/offwaketime_user.c | 5 + samples/bpf/sampleip_user.c

  1   2   3   >