[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZ3Kt0iw1mOjuLL2m0gnrrj0u7znSuacJm3rjv=zZ27eQ@mail.gmail.com>
Date: Mon, 7 Jun 2021 16:37:04 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Kumar Kartikeya Dwivedi <memxor@...il.com>
Cc: Alexei Starovoitov <alexei.starovoitov@...il.com>,
bpf <bpf@...r.kernel.org>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Jamal Hadi Salim <jhs@...atatu.com>,
Vlad Buslov <vladbu@...dia.com>,
Cong Wang <xiyou.wangcong@...il.com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next v2 6/7] libbpf: add bpf_link based TC-BPF
management API
On Fri, Jun 4, 2021 at 9:52 PM Kumar Kartikeya Dwivedi <memxor@...il.com> wrote:
>
> On Fri, Jun 04, 2021 at 11:31:57PM IST, Alexei Starovoitov wrote:
> > On Fri, Jun 04, 2021 at 12:01:15PM +0530, Kumar Kartikeya Dwivedi wrote:
> > > +/* TC bpf_link related API */
> > > +struct bpf_tc_hook;
> > > +
> > > +struct bpf_tc_link_opts {
> > > + size_t sz;
> > > + __u32 handle;
> > > + __u32 priority;
> > > + __u32 gen_flags;
> > > + size_t :0;
> > > +};
> >
> > Did you think of a way to share struct bpf_tc_opts with above?
> > Or use bpf_tc_link_opts inside bpf_tc_opts?
>
> A couple of fields in bpf_tc_opts aren't really relevant here (prog_fd, prog_id)
> and will always be unused, so I thought it would be cleaner to give this its own
> opts struct. It still reuses the hook abstraction that was added, though.
Overall probably it will be less confusing to have one _opts struct
across both APIs, even if some of the fields are not used. Just
enforce that they are always NULL (and document in a comment that for
bpf_link-based API it's not expected).
>
> > Some other way?
> > gen_flags here and flags there are the same?
>
> No, it was an oversight that I missed adding gen_flags there, I'll send a patch
> separately with some other assorted things. It's used when offloading to HW.
>
> We don't really support any other flags (e.g. BPF_TC_F_REPLACE) for this.
>
> --
> Kartikeya
Powered by blists - more mailing lists