From: Jakub Kicinski <kuba@kernel.org>
To: menglong8.dong@gmail.com
Cc: edumazet@google.com, rostedt@goodmis.org, mingo@redhat.com,
davem@davemloft.net, yoshfuji@linux-ipv6.org, dsahern@kernel.org,
pabeni@redhat.com, imagedong@tencent.com, kafai@fb.com,
talalahmad@google.com, keescook@chromium.org,
dongli.zhang@oracle.com, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, Jiang Biao <benbjiang@tencent.com>,
Hao Peng <flyingpeng@tencent.com>
Subject: Re: [PATCH net-next v2 1/9] net: skb: introduce __DEFINE_SKB_DROP_REASON() to simply the code
Date: Tue, 17 May 2022 18:14:57 -0700 [thread overview]
Message-ID: <20220517181457.04c37147@kernel.org> (raw)
In-Reply-To: <20220517081008.294325-2-imagedong@tencent.com>
On Tue, 17 May 2022 16:10:00 +0800 menglong8.dong@gmail.com wrote:
> From: Menglong Dong <imagedong@tencent.com>
>
> 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. So why not make them togather by define a macro?
>
> Therefore, introduce __DEFINE_SKB_DROP_REASON() and use it for 'enum
> skb_drop_reason' definition and string converting.
>
> Now, what should we with the document for the reasons? How about follow
> __BPF_FUNC_MAPPER() and make these document togather?
Hi, I know BPF does this but I really find the definition-by-macro
counter productive :(
kdoc will no longer work right because the parser will not see
the real values. cscope and other code indexers will struggle
to find definitions.
Did you investigate using auto-generation? Kernel already generates
a handful of headers. Maybe with a little script we could convert
the enum into the string thing at build time?
Also let's use this opportunity to move the enum to a standalone
header, it's getting huge.
Probably worth keeping this rework separate from the TCP patches.
Up to you which one you'd like to get done first.
next prev parent reply other threads:[~2022-05-18 1:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-17 8:09 [PATCH net-next v2 0/9] net: tcp: add skb drop reasons to tcp state change menglong8.dong
2022-05-17 8:10 ` [PATCH net-next v2 1/9] net: skb: introduce __DEFINE_SKB_DROP_REASON() to simply the code menglong8.dong
2022-05-18 1:14 ` Jakub Kicinski [this message]
2022-05-18 2:15 ` Menglong Dong
2022-05-17 8:10 ` [PATCH net-next v2 2/9] net: skb: introduce __skb_queue_purge_reason() menglong8.dong
2022-05-17 8:10 ` [PATCH net-next v2 3/9] net: sock: introduce sk_stream_kill_queues_reason() menglong8.dong
2022-05-17 8:10 ` [PATCH net-next v2 4/9] net: inet: add skb drop reason to inet_csk_destroy_sock() menglong8.dong
2022-05-17 8:10 ` [PATCH net-next v2 5/9] net: tcp: make tcp_rcv_synsent_state_process() return drop reasons menglong8.dong
2022-05-17 8:10 ` [PATCH net-next v2 6/9] net: tcp: make tcp_rcv_state_process() return drop reason menglong8.dong
2022-05-17 8:10 ` [PATCH net-next v2 7/9] net: tcp: add skb drop reasons to tcp connect requesting menglong8.dong
2022-05-17 8:10 ` [PATCH net-next v2 8/9] net: tcp: add skb drop reasons to tcp tw code path menglong8.dong
2022-05-17 8:10 ` [PATCH net-next v2 9/9] net: tcp: add skb drop reasons to route_req() menglong8.dong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220517181457.04c37147@kernel.org \
--to=kuba@kernel.org \
--cc=benbjiang@tencent.com \
--cc=davem@davemloft.net \
--cc=dongli.zhang@oracle.com \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=flyingpeng@tencent.com \
--cc=imagedong@tencent.com \
--cc=kafai@fb.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=menglong8.dong@gmail.com \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rostedt@goodmis.org \
--cc=talalahmad@google.com \
--cc=yoshfuji@linux-ipv6.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).