summaryrefslogtreecommitdiff
path: root/net/core/drop_monitor.c
diff options
context:
space:
mode:
authorMenglong Dong <imagedong@tencent.com>2022-06-06 10:24:35 +0800
committerPaolo Abeni <pabeni@redhat.com>2022-06-07 12:51:41 +0200
commitec43908dd556b2292f028c6e412261689405ba6e (patch)
treed9b6e2d99b5bd1ddea7d05531103cac5a67f9dbb /net/core/drop_monitor.c
parentff8372a467fa28752610f57a6512c5365413faa2 (diff)
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>
Diffstat (limited to 'net/core/drop_monitor.c')
-rw-r--r--net/core/drop_monitor.c13
1 files changed, 0 insertions, 13 deletions
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 41cac0e4834e..4ad1decce724 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -48,19 +48,6 @@
static int trace_state = TRACE_OFF;
static bool monitor_hw;
-#undef EM
-#undef EMe
-
-#define EM(a, b) [a] = #b,
-#define EMe(a, b) [a] = #b
-
-/* drop_reasons is used to translate 'enum skb_drop_reason' to string,
- * which is reported to user space.
- */
-static const char * const drop_reasons[] = {
- TRACE_SKB_DROP_REASON
-};
-
/* net_dm_mutex
*
* An overall lock guarding every operation coming from userspace.