From: Menglong Dong <menglong8.dong@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
Ingo Molnar <mingo@redhat.com>,
David Miller <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Neil Horman <nhorman@tuxdriver.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>, Martin Lau <kafai@fb.com>,
Song Liu <songliubraving@fb.com>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Menglong Dong <imagedong@tencent.com>,
David Ahern <dsahern@kernel.org>,
Talal Ahmad <talalahmad@google.com>,
Kees Cook <keescook@chromium.org>,
LKML <linux-kernel@vger.kernel.org>,
netdev <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH net-next 2/3] net: skb: use auto-generation to convert skb drop reason to string
Date: Sat, 28 May 2022 12:26:43 +0800 [thread overview]
Message-ID: <CADxym3YJKOmxmZPvqAJGS_WHUv5i+Cb0MSwu583wK+G6BO0MOw@mail.gmail.com> (raw)
In-Reply-To: <20220527181426.126367e5@kernel.org>
On Sat, May 28, 2022 at 9:14 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Fri, 27 May 2022 15:15:21 +0800 menglong8.dong@gmail.com wrote:
> > +clean-files := dropreason_str.h
> > +
> > +quiet_cmd_dropreason_str = GEN $@
> > +cmd_dropreason_str = echo '\n\#define __DEFINE_SKB_DROP_REASON(FN) \' > $@;\
>
> echo -n
>
> > + sed -e '/enum skb_drop_reason {/,/}/!d' $< | \
> > + awk -F ',' '/SKB_DROP_REASON_/{printf " FN(%s) \\\n", substr($$1, 18)}' >> $@;\
> > + echo '' >> $@
>
> Trying to figure out when we're in the enum could be more robust
> in case more stuff gets added to the header:
>
> | awk -F ',' '/^enum skb_drop/ { dr=1; }
> /\}\;/ { dr=0; }
> /^\tSKB_DROP/ { if (dr) {print $1;}}'
>
> > +$(obj)/dropreason_str.h: $(srctree)/include/linux/dropreason.h
> > + $(call cmd,dropreason_str)
> > +
> > +$(obj)/skbuff.o: $(obj)/dropreason_str.h
>
> Since we just generate the array directly now should we generate
> a source file with it directly instead of generating a header with
> the huge define?
This seems to be a good idea, which is able to decouple the
definition of the array with skbuff.c. I'll try this.
Thanks!
Menglong Dong
next prev parent reply other threads:[~2022-05-28 4:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 7:15 [PATCH net-next 0/3] reorganize the code of the enum skb_drop_reason menglong8.dong
2022-05-27 7:15 ` [PATCH net-next 1/3] net: skb: move enum skb_drop_reason to standalone header file menglong8.dong
2022-05-28 1:08 ` Jakub Kicinski
2022-05-27 7:15 ` [PATCH net-next 2/3] net: skb: use auto-generation to convert skb drop reason to string menglong8.dong
2022-05-27 14:03 ` kernel test robot
2022-05-28 1:14 ` Jakub Kicinski
2022-05-28 4:26 ` Menglong Dong [this message]
2022-05-27 7:15 ` [PATCH net-next 3/3] net: dropreason: reformat the comment fo skb drop reasons menglong8.dong
2022-05-28 1:19 ` Jakub Kicinski
2022-05-28 4:32 ` Menglong 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=CADxym3YJKOmxmZPvqAJGS_WHUv5i+Cb0MSwu583wK+G6BO0MOw@mail.gmail.com \
--to=menglong8.dong@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=imagedong@tencent.com \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=keescook@chromium.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=pabeni@redhat.com \
--cc=rostedt@goodmis.org \
--cc=songliubraving@fb.com \
--cc=talalahmad@google.com \
--cc=yhs@fb.com \
/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).