Skip to content

Commit cb5f733

Browse files
netoptimizerborkmann
authored andcommitted
bpf: add comments to BPF ld/ldx sizes
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 <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]>
1 parent eefa864 commit cb5f733

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

include/uapi/linux/bpf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define BPF_ALU64 0x07 /* alu mode in double word width */
1818

1919
/* ld/ldx fields */
20-
#define BPF_DW 0x18 /* double word */
20+
#define BPF_DW 0x18 /* double word (64-bit) */
2121
#define BPF_XADD 0xc0 /* exclusive add */
2222

2323
/* alu/jmp fields */

include/uapi/linux/bpf_common.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@
1515

1616
/* ld/ldx fields */
1717
#define BPF_SIZE(code) ((code) & 0x18)
18-
#define BPF_W 0x00
19-
#define BPF_H 0x08
20-
#define BPF_B 0x10
18+
#define BPF_W 0x00 /* 32-bit */
19+
#define BPF_H 0x08 /* 16-bit */
20+
#define BPF_B 0x10 /* 8-bit */
21+
/* eBPF BPF_DW 0x18 64-bit */
2122
#define BPF_MODE(code) ((code) & 0xe0)
2223
#define BPF_IMM 0x00
2324
#define BPF_ABS 0x20

0 commit comments

Comments
 (0)