Hi Steven, On Tue, Apr 9, 2024 at 11:36 PM Steven Rostedt <rost...@goodmis.org> wrote: > > On Tue, 9 Apr 2024 18:09:34 +0800 > Jason Xing <kerneljasonx...@gmail.com> wrote: > > > /* > > * tcp event with arguments sk and skb > > @@ -74,20 +75,38 @@ DEFINE_EVENT(tcp_event_sk_skb, tcp_retransmit_skb, > > TP_ARGS(sk, skb) > > ); > > > > +#undef FN1 > > +#define FN1(reason) TRACE_DEFINE_ENUM(SK_RST_REASON_##reason); > > +#undef FN2 > > +#define FN2(reason) TRACE_DEFINE_ENUM(SKB_DROP_REASON_##reason); > > +DEFINE_RST_REASON(FN1, FN1) > > Interesting. I've never seen the passing of the internal macros to the main > macro before. I see that you are using it for handling both the > SK_RST_REASON and the SK_DROP_REASON.
Yes, I want to cover two kinds of reasons and then strip them of prefixes which can be reported to userspace. > > > + > > +#undef FN1 > > +#undef FNe1 > > +#define FN1(reason) { SK_RST_REASON_##reason, #reason }, > > +#define FNe1(reason) { SK_RST_REASON_##reason, #reason } > > + > > +#undef FN2 > > +#undef FNe2 > > +#define FN2(reason) { SKB_DROP_REASON_##reason, #reason }, > > +#define FNe2(reason) { SKB_DROP_REASON_##reason, #reason } > > Anyway, from a tracing point of view, as it looks like it would work > (I haven't tested it). Sure, it works. One simple test if you're interested: 1) Apply this patchset locally 2) add 'trace_tcp_send_reset(sk, skb, [one reason])' in the receive path, say, somewhere in the tcp_v4_rcv() The possible result can be seen in the cover letter. I list here: <idle>-0 [002] ..s1. 1830.262425: tcp_send_reset: skbaddr=x skaddr=x src=x dest=x state=x reason=NOT_SPECIFIED <idle>-0 [002] ..s1. 1830.262425: tcp_send_reset: skbaddr=x skaddr=x src=x dest=x state=x reason=NO_SOCKET > > Reviewed-by: Steven Rostedt (Google) <rost...@goodmis.org> Thanks! > > -- Steve