Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp893574pxp; Fri, 11 Mar 2022 18:17:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8aVdIJHNNcabKmGM3Bgf6QvuD23F7nclrWZKLputu5B9qeIpixkQ8TRz09myCFaMpWh61 X-Received: by 2002:a05:6402:1941:b0:413:2555:53e3 with SMTP id f1-20020a056402194100b00413255553e3mr11554759edz.164.1647051469938; Fri, 11 Mar 2022 18:17:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647051469; cv=none; d=google.com; s=arc-20160816; b=yE0vcKHEm60tpb6oxZaGgU1T2EOvMBAM6d6aCyh8K1mh3qPlnBr5Q6nmSKU9pOyjPi 8XZv8ODksSf/fwMKwV1CDlC1bT1oEq5CkhXYZzuIYlR3LU8BzLRP110fhi3ZuR3AAsqX coLavHnpoxb9dxqyHJ7UTH6p9v16XZqoCDZFwXobDOvq2nd8A3ZZ5LfluWmMnMhp25P/ kyodreX7QCtFmIQGfsmF0bQZqQjA4/2LcJ1oGFROIXGCc1pSESuIiEGUgio7Jst4+FMT /Aiqxm4IJ1n8hxSlIjvFnKdzy+QiP6D5zj7PT7vQ5SKZJ7ZwnosgooU3nrec7Udp2JGU LHcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=NRfHmLV6jC//S0JUnsW7EkyoAJl8Vb/or5+A/gBKAzM=; b=by3tpRQhRWb1g3Lf4121tjW0S8Qe22Zrljld3MkK451ibDSbF+jIQN3vawj3lbbmKA bCY3hljdvyI21B5bCg24U9DYFuUuY9LxhtHEyXeyyZHJm+NxJDAomzFH7je7nYEumLo+ dGxJEK0wZxBSaGUnNVqHJwjqnOOUsMyQp2w6x/tbb7vSqWCxlLvBX3BDs/bwvlOhhG5w FdmMQyJrPUt1Oid1NTPtOhcve7/wNlgN2NB9PVKrSUuEddIByyHnWHZTKzDA6CFvb8Hs gxEmGKWnYJvCOXV1L/mIjhEH9Xm0vZG6Q68VJJnkiTRyEtlwwkkAn2rdYGmtR83U4CZC DA5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KwPsT2Xs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a0564021e8b00b004168e0aa9f7si8217749edf.130.2022.03.11.18.17.25; Fri, 11 Mar 2022 18:17:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KwPsT2Xs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229788AbiCKXz2 (ORCPT + 99 others); Fri, 11 Mar 2022 18:55:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbiCKXz1 (ORCPT ); Fri, 11 Mar 2022 18:55:27 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDD40E6DBC; Fri, 11 Mar 2022 14:23:24 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id k5-20020a17090a3cc500b001befa0d3102so9322725pjd.1; Fri, 11 Mar 2022 14:23:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NRfHmLV6jC//S0JUnsW7EkyoAJl8Vb/or5+A/gBKAzM=; b=KwPsT2XsrHShv56NDjUu3yvGQa1JlqCIdWproXqbg0elY5sxpXeo0jGIjpog1jChpi l3dl2QAURioV1sWFgBC6rU++phG9LloQXtBVTzFVf9zjriVpimSq1gB881YT5sdLGfCm f7MOSPCElXan/sdrSTwGt4sjsY7A1JBpgzh2Flwbq5F3z1mBemRaxQcxwKye6b8vOiDm OTYLAvOcQTstwGN+sfa4LteZ6Tt4VPiJQdOYRdYfTwvbqxgiv7ZaD8cKJd+yD9V/BrFk EEvv3Yxg92wD1nDc+lrdjhYVextf5yiEEd8VD6rbYEpvf3mCVrrOlr9zk2ldJeVW9BIl kIjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NRfHmLV6jC//S0JUnsW7EkyoAJl8Vb/or5+A/gBKAzM=; b=DW76xWJ0v2gdlCWZsCsOdD3LHfjp2VFmjucyvToYxBG5cPAGANISPku+fkOQDIzPuH C+6qKtvSJLO+NLBNIIAjbGRrwM62gIZ4bi8FnOd6ZssUr0q4d3y11WZtArWIeblRJVOj LAlzaam0RJ/YFfztOAPGHKw+qCBIHTqn8DMArIzOc33NdrmTH/rww7kMoNLi9IuRMTiQ uCJtt2t0Jmdjc9dlsszsKEka/8ZboHTUcmvOSpNmHiDJ2c/rnP+gT6YcyN2yVgf1Ke90 i97+J79M20PP2UIJMqeORG/I1wBXh42x7F6IRmRSDtYf7+6IbDVMkHdtCPpCPnVQPRlI hX0g== X-Gm-Message-State: AOAM531GXcfAy3vSVuC1FvD7iprLxvaPGA4JNx97Ywpl6LQAe+eue8Bh +9o1Vm22AFSgTrYcchnSKxVU+MK/cvRPEGcLWQU= X-Received: by 2002:a17:902:e80d:b0:151:e043:a2c3 with SMTP id u13-20020a170902e80d00b00151e043a2c3mr12518835plg.64.1647037404220; Fri, 11 Mar 2022 14:23:24 -0800 (PST) MIME-Version: 1.0 References: <20220311032828.702392-1-imagedong@tencent.com> <20220310195429.4ba93edf@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: From: Alexei Starovoitov Date: Fri, 11 Mar 2022 14:23:13 -0800 Message-ID: Subject: Re: [PATCH] net: skb: move enum skb_drop_reason to uapi To: Menglong Dong Cc: Jakub Kicinski , David Ahern , Neil Horman , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , David Miller , Menglong Dong , Eric Dumazet , Talal Ahmad , Kees Cook , Alexander Lobakin , LKML , netdev , bpf , Mengen Sun , Hao Peng Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 10, 2022 at 8:58 PM Menglong Dong wrote: > > On Fri, Mar 11, 2022 at 11:54 AM Jakub Kicinski wrote: > > > > On Fri, 11 Mar 2022 11:28:28 +0800 menglong8.dong@gmail.com wrote: > > > From: Menglong Dong > > > > > > 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.