]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - samples/bpf/bpf_insn.h
Merge tag 'clk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/clk/linux
[mirror_ubuntu-jammy-kernel.git] / samples / bpf / bpf_insn.h
index 20dc5cefec8448e117b839bb8cef12559574e006..544237980582b909fe251fd68c7ee6b8eb946f5a 100644 (file)
@@ -164,6 +164,16 @@ struct bpf_insn;
                .off   = OFF,                                   \
                .imm   = 0 })
 
+/* Like BPF_JMP_REG, but with 32-bit wide operands for comparison. */
+
+#define BPF_JMP32_REG(OP, DST, SRC, OFF)                       \
+       ((struct bpf_insn) {                                    \
+               .code  = BPF_JMP32 | BPF_OP(OP) | BPF_X,        \
+               .dst_reg = DST,                                 \
+               .src_reg = SRC,                                 \
+               .off   = OFF,                                   \
+               .imm   = 0 })
+
 /* Conditional jumps against immediates, if (dst_reg 'op' imm32) goto pc + off16 */
 
 #define BPF_JMP_IMM(OP, DST, IMM, OFF)                         \
@@ -174,6 +184,16 @@ struct bpf_insn;
                .off   = OFF,                                   \
                .imm   = IMM })
 
+/* Like BPF_JMP_IMM, but with 32-bit wide operands for comparison. */
+
+#define BPF_JMP32_IMM(OP, DST, IMM, OFF)                       \
+       ((struct bpf_insn) {                                    \
+               .code  = BPF_JMP32 | BPF_OP(OP) | BPF_K,        \
+               .dst_reg = DST,                                 \
+               .src_reg = 0,                                   \
+               .off   = OFF,                                   \
+               .imm   = IMM })
+
 /* Raw code statement block */
 
 #define BPF_RAW_INSN(CODE, DST, SRC, OFF, IMM)                 \