drivers/infiniband/core/rdma_core.c
Source file repositories/reference/linux-study-clean/drivers/infiniband/core/rdma_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/infiniband/core/rdma_core.c- Extension
.c- Size
- 30123 bytes
- Lines
- 1074
- Domain
- Driver Families
- Bucket
- drivers/infiniband
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/file.hlinux/anon_inodes.hlinux/sched/mm.hrdma/ib_verbs.hrdma/uverbs_types.hlinux/rcupdate.hrdma/uverbs_ioctl.hrdma/rdma_user_ioctl.huverbs.hcore_priv.hrdma_core.h
Detected Declarations
function ib_uverbs_release_filefunction uverbs_uobject_freefunction uverbs_uobject_putfunction uverbs_try_lock_objectfunction assert_uverbs_usecntfunction kreffunction uverbs_destroy_uobjectfunction uobj_put_destroyfunction uobj_get_destroyfunction idr_add_uobjfunction lookup_get_idr_uobjectfunction lookup_get_fd_uobjectfunction fgetfunction alloc_begin_idr_uobjectfunction alloc_begin_fd_uobjectfunction alloc_abort_idr_uobjectfunction destroy_hw_idr_uobjectfunction remove_handle_idr_uobjectfunction alloc_abort_fd_uobjectfunction destroy_hw_fd_uobjectfunction remove_handle_fd_uobjectfunction swap_idr_uobjectsfunction alloc_commit_fd_uobjectfunction rdma_alloc_commit_uobjectfunction rdma_alloc_commit_uobjectfunction rdma_alloc_abort_uobjectfunction lookup_put_idr_uobjectfunction rdma_lookup_put_uobjectfunction setup_ufile_idr_uobjectfunction release_ufile_idr_uobjectfunction uverbs_cleanup_ufilefunction uverbs_uobject_releasefunction uverbs_uobject_fd_releasefunction __uverbs_cleanup_ufilefunction threadsfunction uverbs_get_uobject_from_filefunction uverbs_finalize_objectfunction rdma_uattrs_has_raw_capexport uverbs_uobject_putexport uverbs_try_lock_objectexport uverbs_idr_classexport uverbs_uobject_fd_releaseexport uverbs_fd_classexport rdma_uattrs_has_raw_cap
Annotated Snippet
if (uobj->uapi_object != obj) {
ret = -EINVAL;
goto free;
}
}
/*
* If we have been disassociated block every command except for
* DESTROY based commands.
*/
if (mode != UVERBS_LOOKUP_DESTROY &&
!srcu_dereference(ufile->device->ib_dev,
&ufile->device->disassociate_srcu)) {
ret = -EIO;
goto free;
}
ret = uverbs_try_lock_object(uobj, mode);
if (ret)
goto free;
if (attrs)
attrs->context = uobj->context;
return uobj;
free:
uobj->uapi_object->type_class->lookup_put(uobj, mode);
uverbs_uobject_put(uobj);
return ERR_PTR(ret);
}
EXPORT_SYMBOL_NS_GPL(rdma_lookup_get_uobject, "rdma_core");
static struct ib_uobject *
alloc_begin_idr_uobject(const struct uverbs_api_object *obj,
struct uverbs_attr_bundle *attrs)
{
int ret;
struct ib_uobject *uobj;
uobj = alloc_uobj(attrs, obj);
if (IS_ERR(uobj))
return uobj;
ret = idr_add_uobj(uobj);
if (ret)
goto uobj_put;
ret = ib_rdmacg_try_charge(&uobj->cg_obj, uobj->context->device,
RDMACG_RESOURCE_HCA_OBJECT);
if (ret)
goto remove;
return uobj;
remove:
xa_erase(&attrs->ufile->idr, uobj->id);
uobj_put:
uverbs_uobject_put(uobj);
return ERR_PTR(ret);
}
static struct ib_uobject *
alloc_begin_fd_uobject(const struct uverbs_api_object *obj,
struct uverbs_attr_bundle *attrs)
{
const struct uverbs_obj_fd_type *fd_type;
int new_fd;
struct ib_uobject *uobj, *ret;
struct file *filp;
uobj = alloc_uobj(attrs, obj);
if (IS_ERR(uobj))
return uobj;
fd_type =
container_of(obj->type_attrs, struct uverbs_obj_fd_type, type);
if (WARN_ON(fd_type->fops &&
fd_type->fops->release != &uverbs_uobject_fd_release)) {
ret = ERR_PTR(-EINVAL);
goto err_fd;
}
new_fd = get_unused_fd_flags(O_CLOEXEC);
if (new_fd < 0) {
ret = ERR_PTR(new_fd);
goto err_fd;
}
if (fd_type->fops) {
/* Note that uverbs_uobject_fd_release() is called during abort */
filp = anon_inode_getfile(fd_type->name, fd_type->fops, NULL,
Annotation
- Immediate include surface: `linux/file.h`, `linux/anon_inodes.h`, `linux/sched/mm.h`, `rdma/ib_verbs.h`, `rdma/uverbs_types.h`, `linux/rcupdate.h`, `rdma/uverbs_ioctl.h`, `rdma/rdma_user_ioctl.h`.
- Detected declarations: `function ib_uverbs_release_file`, `function uverbs_uobject_free`, `function uverbs_uobject_put`, `function uverbs_try_lock_object`, `function assert_uverbs_usecnt`, `function kref`, `function uverbs_destroy_uobject`, `function uobj_put_destroy`, `function uobj_get_destroy`, `function idr_add_uobj`.
- Atlas domain: Driver Families / drivers/infiniband.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.