Thread (9 messages) flat view 9 messages, 4 authors, 2022-10-28

Re: [PATCH net-next v2] net: skb: export skb drop reaons to user by TRACE_DEFINE_ENUM

From: Steven Rostedt <rostedt@goodmis.org>
Date: 2022-09-05 14:40:33
Also in: lkml

On Fri, 2 Sep 2022 08:43:07 -0700
Eric Dumazet [off-list ref] wrote:
quoted
---
v2:
- undef FN/FNe after use it (Jakub Kicinski)  
I would love some feedback from Steven :)
The undef should be fine. I usually do not, but that's more of a preference
than a rule.

As long as the undef is done after the C portion of where the macro is used:

+#undef FN
+#define FN(reason)	TRACE_DEFINE_ENUM(SKB_DROP_REASON_##reason);
+DEFINE_DROP_REASON(FN, FN) <<<--- C portion

+#undef FN
+#undef FNe
+#define FN(reason)	{ SKB_DROP_REASON_##reason, #reason },
+#define FNe(reason)	{ SKB_DROP_REASON_##reason, #reason }
+
 /*
  * Tracepoint for free an sk_buff:
  */
@@ -35,9 +44,13 @@ TRACE_EVENT(kfree_skb,
 
 	TP_printk("skbaddr=%p protocol=%u location=%p reason: %s",
 		  __entry->skbaddr, __entry->protocol, __entry->location,
-		  drop_reasons[__entry->reason])
+		  __print_symbolic(__entry->reason,
+				   DEFINE_DROP_REASON(FN, FNe)))  <<<--- C portion
 );
 
+#undef FN
+#undef FNe
So for this part: Reviewed-by: Steven Rostedt (Google) [off-list ref]

-- Steve
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help