Let us make the following source change, note that we have a 4-byte
tailing padding now.
- diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
- index 6cd9c501624f..0dd83910ae9a 100644
- --- a/tools/lib/bpf/libbpf.h
- +++ b/tools/lib/bpf/libbpf.h
- @@ -803,13 +803,13 @@ bpf_program__attach_tcx(const struct bpf_program *prog, int ifindex,
- struct bpf_netkit_opts {
- /* size of this struct, for forward/backward compatibility */
- size_t sz;
- - __u32 flags;
- __u32 relative_fd;
- __u32 relative_id;
- __u64 expected_revision;
- + __u32 flags;
- size_t :0;
- };
- -#define bpf_netkit_opts__last_field expected_revision
- +#define bpf_netkit_opts__last_field flags
+# diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
+# index 6cd9c501624f..0dd83910ae9a 100644
+# --- a/tools/lib/bpf/libbpf.h
+# +++ b/tools/lib/bpf/libbpf.h
+# @@ -803,13 +803,13 @@ bpf_program__attach_tcx(const struct bpf_program *prog, int ifindex,
+# struct bpf_netkit_opts {
+# /* size of this struct, for forward/backward compatibility */
+# size_t sz;
+# - __u32 flags;
+# __u32 relative_fd;
+# __u32 relative_id;
+# __u64 expected_revision;
+# + __u32 flags;
+# size_t :0;
+# };
+# -#define bpf_netkit_opts__last_field expected_revision
+# +#define bpf_netkit_opts__last_field flags
The clang 18 generated asm code looks like below:
; LIBBPF_OPTS_RESET(optl,
Link: https://lore.kernel.org/bpf/20231107201511.2548645-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- tools/lib/bpf/libbpf_common.h | 13 ++++++++-----
+ tools/lib/bpf/libbpf_common.h | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
-diff --git a/tools/lib/bpf/libbpf_common.h b/tools/lib/bpf/libbpf_common.h
-index b7060f254486..8fe248e14eb6 100644
--- a/tools/lib/bpf/libbpf_common.h
+++ b/tools/lib/bpf/libbpf_common.h
@@ -79,11 +79,14 @@
} while (0)
#endif /* __LIBBPF_LIBBPF_COMMON_H */
---
-2.43.0
-
Let us make the following source change, note that we have a 4-byte
tailing padding now.
- diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
- index 6cd9c501624f..0dd83910ae9a 100644
- --- a/tools/lib/bpf/libbpf.h
- +++ b/tools/lib/bpf/libbpf.h
- @@ -803,13 +803,13 @@ bpf_program__attach_tcx(const struct bpf_program *prog, int ifindex,
- struct bpf_netkit_opts {
- /* size of this struct, for forward/backward compatibility */
- size_t sz;
- - __u32 flags;
- __u32 relative_fd;
- __u32 relative_id;
- __u64 expected_revision;
- + __u32 flags;
- size_t :0;
- };
- -#define bpf_netkit_opts__last_field expected_revision
- +#define bpf_netkit_opts__last_field flags
+# diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
+# index 6cd9c501624f..0dd83910ae9a 100644
+# --- a/tools/lib/bpf/libbpf.h
+# +++ b/tools/lib/bpf/libbpf.h
+# @@ -803,13 +803,13 @@ bpf_program__attach_tcx(const struct bpf_program *prog, int ifindex,
+# struct bpf_netkit_opts {
+# /* size of this struct, for forward/backward compatibility */
+# size_t sz;
+# - __u32 flags;
+# __u32 relative_fd;
+# __u32 relative_id;
+# __u64 expected_revision;
+# + __u32 flags;
+# size_t :0;
+# };
+# -#define bpf_netkit_opts__last_field expected_revision
+# +#define bpf_netkit_opts__last_field flags
The clang 18 generated asm code looks like below:
; LIBBPF_OPTS_RESET(optl,
Link: https://lore.kernel.org/bpf/20231107201511.2548645-1-yonghong.song@linux.dev
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
- tools/lib/bpf/libbpf_common.h | 13 ++++++++-----
+ tools/lib/bpf/libbpf_common.h | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
-diff --git a/tools/lib/bpf/libbpf_common.h b/tools/lib/bpf/libbpf_common.h
-index b7060f254486..8fe248e14eb6 100644
--- a/tools/lib/bpf/libbpf_common.h
+++ b/tools/lib/bpf/libbpf_common.h
@@ -79,11 +79,14 @@
} while (0)
#endif /* __LIBBPF_LIBBPF_COMMON_H */
---
-2.43.0
-