Re: [PATCH] net: skb: introduce kfree_skb_reason()
From: Benjamin Yim <hidden>
Date: 2022-01-10 02:07:47
Also in:
lkml
From: Benjamin Yim <hidden>
Date: 2022-01-10 02:07:47
Also in:
lkml
On Thu, 6 Jan 2022 14:36:26 +0800 Menglong Dong wrote:
Introduce the interface kfree_skb_reason(), which is able to pass the reason why the skb is dropped to 'kfree_skb' tracepoint.
Add the 'reason' field to 'trace_kfree_skb', therefor user can get more detail information about abnormal skb with 'drop_monitor' or eBPF.
All drop reasons are defined in the enum 'skb_drop_reason', and they will be print as string in 'kfree_skb' tracepoint in format of 'reason: XXX'.
( Maybe the reasons should be defined in a uapi header file, so that user space can use them? )
Since these drops are hardly hot path, why not simply use a string ? An ENUM will not really help grep games. tcp_drop(sk, skb, "csum error"); can refer to the previous discussion: https://lkml.org/lkml/2021/8/25/613