[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220527181426.126367e5@kernel.org>
Date: Fri, 27 May 2022 18:14:26 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: menglong8.dong@...il.com
Cc: rostedt@...dmis.org, mingo@...hat.com, davem@...emloft.net,
edumazet@...gle.com, pabeni@...hat.com, nhorman@...driver.com,
ast@...nel.org, daniel@...earbox.net, andrii@...nel.org,
kafai@...com, songliubraving@...com, yhs@...com,
john.fastabend@...il.com, kpsingh@...nel.org,
imagedong@...cent.com, dsahern@...nel.org, talalahmad@...gle.com,
keescook@...omium.org, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH net-next 2/3] net: skb: use auto-generation to convert
skb drop reason to string
On Fri, 27 May 2022 15:15:21 +0800 menglong8.dong@...il.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?
Powered by blists - more mailing lists