On Thu, Mar 10, 2022 at 8:58 PM Menglong Dong <menglong8.dong@xxxxxxxxx> wrote: > > On Fri, Mar 11, 2022 at 11:54 AM Jakub Kicinski <kuba@xxxxxxxxxx> wrote: > > > > On Fri, 11 Mar 2022 11:28:28 +0800 menglong8.dong@xxxxxxxxx wrote: > > > From: Menglong Dong <imagedong@xxxxxxxxxxx> > > > > > > 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. As Jakub said there is no reason to expose this in uapi. > 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. No. Please use CO-RE and vmlinux.h instead.