[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZP-2U25dOQvPbMtF7A1KXw5DEs9FjmCyW8BCJAcCF46Q@mail.gmail.com>
Date: Wed, 2 Jun 2021 14:03:19 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Kumar Kartikeya Dwivedi <memxor@...il.com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
Jamal Hadi Salim <jhs@...atatu.com>,
Vlad Buslov <vladbu@...dia.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jiri Pirko <jiri@...nulli.us>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>, Joe Stringer <joe@...ium.io>,
Quentin Monnet <quentin@...valent.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH RFC bpf-next 6/7] libbpf: add bpf_link based TC-BPF
management API
On Fri, May 28, 2021 at 1:01 PM Kumar Kartikeya Dwivedi
<memxor@...il.com> wrote:
>
> This adds userspace TC-BPF management API based on bpf_link.
>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@...il.com>
> ---
> tools/lib/bpf/bpf.c | 5 ++++
> tools/lib/bpf/bpf.h | 8 +++++-
> tools/lib/bpf/libbpf.c | 59 ++++++++++++++++++++++++++++++++++++++--
> tools/lib/bpf/libbpf.h | 17 ++++++++++++
> tools/lib/bpf/libbpf.map | 1 +
> tools/lib/bpf/netlink.c | 5 ++--
> tools/lib/bpf/netlink.h | 8 ++++++
> 7 files changed, 98 insertions(+), 5 deletions(-)
> create mode 100644 tools/lib/bpf/netlink.h
>
> diff --git a/tools/lib/bpf/bpf.c b/tools/lib/bpf/bpf.c
> index 86dcac44f32f..ab2e2e9ccc5e 100644
> --- a/tools/lib/bpf/bpf.c
> +++ b/tools/lib/bpf/bpf.c
> @@ -28,6 +28,7 @@
> #include <asm/unistd.h>
> #include <errno.h>
> #include <linux/bpf.h>
> +#include <arpa/inet.h>
> #include "bpf.h"
> #include "libbpf.h"
> #include "libbpf_internal.h"
> @@ -692,6 +693,10 @@ int bpf_link_create(int prog_fd, int target_fd,
> attr.link_create.target_fd = target_fd;
> attr.link_create.attach_type = attach_type;
> attr.link_create.flags = OPTS_GET(opts, flags, 0);
> + attr.link_create.tc.parent = OPTS_GET(opts, tc.parent, 0);
> + attr.link_create.tc.handle = OPTS_GET(opts, tc.handle, 0);
> + attr.link_create.tc.priority = OPTS_GET(opts, tc.priority, 0);
> + attr.link_create.tc.gen_flags = OPTS_GET(opts, tc.gen_flags, 0);
you can't do filling out link_create.tc unless you know it's TC
bpf_link that is being created, right? link_create.tc is part of a
union, so you might be overwriting bpf_iter link data, for instance.
>
> if (iter_info_len) {
> attr.link_create.iter_info =
[...]
Powered by blists - more mailing lists