Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp371641pxb; Fri, 28 Jan 2022 00:39:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJxS5Z0UPdamqktlxaqpHdmNKv/ZbYqnodm+7yDjoPgkxZe4zrA9mLdXQLKXU8HUgChPG6rY X-Received: by 2002:a17:903:2311:: with SMTP id d17mr7384601plh.39.1643359152870; Fri, 28 Jan 2022 00:39:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643359152; cv=none; d=google.com; s=arc-20160816; b=FTzPhmmhknB978xU5SNjpIRG1+MKulERwzYfwsw3v6FPnEPobDXDAWBGxBNa5XMamG 8t7+/9lOnq/ZsSZjo5u/FxL7cedoTJ9Tjgb0SwzYjSGo9vIkH/72/NJC1ywFKzJHzD6N 8Vn0invzHimP2VEjhIS9C85Zc3Ut5w0CLG7d4gYhoBRW4skzSyz6fd/vIIvKA5V8WhDs l+qMcpC43ripT1tQFOH7C4UE7LpDgd1pSeaNVix7l4I1o3+TVTO9/DwN1e0msDTmrDrC OVkqPnsz9tYpaLh4hCdKqMHDWZiwKKiqWC4Ogn/WFPB+2D+lEeOe74jLRFh9o1eL9Gqe qqvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5DAjFJrfQui823l8qiWTFnZAur3Gan3zT89TW6AziVE=; b=JRBVmzxGWQm6ZTQ/3Mx46bjqjsPQIjij4lEjacgAbt+RpOAEEXJMvcgU920laYJEdP A46wHJTMx41qYIQzF4troVCgRDDhYwSaIZ4z+2HGUBSRvIpyJVBq/mWRqGE9tuAqITZR 5S3/H8ti6jfYz2pIiErSxmm9M6/MMkZIJHPEEI4zoV5wQ1hukCRD5DwwTcxeq66pflCA Nj6l0NyNQptyUJISSHbvTg+14x3DBdiIi9rRTnAIUdepJVcsD2oIKry7eqEVVu3cZ2rG XG+fn8ZZM659CEWClqAZGZdUmXcY+84ZA/54FlMYccVIkCB8UafD6bw3T39ELl7B3Osz /q9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=dO+yAa+h; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d15si4618115pgk.641.2022.01.28.00.38.59; Fri, 28 Jan 2022 00:39:12 -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=@messagingengine.com header.s=fm1 header.b=dO+yAa+h; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243401AbiA0QDN (ORCPT + 99 others); Thu, 27 Jan 2022 11:03:13 -0500 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:33395 "EHLO wout4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243470AbiA0QDD (ORCPT ); Thu, 27 Jan 2022 11:03:03 -0500 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 654A832022BA; Thu, 27 Jan 2022 11:03:01 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Thu, 27 Jan 2022 11:03:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=5DAjFJrfQui823l8q iWTFnZAur3Gan3zT89TW6AziVE=; b=dO+yAa+hgpt88zcdnql0EQJsP7RPqI3fK SEazh//IStN3oxVwskw6z3LJAdyj3CrUnwfIKyWriR5mbj4+wVeEIl2h8+ZD5oa9 yEwHIgCxcg1ke+CR439CZD5kkJQS/oEuQcVW2c58Y/cenrJYeKq3bItjSOW20WKm AcsMvOPNdDKNmOI3SZokyDUrPUuWljBjPhmXeKWvXVuA9CNmxoMx8BLgWGwnG6pK G5DDyaJjoXhHes5PvJTs6szKr1vD+71f9Mjkl4C/jU0Ct3zIkJAclemiOUw/ONn4 qIrz9bCHqkdN1ZuujAniYC/nU5J0u2fcMrooY+FAq70hIn0bJuPgg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvvddrfeefgdekgecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpeffhffvuffkfhggtggujgesthdtredttddtvdenucfhrhhomhepkfguohcuufgt hhhimhhmvghluceoihguohhstghhsehiughoshgthhdrohhrgheqnecuggftrfgrthhtvg hrnhephedugeduudeigfejteehiedvjedtgefhfefhvddukeekhefggeegudeifffhgfei necuffhomhgrihhnpeifihhrvghshhgrrhhkrdhorhhgnecuvehluhhsthgvrhfuihiivg eptdenucfrrghrrghmpehmrghilhhfrhhomhepihguohhstghhsehiughoshgthhdrohhr gh X-ME-Proxy: Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 27 Jan 2022 11:02:59 -0500 (EST) Date: Thu, 27 Jan 2022 18:02:56 +0200 From: Ido Schimmel To: David Ahern Cc: menglong8.dong@gmail.com, kuba@kernel.org, nhorman@tuxdriver.com, davem@davemloft.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, dsahern@kernel.org, rostedt@goodmis.org, Menglong Dong Subject: Re: [PATCH v3 net-next] net: drop_monitor: support drop reason Message-ID: References: <20220127033356.4050072-1-imagedong@tencent.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 27, 2022 at 08:53:04AM -0700, David Ahern wrote: > 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. I think the best option would be to convert it to a string in the kernel (or report both). Then you don't need to update user space tools such as the Wireshark dissector [1] and DropWatch every time a new reason is added. [1] https://www.wireshark.org/docs/dfref/n/net_dm.html