From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Jiri Benc <jbenc@redhat.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>, Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Mykola Lysenko <mykolal@fb.com>,
Shuah Khan <shuah@kernel.org>,
bpf@vger.kernel.org
Subject: Re: [PATCH bpf 2/2] selftests/bpf: Add local definition of enum nf_nat_manip_type to bpf_nf test
Date: Thu, 01 Dec 2022 12:09:32 +0100 [thread overview]
Message-ID: <87cz93xtw3.fsf@toke.dk> (raw)
In-Reply-To: <CAEf4Bzb+Vg0QGb40f2z4UrhNhzcH6sEvzoVjvvM=uVHXFRchpw@mail.gmail.com>
Andrii Nakryiko <andrii.nakryiko@gmail.com> writes:
> On Wed, Nov 30, 2022 at 5:18 PM Andrii Nakryiko
> <andrii.nakryiko@gmail.com> wrote:
>>
>> On Wed, Nov 30, 2022 at 6:42 AM Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>> >
>> > The bpf_nf selftest calls the bpf_ct_set_nat_info() kfunc, which takes a
>> > parameter of type enum nf_nat_manip_type. However, if the nf_nat code is
>> > compiled as a module, that enum is not defined in vmlinux BTF, and
>> > compilation of the selftest fails.
>> >
>> > A previous patch suggested just hard-coding the enum values:
>> >
>> > https://lore.kernel.org/r/tencent_4C0B445E0305A18FACA04B4A959B57835107@qq.com
>> >
>> > However, this doesn't work as the compiler then complains about an
>> > incomplete type definition in the function prototype. Instead, just add a
>> > local definition of the enum to the selftest code.
>> >
>> > Fixes: b06b45e82b59 ("selftests/bpf: add tests for bpf_ct_set_nat_info kfunc")
>> > Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> > ---
>> > tools/testing/selftests/bpf/progs/test_bpf_nf.c | 5 +++++
>> > 1 file changed, 5 insertions(+)
>> >
>> > diff --git a/tools/testing/selftests/bpf/progs/test_bpf_nf.c b/tools/testing/selftests/bpf/progs/test_bpf_nf.c
>> > index 227e85e85dda..6350d11ec6f6 100644
>> > --- a/tools/testing/selftests/bpf/progs/test_bpf_nf.c
>> > +++ b/tools/testing/selftests/bpf/progs/test_bpf_nf.c
>> > @@ -43,6 +43,11 @@ struct bpf_ct_opts___local {
>> > u8 reserved[3];
>> > } __attribute__((preserve_access_index));
>> >
>> > +enum nf_nat_manip_type {
>> > + NF_NAT_MANIP_SRC,
>> > + NF_NAT_MANIP_DST
>> > +};
>> > +
>>
>> and enum redefinition error if vmlinux.h already defines it?...
>
>
> ... which is apparently proven by our CI already:
>
> [0] https://github.com/kernel-patches/bpf/actions/runs/3584446939/jobs/6031141757
Doh *facepalm*! Will fix...
-Toke
next prev parent reply other threads:[~2022-12-01 11:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 14:42 [PATCH bpf 1/2] bpf: Add dummy type reference to nf_conn___init to fix type deduplication Toke Høiland-Jørgensen
2022-11-30 14:42 ` [PATCH bpf 2/2] selftests/bpf: Add local definition of enum nf_nat_manip_type to bpf_nf test Toke Høiland-Jørgensen
2022-12-01 1:18 ` Andrii Nakryiko
2022-12-01 1:19 ` Andrii Nakryiko
2022-12-01 11:09 ` Toke Høiland-Jørgensen [this message]
2022-12-01 1:16 ` [PATCH bpf 1/2] bpf: Add dummy type reference to nf_conn___init to fix type deduplication Yonghong Song
2022-12-01 1:16 ` Andrii Nakryiko
2022-12-01 11:06 ` Toke Høiland-Jørgensen
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=87cz93xtw3.fsf@toke.dk \
--to=toke@redhat.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=jbenc@redhat.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=lorenzo@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=mykolal@fb.com \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.