STRUCT DEVLINK_TRAP(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay bestie, welcome to the Kernel API Manual entry for struct devlink_trap(9) β€” yes that's the whole title, and yes it's a whole vibe. this one's short and sweet and honestly kind of iconic in its minimalism πŸ’…


πŸŽ€ NAME πŸŽ€

struct devlink_trap β€” Immutable packet trap attributes.

like, immutable. as in: these things are NOT changing, bestie. set in stone. periodt. πŸͺ¨


πŸ¦‹ SYNOPSIS πŸ¦‹

struct devlink_trap {
    enum devlink_trap_type type;
    enum devlink_trap_action init_action;
    bool generic;
    u16 id;
    const char *name;
    u16 init_group_id;
    u32 metadata_cap;
 };

look at her. seven fields. no notes. πŸ”₯


🌸 Members 🌸

  • type β€” the trap type. that's it, that's the field. lowkey self-explanatory but we love her anyway πŸ’–
  • init_action β€” the initial trap action. emphasis on initial, because the whole struct is immutable but this one's literally named after the starting state, iykyk.
  • generic β€” a bool telling you whether the trap is generic or not. that's the entire lore. 🫢
  • id β€” the trap identifier. a u16. she's small but she's doing her best.
  • name β€” the trap name, as a const char *. ✨ branding ✨
  • init_group_id β€” the initial group identifier, also a u16. matching set with id, cute.
  • metadata_cap β€” the metadata types that can be provided by the trap. a u32 full of possibilities πŸ¦‹

πŸ’œ Description πŸ’œ

so this struct describes the immutable attributes of packet traps that drivers register with devlink. that's the whole thing. short queen. πŸ‘‘

like β€” drivers register traps with devlink, and these are the attributes that never change on them. no cap. 🧚


🌈 SEE ALSO 🌈

Kernel file ./include/net/devlink.h, plus the whole friend group:

  • struct devlink_port_pci_pf_attrs(9)
  • struct devlink_port_pci_vf_attrs(9)
  • struct devlink_port_pci_sf_attrs(9)
  • struct devlink_port_attrs(9)
  • struct devlink_linecard_ops(9)
  • struct devlink_dpipe_field(9)
  • struct devlink_dpipe_header(9)
  • struct devlink_dpipe_match(9)
  • struct devlink_dpipe_action(9)
  • struct devlink_dpipe_value(9)
  • struct devlink_dpipe_entry(9)
  • struct devlink_dpipe_dump_ctx(9)
  • struct devlink_dpipe_table(9)
  • struct devlink_dpipe_table_ops(9)
  • struct devlink_dpipe_headers(9)
  • struct devlink_resource_size_params(9)
  • struct devlink_flash_notify(9)
  • struct devlink_param(9)
  • struct devlink_flash_update_params(9)
  • struct devlink_region_ops(9)
  • struct devlink_port_region_ops(9)
  • struct devlink_health_reporter_ops(9)
  • struct devlink_trap_metadata(9)
  • struct devlink_trap_policer(9)
  • struct devlink_trap_group(9)
  • struct devlink_port_ops(9)

that's a LOT of structs. the devlink extended universe is real and it is thriving πŸ’€πŸ’–


ok that's the whole page, bestie. go forth and register your traps. 🫢

and finally, the cute little sign-off from the original footer: this one lives in ./include/net, straight from the October 2026 era of the kernel, and its name is β€” say it with me β€” struct devlink_trap(9). slay. πŸŒŸπŸ’…

πŸ“¦ where this page comes from