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
4444 #define BPF_CALL 0x80 /* function call */
4545 #define BPF_EXIT 0x90 /* function return */
4646
47+/* atomic op type fields (stored in immediate) */
48+#define BPF_FETCH 0x01 /* fetch previous value into src reg */
49+
4750 /* Register numbers */
4851 enum {
4952 BPF_REG_0 = 0,