Re: [PATCH bpf-next v3 5/5] bpf/selftests: add selftest for bpf_smc_ops

D. Wythe
2024-12-23T02:08:52Z

On Thu, Dec 19, 2024 at 02:59:15PM -0800, Martin KaFai Lau wrote:
> On 12/17/24 6:44 PM, D. Wythe wrote:
> >+// SPDX-License-Identifier: GPL-2.0
> >+
> >+#include "vmlinux.h"
> >+
> >+#include <bpf/bpf_helpers.h>
> >+#include <bpf/bpf_tracing.h>
> >+#include "bpf_tracing_net.h"
> >+
> >+char _license[] SEC("license") = "GPL";
> >+
> >+struct smc_sock {
>
> I suspect this should be "smc_sock___local". Otherwise, it can't
> compile if the same type is found in vmlinux.h.
>

Yes, it has been changed to ___local.

> I only looked at the high level of prog_tests/test_bpf_smc.c. A few comments,
>
> Try to reuse the helpers in network_helpers.c and test_progs.c, e.g.
> netns creation helpers, start_server, ...etc. There are many
> examples in selftests/bpf/prog_tests using them.
>
> I see 1s timeout everywhere. BPF CI could be slow some time. Please
> consider how reliable the multi-thread test is. If the test is too
> flaky, it will be put in the selftests/bpf/DENYLIST.
>

Got it, I will remove those timeouts in the next version. I have tried
reusing these helpers, it is very convenient and makes code more
concise!

D. Wythe

> >+ struct sock sk;
> >+ struct smc_sock *listen_smc;
> >+ bool use_fallback;
> >+} __attribute__((preserve_access_index));
> >+