* [PATCH bpf-next] libbpf: don't use kernel-side u32 type in xsk.c
@ 2019-10-29 5:59 Andrii Nakryiko
2019-10-29 8:05 ` Toke Høiland-Jørgensen
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Andrii Nakryiko @ 2019-10-29 5:59 UTC (permalink / raw)
To: bpf, netdev, ast, daniel
Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko, Magnus Karlsson
u32 is a kernel-side typedef. User-space library is supposed to use __u32.
This breaks Github's projection of libbpf. Do u32 -> __u32 fix.
Fixes: 94ff9ebb49a5 ("libbpf: Fix compatibility for kernels without need_wakeup")
Cc: Magnus Karlsson <magnus.karlsson@intel.com>
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
tools/lib/bpf/xsk.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
index d54111133123..74d84f36a5b2 100644
--- a/tools/lib/bpf/xsk.c
+++ b/tools/lib/bpf/xsk.c
@@ -161,22 +161,22 @@ static void xsk_mmap_offsets_v1(struct xdp_mmap_offsets *off)
off->rx.producer = off_v1.rx.producer;
off->rx.consumer = off_v1.rx.consumer;
off->rx.desc = off_v1.rx.desc;
- off->rx.flags = off_v1.rx.consumer + sizeof(u32);
+ off->rx.flags = off_v1.rx.consumer + sizeof(__u32);
off->tx.producer = off_v1.tx.producer;
off->tx.consumer = off_v1.tx.consumer;
off->tx.desc = off_v1.tx.desc;
- off->tx.flags = off_v1.tx.consumer + sizeof(u32);
+ off->tx.flags = off_v1.tx.consumer + sizeof(__u32);
off->fr.producer = off_v1.fr.producer;
off->fr.consumer = off_v1.fr.consumer;
off->fr.desc = off_v1.fr.desc;
- off->fr.flags = off_v1.fr.consumer + sizeof(u32);
+ off->fr.flags = off_v1.fr.consumer + sizeof(__u32);
off->cr.producer = off_v1.cr.producer;
off->cr.consumer = off_v1.cr.consumer;
off->cr.desc = off_v1.cr.desc;
- off->cr.flags = off_v1.cr.consumer + sizeof(u32);
+ off->cr.flags = off_v1.cr.consumer + sizeof(__u32);
}
static int xsk_get_mmap_offsets(int fd, struct xdp_mmap_offsets *off)
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] libbpf: don't use kernel-side u32 type in xsk.c
2019-10-29 5:59 [PATCH bpf-next] libbpf: don't use kernel-side u32 type in xsk.c Andrii Nakryiko
@ 2019-10-29 8:05 ` Toke Høiland-Jørgensen
2019-10-29 8:19 ` Björn Töpel
2019-10-29 13:39 ` Alexei Starovoitov
2 siblings, 0 replies; 4+ messages in thread
From: Toke Høiland-Jørgensen @ 2019-10-29 8:05 UTC (permalink / raw)
To: Andrii Nakryiko, bpf, netdev, ast, daniel
Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko, Magnus Karlsson
Andrii Nakryiko <andriin@fb.com> writes:
> u32 is a kernel-side typedef. User-space library is supposed to use __u32.
> This breaks Github's projection of libbpf. Do u32 -> __u32 fix.
I've always wondered about this, actually. Why are they different?
-Toke
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] libbpf: don't use kernel-side u32 type in xsk.c
2019-10-29 5:59 [PATCH bpf-next] libbpf: don't use kernel-side u32 type in xsk.c Andrii Nakryiko
2019-10-29 8:05 ` Toke Høiland-Jørgensen
@ 2019-10-29 8:19 ` Björn Töpel
2019-10-29 13:39 ` Alexei Starovoitov
2 siblings, 0 replies; 4+ messages in thread
From: Björn Töpel @ 2019-10-29 8:19 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: bpf, Netdev, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Kernel Team, Magnus Karlsson
On Tue, 29 Oct 2019 at 08:26, Andrii Nakryiko <andriin@fb.com> wrote:
>
> u32 is a kernel-side typedef. User-space library is supposed to use __u32.
> This breaks Github's projection of libbpf. Do u32 -> __u32 fix.
>
> Fixes: 94ff9ebb49a5 ("libbpf: Fix compatibility for kernels without need_wakeup")
> Cc: Magnus Karlsson <magnus.karlsson@intel.com>
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Thanks Andrii!
Acked-by: Björn Töpel <bjorn.topel@intel.com>
> ---
> tools/lib/bpf/xsk.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tools/lib/bpf/xsk.c b/tools/lib/bpf/xsk.c
> index d54111133123..74d84f36a5b2 100644
> --- a/tools/lib/bpf/xsk.c
> +++ b/tools/lib/bpf/xsk.c
> @@ -161,22 +161,22 @@ static void xsk_mmap_offsets_v1(struct xdp_mmap_offsets *off)
> off->rx.producer = off_v1.rx.producer;
> off->rx.consumer = off_v1.rx.consumer;
> off->rx.desc = off_v1.rx.desc;
> - off->rx.flags = off_v1.rx.consumer + sizeof(u32);
> + off->rx.flags = off_v1.rx.consumer + sizeof(__u32);
>
> off->tx.producer = off_v1.tx.producer;
> off->tx.consumer = off_v1.tx.consumer;
> off->tx.desc = off_v1.tx.desc;
> - off->tx.flags = off_v1.tx.consumer + sizeof(u32);
> + off->tx.flags = off_v1.tx.consumer + sizeof(__u32);
>
> off->fr.producer = off_v1.fr.producer;
> off->fr.consumer = off_v1.fr.consumer;
> off->fr.desc = off_v1.fr.desc;
> - off->fr.flags = off_v1.fr.consumer + sizeof(u32);
> + off->fr.flags = off_v1.fr.consumer + sizeof(__u32);
>
> off->cr.producer = off_v1.cr.producer;
> off->cr.consumer = off_v1.cr.consumer;
> off->cr.desc = off_v1.cr.desc;
> - off->cr.flags = off_v1.cr.consumer + sizeof(u32);
> + off->cr.flags = off_v1.cr.consumer + sizeof(__u32);
> }
>
> static int xsk_get_mmap_offsets(int fd, struct xdp_mmap_offsets *off)
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next] libbpf: don't use kernel-side u32 type in xsk.c
2019-10-29 5:59 [PATCH bpf-next] libbpf: don't use kernel-side u32 type in xsk.c Andrii Nakryiko
2019-10-29 8:05 ` Toke Høiland-Jørgensen
2019-10-29 8:19 ` Björn Töpel
@ 2019-10-29 13:39 ` Alexei Starovoitov
2 siblings, 0 replies; 4+ messages in thread
From: Alexei Starovoitov @ 2019-10-29 13:39 UTC (permalink / raw)
To: Andrii Nakryiko
Cc: bpf, Network Development, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Kernel Team, Magnus Karlsson
On Tue, Oct 29, 2019 at 12:26 AM Andrii Nakryiko <andriin@fb.com> wrote:
>
> u32 is a kernel-side typedef. User-space library is supposed to use __u32.
> This breaks Github's projection of libbpf. Do u32 -> __u32 fix.
>
> Fixes: 94ff9ebb49a5 ("libbpf: Fix compatibility for kernels without need_wakeup")
> Cc: Magnus Karlsson <magnus.karlsson@intel.com>
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Applied. Thanks
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-29 13:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-29 5:59 [PATCH bpf-next] libbpf: don't use kernel-side u32 type in xsk.c Andrii Nakryiko
2019-10-29 8:05 ` Toke Høiland-Jørgensen
2019-10-29 8:19 ` Björn Töpel
2019-10-29 13:39 ` Alexei Starovoitov
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.