net: skb: introduce kfree_skb_reason()
authorMenglong Dong <imagedong@tencent.com>
Sun, 9 Jan 2022 06:36:26 +0000 (14:36 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jul 2022 15:25:15 +0000 (17:25 +0200)
commit5158e18225c06f39cde0176a431db6e60f52ebc2
treec9b75b4a0ddb4cabb87811563d3863d849e1316d
parent88ec2ff42da3ac93b2437dc52fe25cd4372148e6
net: skb: introduce kfree_skb_reason()

[ Upstream commit c504e5c2f9648a1e5c2be01e8c3f59d394192bd3 ]

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? )

Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/skbuff.h
include/trace/events/skb.h
net/core/dev.c
net/core/drop_monitor.c
net/core/skbuff.c