Re: [PATCH bpf v2 4/4] selftests/bpf: Add netkit test for pkt_type

Martin KaFai Lau
2024-05-24T22:05:12Z

On 5/24/24 9:36 AM, Daniel Borkmann wrote:
> diff --git a/tools/testing/selftests/bpf/progs/test_tc_link.c b/tools/testing/selftests/bpf/progs/test_tc_link.c
> index 992400acb957..b64fcb70ef2f 100644
> --- a/tools/testing/selftests/bpf/progs/test_tc_link.c
> +++ b/tools/testing/selftests/bpf/progs/test_tc_link.c
> @@ -4,6 +4,7 @@
>
> #include <linux/bpf.h>
> #include <linux/if_ether.h>
> +#include <linux/if_packet.h>

The set looks good.

A minor thing is that I am hitting this compilation issue in my environment:

In file included from progs/test_tc_link.c:7:
In file included from /usr/include/linux/if_packet.h:5:
In file included from /usr/include/asm/byteorder.h:5:
In file included from /usr/include/linux/byteorder/little_endian.h:13:
/usr/include/linux/swab.h:136:8: error: unknown type name '__always_inline'
136 | static __always_inline unsigned long __swab(const unsigned long y)
| ^

Adding '#include <linux/stddef.h>' solved it. If the addition is fine, this can
be adjusted before landing.