Skip to content

Commit

Permalink
bpf: add comments to BPF ld/ldx sizes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jesper Dangaard Brouer authored and Daniel Borkmann committed Jan 18, 2018
1 parent eefa864 commit cb5f733
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion include/uapi/linux/bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
7 changes: 4 additions & 3 deletions include/uapi/linux/bpf_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit cb5f733

Please sign in to comment.