]> git.baikalelectronics.ru Git - kernel.git/commit
net: skb: use auto-generation to convert skb drop reason to string
authorMenglong Dong <imagedong@tencent.com>
Mon, 6 Jun 2022 02:24:35 +0000 (10:24 +0800)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 7 Jun 2022 10:51:41 +0000 (12:51 +0200)
commit86046c1c00cdd18dee4482c6eda87b0c7827ef19
treed9b6e2d99b5bd1ddea7d05531103cac5a67f9dbb
parent124effd71c262ad91a7a9f04a266a70d95dcf917
net: skb: use auto-generation to convert skb drop reason to string

It is annoying to add new skb drop reasons to 'enum skb_drop_reason'
and TRACE_SKB_DROP_REASON in trace/event/skb.h, and it's easy to forget
to add the new reasons we added to TRACE_SKB_DROP_REASON.

TRACE_SKB_DROP_REASON is used to convert drop reason of type number
to string. For now, the string we passed to user space is exactly the
same as the name in 'enum skb_drop_reason' with a 'SKB_DROP_REASON_'
prefix. Therefore, we can use 'auto-generation' to generate these
drop reasons to string at build time.

The new source 'dropreason_str.c' will be auto generated during build
time, which contains the string array
'const char * const drop_reasons[]'.

Signed-off-by: Menglong Dong <imagedong@tencent.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
include/net/dropreason.h
include/trace/events/skb.h
net/core/.gitignore [new file with mode: 0644]
net/core/Makefile
net/core/drop_monitor.c
net/core/skbuff.c