]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
bpf: add comments to BPF ld/ldx sizes
authorJesper Dangaard Brouer <brouer@redhat.com>
Wed, 17 Jan 2018 11:05:36 +0000 (12:05 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Thu, 18 Jan 2018 21:12:38 +0000 (22:12 +0100)
Doc BPF ld/ldx size defines as comments in code, as it makes in
faster to lookup in a programming/review setting, than looking up
the sizes in Documentation/networking/filter.txt.

Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
include/uapi/linux/bpf.h
include/uapi/linux/bpf_common.h

index 7c2259e8bc545998cc4d88a0ed3b18cabbde202d..74dc4dc98681ac6fdb308f7a2715c85bf004ab1b 100644 (file)
@@ -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 */
index 18be90725ab04a4a3fa2691d3eb57067778399d5..ee97668bdadb31585815e271af40667b6dea8b53 100644 (file)
 
 /* 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