On Mon, May 6, 2024 at 8:19 AM Cupertino Miranda <cupertino.miranda@xxxxxxxxxx> wrote: > > The test_xdp_noinline.c contains 2 functions that use more then 5 > arguments. This patch collapses the 2 last arguments in an array. > Also in GCC and ipa_sra optimization increases the number of arguments > used in function encap_v4. This pass disables the optimization for that > particular file. > > Signed-off-by: Cupertino Miranda <cupertino.miranda@xxxxxxxxxx> > Cc: Alexei Starovoitov <alexei.starovoitov@xxxxxxxxx> > Cc: Andrii Nakryiko <andrii.nakryiko@xxxxxxxxx> > Cc: Eduard Zingerman <eddyz87@xxxxxxxxx> > Cc: Yonghong Song <yonghong.song@xxxxxxxxx> > Cc: David Faust <david.faust@xxxxxxxxxx> > Cc: Jose Marchesi <jose.marchesi@xxxxxxxxxx> > Cc: Elena Zannoni <elena.zannoni@xxxxxxxxxx> > --- > tools/testing/selftests/bpf/Makefile | 1 + > .../selftests/bpf/progs/test_xdp_noinline.c | 15 +++++++++------ > 2 files changed, 10 insertions(+), 6 deletions(-) > > diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile > index e506a5948cc2..6fe9b0dd2ea0 100644 > --- a/tools/testing/selftests/bpf/Makefile > +++ b/tools/testing/selftests/bpf/Makefile > @@ -86,6 +86,7 @@ progs/btf_dump_test_case_namespacing.c-bpf_gcc-CFLAGS := -Wno-error > progs/btf_dump_test_case_packing.c-bpf_gcc-CFLAGS := -Wno-error > progs/btf_dump_test_case_padding.c-bpf_gcc-CFLAGS := -Wno-error > progs/btf_dump_test_case_syntax.c-bpf_gcc-CFLAGS := -Wno-error > +progs/test_xdp_noinline.c-bpf_gcc-CFLAGS := -fno-ipa-sra Can this be done through `#pragma GCC optimize`? If yes, let's do that instead? > endif > > ifneq ($(CLANG_CPUV4),) > diff --git a/tools/testing/selftests/bpf/progs/test_xdp_noinline.c b/tools/testing/selftests/bpf/progs/test_xdp_noinline.c > index 5c7e4758a0ca..a38199f900ec 100644 > --- a/tools/testing/selftests/bpf/progs/test_xdp_noinline.c > +++ b/tools/testing/selftests/bpf/progs/test_xdp_noinline.c > @@ -588,12 +588,13 @@ static void connection_table_lookup(struct real_definition **real, > __attribute__ ((noinline)) > static int process_l3_headers_v6(struct packet_description *pckt, > __u8 *protocol, __u64 off, > - __u16 *pkt_bytes, void *data, > - void *data_end) > + __u16 *pkt_bytes, void *extra_args[2]) > { > struct ipv6hdr *ip6h; > __u64 iph_len; > int action; > + void *data = extra_args[0]; > + void *data_end = extra_args[1]; > > ip6h = data + off; > if (ip6h + 1 > data_end) > @@ -619,11 +620,12 @@ static int process_l3_headers_v6(struct packet_description *pckt, > __attribute__ ((noinline)) > static int process_l3_headers_v4(struct packet_description *pckt, > __u8 *protocol, __u64 off, > - __u16 *pkt_bytes, void *data, > - void *data_end) > + __u16 *pkt_bytes, void *extra_args[2]) > { > struct iphdr *iph; > int action; > + void *data = extra_args[0]; > + void *data_end = extra_args[1]; > > iph = data + off; > if (iph + 1 > data_end) > @@ -666,13 +668,14 @@ static int process_packet(void *data, __u64 off, void *data_end, > __u8 protocol; > __u32 vip_num; > int action; > + void *extra_args[2] = { data, data_end }; > > if (is_ipv6) > action = process_l3_headers_v6(&pckt, &protocol, off, > - &pkt_bytes, data, data_end); > + &pkt_bytes, extra_args); > else > action = process_l3_headers_v4(&pckt, &protocol, off, > - &pkt_bytes, data, data_end); > + &pkt_bytes, extra_args); > if (action >= 0) > return action; > protocol = pckt.flow.proto; > -- > 2.39.2 >