Message ID | 20200528001423.58575-5-dsahern@kernel.org |
---|---|
State | Changes Requested |
Delegated to: | BPF Maintainers |
Headers | show |
Series | bpf: Add support for XDP programs in DEVMAP entries | expand |
On Wed, May 27, 2020 at 5:17 PM David Ahern <dsahern@kernel.org> wrote: > > Support SEC("xdp_dm*") as a short cut for loading the program with > type BPF_PROG_TYPE_XDP and expected attach type BPF_XDP_DEVMAP. > > Signed-off-by: David Ahern <dsahern@kernel.org> > --- > tools/lib/bpf/libbpf.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index 5d60de6fd818..493909d5d3d3 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -6657,6 +6657,8 @@ static const struct bpf_sec_def section_defs[] = { > .expected_attach_type = BPF_TRACE_ITER, > .is_attach_btf = true, > .attach_fn = attach_iter), > + BPF_EAPROG_SEC("xdp_dm", BPF_PROG_TYPE_XDP, > + BPF_XDP_DEVMAP), naming is hard and subjective, but does "dm" really associate with DEVMAP to you, rather than "direct message" or "direct memory" or something along those line? Is there any harm to call this "xdp_devmap"? It's still short enough, IMO. > BPF_PROG_SEC("xdp", BPF_PROG_TYPE_XDP), > BPF_PROG_SEC("perf_event", BPF_PROG_TYPE_PERF_EVENT), > BPF_PROG_SEC("lwt_in", BPF_PROG_TYPE_LWT_IN), > -- > 2.21.1 (Apple Git-122.3) >
On 5/28/20 1:04 AM, Andrii Nakryiko wrote: >> diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c >> index 5d60de6fd818..493909d5d3d3 100644 >> --- a/tools/lib/bpf/libbpf.c >> +++ b/tools/lib/bpf/libbpf.c >> @@ -6657,6 +6657,8 @@ static const struct bpf_sec_def section_defs[] = { >> .expected_attach_type = BPF_TRACE_ITER, >> .is_attach_btf = true, >> .attach_fn = attach_iter), >> + BPF_EAPROG_SEC("xdp_dm", BPF_PROG_TYPE_XDP, >> + BPF_XDP_DEVMAP), > > naming is hard and subjective, but does "dm" really associate with > DEVMAP to you, rather than "direct message" or "direct memory" or Yes it does b/c of the XDP context. Program name lengths being limited to 15 characters makes me shorten all prefixes to leave some usable characters for id'ing the program. > something along those line? Is there any harm to call this > "xdp_devmap"? It's still short enough, IMO. > but for the SEC name, I switched it to xdp_devmap.
diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 5d60de6fd818..493909d5d3d3 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -6657,6 +6657,8 @@ static const struct bpf_sec_def section_defs[] = { .expected_attach_type = BPF_TRACE_ITER, .is_attach_btf = true, .attach_fn = attach_iter), + BPF_EAPROG_SEC("xdp_dm", BPF_PROG_TYPE_XDP, + BPF_XDP_DEVMAP), BPF_PROG_SEC("xdp", BPF_PROG_TYPE_XDP), BPF_PROG_SEC("perf_event", BPF_PROG_TYPE_PERF_EVENT), BPF_PROG_SEC("lwt_in", BPF_PROG_TYPE_LWT_IN),
Support SEC("xdp_dm*") as a short cut for loading the program with type BPF_PROG_TYPE_XDP and expected attach type BPF_XDP_DEVMAP. Signed-off-by: David Ahern <dsahern@kernel.org> --- tools/lib/bpf/libbpf.c | 2 ++ 1 file changed, 2 insertions(+)