History

bpf: Add BPF_FETCH field / create atomic_fetch_add instruction

The BPF_FETCH field can be set in bpf_insn.imm, for BPF_ATOMIC instructions, in order to have the previous value of the atomically-modified memory location loaded into the src register after an atomic op is carried out.

Brendan Jackman committed 5 years ago

Commit 5ca419f1 parent c5bcb5e8 files · +56 −9Browse files

Showing the changes to include/uapi (1 of 8 files). Show all

Unified · Split

include/uapi/linux/bpf.h+3−0
@@ -44,6 +44,9 @@ · 43 unmodified lines
44#define BPF_CALL 0x80 /* function call */44#define BPF_CALL 0x80 /* function call */
45#define BPF_EXIT 0x90 /* function return */45#define BPF_EXIT 0x90 /* function return */
46 46
47/* atomic op type fields (stored in immediate) */
48#define BPF_FETCH 0x01 /* fetch previous value into src reg */
49
47/* Register numbers */50/* Register numbers */
48enum {51enum {
49 BPF_REG_0 = 0,52 BPF_REG_0 = 0,