Jump and control flow operations for BPF programs.
Provides:
Jump and control flow operations for BPF programs. Provides: - Conditional jumps (jeq, jne, jgt, jge, etc.) - Unconditional jumps (ja) - Function calls (call) - Program exit (exit)
(call helper-id)Call a BPF helper function.
r0 = bpf_helper(r1, r2, r3, r4, r5)
Arguments:
Call a BPF helper function. r0 = bpf_helper(r1, r2, r3, r4, r5) Arguments: - helper-id: BPF helper function ID (e.g., 1 for map_lookup_elem)
(exit-insn)Exit the BPF program.
return r0
The value in r0 is returned to the caller.
Exit the BPF program. return r0 The value in r0 is returned to the caller.
(ja offset)Unconditional jump.
goto +offset
Arguments:
Unconditional jump. goto +offset Arguments: - offset: Jump offset (in instructions)
(ja-label label-name)Unconditional jump to label.
Unconditional jump to label.
(jeq dst src-or-imm offset)Jump if equal.
if (dst == src/imm) goto +offset
Jump if equal. if (dst == src/imm) goto +offset
(jeq-label dst src-or-imm label-name)Jump if equal to label.
if (dst == src/imm) goto label
Jump if equal to label. if (dst == src/imm) goto label
(jge dst src-or-imm offset)Jump if greater than or equal (unsigned).
if (dst >= src/imm) goto +offset
Jump if greater than or equal (unsigned). if (dst >= src/imm) goto +offset
(jgt dst src-or-imm offset)Jump if greater than (unsigned).
if (dst > src/imm) goto +offset
Jump if greater than (unsigned). if (dst > src/imm) goto +offset
(jle dst src-or-imm offset)Jump if less than or equal (unsigned).
if (dst <= src/imm) goto +offset
Jump if less than or equal (unsigned). if (dst <= src/imm) goto +offset
(jlt dst src-or-imm offset)Jump if less than (unsigned).
if (dst < src/imm) goto +offset
Jump if less than (unsigned). if (dst < src/imm) goto +offset
(jmp-imm op dst imm offset)Conditional jump with immediate comparison.
if (dst OP imm) goto +offset
Arguments:
Conditional jump with immediate comparison. if (dst OP imm) goto +offset Arguments: - op: Jump operation (:jeq, :jne, :jgt, etc.) - dst: Register to compare - imm: Immediate value to compare against - offset: Jump offset (in instructions, not bytes)
Map of jump operation keywords to BPF opcodes
Map of jump operation keywords to BPF opcodes
(jmp-reg op dst src offset)Conditional jump with register comparison.
if (dst OP src) goto +offset
Arguments:
Conditional jump with register comparison. if (dst OP src) goto +offset Arguments: - op: Jump operation (:jeq, :jne, :jgt, etc.) - dst: Register to compare - src: Register to compare against - offset: Jump offset (in instructions)
(jmp32-imm op dst imm offset)32-bit conditional jump with immediate comparison.
if ((u32)dst OP imm) goto +offset
32-bit conditional jump with immediate comparison. if ((u32)dst OP imm) goto +offset
(jmp32-reg op dst src offset)32-bit conditional jump with register comparison.
if ((u32)dst OP (u32)src) goto +offset
32-bit conditional jump with register comparison. if ((u32)dst OP (u32)src) goto +offset
(jne dst src-or-imm offset)Jump if not equal.
if (dst != src/imm) goto +offset
Jump if not equal. if (dst != src/imm) goto +offset
(jne-label dst src-or-imm label-name)Jump if not equal to label.
Jump if not equal to label.
(jset dst src-or-imm offset)Jump if bitwise AND is non-zero.
if (dst & src/imm) goto +offset
Jump if bitwise AND is non-zero. if (dst & src/imm) goto +offset
(jsge dst src-or-imm offset)Jump if greater than or equal (signed).
if ((s64)dst >= (s64)src/imm) goto +offset
Jump if greater than or equal (signed). if ((s64)dst >= (s64)src/imm) goto +offset
(jsgt dst src-or-imm offset)Jump if greater than (signed).
if ((s64)dst > (s64)src/imm) goto +offset
Jump if greater than (signed). if ((s64)dst > (s64)src/imm) goto +offset
(jsle dst src-or-imm offset)Jump if less than or equal (signed).
if ((s64)dst <= (s64)src/imm) goto +offset
Jump if less than or equal (signed). if ((s64)dst <= (s64)src/imm) goto +offset
(jslt dst src-or-imm offset)Jump if less than (signed).
if ((s64)dst < (s64)src/imm) goto +offset
Jump if less than (signed). if ((s64)dst < (s64)src/imm) goto +offset
(label name)Create a label marker for the assembler.
Labels are resolved during assembly to compute jump offsets.
Create a label marker for the assembler. Labels are resolved during assembly to compute jump offsets.
(label-ref name)Create a reference to a label.
Used as the offset argument in jump instructions.
Create a reference to a label. Used as the offset argument in jump instructions.
(label-ref? v)Check if a value is a label reference.
Check if a value is a label reference.
(label? insn)Check if an instruction is a label.
Check if an instruction is a label.
(tail-call)Generate a tail call to another BPF program.
This is essentially: bpf_tail_call(ctx, prog_array, index) Helper ID 12 = bpf_tail_call
Generate a tail call to another BPF program. This is essentially: bpf_tail_call(ctx, prog_array, index) Helper ID 12 = bpf_tail_call
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |