Re: [PATCH bpf-next v3] selftests/bpf: fix compilation failure when CONFIG_NET_FOU!=y

From: Simon Horman
Date: Tue Jul 23 2024 - 05:45:19 EST


On Tue, Jul 23, 2024 at 09:10:31AM +0200, Artem Savkov wrote:
> Without CONFIG_NET_FOU bpf selftests are unable to build because of
> missing definitions. Add ___local versions of struct bpf_fou_encap and
> enum bpf_fou_encap_type to fix the issue.
>
> Signed-off-by: Artem Savkov <asavkov@xxxxxxxxxx>
>
> ---
> v3: swith from using BPF_NO_KFUNC_PROTOTYPES to casting to keep kfunc
> prototype intact.
>
> v2: added BPF_NO_KFUNC_PROTOTYPES define to avoid issues when
> CONFIG_NET_FOU is set.
> ---
> .../selftests/bpf/progs/test_tunnel_kern.c | 26 ++++++++++++++-----
> 1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
> index 3f5abcf3ff136..fcff3010d8a60 100644
> --- a/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
> +++ b/tools/testing/selftests/bpf/progs/test_tunnel_kern.c
> @@ -26,6 +26,18 @@
> */
> #define ASSIGNED_ADDR_VETH1 0xac1001c8
>
> +struct bpf_fou_encap___local {
> + __be16 sport;
> + __be16 dport;
> +};
> +
> +enum bpf_fou_encap_type___local {
> + FOU_BPF_ENCAP_FOU___local,
> + FOU_BPF_ENCAP_GUE___local,
> +};

nit: The above use spaces rather than tabs for indentation.