STRUCT NFP_INSN_META(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct nfp_insn_meta(9) β€” BPF instruction wrapper

okay so bestie, welcome to the Kernel API Manual entry for struct nfp_insn_meta, aka the little glow-up wrapper that holds one BPF instruction and all its side quests. this thing is literally the main character of the NFP BPF JIT. let's get into it πŸŽ€


✨ SYNOPSIS ✨

struct nfp_insn_meta {
    struct bpf_insn insn;
    union {
      struct {
        struct bpf_reg_state ptr;
        struct bpf_insn *paired_st;
        s16 ldst_gather_len;
        bool ptr_not_const;
        struct {
          s16 range_start;
          s16 range_end;
          bool do_init;
        } pkt_cache;
        bool xadd_over_16bit;
        bool xadd_maybe_16bit;
      };
      struct {
        struct nfp_insn_meta *jmp_dst;
        bool jump_neg_op;
        u32 num_insns_after_br;
      };
      struct {
        u32 func_id;
        struct bpf_reg_state arg1;
        struct nfp_bpf_reg_state arg2;
      };
      struct {
        u64 umin_src;
        u64 umax_src;
        u64 umin_dst;
        u64 umax_dst;
      };
    };
    unsigned int off;
    unsigned short n;
    unsigned short flags;
    unsigned short subprog_idx;
    instr_cb_t double_cb;
    struct list_head l;
 };

no cap, that's the whole shape of it. the big anonymous union in the middle means only one of those little structs is live at a time β€” it's giving "one outfit per occasion" energy. πŸ¦‹


🌸 Members 🌸

the basics

  • insn β€” the BPF instruction itself. the whole reason we're here fr fr.

{unnamed_union}

anonymous. she has no name and she doesn't need one πŸ’…

{unnamed_struct} (the memory-ops one)

anonymous β€” this is the cluster for memory operations.

  • ptr β€” pointer type for memory operations
  • paired_st β€” the paired store insn at the head of the sequence
  • ldst_gather_len β€” memcpy length gathered from load/store sequence
  • ptr_not_const β€” pointer is not always constant
  • pkt_cache β€” packet data cache information
    • pkt_cache.range_start β€” start offset for associated packet data cache
    • pkt_cache.range_end β€” end offset for associated packet data cache
    • pkt_cache.do_init β€” this read needs to initialize packet data cache
  • xadd_over_16bit β€” 16bit immediate is not guaranteed
  • xadd_maybe_16bit β€” 16bit immediate is possible

{unnamed_struct} (the jump one)

anonymous β€” jump instructions get their own little corner πŸ‡

  • jmp_dst β€” destination info for jump instructions
  • jump_neg_op β€” jump instruction has inverted immediate, use ADD instead of SUB
  • num_insns_after_br β€” number of insns following a branch jump, used for fixup

{unnamed_struct} (the call one)

anonymous β€” call instructions, bestie πŸ“ž

  • func_id β€” function id for call instructions
  • arg1 β€” arg1 for call instructions
  • arg2 β€” arg2 for call instructions

{unnamed_struct} (the verifier-range one)

anonymous β€” the min/max bookkeeping squad.

  • umin_src β€” copy of core verifier umin_value for src opearnd. (yes the source really spells it "opearnd", we keep it verbatim, she's iconic πŸ’€)
  • umax_src β€” copy of core verifier umax_value for src operand.
  • umin_dst β€” copy of core verifier umin_value for dst opearnd.
  • umax_dst β€” copy of core verifier umax_value for dst operand.

the rest of the squad

  • off β€” index of first generated machine instruction (in nfp_prog.prog)
  • n β€” eBPF instruction number
  • flags β€” eBPF instruction extra optimization flags
  • subprog_idx β€” index of subprogram to which the instruction belongs
  • double_cb β€” callback for second part of the instruction
  • l β€” link on nfp_prog->insns list
not me pointing out that double_cb is literally a callback for the second part of the instruction β€” two-part release, we love a deluxe edition πŸ”₯

🌈 SEE ALSO 🌈

  • Kernel file ./drivers/net/ethernet/netronome/nfp/bpf/main.h struct nfp_app_bpf(9), struct nfp_bpf_map(9), struct nfp_bpf_reg_state(9), struct nfp_bpf_subprog_info(9), struct nfp_prog(9), struct nfp_bpf_vnic(9)

go read those too, they're all in the same friend group 🫢


later bestie πŸ’– this page came from ./drivers/net/ethernet/netrono... and it's dated October 2026 β€” so it's serving future-flavoured AND kernel-flavoured at the same time. obsessed. β­πŸ‘‘

πŸ“¦ where this page comes from