ib_register_device(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… ib_register_device β€” like, the Kernel API Manual girlies' favorite little registration ritual ✨

okay so bestie, you know how every low-level driver out there is just dying to be seen by the IB core? yeah. this is the function that makes it official. let's get into it 🫢


✨ SYNOPSIS ✨

int ib_register_device (struct ib_device *device , const char *name ,
       struct device *dma_device );

like, three args, one int back. no cap, that's the whole vibe 🌸


πŸŽ€ ARGUMENTS πŸŽ€

  • device β€” the actual device you're registering. your main character. πŸ‘‘
  • name β€” the device name, and it has to be unique within the device's net namespace. plot twist: it can contain a '%', and if it does, a unique index gets tacked onto the device name you passed in. cute, right? πŸ¦‹
  • dma_device β€” a pointer to a DMA-capable device. here's the tea β˜•: if this is NULL, then the IB device itself gets used instead. and in that case the caller should fully set up the ibdev for DMA β€” which usually means reaching for dma_virt_ops. iykyk πŸ’€

πŸ’– DESCRIPTION πŸ’–

so the low-level drivers use ib_register_device to register their devices with the IB core. literally that simple. and once a device is added, all registered clients get a callback for it β€” everyone's invited to the group chat πŸ“²βœ¨

one thing though: device must be allocated with ib_alloc_device. non-negotiable, bestie.

okay so this is the slightly unhinged part πŸ™ˆ β€” if the driver uses ops.dealloc_driver and calls any ib_unregister_device asynchronously, then the device pointer may become freed as soon as this function returns. like, immediately. so don't go touching it after, fr fr 😭

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./drivers/infiniband/core/device.c β€” and the whole extended friendship circle:


mwah πŸ’‹ this lil page lives at ./drivers/infiniband/core, and it's stamped October 2026 β€” so if you're reading this in the future, hiii, you're doing amazing, go register that device bestie πŸ’œπŸŒˆ

πŸ“¦ where this page comes from