devlink_port...ter_with_ops(9)
π devlink_port_register_with_ops(9) β a Kernel API Manual moment
okay so bestie, welcome to the Kernel API Manual page for devlink_port_register_with_ops(9) β yes the title is literally truncated with dots in the header, that's just how it's printed, we don't fix it, we respect it β¨
πΈ NAME πΈ
devlink_port_register_with_ops β Register devlink port. that's it. that's the vibe. registering a port, but make it devlink π
π¦ SYNOPSIS π¦
int devlink_port_register_with_ops (struct devlink *devlink , struct
devlink_port *devlink_port , unsigned int port_index , const struct
devlink_port_ops *ops );
literally the whole signature, copied exactly, no cap. it returns an int, and yes we looked at it very respectfully π
π ARGUMENTS π
devlinkβ the devlink. iconic. no notes. it's thestruct devlink *you're passing in π«Άdevlink_portβ the devlink port, i.e. thestruct devlink_port *getting registered, main character energy fr frport_indexβ the driver-specific numerical identifier of the port. driver-specific!! numerical!! it's anunsigned intand it's yours to define πopsβ port ops. theconst struct devlink_port_ops *. the operations. the whole point. obsessed π
β¨ DESCRIPTION β¨
so what this does: it registers the devlink port with the port index you provide. and here's the cute part β you can use any indexing you want, even a hw-related one. go off, honestly π₯
also, the devlink_port structure is convenient to be embedded inside your driver's private structure. like, structurally it just fits, it's giving designed-for-it π§
β οΈ but listen β the caller should take care of zeroing the devlink_port structure. that's on you, bestie. not the kernel. you. zero it. π
β CONTEXT β
takes and releases devlink->lock <mutex>. so like, the lock is handled, but that's a mutex situation, be aware, don't be weird about it π
π SEE ALSO π
kernel file ./net/devlink/port.c and the whole friend group:
devlink_port_init(9)devlink_port_fini(9)devl_port_register_with_ops(9)devl_port_unregister(9)devlink_port_unregister(9)devlink_port_type_eth_set(9)devlink_port_type_ib_set(9)devlink_port_type_clear(9)devlink_port_attrs_set(9)devlink_port_attrs_pci_pf_set(9)devlink_port_attrs_pci_vf_set(9)devlink_port_attrs_pci_sf_set(9)devl_port_fn_devlink_set(9)devlink_port_linecard_set(9)
and that's the page!! sourced from ./net/devlink, dated October 2026, and it signs off as devlink_port...ter_with_ops(9) because the header and the footer are the same beastie. slay, go register your port, zero your struct π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms