diff mbox series

[bpf-next] selftests/bpf: Fix a selftest compilation error

Message ID 20230818174312.1883381-1-yonghong.song@linux.dev (mailing list archive)
State Accepted
Commit 0a55264cf966fb95ebf9d03d9f81fa992f069312
Delegated to: BPF
Headers show
Series [bpf-next] selftests/bpf: Fix a selftest compilation error | expand

Checks

Context Check Description
bpf/vmtest-bpf-next-PR success PR summary
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for bpf-next, async
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 9 this patch: 9
netdev/cc_maintainers warning 15 maintainers not CCed: kpsingh@kernel.org martin.lau@linux.dev john.fastabend@gmail.com sdf@google.com trix@redhat.com shuah@kernel.org song@kernel.org jolsa@kernel.org mykolal@fb.com nathan@kernel.org llvm@lists.linux.dev linux-kselftest@vger.kernel.org haoluo@google.com yan@cloudflare.com ndesaulniers@google.com
netdev/build_clang success Errors and warnings before: 9 this patch: 9
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 9 this patch: 9
netdev/checkpatch warning WARNING: use relative pathname instead of absolute in changelog text
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next-VM_Test-1 success Logs for ${{ matrix.test }} on ${{ matrix.arch }} with ${{ matrix.toolchain_full }}
bpf/vmtest-bpf-next-VM_Test-2 success Logs for ShellCheck
bpf/vmtest-bpf-next-VM_Test-3 success Logs for build for aarch64 with gcc
bpf/vmtest-bpf-next-VM_Test-4 fail Logs for build for s390x with gcc
bpf/vmtest-bpf-next-VM_Test-5 success Logs for build for x86_64 with gcc
bpf/vmtest-bpf-next-VM_Test-6 success Logs for build for x86_64 with llvm-16
bpf/vmtest-bpf-next-VM_Test-7 success Logs for set-matrix
bpf/vmtest-bpf-next-VM_Test-8 success Logs for veristat

Commit Message

Yonghong Song Aug. 18, 2023, 5:43 p.m. UTC
When building the kernel and selftest with clang compiler (llvm17 or llvm18),
I hit the following compilation failure:
  In file included from progs/test_lwt_redirect.c:3:
  In file included from /usr/include/linux/ip.h:21:
  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)
        |        ^
  /usr/include/linux/swab.h:171:8: error: unknown type name '__always_inline'
    171 | static __always_inline __u16 __swab16p(const __u16 *p)
  ...

bpf_helpers.h file provided a definition for __always_inline.
Putting 'ip.h' after 'bpf_helpers.h' fixed the issue.

Signed-off-by: Yonghong Song <yonghong.song@linux.dev>
---
 tools/testing/selftests/bpf/progs/test_lwt_redirect.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

patchwork-bot+netdevbpf@kernel.org Aug. 18, 2023, 7:30 p.m. UTC | #1
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:

On Fri, 18 Aug 2023 10:43:12 -0700 you wrote:
> When building the kernel and selftest with clang compiler (llvm17 or llvm18),
> I hit the following compilation failure:
>   In file included from progs/test_lwt_redirect.c:3:
>   In file included from /usr/include/linux/ip.h:21:
>   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)
>         |        ^
>   /usr/include/linux/swab.h:171:8: error: unknown type name '__always_inline'
>     171 | static __always_inline __u16 __swab16p(const __u16 *p)
>   ...
> 
> [...]

Here is the summary with links:
  - [bpf-next] selftests/bpf: Fix a selftest compilation error
    https://git.kernel.org/bpf/bpf-next/c/0a55264cf966

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/testing/selftests/bpf/progs/test_lwt_redirect.c b/tools/testing/selftests/bpf/progs/test_lwt_redirect.c
index 7ab1fd310efb..8c895122f293 100644
--- a/tools/testing/selftests/bpf/progs/test_lwt_redirect.c
+++ b/tools/testing/selftests/bpf/progs/test_lwt_redirect.c
@@ -1,8 +1,8 @@ 
 // SPDX-License-Identifier: GPL-2.0
 #include <linux/bpf.h>
-#include <linux/ip.h>
 #include <bpf/bpf_endian.h>
 #include <bpf/bpf_helpers.h>
+#include <linux/ip.h>
 #include "bpf_tracing_net.h"
 
 /* We don't care about whether the packet can be received by network stack.