[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADxym3YybdOPMwHr3TOf0vxAN5W8mMdeQmQiQq_nr-1SSF5jMA@mail.gmail.com>
Date: Fri, 11 Mar 2022 12:58:13 +0800
From: Menglong Dong <menglong8.dong@...il.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: David Ahern <dsahern@...nel.org>,
Neil Horman <nhorman@...driver.com>,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>, Martin Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
KP Singh <kpsingh@...nel.org>,
David Miller <davem@...emloft.net>,
Menglong Dong <imagedong@...cent.com>,
Eric Dumazet <edumazet@...gle.com>,
Talal Ahmad <talalahmad@...gle.com>,
Kees Cook <keescook@...omium.org>,
Alexander Lobakin <alobakin@...me>,
LKML <linux-kernel@...r.kernel.org>,
netdev <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
Mengen Sun <mengensun@...cent.com>,
Hao Peng <flyingpeng@...cent.com>
Subject: Re: [PATCH] net: skb: move enum skb_drop_reason to uapi
On Fri, Mar 11, 2022 at 11:54 AM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Fri, 11 Mar 2022 11:28:28 +0800 menglong8.dong@...il.com wrote:
> > From: Menglong Dong <imagedong@...cent.com>
> >
> > Move the definition of 'enum skb_drop_reason' in 'skbuff.h' to the uapi
> > header 'net_dropmon.h', therefore some users, such as eBPF program, can
> > make use of it.
>
> BPF does not need an enum definition to be part of the uAPI to make use
> of it. BTF should encode the values, and CO-RE can protect from them
> changing, AFAIU. I think we need a better example user / justification.
There is something wrong with my description, it's not the eBPF, but the user
program that loads eBPF.
In my case, I'll pass the packet info (protocol, ip, port, etc) and drop reason
to user space by eBPF that is attached on the kfree_skb() tracepoint.
In the user space, I'll custom the description for drop reasons and convert them
from int to string. Therefore, I need to use 'enum skb_drop_reason' in my
user space code.
For now, I copied the definition of 'enum skb_drop_reason' to my code,
and I think it's better to make them uapi, considering someone else may
use it this way too.
Thanks
Menglong Dong
Powered by blists - more mailing lists