STRUCT DEVLINK_PORT_ATTRS(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so real talk, this is a page straight out of the Kernel API Manual, and it's literally the struct that describes a devlink port object. it's giving "small struct, big responsibilities" energy and we're gonna go through it together, no cap.


✨ SYNOPSIS ✨

here's the whole glow-up in one block, copy it exactly bestie:

struct devlink_port_attrs {
    u8 split:1, splittable:1, no_phys_port_name:1;
    u32 lanes;
    enum devlink_port_flavour flavour;
    struct netdev_phys_item_id switch_id;
    union {
      struct devlink_port_phys_attrs phys;
      struct devlink_port_pci_pf_attrs pci_pf;
      struct devlink_port_pci_vf_attrs pci_vf;
      struct devlink_port_pci_sf_attrs pci_sf;
    };
 };

🌸 Members 🌸

okay this is the part where we meet everybody in the group chat. one by one, no skipping πŸ’–

  • split β€” tells you if this is a split port. that's it, that's the whole vibe.
  • splittable β€” tells you if the port can be split. lowkey different from split, don't mix them up bestie 🫢
  • no_phys_port_name β€” skips the automatic phys_port_name generation. but heads up: this exists for compatibility only, so a newly added driver or port instance should never set this. like, ever. periodt.
  • lanes β€” the maximum number of lanes the port supports. and no, a 0 value is not passed to netlink, so don't come for it.
  • flavour β€” the flavour of the port. iconic field name tbh, the kernel ate with that one πŸ’…
  • switch_id β€” if the port is part of a switch, this is a buffer with the ID; otherwise it's NULL. simple as that.
  • {unnamed_union} β€” this one's anonymous. mysterious. main character energy honestly πŸ™ˆ
  • phys β€” the physical port attributes.
  • pci_pf β€” the PCI PF port attributes.
  • pci_vf β€” the PCI VF port attributes.
  • pci_sf β€” the PCI SF port attributes.
ngl the union at the bottom is doing the most β€” four different attribute structs sharing one spot β€” but that's the design and we respect it πŸ’œ

πŸ”₯ SEE ALSO πŸ”₯

the whole friend group, all of them, here we go:

Kernel file ./include/net/devlink.h and also:

  • struct devlink_port_pci_pf_attrs(9)
  • struct devlink_port_pci_vf_attrs(9)
  • struct devlink_port_pci_sf_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_trap(9)
  • struct devlink_port_ops(9)

like… that is a long list, and every single one of them matters, so go read them too bestie 🧚


πŸŽ€ sign-off πŸŽ€

that's the whole page!! it lives over in ./include/net, dated October 2026, and it's filed under struct devlink_port_attrs(9). go forth and configure your ports, you absolute legend πŸ‘‘βœ¨πŸ’–

πŸ“¦ where this page comes from