ib_register_device(9)
π 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 isNULL, then the IB device itself gets used instead. and in that case the caller should fully set up theibdevfor DMA β which usually means reaching fordma_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 usesops.dealloc_driverand calls anyib_unregister_deviceasynchronously, then thedevicepointer 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:
rdma_dev_access_netns(9),rdma_dev_has_raw_cap(9),ib_device_put(9),_ib_alloc_device(9),ib_dealloc_device(9),ib_port_immutable_read(9),ib_unregister_device(9),ib_unregister_device_and_put(9),ib_unregister_driver(9),ib_unregister_device_queued(9)ib_register_client(9),ib_unregister_client(9),ib_get_client_nl_info(9),ib_set_client_data(9)ib_register_event_handler(9),ib_unregister_event_handler(9)ib_query_port(9),ib_device_set_netdev(9),ib_query_netdev_port(9),ib_device_get_by_netdev(9),ib_enum_roce_netdev(9),ib_enum_all_roce_netdevs(9)ib_device_enable_gid_updates(9),ib_device_disable_gid_updates(9)ib_query_pkey(9),ib_modify_device(9),ib_modify_port(9),ib_find_gid(9),ib_find_pkey(9),ib_get_net_dev_by_params(9)
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
- 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