From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jesper Dangaard Brouer Subject: [RFC bpf-next PATCH] bpf: add comments to BPF ld/ldx sizes Date: Tue, 16 Jan 2018 12:31:06 +0100 Message-ID: <151610226596.29962.4661213256715212454.stgit@firesoul> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, Jesper Dangaard Brouer To: Daniel Borkmann , Alexei Starovoitov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:37866 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751335AbeAPLbK (ORCPT ); Tue, 16 Jan 2018 06:31:10 -0500 Sender: netdev-owner@vger.kernel.org List-ID: Doc BPF ld/ldx size defines, as it help me understand the code in filter.c. Signed-off-by: Jesper Dangaard Brouer --- 0 files changed diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 395d261948de..4729d9a002d4 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h @@ -17,7 +17,7 @@ #define BPF_ALU64 0x07 /* alu mode in double word width */ /* ld/ldx fields */ -#define BPF_DW 0x18 /* double word */ +#define BPF_DW 0x18 /* double word (64-bit) */ #define BPF_XADD 0xc0 /* exclusive add */ /* alu/jmp fields */ diff --git a/include/uapi/linux/bpf_common.h b/include/uapi/linux/bpf_common.h index 18be90725ab0..ee97668bdadb 100644 --- a/include/uapi/linux/bpf_common.h +++ b/include/uapi/linux/bpf_common.h @@ -15,9 +15,10 @@ /* ld/ldx fields */ #define BPF_SIZE(code) ((code) & 0x18) -#define BPF_W 0x00 -#define BPF_H 0x08 -#define BPF_B 0x10 +#define BPF_W 0x00 /* 32-bit */ +#define BPF_H 0x08 /* 16-bit */ +#define BPF_B 0x10 /* 8-bit */ +/* eBPF BPF_DW 0x18 64-bit */ #define BPF_MODE(code) ((code) & 0xe0) #define BPF_IMM 0x00 #define BPF_ABS 0x20