Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp370298pxb; Fri, 28 Jan 2022 00:37:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJy51gNf8Lhta/Gm7hLGMmab/RlWukUo+XbixLIgLUeccjmY2LSYIxIzeMqhUmHbCkM/wb05 X-Received: by 2002:a17:902:9a0a:: with SMTP id v10mr7290364plp.61.1643359022491; Fri, 28 Jan 2022 00:37:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643359022; cv=none; d=google.com; s=arc-20160816; b=MF7Jb0S5rBrdI6qA0080fEbaq8zVTA80Uqp3pAqzrc0AL8fSfGtkiTchRg9uDTDjid IB0K0RR5h6OH/8gJPKvYqfA6opZLQpAt5vD0JnQoSOcq5jIYQh4eZuYx7RW1P3s0NvIT BcvvmyBbV/3dUMG0k9UgjxFteY+oaU8yD+NMz4MjSF5UphRlFzi7LUVhf50ql88dNnAg uzVQzOXq1CvpvpxDhGSvAkFccUwnE3ekbKicGZAKnZe2Eodki7yRK9c/djrPZks7XCSA VcXAOBznjfICyuWgV9m3OW5gdcnvOjw7B/DzP8W9rXiBpMdtCSZhE588ViFvIoYWcEvg JifQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=zYCnHem+yXsL+h430Le5ssJgbtLMHBH+MRHKqejQOZo=; b=dS+D3t+NC7FYSjaDmqirJwPsbwHC3xA4kwbbUYDsAnqqJ4pgOCX6SRZ+raNB6BtL7A jDQ7aAE0yF3zV0W/tztI2q8uwb4967InLoKES5chTkyQQQXJMZvCdnkC7z/QkG3ZNTO3 sUWqGMuSw/650LpDlsVAW/k4eKG9EEJ71mrvR62X4sOeNw9xzibP4gaOWReg4T6bS57I t4DMdRS9GZGU0Spg0MU/saX2nUlieei4PtC1yx3kbjcOvIZ8mfNfCxsBqWtRbr+zcsMs L3ohFIx4GhJ450F0ZcNTswmfIMWkXODbK7bqRzZz0RFCs7JpKJh2Gw1tMD6uuGOu9FM+ rU8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q7mfusPK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a1si4245951plp.572.2022.01.28.00.36.51; Fri, 28 Jan 2022 00:37:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=q7mfusPK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S243284AbiA0PxL (ORCPT + 99 others); Thu, 27 Jan 2022 10:53:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243271AbiA0PxI (ORCPT ); Thu, 27 Jan 2022 10:53:08 -0500 Received: from mail-il1-x134.google.com (mail-il1-x134.google.com [IPv6:2607:f8b0:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E718C06173B; Thu, 27 Jan 2022 07:53:08 -0800 (PST) Received: by mail-il1-x134.google.com with SMTP id z4so2855194ilz.4; Thu, 27 Jan 2022 07:53:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=zYCnHem+yXsL+h430Le5ssJgbtLMHBH+MRHKqejQOZo=; b=q7mfusPKYjow17ekmUngWUB2JDK5Z3A1oufO+WTYJbLB5GCS/XnxBWSz/rwIiZTifE kugVXBn6BIrVOL/ALCec8NgGiP41zsG1CXKvjzjyFpv4AGG1nIn/A3vP24cGiWX2b6KV TLrml1TmvuIUm5Wxptrg4vAxDipjGKdoIsrU/19zKRzUhyr9leDLnGEs9VdCNN6Vrvw8 kLy9G9omhYv4+BPPoBCrrdTqYclsQq5XJhbxJz9uCsntqom8OrgdPFYkAGUXFU/4q7Mo m1d/i7x+Zzglo60wKj0ZgTjinoMeAlvxh+BMaN5LOJHNKN3SumWgQc2JAHxJDEQa261J LIDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=zYCnHem+yXsL+h430Le5ssJgbtLMHBH+MRHKqejQOZo=; b=1B6KDYWn24OQl96ZrCLGd3ZykFD0zZRTA3COYpeUNbPZJXtrbINXNd73/PSPF+koCV z9ikwVVnBnxDA0mysWkcWfOvQ22oeReAnXV+NDgOFQk6xtwHp73sydwbffxv/8e2/Zrb xvqjXm7YX8cnf6JGI9qyMkSY3QUa1ReAgiDT/0urZkykoc3NZuQKbAW6s3+eyh6i8Bak +Dsg79+OWna20hTVi6HuWP86fZEkd31W1hHlin1C7bYEMqCfhFk1GGC2hWuZAcHu+vU5 v2ddfB/a5HV4fCuIFWtpPH3NXzpjAusy3RXt0nafcrJvRE9QQq8owrGxwQjOwsVmGQEF 6t3w== X-Gm-Message-State: AOAM5333zyRm+jr22pyKiex8pQ+WU9s/EsTKnbzIgN2K3uggAYCfu3Tg 9TU+/9ZKGVsgmrVFoVQTe9k= X-Received: by 2002:a92:ca45:: with SMTP id q5mr2854645ilo.55.1643298787938; Thu, 27 Jan 2022 07:53:07 -0800 (PST) Received: from ?IPV6:2601:282:800:dc80:182c:2e54:e650:90f5? ([2601:282:800:dc80:182c:2e54:e650:90f5]) by smtp.googlemail.com with ESMTPSA id i11sm12685619iow.9.2022.01.27.07.53.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Jan 2022 07:53:07 -0800 (PST) Message-ID: Date: Thu, 27 Jan 2022 08:53:04 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH v3 net-next] net: drop_monitor: support drop reason Content-Language: en-US To: menglong8.dong@gmail.com, kuba@kernel.org Cc: nhorman@tuxdriver.com, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dsahern@kernel.org, rostedt@goodmis.org, Menglong Dong , Ido Schimmel References: <20220127033356.4050072-1-imagedong@tencent.com> From: David Ahern In-Reply-To: <20220127033356.4050072-1-imagedong@tencent.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/26/22 8:33 PM, menglong8.dong@gmail.com wrote: > From: Menglong Dong > > In the commit c504e5c2f964 ("net: skb: introduce kfree_skb_reason()") > drop reason is introduced to the tracepoint of kfree_skb. Therefore, > drop_monitor is able to report the drop reason to users by netlink. > > For now, the number of drop reason is passed to users ( seems it's > a little troublesome to pass the drop reason as string ). Therefore, > users can do some customized description of the reason. > > Signed-off-by: Menglong Dong > --- > v3: > - referring to cb->reason and cb->pc directly in > net_dm_packet_report_fill() > > v2: > - get a pointer to struct net_dm_skb_cb instead of local var for > each field > --- > include/uapi/linux/net_dropmon.h | 1 + > net/core/drop_monitor.c | 16 ++++++++++++---- > 2 files changed, 13 insertions(+), 4 deletions(-) > > diff --git a/include/uapi/linux/net_dropmon.h b/include/uapi/linux/net_dropmon.h > index 66048cc5d7b3..b2815166dbc2 100644 > --- a/include/uapi/linux/net_dropmon.h > +++ b/include/uapi/linux/net_dropmon.h > @@ -93,6 +93,7 @@ enum net_dm_attr { > NET_DM_ATTR_SW_DROPS, /* flag */ > NET_DM_ATTR_HW_DROPS, /* flag */ > NET_DM_ATTR_FLOW_ACTION_COOKIE, /* binary */ > + NET_DM_ATTR_REASON, /* u32 */ > For userspace to properly convert reason from id to string, enum skb_drop_reason needs to be moved from skbuff.h to a uapi file. include/uapi/linux/net_dropmon.h seems like the best candidate to me. Maybe others have a better idea.