In the current code, BPF_ALU means BPF_ALU32, but BPF_JMP means BPF_JMP64,
it is a little confusing at the first glance, add new macro BPF_ALU32 and
BPF_JMP64, then we can replace the ambiguos macro BPF_ALU and BPF_JMP with
new macro BPF_ALU32 and BPF_JMP64 step by step, BPF_ALU and BPF_JMP can be
removed from the uapi header file in some day.
Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
---
include/uapi/linux/bpf.h | 2 ++
tools/include/uapi/linux/bpf.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
index ba0f0cf..a118c43 100644
--- a/include/uapi/linux/bpf.h
+++ b/include/uapi/linux/bpf.h
@@ -15,6 +15,8 @@
/* instruction classes */
#define BPF_JMP32 0x06 /* jmp mode in word width */
+#define BPF_JMP64 0x05 /* jmp mode in double word width */
+#define BPF_ALU32 0x04 /* alu mode in word width */
#define BPF_ALU64 0x07 /* alu mode in double word width */
/* ld/ldx fields */
diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h
index 7f024ac..014b449 100644
--- a/tools/include/uapi/linux/bpf.h
+++ b/tools/include/uapi/linux/bpf.h
@@ -15,6 +15,8 @@
/* instruction classes */
#define BPF_JMP32 0x06 /* jmp mode in word width */
+#define BPF_JMP64 0x05 /* jmp mode in double word width */
+#define BPF_ALU32 0x04 /* alu mode in word width */
#define BPF_ALU64 0x07 /* alu mode in double word width */
/* ld/ldx fields */
--
2.1.0
Forwarding this to the bpf@ietf.org list for visibility, since the instruction-set.rst change would affect the Internet Draft proposed for cross-platform standardization. > -----Original Message----- > From: Tiezhu Yang <yangtiezhu@loongson.cn> > Sent: Wednesday, February 1, 2023 4:37 AM > To: Alexei Starovoitov <ast@kernel.org>; Daniel Borkmann > <daniel@iogearbox.net>; Andrii Nakryiko <andrii@kernel.org> > Cc: bpf@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: [PATCH bpf-next 1/4] bpf: Add new macro BPF_ALU32 and > BPF_JMP64 > > In the current code, BPF_ALU means BPF_ALU32, but BPF_JMP means > BPF_JMP64, it is a little confusing at the first glance, add new macro > BPF_ALU32 and BPF_JMP64, then we can replace the ambiguos macro > BPF_ALU and BPF_JMP with new macro BPF_ALU32 and BPF_JMP64 step by > step, BPF_ALU and BPF_JMP can be removed from the uapi header file in > some day. > > Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn> > --- > include/uapi/linux/bpf.h | 2 ++ > tools/include/uapi/linux/bpf.h | 2 ++ > 2 files changed, 4 insertions(+) > > diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index > ba0f0cf..a118c43 100644 > --- a/include/uapi/linux/bpf.h > +++ b/include/uapi/linux/bpf.h > @@ -15,6 +15,8 @@ > > /* instruction classes */ > #define BPF_JMP32 0x06 /* jmp mode in word width */ > +#define BPF_JMP64 0x05 /* jmp mode in double word width */ > +#define BPF_ALU32 0x04 /* alu mode in word width */ > #define BPF_ALU64 0x07 /* alu mode in double word width */ > > /* ld/ldx fields */ > diff --git a/tools/include/uapi/linux/bpf.h b/tools/include/uapi/linux/bpf.h > index 7f024ac..014b449 100644 > --- a/tools/include/uapi/linux/bpf.h > +++ b/tools/include/uapi/linux/bpf.h > @@ -15,6 +15,8 @@ > > /* instruction classes */ > #define BPF_JMP32 0x06 /* jmp mode in word width */ > +#define BPF_JMP64 0x05 /* jmp mode in double word width */ > +#define BPF_ALU32 0x04 /* alu mode in word width */ > #define BPF_ALU64 0x07 /* alu mode in double word width */ > > /* ld/ldx fields */ > -- > 2.1.0
© 2016 - 2025 Red Hat, Inc.