archive mirror
 help / color / mirror / Atom feed
From: Ian Rogers <>
To: Peter Zijlstra <>,
	Ingo Molnar <>,
	Arnaldo Carvalho de Melo <>,
	Mark Rutland <>,
	Alexander Shishkin <>,
	Jiri Olsa <>, Namhyung Kim <>,
	Song Liu <>,, Alexei Starovoitov <>,
	Daniel Borkmann <>,
	Andrii Nakryiko <>,
	Martin KaFai Lau <>, Yonghong Song <>,
	John Fastabend <>,
	KP Singh <>,
	Tiezhu Yang <>,,
Cc: Stephane Eranian <>, Ian Rogers <>
Subject: [PATCH] tools include: Add __sum16 and __wsum definitions.
Date: Sun,  7 Mar 2021 14:30:24 -0800	[thread overview]
Message-ID: <> (raw)

This adds definitions available in the uapi version.

In the kernel include of types.h the uapi version is included.
In tools the uapi/linux/types.h and linux/types.h are distinct.
For BPF programs a definition of __wsum is needed by the generated
bpf_helpers.h. The definition comes either from a generated vmlinux.h or
from <linux/types.h> that may be transitively included from bpf.h. The
perf build prefers linux/types.h over uapi/linux/types.h for
<linux/types.h>*. To allow tools/perf/util/bpf_skel/bpf_prog_profiler.bpf.c
to compile with the same include path used for perf then these
definitions are necessary.

There is likely a wider conversation about exactly how types.h should be
specified and the include order used by the perf build - it is somewhat
confusing that tools/include/uapi/linux/bpf.h is using the non-uapi

*see tools/perf/Makefile.config:
INC_FLAGS += -I$(srctree)/tools/include/
INC_FLAGS += -I$(srctree)/tools/arch/$(SRCARCH)/include/uapi
INC_FLAGS += -I$(srctree)/tools/include/uapi
The include directories are scanned from left-to-right:
As tools/include/linux/types.h appears before
tools/include/uapi/linux/types.h then I say it is preferred.

Signed-off-by: Ian Rogers <>
 tools/include/linux/types.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/include/linux/types.h b/tools/include/linux/types.h
index e9c5a215837d..6e14a533ab4e 100644
--- a/tools/include/linux/types.h
+++ b/tools/include/linux/types.h
@@ -61,6 +61,9 @@ typedef __u32 __bitwise __be32;
 typedef __u64 __bitwise __le64;
 typedef __u64 __bitwise __be64;
+typedef __u16 __bitwise __sum16;
+typedef __u32 __bitwise __wsum;
 typedef struct {
 	int counter;
 } atomic_t;

             reply	other threads:[~2021-03-07 22:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-07 22:30 Ian Rogers [this message]
2021-03-08 13:37 ` [PATCH] tools include: Add __sum16 and __wsum definitions Daniel Borkmann
2021-03-08 13:41   ` Arnaldo Carvalho de Melo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).